/* ==========================================================================
   vunguyen.io — Transit Authority
   Massachusetts civic signage: enamel panels, route bands, timetable rules.
   ========================================================================== */

/* --- Tokens --------------------------------------------------------------- */

:root {
  /* Ink & ground */
  --ink: #0d1b2a;
  --ink-raised: #16293d;
  --ink-rule: #2c435c;
  --ground: #e6e5e0;
  --paper: #f3f2ee;
  --white: #ffffff;

  /* Route colours — functional roles, one per destination */
  --red: #c8102e;      /* Projects  */
  --orange: #d96d00;   /* Work      */
  --green: #00693e;    /* Study     */
  --blue: #1268c3;     /* Contact   */
  --yellow: #ffc72c;   /* Tactile edge, focus, you-are-here */

  /* Text-safe variants for use on the light ground */
  --orange-ink: #8f4a00;

  /* Type */
  --sign: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --table: "Barlow Condensed", "Helvetica Neue", Helvetica, Arial, sans-serif;

  /* Rhythm */
  --gap: clamp(1rem, 2.5vw, 1.75rem);
  --pad-x: clamp(1.25rem, 5vw, 4.5rem);
  --section-y: clamp(4.5rem, 10vw, 9rem);
  --measure: 58ch;
  --rule: 2px;
  --bar-h: 68px;

  /* Depth — offset plus soft blur, never a flat halo */
  --lift: 0 14px 34px -20px rgba(13, 27, 42, 0.55);
  --lift-lg: 0 26px 60px -28px rgba(13, 27, 42, 0.6);
}

/* --- Reset ---------------------------------------------------------------- */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--bar-h) + 1rem);
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sign);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  line-height: 1.6;
  font-variation-settings: "wdth" 100;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
img { height: auto; }

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

p { margin: 0 0 1em; max-width: var(--measure); }
p:last-child { margin-bottom: 0; }

ul, ol { margin: 0; padding: 0; list-style: none; }

a { color: inherit; }

button { font: inherit; color: inherit; }

/* Ink ring on the light ground, yellow on the navy panels — yellow alone reads
   at roughly 1.2:1 against concrete and is not a visible focus indicator there. */
:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
  border-radius: 2px;
}

.bar :focus-visible,
.panel :focus-visible,
.contact :focus-visible,
.foot :focus-visible,
.skip:focus-visible { outline-color: var(--yellow); }

::selection { background: var(--yellow); color: var(--ink); }

/* --- Shared type patterns ------------------------------------------------- */

.sign-caps {
  font-family: var(--sign);
  font-variation-settings: "wdth" 118;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.legend {
  font-family: var(--table);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.14em;
  font-size: 0.875rem;
  line-height: 1.2;
}

.skip {
  position: absolute;
  left: 0.5rem;
  top: -100vh;
  z-index: 100;
  padding: 0.75rem 1.25rem;
  background: var(--yellow);
  color: var(--ink);
  font-family: var(--table);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  text-decoration: none;
}
.skip:focus { top: 0.5rem; }

/* --- Route bullet --------------------------------------------------------- */

.bullet {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 1.75em;
  height: 1.75em;
  border-radius: 50%;
  background: var(--bullet, var(--ink));
  color: var(--white);
  font-family: var(--table);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}

/* --- Header / signage bar ------------------------------------------------- */

.bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--ink);
  border-bottom: 4px solid var(--yellow);
}

.bar__inner {
  display: flex;
  align-items: center;
  gap: var(--gap);
  min-height: var(--bar-h);
  padding: 0 var(--pad-x);
}

.bar__mark {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  color: var(--white);
  padding: 0.5rem 0;
}

.bar__mark img { width: 36px; height: 36px; }

.bar__mark span {
  font-family: var(--sign);
  font-variation-settings: "wdth" 118;
  text-transform: uppercase;
  font-weight: 800;
  font-size: 0.9375rem;
  letter-spacing: 0.06em;
}

.bar__nav { margin-left: auto; }

.bar__list {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.bar__link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  color: #cfd8e3;
  text-decoration: none;
  font-family: var(--table);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.12em;
  font-size: 0.9375rem;
  border-bottom: 3px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.bar__link:hover { color: var(--white); border-bottom-color: var(--bullet, var(--yellow)); }
.bar__link[aria-current="true"] { color: var(--white); border-bottom-color: var(--yellow); }

.bar__dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: var(--bullet, var(--yellow));
  flex: 0 0 auto;
}

