/* The yard feature cards that expand with a notch: the modules of Yardline's Yard Operating System on a deep petrol
   page. Each card is a wrapper (.card, its width moves in CSS, its scale in GSAP) with a clipped body (.card__surface,
   whose clip-path is the notched shape the script rebuilds) and the 1px rim drawn with the same path (.rim). */
:root {
  --page: #052424;          /* the deep petrol page */
  --page-2: #031818;        /* the page at its edges */
  --lime: #abff02;          /* the one accent */
  --paper: #f1efe7;         /* warm white */
  --stone: #c6c8bf;         /* warm grey */
  --deep: #0b3535;          /* the dark card */
  --open: #0a2f2f;          /* the open card */
  --ink: #052424;           /* text on light cards */
  --mute: rgba(241, 239, 231, 0.56);
  --hair: rgba(241, 239, 231, 0.1);
  --cw: clamp(84px, 12.5vw, 168px);           /* a closed card */
  --ew: clamp(200px, 44vw, 520px);            /* the open card */
  --h: clamp(230px, calc(100vh - 128px), 440px);
  --gap: clamp(6px, 0.9vw, 12px);
  --open-time: 0.6s;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { touch-action: manipulation; }
html, body { overflow-x: clip; }

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--paper);
  font-family: 'Geist Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: 'Geist Mono Variable', ui-monospace, monospace; }

.sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

.stage {
  position: relative;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: clamp(12px, 3vh, 40px) clamp(12px, 3vw, 40px);
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(60% 50% at 18% 100%, rgba(171, 255, 2, 0.07), transparent 70%),
    radial-gradient(70% 60% at 85% 0%, rgba(30, 90, 84, 0.45), transparent 70%),
    radial-gradient(120% 90% at 50% 50%, var(--page) 40%, var(--page-2) 100%);
}

.lanes {
  position: absolute; inset: 0; width: 100%; height: 100%;
  z-index: -1; fill: none; stroke: rgba(241, 239, 231, 0.06); stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.lanes path { vector-effect: non-scaling-stroke; }

.grain {
  position: absolute; inset: -50%; z-index: 3; pointer-events: none; opacity: 0.07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.yos {
  width: min(1080px, 100%);
  min-width: 0;
  opacity: 0;
}

/* ------------------------------------------------------------ the head */
.yos__head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  margin-bottom: clamp(10px, 2.4vh, 22px);
  padding-inline: 2px;
}
.yos__eyebrow {
  font-family: 'Geist Mono Variable', ui-monospace, monospace;
  font-size: clamp(9px, 1vw, 11px); letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--lime); margin-bottom: 6px;
}
.yos__title {
  font-size: clamp(17px, 2.6vw, 34px); font-weight: 420; letter-spacing: -0.035em; line-height: 1;
}
.yos__nav { display: flex; gap: 6px; flex: none; }
.nav-btn {
  width: clamp(30px, 3.4vw, 40px); aspect-ratio: 1; border-radius: 10px;
  border: 1px solid rgba(241, 239, 231, 0.14);
  background: linear-gradient(rgba(241, 239, 231, 0.07), rgba(241, 239, 231, 0.02));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 6px 14px -8px rgba(0, 0, 0, 0.6);
  color: var(--paper); display: grid; place-items: center; cursor: pointer;
  transition: background-color 0.25s, border-color 0.25s;
}
.nav-btn svg { width: 45%; height: 45%; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) {
  .nav-btn:hover { border-color: rgba(171, 255, 2, 0.5); background-color: rgba(171, 255, 2, 0.06); }
}

