/*
  thetrail.online

  The palette is limestone and ink, with one accent borrowed from the yellow
  arrow that marks the Camino. No photography: the repo has none, and a
  restrained type-and-colour page beats a bad hero image.
*/

:root {
  color-scheme: light dark;

  --ink: #1b1815;
  --ink-soft: #4a443c;
  --ink-faint: #7a7266;
  --ground: #faf7f1;
  --ground-raised: #f3eee4;
  --rule: #e0d8c9;
  --waymark: #c07d1c;
  --waymark-soft: #f0e2c4;

  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
    "Times New Roman", serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;

  --measure: 34rem;
  --gutter: clamp(1.25rem, 5vw, 3rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ece6da;
    --ink-soft: #b8afa0;
    --ink-faint: #8a8173;
    --ground: #14120f;
    --ground-raised: #1d1a16;
    --rule: #302b24;
    --waymark: #e0a542;
    --waymark-soft: #3a2f1a;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0;
  text-wrap: balance;
}

p {
  margin: 0 0 1.15em;
  text-wrap: pretty;
}

a {
  color: inherit;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--waymark);
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--waymark);
  outline-offset: 3px;
  border-radius: 2px;
}

.shell {
  width: 100%;
  max-width: 62rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.prose {
  max-width: var(--measure);
}

/* ---------- Skip link ---------- */

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: var(--gutter);
  top: 0.75rem;
  z-index: 10;
  background: var(--ground-raised);
  padding: 0.6rem 0.9rem;
  border-radius: 4px;
}

/* ---------- Masthead ---------- */

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: 1.75rem;
  flex-wrap: wrap;
}

.wordmark {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.wordmark::before {
  content: "";
  width: 0.72rem;
  height: 0.72rem;
  background: var(--waymark);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.masthead nav {
  display: flex;
  gap: 1.5rem;
  font-size: 0.9375rem;
  color: var(--ink-soft);
}

.masthead nav a {
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
}

.masthead nav a:hover,
.masthead nav a[aria-current="page"] {
  border-bottom-color: var(--waymark);
}

/* ---------- Hero ---------- */

.hero {
  padding-block: clamp(3rem, 9vw, 6.5rem) clamp(2.5rem, 7vw, 4.5rem);
}

.eyebrow {
  font-size: 0.8125rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--waymark);
  margin: 0 0 1.5rem;
  font-weight: 600;
}

.hero h1 {
  font-size: clamp(2.25rem, 1.4rem + 4.2vw, 4.25rem);
  max-width: 20ch;
  margin-bottom: 1.5rem;
}

.lede {
  font-family: var(--font-display);
  font-size: clamp(1.1875rem, 1.08rem + 0.6vw, 1.5rem);
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 42ch;
}

/* ---------- Sections ---------- */

section {
  padding-block: clamp(2.5rem, 6vw, 4.25rem);
  border-top: 1px solid var(--rule);
}

.section-label {
  font-size: 0.8125rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 1.75rem;
  font-weight: 600;
}

section h2 {
  font-size: clamp(1.5rem, 1.25rem + 1.1vw, 2.125rem);
  margin-bottom: 1.25rem;
  max-width: 24ch;
}

section h3 {
  font-size: 1.1875rem;
  margin-bottom: 0.5rem;
}

/* ---------- The stage list ---------- */

.route {
  list-style: none;
  margin: 2rem 0 0;
  padding: 0 0 0 1.75rem;
  border-left: 1px solid var(--rule);
  max-width: var(--measure);
}

.route li {
  position: relative;
  padding-bottom: 1.75rem;
}

.route li:last-child {
  padding-bottom: 0;
}

.route li::before {
  content: "";
  position: absolute;
  left: calc(-1.75rem - 4px);
  top: 0.55rem;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--waymark);
}

.route strong {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.0625rem;
  display: block;
  margin-bottom: 0.15rem;
}

.route span {
  color: var(--ink-soft);
}

/* ---------- Card grid ---------- */

.grid {
  display: grid;
  gap: 1.5rem 2.5rem;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  margin-top: 2rem;
}

.grid > div > p {
  color: var(--ink-soft);
  margin-bottom: 0;
}

/* ---------- Trails ahead ---------- */

.trails {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.75rem;
  padding: 0;
  list-style: none;
}

.trails li {
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
  font-size: 0.9375rem;
  color: var(--ink-soft);
}

.trails li span {
  color: var(--ink-faint);
}

/* ---------- Invitation form ---------- */

.invite {
  background: var(--ground-raised);
  border-top: 1px solid var(--rule);
}

