/* Self-hosted fonts (latin subset, SIL Open Font License) */
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url('assets/fonts/montserrat-latin-var.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'DM Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('assets/fonts/dm-mono-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'DM Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('assets/fonts/dm-mono-500-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;

  /* Brand — sampled from the official logo files */
  --navy: #0d2742;
  --navy-soft: #1b3a5c;
  --ink-soft: #4a5d72;
  --teal: #00c2b3;
  --teal-deep: #0b7f86;
  --teal-ink: #08737a;
  --blue: #1565a8;
  --orange: #ff8a00;
  --orange-deep: #c9650f;
  --error: #b3261e;
  --paper: #f7f5f0;
  --white: #ffffff;
  --line: rgba(13, 39, 66, 0.14);
  --field-edge: #7d8a98;

  --sans: 'Montserrat', system-ui, sans-serif;
  --mono: 'DM Mono', ui-monospace, monospace;

  --gutter: clamp(16px, 4vw, 64px);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--navy);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  background:
    radial-gradient(60vw 55vh at 88% 12%, rgba(0, 194, 179, 0.13), transparent 62%),
    radial-gradient(55vw 50vh at 0% 100%, rgba(255, 138, 0, 0.1), transparent 60%),
    radial-gradient(rgba(13, 39, 66, 0.09) 1px, transparent 1.3px) 0 0 / 22px 22px,
    var(--paper);
}

/* Paper grain */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.06;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* One screen by default; grows (and scrolls) only if the user enlarges text or spacing */
.page {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  max-width: 1600px;
  margin-inline: auto;
  padding: clamp(14px, 2.6vh, 32px) var(--gutter) clamp(12px, 2.2vh, 26px);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  gap: clamp(8px, 2vh, 24px);
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: block;
  height: clamp(44px, 7.5vh, 76px);
  width: auto;
}

.clock {
  justify-self: end;
  white-space: nowrap;
}

.clock time {
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}

/* ---------- Stage ---------- */
.stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: center;
  gap: clamp(16px, 4vw, 72px);
}

.copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(10px, 2.2vh, 24px);
  min-width: 0;
}

.kicker {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  font: 500 12px/1 var(--mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--teal-ink);
}

.kicker::before {
  content: '';
  width: 32px;
  height: 2px;
  background: linear-gradient(90deg, var(--teal-deep) 50%, var(--orange) 50%);
}

h1 {
  margin: 0;
  max-width: 13ch;
  font-weight: 800;
  font-size: clamp(2rem, min(5.3vw, 9.2vh), 5.9rem);
  line-height: 1.04;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.bridge {
  position: relative;
  display: inline-block;
}

.grad {
  background: linear-gradient(95deg, var(--teal-deep), var(--blue));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* The orange "bridge" span builds in under the word */
.bridge::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0.04em;
  bottom: -0.08em;
  height: 0.085em;
  border-radius: 0.04em;
  background: var(--orange);
  transform-origin: left;
  animation: build 0.8s var(--ease) 1s both;
}

.lead {
  margin: 0;
  max-width: 44ch;
  font-size: clamp(0.92rem, 1.9vh, 1.08rem);
  font-weight: 500;
  line-height: 1.6;
  color: var(--ink-soft);
}

/* Departure board */
.board-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  max-width: 100%;
}

.board-label {
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.board {
  min-width: 0;
  max-width: 100%;
  display: grid;
  grid-template-columns: repeat(var(--tiles, 18), minmax(0, 1.3em));
  gap: 3px;
  font: 500 clamp(0.7rem, 1.7vh, 0.92rem) / 1 var(--mono);
  color: var(--white);
}

.tile {
  position: relative;
  height: 1.75em;
  display: grid;
  place-items: center;
  border-radius: 3px;
  background: linear-gradient(var(--navy-soft) 50%, var(--navy) 50%);
  box-shadow: 0 1px 0 rgba(13, 39, 66, 0.25);
}

.tile::after {
  content: '';
  position: absolute;
  inset: 50% 0 auto;
  height: 1px;
  background: rgba(0, 0, 0, 0.35);
}

.tile.is-flipping {
  color: var(--orange);
}

/* Notify form */
.notify {
  width: 100%;
  max-width: 480px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 22px;
  border: 1px solid var(--field-edge);
  border-radius: 999px;
  background: var(--white);
  box-shadow: 0 18px 40px -22px rgba(13, 39, 66, 0.35);
  transition: border-color 0.25s, box-shadow 0.25s;
}

.notify:focus-within {
  border-color: var(--teal-deep);
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(0, 194, 179, 0.22), 0 18px 40px -22px rgba(13, 39, 66, 0.35);
}

.notify.is-invalid {
  border-color: var(--error);
}

.notify input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font: 500 16px var(--sans);
  color: var(--navy);
  padding: 10px 0;
}