/* ------------------------------------------------------------ the row */
.track {
  position: relative;
  display: flex; gap: var(--gap);
  height: var(--h);
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  padding-inline: 2px;
}
/* a soft fade only on the side where more cards wait */
.track.is-l { -webkit-mask-image: linear-gradient(90deg, transparent, #000 22px); mask-image: linear-gradient(90deg, transparent, #000 22px); }
.track.is-r { -webkit-mask-image: linear-gradient(270deg, transparent, #000 22px); mask-image: linear-gradient(270deg, transparent, #000 22px); }
.track.is-l.is-r { -webkit-mask-image: linear-gradient(90deg, transparent, #000 22px, #000 calc(100% - 22px), transparent); mask-image: linear-gradient(90deg, transparent, #000 22px, #000 calc(100% - 22px), transparent); }
.track::-webkit-scrollbar { display: none; }
.probe { position: absolute; width: var(--ew); height: 0; visibility: hidden; pointer-events: none; }
.probe--c { width: var(--cw); }

/* ------------------------------------------------------------ a card */
.card {
  position: relative; flex: none;
  width: var(--cw); height: 100%;
  transition: width var(--open-time) cubic-bezier(0.19, 1, 0.22, 1);
  cursor: pointer; outline: none;
  filter: drop-shadow(0 22px 26px rgba(0, 0, 0, 0.32)) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
  -webkit-tap-highlight-color: transparent;
}
.card.is-open { width: var(--ew); cursor: default; }
.card[data-tone='lime'] { --bg: var(--lime); --fg: var(--ink); --rim-a: rgba(255, 255, 255, 0.75); --rim-b: rgba(5, 36, 36, 0.18); }
.card[data-tone='paper'] { --bg: var(--paper); --fg: var(--ink); --rim-a: rgba(255, 255, 255, 0.95); --rim-b: rgba(5, 36, 36, 0.14); }
.card[data-tone='deep'] { --bg: var(--deep); --fg: var(--paper); --rim-a: rgba(241, 239, 231, 0.3); --rim-b: rgba(241, 239, 231, 0.06); }
.card[data-tone='stone'] { --bg: var(--stone); --fg: var(--ink); --rim-a: rgba(255, 255, 255, 0.8); --rim-b: rgba(5, 36, 36, 0.16); }
.card.is-open { --fg: var(--paper); --rim-a: rgba(241, 239, 231, 0.32); --rim-b: rgba(171, 255, 2, 0.16); }

.card__surface {
  position: absolute; inset: 0;
  border-radius: 16px;
  overflow: hidden;
  color: var(--fg);
  background-color: var(--bg);
  background-image: linear-gradient(170deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 40%, rgba(0, 0, 0, 0.08));
  transition: background-color var(--open-time) cubic-bezier(0.19, 1, 0.22, 1), color 0.3s;
}
.card.is-open .card__surface {
  background-color: var(--open);
  background-image:
    radial-gradient(70% 55% at 100% 0%, rgba(171, 255, 2, 0.16), transparent 70%),
    radial-gradient(60% 50% at 0% 100%, rgba(40, 120, 110, 0.28), transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0) 30%);
}
/* grain inside the open card */
.card.is-open .card__surface::before {
  content: ''; position: absolute; inset: 0; opacity: 0.08; mix-blend-mode: overlay; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* the soft light under the pointer on a closed card */
.card__light {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(160px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.34), transparent 65%);
  mix-blend-mode: soft-light;
  transition: opacity 0.4s;
}
.card.is-hover .card__light { opacity: 1; }

/* the rim: the same path as the clip, stroked; half of the 2px stroke is clipped away, so 1px shows */
.rim { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.rim path { fill: none; stroke-width: 2; }

/* the lime light that sits in the notch */
.card__mark {
  position: absolute; left: 0; top: 0; width: 2px; height: 40px; border-radius: 2px;
  background: var(--lime);
  box-shadow: 0 0 10px 1px rgba(171, 255, 2, 0.55), 0 0 26px 4px rgba(171, 255, 2, 0.22);
  opacity: 0; pointer-events: none; z-index: 2;
}

/* ------------------------------------------------------------ the closed face */
.face--c {
  position: absolute; left: 0; top: 0; bottom: 0; width: var(--cw);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: clamp(10px, 1.4vw, 18px);
  transition: opacity 0.3s 0.25s;
}
.card.is-open .face--c { opacity: 0; transition: opacity 0.18s; pointer-events: none; }
.face__label {
  font-family: 'Geist Mono Variable', ui-monospace, monospace;
  font-size: clamp(8.5px, 0.85vw, 10.5px); letter-spacing: 0.16em; text-transform: uppercase; line-height: 1.45;
  opacity: 0.72;
}
.face__title {
  writing-mode: vertical-rl; transform: rotate(180deg);
  font-size: clamp(19px, 2.3vw, 30px); font-weight: 430; letter-spacing: -0.035em; line-height: 0.95;
  white-space: nowrap; margin-top: auto; margin-bottom: 12px;
}
.face__foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.face__stat {
  font-family: 'Geist Mono Variable', ui-monospace, monospace;
  font-size: clamp(10px, 1vw, 12px); letter-spacing: 0.04em; font-variant-numeric: tabular-nums;
  padding: 3px 6px; border-radius: 6px; border: 1px solid currentColor; opacity: 0.8;
}
.face__plus {
  width: clamp(18px, 1.7vw, 22px); height: clamp(18px, 1.7vw, 22px); flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round;
}

/* ------------------------------------------------------------ the open face */
.face--e {
  position: absolute; left: 0; top: 0; bottom: 0; width: var(--ew);
  display: flex; flex-direction: column; gap: clamp(6px, 1.3vh, 12px);
  padding: clamp(14px, 2.2vw, 28px);
  opacity: 0; visibility: hidden; color: var(--paper);
  transition: opacity 0.2s, visibility 0s 0.2s;
}
.card.is-open .face--e { opacity: 1; visibility: visible; transition: opacity 0.3s 0.08s, visibility 0s; }
.top { display: flex; align-items: center; justify-content: space-between; }
.top .mono { font-size: clamp(9px, 0.9vw, 11px); letter-spacing: 0.18em; text-transform: uppercase; color: var(--mute); }
.live {
  font-family: 'Geist Mono Variable', ui-monospace, monospace;
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--lime);
  padding: 3px 7px; border-radius: 6px; border: 1px solid rgba(171, 255, 2, 0.4);
  background: rgba(171, 255, 2, 0.06);
}
.e-title { font-size: clamp(20px, 2.6vw, 34px); font-weight: 420; letter-spacing: -0.04em; line-height: 1; }
.e-desc { font-size: clamp(12px, 1.1vw, 14px); line-height: 1.45; color: var(--mute); max-width: 40ch; }

.panel {
  flex: 1; min-height: 0; position: relative;
  border-radius: 12px; padding: clamp(8px, 1.2vw, 14px);
  background: linear-gradient(180deg, rgba(241, 239, 231, 0.06), rgba(241, 239, 231, 0.025));
  box-shadow: inset 0 0 0 1px rgba(241, 239, 231, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

/* the arrivals at the gate */
.arrivals { list-style: none; display: flex; flex-direction: column; height: 100%; justify-content: space-between; gap: 4px; }
.arrivals li {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px;
  font-size: 12px; padding: 4px 4px 4px 8px; border-radius: 8px;
}
.arrivals li + li { box-shadow: 0 -1px 0 var(--hair); }
.arrivals li.is-now { background: rgba(171, 255, 2, 0.06); box-shadow: inset 0 0 0 1px rgba(171, 255, 2, 0.18); }
.arrivals .mono { font-size: 11px; letter-spacing: 0.04em; }
.arrivals .car { color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arrivals .t { color: var(--mute); }

.chip {
  position: relative; display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 500; letter-spacing: 0.01em;
  padding: 3px 8px; border-radius: 999px; white-space: nowrap; overflow: hidden;
}
.chip svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.chip.ok { color: var(--lime); background: rgba(171, 255, 2, 0.1); }
.chip.wait { color: var(--mute); background: rgba(241, 239, 231, 0.06); }
.chip.swap { display: inline-grid; color: var(--paper); background: rgba(241, 239, 231, 0.1); }
.chip.swap > span { grid-area: 1 / 1; display: inline-flex; align-items: center; gap: 4px; }
.chip__b { opacity: 0; }
.chip.swap.is-done { color: var(--lime); background: rgba(171, 255, 2, 0.12); }
.chip__a { position: relative; }
/* the scan: a band of light across the chip while it reads */
.chip.swap.is-scan::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(171, 255, 2, 0.35), transparent);
  transform: translateX(-100%);
  animation: scan 1.1s cubic-bezier(0.52, 0, 0, 1) infinite;
}
@keyframes scan { to { transform: translateX(100%); } }

/* the yard map */
.map { position: absolute; inset: clamp(8px, 1.2vw, 14px); width: calc(100% - 2 * clamp(8px, 1.2vw, 14px)); height: calc(100% - 2 * clamp(8px, 1.2vw, 14px)); overflow: visible; }
.map .slot { fill: none; stroke: rgba(241, 239, 231, 0.16); stroke-width: 1; }
.map .slot.full { fill: rgba(241, 239, 231, 0.16); stroke: rgba(241, 239, 231, 0.22); }
.map .slot.goal { stroke: var(--lime); stroke-dasharray: 2 2; }
.map .slot.goal.is-in { fill: var(--lime); stroke-dasharray: none; }
.map .lane-l { font: 500 7px 'Geist Mono Variable', monospace; fill: rgba(241, 239, 231, 0.4); }
.map__route { fill: none; stroke: var(--lime); stroke-width: 1.4; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; filter: drop-shadow(0 0 3px rgba(171, 255, 2, 0.6)); }
.map__pin { fill: var(--lime); }
.map__tag rect { fill: #0d3d3b; stroke: rgba(171, 255, 2, 0.6); stroke-width: 0.8; }
.map__tag text { font: 600 7px 'Geist Mono Variable', monospace; fill: var(--lime); text-anchor: middle; }

/* the dock schedule */
.dock { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: center; gap: clamp(4px, 1.2vh, 10px); padding-left: 36px; }
.dock__axis { display: flex; justify-content: space-between; font: 500 9px 'Geist Mono Variable', monospace; color: var(--mute); }
.dock__row { position: relative; display: flex; align-items: center; flex: 1; max-height: 34px; }
.dock__row .mono { position: absolute; left: -36px; font-size: 10px; color: var(--mute); }
.dock__row.is-hot .mono { color: var(--lime); }
.dock__lane { position: relative; display: block; width: 100%; height: 72%; border-radius: 6px; background: rgba(241, 239, 231, 0.04); }
.dock__lane i {
  position: absolute; top: 0; bottom: 0; border-radius: 6px;
  background: linear-gradient(180deg, rgba(241, 239, 231, 0.2), rgba(241, 239, 231, 0.12));
  box-shadow: inset 0 0 0 1px rgba(241, 239, 231, 0.08);
  transform-origin: 0 50%;
}
.dock__lane i.hot { background: linear-gradient(180deg, rgba(171, 255, 2, 0.95), rgba(150, 230, 0, 0.85)); box-shadow: 0 0 18px -2px rgba(171, 255, 2, 0.45); }
.dock__lane i b { position: absolute; left: 7px; top: 50%; translate: 0 -50%; font: 600 9.5px 'Geist Mono Variable', monospace; color: var(--ink); white-space: nowrap; }
.dock__now {
  position: absolute; top: 14px; bottom: 0; left: calc(36px + (100% - 36px) * 0.46); width: 1px;
  background: var(--lime); transform-origin: 50% 0;
}
.dock__now .mono {
  position: absolute; top: -14px; left: 50%; translate: -50% 0;
  font-size: 9px; color: var(--ink); background: var(--lime); padding: 1px 4px; border-radius: 4px;
}

/* the trailer */
.panel--track { display: flex; }
.trl { display: flex; flex-direction: column; justify-content: space-between; width: 100%; gap: 12px; }
.trl__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.trl__head p { display: flex; flex-direction: column; gap: 3px; }
.trl__id { font-size: clamp(15px, 1.6vw, 20px); letter-spacing: 0.02em; }
.trl__sub { font-size: 11px; color: var(--mute); }
.trl__line { position: relative; height: 2px; margin: 0 8px 34px; background: rgba(241, 239, 231, 0.12); border-radius: 2px; }
.trl__fill { position: absolute; inset: 0; background: var(--lime); border-radius: 2px; transform-origin: 0 50%; box-shadow: 0 0 10px rgba(171, 255, 2, 0.5); }
.trl__stop { position: absolute; top: -5px; width: 0; }
.trl__stop::before {
  content: ''; position: absolute; left: -1px; top: 0; width: 2px; height: 12px; border-radius: 2px;
  background: rgba(241, 239, 231, 0.3); transition: background-color 0.3s;
}
.trl__stop.is-past::before { background: var(--lime); }
.trl__stop b, .trl__stop em { position: absolute; left: 0; translate: -50% 0; white-space: nowrap; font-style: normal; }
.trl__stop:first-child b, .trl__stop:first-child em { translate: -8px 0; }
.trl__stop:last-child b, .trl__stop:last-child em { translate: calc(-100% + 8px) 0; }
.trl__stop b { top: 18px; font-size: 11px; font-weight: 500; }
.trl__stop em { top: 33px; font-size: 9.5px; color: var(--mute); }

/* the numbers */
.kpis { display: flex; align-items: flex-end; gap: clamp(14px, 2.4vw, 32px); }
.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi__n { display: inline-flex; align-items: baseline; font-size: clamp(22px, 2.8vw, 36px); font-weight: 420; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi__n small { font-size: 0.45em; letter-spacing: 0; color: var(--mute); margin-left: 2px; }
.kpi__l { font-family: 'Geist Mono Variable', ui-monospace, monospace; font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--mute); }
.roll { display: inline-block; height: 1em; overflow: hidden; vertical-align: top; }
.roll__col { display: flex; flex-direction: column; }
.roll__col > span { height: 1em; line-height: 1; }
.go {
  margin-left: auto; display: inline-flex; align-items: center; gap: 8px;
  font-family: 'Geist Mono Variable', ui-monospace, monospace; font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink); background: var(--lime); padding: 10px 12px 10px 14px; border-radius: 9px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 8px 20px -8px rgba(171, 255, 2, 0.55);
}
.go svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------ the pointer of the preview */
.cursor {
  position: fixed; left: 0; top: 0; width: 22px; height: 22px; margin: -3px 0 0 -5px;
  fill: #ffffff; stroke: #052424; stroke-width: 1.3; stroke-linejoin: round;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.5));
  pointer-events: none; opacity: 0; z-index: 10;
}

/* ------------------------------------------------------------ short or narrow: fewer words, same gesture */
@media (max-height: 560px), (max-width: 640px) {
  .e-desc, .kpi--2, .go { display: none; }
  .arrivals li:last-child { display: none; }
}
@media (max-width: 640px) {
  .card__surface { border-radius: 12px; }
  .arrivals li { grid-template-columns: 1fr auto; gap: 6px; padding-left: 6px; font-size: 11px; }
  .arrivals .car, .arrivals .t { display: none; }
  .arrivals .mono { font-size: 10px; }
  .chip { font-size: 9.5px; padding: 2px 6px; }
  .dock { padding-left: 28px; }
  .dock__row .mono { left: -28px; font-size: 9px; }
  .dock__now { left: calc(28px + (100% - 28px) * 0.46); }
  .dock__lane i b { font-size: 8px; left: 4px; }
  .dock__lane i b span { display: none; }
  .dock__row:nth-child(5) { display: none; }
  .trl__stop b { font-size: 10px; }
  .trl__stop em { font-size: 8.5px; }
  .yos__nav { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
  .card__surface { transition: none; }
  .chip.swap.is-scan::after { animation: none; opacity: 0; }
}