.invite-inner {
  display: grid;
  gap: clamp(2rem, 5vw, 4rem);
  grid-template-columns: 1fr;
}

@media (min-width: 52rem) {
  .invite-inner {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

form {
  display: grid;
  gap: 1.1rem;
}

label {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

input,
textarea {
  width: 100%;
  font: inherit;
  color: inherit;
  background: var(--ground);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.65rem 0.75rem;
}

textarea {
  min-height: 5.5rem;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--waymark);
  outline: none;
  box-shadow: 0 0 0 3px var(--waymark-soft);
}

/* The honeypot. Hidden from people, reachable by anything filling fields
   without reading the page. Not display:none, which some bots skip. */
.trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

button {
  font: inherit;
  font-weight: 600;
  background: var(--ink);
  color: var(--ground);
  border: 1px solid var(--ink);
  border-radius: 4px;
  padding: 0.7rem 1.4rem;
  cursor: pointer;
  justify-self: start;
}

button:hover:not(:disabled) {
  background: var(--waymark);
  border-color: var(--waymark);
  color: #17140f;
}

button:disabled {
  opacity: 0.55;
  cursor: progress;
}

.form-note {
  font-size: 0.875rem;
  color: var(--ink-faint);
  margin: 0;
  max-width: 46ch;
}

.form-status {
  margin: 0;
  font-size: 0.9375rem;
  min-height: 1.5rem;
}

.form-status[data-state="error"] {
  color: #b3261e;
}

@media (prefers-color-scheme: dark) {
  .form-status[data-state="error"] {
    color: #f2b8b5;
  }
}

.thanks {
  border-left: 2px solid var(--waymark);
  padding-left: 1.1rem;
}

.thanks h3 {
  margin-bottom: 0.4rem;
}

[hidden] {
  display: none !important;
}

/* ---------- Footer ---------- */

footer {
  border-top: 1px solid var(--rule);
  padding-block: 2.5rem 3.5rem;
  color: var(--ink-faint);
  font-size: 0.875rem;
}

footer p {
  max-width: 52ch;
}

footer a {
  color: var(--ink-soft);
}

/* ---------- Engineering page ---------- */

.doc-header {
  padding-block: clamp(2.5rem, 7vw, 4.5rem) clamp(1.5rem, 4vw, 2.5rem);
}

.doc-header h1 {
  font-size: clamp(1.875rem, 1.4rem + 2.2vw, 3rem);
  margin-bottom: 1.25rem;
  max-width: 22ch;
}

.doc h2 {
  font-size: clamp(1.375rem, 1.2rem + 0.85vw, 1.75rem);
}

.doc h3 {
  margin-top: 2rem;
}

.doc p,
.doc ul {
  max-width: var(--measure);
}

.doc ul {
  padding-left: 1.15rem;
  color: var(--ink-soft);
}

.doc li {
  margin-bottom: 0.5rem;
}

.doc li strong {
  color: var(--ink);
}

.figure {
  margin: 2.25rem 0 0;
  padding: 1.5rem;
  background: var(--ground-raised);
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow-x: auto;
}

.figure svg {
  display: block;
  width: 100%;
  height: auto;
  min-width: 30rem;
}

.figure figcaption {
  margin-top: 1rem;
  font-size: 0.875rem;
  color: var(--ink-faint);
  max-width: 52ch;
  min-width: 0;
}

/* Diagram ink follows the theme rather than being baked into the markup. */
.figure svg {
  --d-line: var(--ink-faint);
  --d-text: var(--ink);
  --d-muted: var(--ink-soft);
  --d-fill: var(--ground);
  --d-accent: var(--waymark);
}

.d-box {
  fill: var(--d-fill);
  stroke: var(--d-line);
  stroke-width: 1;
}

.d-box-accent {
  fill: none;
  stroke: var(--d-accent);
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
}

.d-label {
  fill: var(--d-text);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
}

.d-sub {
  fill: var(--d-muted);
  font-family: var(--font-body);
  font-size: 11.5px;
}

.d-cap {
  fill: var(--d-accent);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.d-arrow {
  stroke: var(--d-line);
  stroke-width: 1.25;
  fill: none;
}

.d-head {
  fill: var(--d-line);
}

.d-gate {
  fill: none;
  stroke: var(--d-accent);
  stroke-width: 1.5;
}

/* ---------- Error page ---------- */

.oops {
  min-height: 62vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: 3rem;
}

.oops h1 {
  font-size: clamp(1.75rem, 1.4rem + 1.8vw, 2.5rem);
  margin-bottom: 1rem;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