.bar__toggle {
  display: none;
  margin-left: auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.9rem;
  background: transparent;
  border: 2px solid var(--ink-rule);
  color: var(--white);
  font-family: var(--table);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.12em;
  cursor: pointer;
}

.bar__toggle:hover { border-color: var(--yellow); }
.bar__toggle svg { width: 18px; height: 18px; }

/* --- Hero panel ----------------------------------------------------------- */

.panel {
  position: relative;
  background: var(--ink);
  color: var(--white);
  padding: clamp(3rem, 8vw, 6rem) var(--pad-x) clamp(3.5rem, 8vw, 6rem);
  border-bottom: 14px solid var(--yellow);
}

.panel__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 0.85fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: end;
  max-width: 1400px;
  margin: 0 auto;
}

.panel__name {
  font-variation-settings: "wdth" 122;
  text-transform: uppercase;
  font-weight: 900;
  font-size: clamp(2.75rem, 9.5vw, 6rem);
  letter-spacing: -0.025em;
  line-height: 0.92;
}

.panel__role {
  margin: 1.25rem 0 0;
  padding-top: 1.25rem;
  border-top: var(--rule) solid var(--ink-rule);
  font-family: var(--table);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.16em;
  font-size: clamp(1rem, 2.2vw, 1.375rem);
  color: var(--yellow);
  max-width: none;
}

.panel__intro {
  margin-top: 1.75rem;
  color: #d8e0e9;
  font-size: clamp(1rem, 0.95rem + 0.35vw, 1.1875rem);
  line-height: 1.65;
}

.panel__intro a {
  color: var(--white);
  text-decoration-color: var(--yellow);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.panel__intro a:hover { color: var(--yellow); }

.stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1.75rem;
}

.stack__label {
  margin: 1.75rem 0 0.75rem;
  font-family: var(--table);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.16em;
  font-size: 0.8125rem;
  color: #93a2b2;
}

.stack__label + .stack { margin-top: 0; }

.stack li {
  padding: 0.28rem 0.62rem;
  border: 2px solid var(--ink-rule);
  color: #d8e0e9;
  font-family: var(--table);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.1em;
  font-size: 0.8125rem;
  line-height: 1.35;
}

.panel__destinations {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2.25rem;
}

.dest {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 1.15rem;
  background: var(--ink-raised);
  color: var(--white);
  text-decoration: none;
  font-family: var(--table);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.12em;
  transition: background 0.2s, transform 0.2s;
}

/* Route bullet, same grammar as the nav — not an edge tab */
.dest::before {
  content: "";
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  background: var(--bullet);
  flex: 0 0 auto;
}

.dest:hover { background: #1f3752; transform: translateX(3px); }
.dest svg { width: 16px; height: 16px; flex: 0 0 auto; margin-left: 0.15rem; }

.portrait {
  position: relative;
  border: 6px solid var(--ink-raised);
  box-shadow: var(--lift-lg);
  background: var(--ink-raised);
}

.portrait img { width: 100%; aspect-ratio: 5 / 6; object-fit: cover; }

.portrait__tag {
  position: absolute;
  left: 0;
  bottom: 0;
  padding: 0.5rem 0.9rem;
  background: var(--yellow);
  color: var(--ink);
  font-family: var(--table);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.14em;
  font-size: 0.8125rem;
}

/* --- Sections ------------------------------------------------------------- */

.section { padding: var(--section-y) var(--pad-x); }
.section__inner { max-width: 1400px; margin: 0 auto; }

.section__head {
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2vw, 1.25rem);
  padding-bottom: 1.25rem;
  border-bottom: 4px solid var(--bullet, var(--ink));
}

.section__head h2 {
  font-variation-settings: "wdth" 118;
  text-transform: uppercase;
  font-size: clamp(1.75rem, 5vw, 3.25rem);
  letter-spacing: -0.015em;
}

.section__head .bullet { font-size: clamp(0.75rem, 2vw, 1rem); }

.section__note {
  margin: 1.5rem 0 0;
  color: #4a5a6b;
  font-size: 1.0625rem;
}

