@font-face {
  font-family: "Cabin Display";
  src: url("/assets/fonts/BarlowCondensed-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Cabin Display";
  src: url("/assets/fonts/BarlowCondensed-SemiBold.ttf") format("truetype");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

:root {
  --night: #090c0a;
  --metal-black: #0f1714;
  --metal: #182621;
  --metal-lift: #21312b;
  --metal-wear: #3a443b;
  --ivory: #ddd4ba;
  --ivory-dim: #b8b097;
  --paper: #d8ceb0;
  --paper-light: #ebe2c9;
  --paper-ink: #171a17;
  --amber: #f3a62f;
  --amber-deep: #9b5a0c;
  --red: #a83b2a;
  --red-dark: #642218;
  --seam: #6e705f;
  --shadow: rgba(0, 0, 0, 0.64);
  --display: "Cabin Display", "Arial Narrow", sans-serif;
  --measure: ui-monospace, "SFMono-Regular", "Cascadia Mono", "Roboto Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--night);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100svh;
  margin: 0;
  color: var(--ivory);
  background:
    radial-gradient(circle at 14% 16%, rgba(213, 197, 157, 0.05) 0 1px, transparent 1.5px) 0 0 / 19px 23px,
    radial-gradient(circle at 78% 63%, rgba(213, 197, 157, 0.035) 0 1px, transparent 1.5px) 0 0 / 29px 31px,
    var(--night);
  font-family: var(--measure);
  padding: clamp(0px, 1.5vw, 22px);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  color: var(--paper-ink);
  background: var(--paper-light);
  border: 2px solid var(--amber);
  transform: translateY(-160%);
  transition: transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.skip-link:focus {
  transform: translateY(0);
}

.cabin {
  position: relative;
  display: grid;
  grid-template-columns: clamp(230px, 19vw, 310px) minmax(0, 1fr);
  width: min(1540px, 100%);
  min-height: calc(100svh - clamp(0px, 3vw, 44px));
  margin: 0 auto;
  overflow: hidden;
  background:
    linear-gradient(110deg, rgba(255, 255, 255, 0.018), transparent 24%, rgba(255, 255, 255, 0.012) 58%, transparent),
    var(--metal);
  border: 1px solid #4b5549;
  box-shadow:
    0 22px 55px var(--shadow),
    inset 0 0 0 5px #0b110f,
    inset 0 0 0 7px #4b5247;
}

.cabin::before,
.cabin::after {
  position: absolute;
  z-index: 10;
  width: 9px;
  height: 9px;
  content: "";
  pointer-events: none;
  background: #101713;
  border: 1px solid #7b7966;
  border-radius: 50%;
  box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.1), 2px 3px 5px rgba(0, 0, 0, 0.5);
}

.cabin::before {
  top: 12px;
  left: 12px;
}

.cabin::after {
  right: 12px;
  bottom: 12px;
}

.status-tower {
  position: relative;
  display: flex;
  min-height: 100%;
  flex-direction: column;
  align-items: center;
  padding: clamp(36px, 5vh, 62px) clamp(20px, 2.5vw, 34px) 28px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.015), transparent 16%, transparent 84%, rgba(0, 0, 0, 0.18)),
    var(--metal-black);
  border-right: 1px solid var(--seam);
  box-shadow: inset -9px 0 22px rgba(0, 0, 0, 0.26);
}

.status-tower::before {
  position: absolute;
  inset: 12px;
  content: "";
  pointer-events: none;
  border: 1px solid #3b473f;
}

.identity {
  position: relative;
  z-index: 1;
  width: 100%;
  color: var(--ivory);
  font-family: var(--display);
  font-size: clamp(3.2rem, 5vw, 4.8rem);
  font-weight: 400;
  letter-spacing: 0.09em;
  line-height: 0.86;
  text-align: center;
  text-transform: uppercase;
}

.identity span {
  display: block;
}

.identity span + span {
  margin-top: 0.12em;
}

.identity::after {
  display: block;
  width: 44%;
  height: 1px;
  margin: 25px auto 0;
  content: "";
  background: var(--seam);
}

.line-state {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  margin-top: clamp(34px, 5vh, 60px);
}

.signal-lamp {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  background: #121a16;
  border: 7px solid #0a0e0c;
  border-radius: 50%;
  box-shadow:
    3px 6px 15px rgba(0, 0, 0, 0.68),
    inset 0 0 0 2px #656552;
}