.notify input::placeholder {
  color: var(--ink-soft);
  opacity: 1;
}

.notify button {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  border: 2px solid transparent;
  border-radius: 999px;
  padding: 11px 22px;
  background: var(--orange);
  color: var(--navy);
  font: 700 14px var(--sans);
  cursor: pointer;
  transition: background 0.25s, transform 0.25s var(--ease);
}

.notify .arrow {
  flex: none;
  transition: transform 0.25s var(--ease);
}

.notify button:hover {
  background: #ff9d2e;
}

.notify button:hover .arrow {
  transform: translateX(3px);
}

.notify button:active {
  transform: scale(0.97);
}

.notify button:focus-visible {
  outline: 3px solid var(--navy);
  outline-offset: 3px;
}

.notify.is-done button {
  background: var(--teal);
  cursor: default;
  transform: none;
}

.note {
  margin: -4px 0 0 22px;
  font: 500 13px/1.4 var(--sans);
  color: var(--ink-soft);
}

.note.is-success {
  color: var(--teal-ink);
}

.note.is-error {
  color: var(--error);
}

/* ---------- Network visual ---------- */
.visual {
  position: relative;
  align-self: stretch;
  min-height: 0;
  perspective: 1000px;
}

.visual svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  transform: rotateY(calc(var(--px, 0) * 7deg)) rotateX(calc(var(--py, 0) * -7deg));
  transition: transform 0.4s var(--ease);
}

.hex-ring {
  fill: none;
  stroke: var(--navy);
  stroke-opacity: 0.16;
  stroke-width: 1;
  stroke-dasharray: 2 9;
}

.spin {
  transform-box: fill-box;
  transform-origin: center;
  animation: spin 80s linear infinite;
}

.hex-outer,
.hex-inner {
  fill: none;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  animation: draw 1.8s var(--ease) 0.3s both;
}

.hex-outer {
  stroke: var(--navy);
  stroke-opacity: 0.28;
  stroke-width: 1.2;
}

.hex-inner {
  stroke: url(#g-brand);
  stroke-width: 2.5;
  animation-delay: 0.1s;
}

.hex-accent {
  fill: none;
  stroke: var(--orange);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 1;
  animation: draw 1s var(--ease) 1.4s both;
}

.route {
  fill: none;
  stroke: var(--teal-deep);
  stroke-width: 1.6;
  stroke-dasharray: 5 7;
  stroke-linecap: round;
  animation: flow 2.4s linear infinite;
}

.route-alt {
  stroke: var(--orange-deep);
  stroke-dasharray: 2 6;
}

.cargo-teal {
  fill: var(--teal);
}

.cargo-orange {
  fill: var(--orange);
}

.node {
  fill: var(--white);
  stroke: var(--navy);
  stroke-width: 2;
}

.ping {
  fill: var(--teal);
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  animation: ping 2.4s ease-out infinite;
}

.nodes text,
.hub {
  font: 500 13px var(--mono);
  letter-spacing: 0.14em;
  fill: var(--navy);
  text-anchor: middle;
}

.hub {
  font-size: 14px;
  fill: var(--teal-ink);
}

.mark {
  transform-box: fill-box;
  transform-origin: center;
  animation: float 6s ease-in-out infinite;
  filter: drop-shadow(0 18px 22px rgba(13, 39, 66, 0.22));
}

/* ---------- Footer ---------- */
.foot {
  display: grid;
  gap: clamp(8px, 1.4vh, 14px);
}

.tagline {
  margin: 0;
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 24px);
  font-weight: 500;
  font-size: clamp(0.66rem, 1.05vw, 0.92rem);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--teal-ink);
  white-space: nowrap;
}

.tagline-text {
  text-wrap: balance;
}

.rule {
  flex: 1;
  height: 3px;
  min-width: 24px;
  border-radius: 2px;
}

.rule-teal {
  background: var(--teal-deep);
}

.rule-orange {
  background: var(--orange);
}

.meta {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 6px 20px;
  font: 400 12px/1.4 var(--mono);
  color: var(--ink-soft);
}

.meta a {
  display: inline-block;
  padding-block: 10px;
  margin-block: -10px;
  color: var(--navy);
  text-decoration: underline;
  text-decoration-color: var(--orange);
  text-underline-offset: 4px;
  transition: color 0.2s;
}

.meta a:hover {
  color: var(--teal-ink);
}

.meta a {
  justify-self: start;
}