.section__note a {
  color: var(--ink);
  font-weight: 700;
  text-decoration-color: var(--bullet);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.section__note a:hover { color: var(--bullet); }

/* --- Projects ------------------------------------------------------------- */

.stops {
  display: grid;
  gap: clamp(3rem, 7vw, 5.5rem);
  margin-top: clamp(2.5rem, 6vw, 4rem);
}

.stop {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
}

.stop:nth-child(even) .stop__shot { order: -1; }

.stop--lead { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }

.stop__plate {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1.25rem;
  background: var(--red);
  color: var(--white);
  margin-bottom: 1.5rem;
}

.stop__plate h3 {
  font-variation-settings: "wdth" 112;
  text-transform: uppercase;
  font-size: clamp(1.125rem, 2.4vw, 1.6rem);
  letter-spacing: 0.005em;
}

.stop__plate svg { width: 22px; height: 22px; flex: 0 0 auto; }

.stop__body p { color: #33414f; }

.stop__tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.5rem 0;
}

.stop__tech li {
  padding: 0.3rem 0.7rem;
  border: 2px solid #b9bdc0;
  color: #3a4855;
  font-family: var(--table);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.1em;
  font-size: 0.8125rem;
}

.stop__shot {
  margin: 0;
  border: 6px solid var(--ink);
  background: var(--ink);
  box-shadow: var(--lift);
}

.stop__shot img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top center; }

/* --- Action button -------------------------------------------------------- */

.action {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.9rem 1.4rem;
  background: var(--ink);
  color: var(--white);
  text-decoration: none;
  font-family: var(--table);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.13em;
  border: none;
  border-bottom: 5px solid var(--bullet, var(--yellow));
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.action:hover { background: var(--ink-raised); transform: translateY(-2px); }
.action:active { transform: translateY(0); }
.action svg { width: 16px; height: 16px; flex: 0 0 auto; }
.action[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }

/* --- The Line ------------------------------------------------------------- */

.line-section { background: var(--paper); }

.line-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--gap);
  align-items: end;
  padding-bottom: 1.25rem;
  border-bottom: 4px solid var(--ink);
}

.line-head h2 {
  font-variation-settings: "wdth" 118;
  text-transform: uppercase;
  font-size: clamp(1.75rem, 5vw, 3.25rem);
}

.line-legend {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.line-legend__btn {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 1rem;
  background: transparent;
  border: 2px solid #b9bdc0;
  font-family: var(--table);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.12em;
  font-size: 0.875rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.line-legend__btn::before {
  content: "";
  flex: none;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  background: var(--bullet, var(--ink));
}

.line-legend__btn:hover { border-color: var(--ink); }
.line-legend__btn[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--white); }

/* The pressed fill is ink, so an ink bullet would disappear into it */
.line-legend__btn[aria-pressed="true"]::before { background: var(--white); }
.line-legend__btn[data-focus="work"][aria-pressed="true"]::before { background: var(--orange); }
.line-legend__btn[data-focus="study"][aria-pressed="true"]::before { background: var(--green); }

/* Interchange bullets: this section carries both lines */
.line-head__bullets { display: flex; gap: 0.4rem; }

.line-head__title { display: flex; align-items: center; gap: clamp(0.75rem, 2vw, 1.25rem); }

.line-head__sub {
  margin: 0.85rem 0 0;
  max-width: none;
  font-family: var(--table);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.14em;
  font-size: clamp(0.875rem, 1.6vw, 1.0625rem);
  color: #4a5a6b;
}

.line {
  position: relative;
  margin-top: clamp(2.5rem, 6vw, 4rem);
}

/* Two parallel tracks sharing one corridor */
.line__track {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px;
  transform-origin: top center;
  z-index: 0;
}

.line__track--study { background: var(--green); }
.line__track--work { background: var(--orange); }

.stations { position: relative; z-index: 1; display: grid; }

.station { position: relative; }

.station__dot {
  position: absolute;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--white);
  border: 7px solid var(--bullet);
  box-shadow: 0 3px 10px -3px rgba(13, 27, 42, 0.5);
  z-index: 2;
  transition: filter 0.3s, opacity 0.3s;
}

.station--study { --bullet: var(--green); }
.station--work { --bullet: var(--orange); }

.station__panel {
  background: var(--white);
  border: 2px solid #d6d5d0;
  border-top: 6px solid var(--bullet);
  padding: clamp(1.25rem, 3vw, 1.85rem);
  box-shadow: var(--lift);
}

.station__year {
  font-family: var(--table);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.9375rem;
  color: var(--ink);
  background: var(--yellow);
  display: inline-block;
  padding: 0.2rem 0.6rem;
  margin-bottom: 0.85rem;
}