.signal-lamp span {
  width: 45px;
  height: 45px;
  background: radial-gradient(circle at 42% 36%, #ffe9aa 0 6%, #ffc45b 18%, var(--amber) 46%, var(--amber-deep) 76%, #311b05 100%);
  border: 1px solid #ffca66;
  border-radius: 50%;
  box-shadow:
    2px 4px 15px rgba(242, 163, 45, 0.5),
    inset -3px -5px 9px rgba(65, 29, 0, 0.66);
  animation: lamp-breathe 5.8s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

.state-word {
  margin-top: 13px;
  color: #ffbd53;
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-shadow: 1px 2px 5px rgba(126, 64, 0, 0.7);
}

.status-plates {
  position: relative;
  z-index: 1;
  display: grid;
  width: 100%;
  gap: 11px;
  margin: clamp(26px, 4vh, 42px) 0 0;
}

.status-plates div {
  color: var(--paper-ink);
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.24), transparent 35%),
    var(--paper);
  border: 1px solid #827a65;
  border-radius: 3px;
  box-shadow:
    2px 4px 10px rgba(0, 0, 0, 0.42),
    inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  padding: 8px 11px 7px;
  text-align: center;
  text-transform: uppercase;
}

.status-plates dt {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.status-plates dd {
  margin: 0;
  font-family: var(--display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.lever {
  position: relative;
  z-index: 1;
  width: min(150px, 70%);
  height: auto;
  margin-top: auto;
  color: #111a16;
  filter: drop-shadow(4px 7px 7px rgba(0, 0, 0, 0.48));
}

.lever-ring {
  stroke: #5a6458;
}

.lever-ring-inner {
  stroke: #2e3932;
}

.lever-bolt,
.lever-pin {
  fill: #151e1a;
  stroke: #737765;
}

.lever-arm-shadow {
  stroke: var(--red-dark);
}

.lever-arm,
.lever-handle {
  fill: rgba(168, 59, 42, 0.16);
  stroke: var(--red);
}

.lever-chain {
  stroke: #777867;
}

.tower-note {
  position: relative;
  z-index: 1;
  margin: 8px 0 0;
  color: var(--ivory-dim);
  font-family: var(--display);
  font-size: 0.78rem;
  letter-spacing: 0.09em;
  line-height: 1.45;
  text-align: center;
  text-transform: uppercase;
}

.main-panel {
  display: grid;
  min-width: 0;
  grid-template-rows: auto auto minmax(185px, auto) auto 1fr;
  padding: clamp(28px, 4vw, 58px) clamp(26px, 5vw, 76px) 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 11px;
  color: var(--ivory-dim);
  border-bottom: 1px solid var(--seam);
  font-family: var(--display);
  font-size: 0.88rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.panel-header p {
  margin: 0;
}

.main-panel > h1 {
  max-width: none;
  margin: clamp(24px, 4vh, 44px) 0 clamp(22px, 3vh, 34px);
  color: var(--ivory);
  font-family: var(--display);
  font-size: clamp(6.5rem, 11vw, 10rem);
  font-weight: 400;
  letter-spacing: -0.005em;
  line-height: 0.74;
  text-wrap: balance;
  text-transform: uppercase;
}

.main-panel > h1 span {
  display: block;
}

.main-panel > h1 span + span {
  margin-top: 0.13em;
}

.transmission {
  position: relative;
  align-self: end;
  color: var(--paper-ink);
  background:
    linear-gradient(90deg, rgba(73, 62, 38, 0.06) 1px, transparent 1px) 0 0 / 24px 100%,
    linear-gradient(rgba(73, 62, 38, 0.055) 1px, transparent 1px) 0 0 / 100% 24px,
    linear-gradient(105deg, transparent 0 68%, rgba(255, 255, 255, 0.16) 69%, transparent 78%),
    var(--paper);
  border: 1px solid #766f5d;
  box-shadow:
    3px 7px 18px rgba(0, 0, 0, 0.4),
    inset 0 0 22px rgba(91, 68, 30, 0.13);
  padding: 17px clamp(26px, 4vw, 54px) 18px;
}

.tape-edge {
  position: absolute;
  right: 0;
  left: 0;
  height: 10px;
  pointer-events: none;
  background: radial-gradient(circle, var(--metal) 0 3px, transparent 3.5px) 3px 50% / 22px 10px repeat-x;
}

.tape-edge-top {
  top: -5px;
}

.tape-edge-bottom {
  bottom: -5px;
}

.transmission-head {
  display: flex;
  gap: 20px;
  align-items: end;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(23, 26, 23, 0.55);
}

.transmission-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
}

.transmission-head dl {
  display: flex;
  gap: clamp(18px, 3vw, 48px);
  margin: 0;
}

.transmission-head dl div {
  display: grid;
  gap: 3px;
}

.transmission-head dt,
.transmission-head dd,
.transmission-foot {
  font-family: var(--display);
  text-transform: uppercase;
}

.transmission-head dt {
  font-size: 0.67rem;
  letter-spacing: 0.12em;
}

.transmission-head dd {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.07em;
}

.message {
  max-width: 69ch;
  margin: clamp(19px, 3vh, 30px) 0;
  font-size: clamp(1rem, 1.35vw, 1.24rem);
  letter-spacing: -0.018em;
  line-height: 1.55;
}

.message span {
  display: block;
}

.transmission-foot {
  display: flex;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid rgba(23, 26, 23, 0.55);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.receipt {
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  padding: clamp(22px, 3vh, 32px) 0;
  border-bottom: 1px solid var(--seam);
}

.receipt h2 {
  margin: 0 0 5px;
  color: var(--ivory-dim);
  font-family: var(--display);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.receipt p {
  margin: 0;
  color: var(--ivory);
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: 0.045em;
}

.acknowledge {
  display: inline-flex;
  min-height: 48px;
  flex: 0 0 auto;
  gap: 11px;
  align-items: center;
  color: var(--paper-ink);
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.27), transparent 32%),
    var(--paper);
  border: 1px solid #8d856d;
  border-radius: 999px;
  box-shadow:
    2px 5px 13px rgba(0, 0, 0, 0.42),
    inset 0 0 0 2px rgba(54, 49, 38, 0.13);
  cursor: pointer;
  font-family: var(--display);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  padding: 9px 15px 9px 11px;
  text-transform: uppercase;
  transition:
    transform 180ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 180ms cubic-bezier(0.16, 1, 0.3, 1),
    background-color 180ms ease;
}

.acknowledge:hover {
  transform: translateY(-2px);
  box-shadow:
    3px 8px 17px rgba(0, 0, 0, 0.5),
    inset 0 0 0 2px rgba(54, 49, 38, 0.13);
}

.acknowledge:active {
  transform: translateY(1px);
  box-shadow:
    1px 3px 8px rgba(0, 0, 0, 0.5),
    inset 0 0 0 2px rgba(54, 49, 38, 0.18);
}

.acknowledge:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 4px;
}

.button-lamp {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  background: #342d20;
  border: 4px solid #1a1c17;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px #7e755e;
  transition:
    background-color 220ms ease,
    box-shadow 220ms ease;
}

.acknowledge svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-width: 1.8;
}

.acknowledge[aria-pressed="true"] .button-lamp {
  background: var(--amber);
  box-shadow:
    1px 3px 9px rgba(120, 64, 0, 0.48),
    inset 0 0 0 1px #ffcf78;
}

.acknowledge[aria-pressed="true"] svg {
  transform: rotate(180deg);
}

.operating-footer {
  display: grid;
  align-self: end;
  margin-top: clamp(32px, 5vh, 66px);
  border-top: 1px solid var(--seam);
}

.operating-data {
  display: grid;
  grid-template-columns: 0.75fr 1.8fr 0.8fr 0.6fr;
  margin: 0;
}

.operating-data div {
  min-width: 0;
  padding: 15px 18px 14px 0;
}

.operating-data div + div {
  border-left: 1px solid var(--seam);
  padding-left: 18px;
}

.operating-data dt,
.archive > span:first-child {
  margin-bottom: 5px;
  color: var(--ivory-dim);
  font-family: var(--display);
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.operating-data dd {
  margin: 0;
  overflow: hidden;
  font-family: var(--display);
  font-size: clamp(0.95rem, 1.5vw, 1.22rem);
  letter-spacing: 0.07em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.archive {
  display: flex;
  min-height: 58px;
  gap: 18px;
  align-items: center;
  border-top: 1px solid var(--seam);
  font-family: var(--display);
  text-transform: uppercase;
}

.archive > span:first-child {
  margin: 0 auto 0 0;
}

.archive a {
  display: grid;
  width: 34px;
  height: 30px;
  place-items: center;
  color: var(--paper-ink);
  background: var(--paper);
  border-radius: 2px;
  font-weight: 600;
  text-decoration: none;
}

.archive a:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
}

.end-of-line {
  color: var(--ivory-dim);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
}

@keyframes lamp-breathe {
  0%, 100% {
    filter: brightness(0.9);
    box-shadow:
      2px 4px 12px rgba(242, 163, 45, 0.38),
      inset -3px -5px 9px rgba(65, 29, 0, 0.66);
  }
  50% {
    filter: brightness(1.12);
    box-shadow:
      3px 6px 20px rgba(242, 163, 45, 0.58),
      inset -3px -5px 9px rgba(65, 29, 0, 0.58);
  }
}

@media (max-width: 900px) {
  body {
    padding: 0;
  }

  .cabin {
    grid-template-columns: 1fr;
    min-height: 100svh;
    border-right: 0;
    border-left: 0;
  }

  .status-tower {
    display: grid;
    min-height: auto;
    grid-template-columns: auto auto minmax(0, 1fr);
    gap: 22px;
    align-items: center;
    padding: 28px 30px;
    border-right: 0;
    border-bottom: 1px solid var(--seam);
    box-shadow: inset 0 -8px 18px rgba(0, 0, 0, 0.2);
  }

  .status-tower::before {
    inset: 10px;
  }

  .identity {
    width: auto;
    font-size: 2.8rem;
    text-align: left;
  }

  .identity span {
    display: inline;
  }

  .identity span + span {
    margin: 0 0 0 0.15em;
  }

  .identity::after,
  .lever,
  .tower-note {
    display: none;
  }

  .line-state {
    margin: 0;
  }

  .signal-lamp {
    width: 52px;
    height: 52px;
    border-width: 5px;
  }

  .signal-lamp span {
    width: 32px;
    height: 32px;
  }

  .state-word {
    margin-top: 7px;
    font-size: 1rem;
  }

  .status-plates {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    margin: 0;
  }

  .status-plates dd {
    overflow: hidden;
    font-size: 0.82rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .main-panel {
    min-height: calc(100svh - 135px);
  }
}

@media (max-width: 620px) {
  .status-tower {
    grid-template-columns: 1fr auto;
    gap: 18px 14px;
    padding: 24px 22px 20px;
  }

  .identity {
    font-size: 2.35rem;
  }

  .line-state {
    grid-column: 2;
    grid-row: 1;
  }

  .signal-lamp {
    width: 43px;
    height: 43px;
  }

  .signal-lamp span {
    width: 27px;
    height: 27px;
  }

  .state-word {
    font-size: 0.82rem;
  }

  .status-plates {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .status-plates div {
    padding: 7px 5px 6px;
  }

  .status-plates dd {
    font-size: 0.7rem;
    letter-spacing: 0.075em;
  }

  .main-panel {
    display: block;
    padding: 24px 20px 0;
  }

  .panel-header {
    gap: 16px;
    font-size: 0.68rem;
  }

  .panel-header p:last-child {
    text-align: right;
  }

  .main-panel > h1 {
    max-width: none;
    margin: 44px 0 36px;
    font-size: clamp(3.4rem, 18vw, 5rem);
    line-height: 0.82;
  }

  .transmission {
    padding: 18px 24px;
  }

  .transmission-head {
    display: grid;
    gap: 14px;
  }

  .transmission-head dl {
    width: 100%;
    justify-content: space-between;
  }

  .message {
    margin: 22px 0;
    font-size: 0.98rem;
    line-height: 1.58;
  }

  .message span {
    margin-top: 0.8em;
  }

  .transmission-foot {
    display: grid;
    gap: 5px;
  }

  .receipt {
    display: grid;
    padding: 28px 0;
  }

  .acknowledge {
    justify-self: start;
  }

  .operating-footer {
    margin-top: 34px;
  }

  .operating-data {
    grid-template-columns: 1fr 1.5fr;
  }

  .operating-data div {
    border-bottom: 1px solid var(--seam);
    padding: 14px 12px 14px 0;
  }

  .operating-data div + div {
    padding-left: 12px;
  }

  .operating-data div:nth-child(3) {
    border-left: 0;
  }

  .operating-data dd {
    font-size: 0.92rem;
  }

  .archive {
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 0 18px;
  }

  .archive > span:first-child {
    width: 100%;
    flex-basis: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