.meta a:focus-visible {
  outline: 2px solid var(--teal-deep);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Entrance ---------- */
.rise {
  animation: rise 0.9s var(--ease) both;
  animation-delay: calc(var(--d, 0) * 90ms);
}

.d1 { --d: 1; }
.d2 { --d: 2; }
.d3 { --d: 3; }
.d4 { --d: 4; }
.d5 { --d: 5; }
.d6 { --d: 6; }
.d7 { --d: 7; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Keyframes ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
}

@keyframes draw {
  from { stroke-dashoffset: 1; }
}

@keyframes build {
  from { transform: scaleX(0); }
}

@keyframes flow {
  to { stroke-dashoffset: -24; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes float {
  50% { transform: translateY(-10px); }
}

@keyframes ping {
  0% { opacity: 0.5; transform: scale(1); }
  100% { opacity: 0; transform: scale(3.4); }
}

/* ---------- Responsive ---------- */

/* Network labels stay legible when the visual is scaled down */
@media (max-width: 1180px) {
  .nodes text { font-size: 18px; }
  .hub { font-size: 19px; }
}

/* Portrait tablets: copy on top, full-width network below */
@media (min-width: 761px) and (max-width: 1023px) and (orientation: portrait) {
  .stage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(260px, 1fr);
    align-items: start;
  }

  h1 {
    max-width: 14ch;
  }
}

/* Phones: network becomes a cropped corner motif */
@media (max-width: 760px) {
  .page {
    overflow: clip;
  }

  .stage {
    position: static;
    grid-template-columns: minmax(0, 1fr);
  }

  .topbar,
  .foot {
    position: relative;
    z-index: 1;
  }

  .visual {
    position: absolute;
    inset: auto -34vw -12vw auto;
    width: 90vw;
    height: 90vw;
    opacity: 0.12;
    pointer-events: none;
  }

  .visual svg {
    transform: none;
  }

  .mark,
  .nodes,
  .hub,
  .cargo {
    display: none;
  }

  h1 {
    font-size: clamp(2.1rem, min(10.5vw, 6.6vh), 3.4rem);
  }

  .board-wrap {
    width: 100%;
  }

  .board {
    width: 100%;
    grid-template-columns: repeat(var(--tiles, 18), minmax(0, 1fr));
    gap: 2px;
    font-size: clamp(0.6rem, 3.4vw, 0.9rem);
  }

  .tagline {
    justify-content: center;
    white-space: normal;
    text-align: center;
    letter-spacing: 0.2em;
    line-height: 1.5;
  }

  .rule {
    max-width: 56px;
  }

  .meta {
    grid-template-columns: 1fr;
    justify-items: center;
    row-gap: 10px;
    text-align: center;
  }

  .meta a,
  .clock {
    justify-self: center;
  }
}

@media (max-width: 420px) {
  .logo {
    height: 40px;
  }

  .notify {
    flex-direction: column;
    align-items: stretch;
    padding: 6px;
    border-radius: 22px;
  }

  .notify input {
    padding: 12px 14px;
  }

  .notify button {
    justify-content: center;
  }

  .note {
    margin-left: 4px;
  }
}

@media (max-width: 340px) {
  .logo {
    height: 34px;
  }

  .kicker {
    margin-top: 6px;
  }

  .legal-long {
    display: none;
  }

  .copy {
    gap: 8px;
  }
}

/* Short phones: drop the secondary line to keep one screen */
@media (max-height: 700px) and (max-width: 760px), (max-height: 560px) {
  .lead {
    display: none;
  }
}

/* Landscape phones: keep the essentials on one screen */
@media (max-height: 460px) {
  .page {
    gap: 6px;
  }

  .logo {
    height: 36px;
  }

  .kicker,
  .board-label,
  .board {
    display: none;
  }

  .tagline {
    white-space: nowrap;
  }

  .meta {
    row-gap: 4px;
  }

  h1 {
    max-width: 22ch;
    font-size: clamp(1.7rem, 9vh, 2.6rem);
  }

  .copy {
    gap: 10px;
  }
}

/* Landscape phones in the single-column layout: keep the motif in the footer band */
@media (max-height: 460px) and (max-width: 760px) {
  .visual {
    width: 95vh;
    height: 95vh;
    inset: auto -22vh -38vh auto;
  }
}

/* Landscape phones in the two-column layout: labels stay legible in the small visual */
@media (max-height: 460px) and (min-width: 761px) {
  .nodes text { font-size: 26px; }
  .hub { font-size: 26px; }
}

/* Forced colours: give the field and buttons real edges */
@media (forced-colors: active) {
  .notify,
  .notify button {
    border: 1px solid CanvasText;
  }

  .notify:focus-within {
    outline: 2px solid Highlight;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