.station--work .station__year { background: var(--orange); color: var(--ink); }
.station--study .station__year { background: var(--green); color: var(--white); }

.station__panel h3 {
  font-variation-settings: "wdth" 108;
  font-size: clamp(1.1rem, 2.2vw, 1.375rem);
  text-transform: uppercase;
  letter-spacing: -0.005em;
}

.station__org {
  margin: 0.5rem 0 0;
  font-family: var(--table);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.1em;
  font-size: 1rem;
  color: #4a5a6b;
}

.station__body { margin-top: 1.1rem; }
.station__body p { color: #33414f; font-size: 1rem; }

.station__list { margin-top: 0.85rem; display: grid; gap: 0.6rem; }

.station__list li {
  position: relative;
  padding-left: 1.5rem;
  color: #33414f;
  font-size: 0.9688rem;
  line-height: 1.55;
  max-width: var(--measure);
}

.station__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 0.7rem;
  height: 3px;
  background: var(--bullet);
}

.station__certs { display: grid; gap: 0.75rem; margin-top: 1rem; }

.station__cert {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.85rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e2e1dc;
}
.station__cert:last-child { border-bottom: 0; padding-bottom: 0; }

.station__cert strong { font-weight: 700; font-size: 1rem; }

.station__cert a {
  font-family: var(--table);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.11em;
  font-size: 0.8125rem;
  color: var(--green);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.station__cert a:hover { color: var(--ink); }

.station__cert span {
  font-family: var(--table);
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-size: 0.8125rem;
  color: #6b7885;
}

/* Interchange band: the one point where both tracks are live and the record changes
   discipline. Paints over the corridor, so the two lines run into it and out again. */
.interchange {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem 1.1rem;
  padding: 0.95rem 1.25rem;
  background: var(--ink);
  border-top: 4px solid var(--yellow);
  border-bottom: 4px solid var(--yellow);
  box-shadow: var(--lift);
}

.interchange__year {
  flex: none;
  padding: 0.22rem 0.62rem;
  background: var(--yellow);
  color: var(--ink);
  font-family: var(--table);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.1em;
  font-size: 0.9375rem;
}

.interchange__text {
  margin: 0;
  max-width: none;
  color: #d8e0e9;
  font-family: var(--table);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.14em;
  font-size: clamp(0.8125rem, 1.4vw, 1rem);
}

/* Distance ticks: the lane without a station still carries the corridor's signage */
.station__tick {
  display: none;
  position: absolute;
  top: 1.75rem;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--table);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.16em;
  font-size: 0.8125rem;
  /* 5.16:1 on --paper. Quiet, but these are the device carrying the corridor and
     must clear the 4.5:1 floor like any other text. */
  color: #5d6670;
  white-space: nowrap;
}

.station__tick::before {
  content: "";
  flex: none;
  width: 30px;
  height: 2px;
  background: #a9aeaa;
}

/* Terminus marker for the ongoing role.
   Specificity has to clear .station__body p, which otherwise wins the colour. */
.station__body p.station__now {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 1rem;
  padding: 0.3rem 0.7rem;
  background: var(--ink);
  color: var(--white);
  font-family: var(--table);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.13em;
  font-size: 0.8125rem;
}

.station__body p.station__now::before {
  content: "";
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--yellow);
}

/* Line focus — mute every colour carrier on the untraced track, never its text.
   Four carriers: the track, the station dot, the panel's top rule, the year chip. */
.line[data-focus="work"] .station--study .station__dot,
.line[data-focus="study"] .station--work .station__dot { filter: grayscale(1); opacity: 0.6; }

.line[data-focus="work"] .line__track--study,
.line[data-focus="study"] .line__track--work { filter: grayscale(1); opacity: 0.45; }

.line[data-focus="work"] .station--study .station__panel,
.line[data-focus="study"] .station--work .station__panel { border-top-color: #b9bdc0; }

.line[data-focus="work"] .station--study .station__year,
.line[data-focus="study"] .station--work .station__year {
  background: #6b7885;
  color: var(--white);
}

/* The tick's rule is a colour carrier and mutes with the rest; its year is text and
   keeps full contrast, same as every other panel in the suppressed lane. */
.line[data-focus="work"] .station--study .station__tick::before,
.line[data-focus="study"] .station--work .station__tick::before { background: #d5d8d3; }

/* --- Contact -------------------------------------------------------------- */

.contact { background: var(--ink); color: var(--white); }
.contact .section__head { border-bottom-color: var(--blue); }
.contact .section__head h2 { color: var(--white); }

.contact__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: clamp(2rem, 5vw, 4rem);
  margin-top: clamp(2.5rem, 6vw, 3.5rem);
  align-items: start;
}

.form { display: grid; gap: 1.25rem; }

.field { display: grid; gap: 0.5rem; }

.field label {
  font-family: var(--table);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.14em;
  font-size: 0.875rem;
  color: var(--yellow);
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--ink-raised);
  border: 2px solid var(--ink-rule);
  color: var(--white);
  font-family: var(--sign);
  font-size: 1rem;
  line-height: 1.5;
  border-radius: 0;
}

.field textarea { resize: vertical; min-height: 9rem; }

.field input::placeholder,
.field textarea::placeholder { color: #93a2b2; }

.field input:hover,
.field textarea:hover { border-color: #3d5570; }

.field input:focus,
.field textarea:focus { border-color: var(--yellow); outline: none; box-shadow: 0 0 0 3px rgba(255, 199, 44, 0.25); }

.field input:user-invalid,
.field textarea:user-invalid { border-color: #ff8a80; }

.field__error {
  font-family: var(--table);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.8125rem;
  color: #ff8a80;
  display: none;
}

.field input:user-invalid ~ .field__error,
.field textarea:user-invalid ~ .field__error { display: block; }

.contact__aside { display: grid; gap: 1.25rem; }

/* Header band on top, matching the station panels rather than a side tab */
.direct {
  padding: clamp(1.25rem, 3vw, 1.75rem);
  background: var(--ink-raised);
  border-top: 6px solid var(--blue);
}

.direct h3 {
  font-variation-settings: "wdth" 112;
  text-transform: uppercase;
  font-size: 1.125rem;
  margin-bottom: 0.75rem;
}

.direct p { color: #c3ceda; font-size: 0.9688rem; }

.direct a.mail {
  display: inline-block;
  margin-top: 0.5rem;
  color: var(--yellow);
  font-weight: 700;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  word-break: break-all;
}
.direct a.mail:hover { color: var(--white); }

.profiles { display: grid; gap: 0.5rem; }

/* Departure-list rows: a rule per service, no decorative edge band */
.profiles a {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.9rem 0.25rem;
  color: var(--white);
  text-decoration: none;
  font-family: var(--table);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.12em;
  border-bottom: 2px solid var(--ink-rule);
  transition: border-color 0.2s, color 0.2s, transform 0.2s;
}

.profiles li:last-child a { border-bottom-width: 0; }
.profiles a:hover { border-bottom-color: var(--yellow); color: var(--yellow); transform: translateX(5px); }
.profiles a svg { width: 20px; height: 20px; flex: 0 0 auto; }
.profiles a::after {
  content: "";
  margin-left: auto;
  width: 0.55rem;
  height: 0.55rem;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.65;
}

/* --- Footer --------------------------------------------------------------- */

.foot {
  background: var(--ink);
  color: #b8c4d0;
  border-top: 14px solid var(--yellow);
  padding: clamp(2.5rem, 6vw, 4rem) var(--pad-x) 2rem;
}

.foot__inner { max-width: 1400px; margin: 0 auto; }

.foot__map {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--gap);
  padding-bottom: 2rem;
  border-bottom: 2px solid var(--ink-rule);
}

.foot__col h3 {
  color: var(--white);
  font-family: var(--table);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.875rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.foot__col li { margin-bottom: 0.6rem; }

.foot__col a {
  color: #b8c4d0;
  text-decoration: none;
  font-size: 0.9688rem;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.foot__col a:hover { color: var(--white); border-bottom-color: var(--yellow); }

.foot__end {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  align-items: center;
  justify-content: space-between;
  padding-top: 1.75rem;
}

.foot__wordmark {
  font-variation-settings: "wdth" 118;
  text-transform: uppercase;
  font-weight: 900;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  color: var(--white);
  letter-spacing: -0.01em;
}

.foot__meta {
  font-family: var(--table);
  text-transform: uppercase;
  letter-spacing: 0.13em;
  font-size: 0.875rem;
}

/* --- Motion --------------------------------------------------------------- */

/* Tracks draw once on approach. Default state is fully drawn: the class is
   only added by JS, so a no-JS or failed-script load shows the finished line. */
.js .line:not(.is-drawn) .line__track { transform: scaleY(0); }

.js .line__track {
  transition: transform 1.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.js .line__track--work { transition-delay: 0.18s; }

/* --- Responsive ----------------------------------------------------------- */

/* Desktop: study on the left, work on the right, tracks down the middle */
/* The corridor sits left of centre: study entries are short, work entries carry long
   contribution lists, so the lanes are sized to their content instead of split evenly.
   Boundary at 42.5% = 0.85fr of a 2fr track. */
@media (min-width: 62rem) {
  /* Narrower than the section shell: a corridor 1400px wide leaves the lane without a
     station in it reading as dead page rather than as track. Left-aligned, not centred,
     so the corridor still hangs on the section head's own rule. */
  .line { max-width: 1080px; margin-inline: 0; }

  /* The head rule stays at the section shell width, matching every other section's
     right edge. Capping it to the corridor fixed one disagreement by creating a
     worse cross-section one (1368 / 1152 / 1368 stepping down the page). */

  /* Ticks live in whichever lane the station does not occupy */
  .station__tick { display: flex; }
  .station--study .station__tick { left: calc(42.5% + 22px); }
  .station--work .station__tick { right: calc(57.5% + 22px); flex-direction: row-reverse; }

  .line__track--study { left: calc(42.5% - 13px); }
  .line__track--work { left: calc(42.5% + 5px); }

  .stations { gap: clamp(2rem, 4vw, 3rem); }

  .station { display: grid; grid-template-columns: 0.85fr 1.15fr; }

  .station--study .station__panel { grid-column: 1; margin-right: clamp(1.75rem, 3.5vw, 3rem); }
  .station--work .station__panel { grid-column: 2; margin-left: clamp(1.75rem, 3.5vw, 3rem); }

  .station--study .station__dot { left: calc(42.5% - 22px); top: 1.75rem; }
  .station--work .station__dot { left: calc(42.5% - 4px); top: 1.75rem; }
}

/* Mobile / tablet: one spine on the left, everything to its right */
@media (max-width: 61.999rem) {
  .line { padding-left: 2.75rem; }
  .line__track { left: 10px; width: 6px; }
  .line__track--work { left: 20px; }
  .stations { gap: 1.75rem; }
  .station__dot { left: -2.75rem; top: 1.5rem; width: 22px; height: 22px; border-width: 6px; }
  .station--work .station__dot { left: -2.1rem; }
}

/* Keeps the #education scroll target out of the header grid flow */
.anchor { display: block; height: 0; overflow: hidden; }

@media (max-width: 61.999rem) {
  .panel__grid { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .portrait { max-width: 300px; }
  .stop,
  .stop--lead { grid-template-columns: minmax(0, 1fr); }
  .stop:nth-child(even) .stop__shot { order: 0; }
  .contact__grid { grid-template-columns: minmax(0, 1fr); }
  .line-head { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 52rem) {
  .bar__toggle { display: flex; }
  .bar__nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--ink);
    border-bottom: 4px solid var(--yellow);
    padding: 0.5rem var(--pad-x) 1.25rem;
  }
  .bar__nav.is-open { display: block; }
  .bar__list { flex-direction: column; align-items: stretch; gap: 0; }
  .bar__link {
    padding: 0.95rem 0;
    border-bottom: 2px solid var(--ink-rule);
    font-size: 1.0625rem;
  }
  .bar__link:hover,
  .bar__link[aria-current="true"] { border-bottom-color: var(--yellow); }
}

@media (max-width: 30rem) {
  .panel__destinations { flex-direction: column; align-items: stretch; }
  .dest { justify-content: flex-start; }

  /* Three-state control stays one even row instead of wrapping 2 + 1 */
  .line-legend { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.35rem; }
  .line-legend__btn {
    justify-content: center;
    padding: 0.55rem 0.4rem;
    gap: 0.35rem;
    font-size: 0.8125rem;
    letter-spacing: 0.06em;
  }
  .line-legend__btn::before { width: 0.7rem; height: 0.7rem; }
}

/* --- Reduced motion ------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .js .line:not(.is-drawn) .line__track { transform: scaleY(1); }
  .dest:hover,
  .action:hover,
  .profiles a:hover { transform: none; }
}

/* --- Print ---------------------------------------------------------------- */

@media print {
  .bar, .panel__destinations, .contact, .foot { display: none; }
  body { background: #fff; }
  .panel { background: #fff; color: #000; border-bottom: 2px solid #000; }
  .station__panel { box-shadow: none; }
}
