@font-face {
  font-family: "Space Grotesk";
  src: url("assets/space-grotesk.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/ibm-plex-mono.ttf") format("truetype");
  font-display: swap;
}

:root {
  --paper: #f4efdf;
  --paper-deep: #e6dec8;
  --ink: #171714;
  --muted: #6e6b60;
  --yellow: #f5d23e;
  --blue: #3064e8;
  --red: #ed5b46;
  --green: #49a982;
  --line: rgba(23, 23, 20, 0.28);
  --shadow: 7px 7px 0 #171714;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color-scheme: light;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(rgba(23, 23, 20, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 23, 20, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  color: var(--ink);
  font-family: "Space Grotesk", sans-serif;
  -webkit-tap-highlight-color: rgba(48, 100, 232, 0.2);
}

button,
input,
select {
  font: inherit;
  touch-action: manipulation;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 12px 16px;
  transform: translateY(-150%);
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  transition: transform 160ms ease;
}

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

.topbar {
  min-height: 72px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 0 max(28px, calc((100vw - 1320px) / 2));
  border-bottom: 2px solid var(--ink);
  background: rgba(244, 239, 223, 0.92);
}

.brand {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover .brand-mark span:nth-child(2) {
  transform: translateY(-4px);
}

.brand-mark {
  width: 34px;
  height: 28px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  padding: 4px;
  border: 2px solid var(--ink);
  background: var(--yellow);
}

.brand-mark span {
  width: 6px;
  background: var(--ink);
  transition: transform 160ms ease;
}

.brand-mark span:nth-child(1) { height: 9px; }
.brand-mark span:nth-child(2) { height: 17px; }
.brand-mark span:nth-child(3) { height: 13px; }

.brand-word {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.shift-note,
.date-stamp {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.73rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.shift-note {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(73, 169, 130, 0.2);
}

.date-stamp { justify-self: end; }

main,
footer {
  width: min(1320px, calc(100% - 56px));
  margin-inline: auto;
}

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 40px;
  min-height: 278px;
  padding: 48px 0 38px;
}

.eyebrow {
  margin: 0 0 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  scroll-margin-top: 1rem;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 900px;
  margin: 0;
  font-size: clamp(3.3rem, 6.2vw, 6.6rem);
  line-height: 0.84;
  letter-spacing: -0.075em;
  text-wrap: balance;
}

h1 em {
  color: var(--blue);
  font-style: normal;
}

.depot-sign {
  width: 156px;
  height: 184px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 13px;
  transform: rotate(2.5deg);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow);
  background: var(--yellow);
  font-family: "IBM Plex Mono", monospace;
  text-align: center;
  text-transform: uppercase;
}

.depot-sign span {
  padding-bottom: 8px;
  border-bottom: 2px solid var(--ink);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
}

.depot-sign strong {
  align-self: center;
  font-family: "Space Grotesk", sans-serif;
  font-size: 4.4rem;
  line-height: 1;
}

.depot-sign small {
  font-size: 0.55rem;
  font-weight: 700;
}

.control-deck {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(200px, 0.42fr) 150px;
  gap: 20px;
  padding: 22px;
  border: 2px solid var(--ink);
  box-shadow: var(--shadow);
  background: var(--ink);
  color: #fff;
}

.search-wrap > label,
.filter-wrap > label,
.detail-select-wrap label {
  display: block;
  margin-bottom: 8px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.input-shell,
.select-shell {
  height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 2px solid transparent;
  background: var(--paper);
  color: var(--ink);
}

.input-shell:focus-within,
.select-shell:focus-within {
  border-color: var(--yellow);
  box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--yellow);
}

.input-shell input,
.select-shell select {
  min-width: 0;
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 650;
}

.input-shell input::placeholder { color: #777368; }

.input-shell kbd {
  padding: 2px 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
}

.select-shell select {
  appearance: none;
  background-color: var(--paper);
}

.manifest-readout {
  display: grid;
  grid-template-columns: 1fr auto;
  align-content: center;
  padding-left: 20px;
  border-left: 1px solid rgba(255, 255, 255, 0.35);
  font-family: "IBM Plex Mono", monospace;
  text-transform: uppercase;
}

.manifest-readout span,
.manifest-readout small {
  font-size: 0.58rem;
  letter-spacing: 0.08em;
}

.manifest-readout strong {
  grid-row: span 2;
  font-family: "Space Grotesk", sans-serif;
  font-size: 3.2rem;
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
}

.route-board { padding: 64px 0 80px; }

.route-heading-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.route-heading-row h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.7rem);
  letter-spacing: -0.055em;
  line-height: 0.95;
  text-wrap: balance;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid var(--ink);
  background: rgba(255, 255, 255, 0.3);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
}

.legend-item::before {
  width: 8px;
  height: 8px;
  content: "";
  border-radius: 50%;
  background: var(--status-color);
}

.belt {
  height: 24px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 13%;
  align-items: center;
  margin-top: 26px;
  overflow: hidden;
  border: 2px solid var(--ink);
  background: var(--ink);
}

.belt span {
  width: 34px;
  height: 34px;
  transform: rotate(45deg);
  border: 7px solid var(--paper);
  opacity: 0.35;
}

.task-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  padding-top: 18px;
}

.task-ticket {
  --status-color: var(--yellow);
  position: relative;
  min-width: 0;
  min-height: 225px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 20px;
  overflow: hidden;
  border: 2px solid var(--ink);
  background: #fffdf5;
  box-shadow: 4px 4px 0 rgba(23, 23, 20, 0.85);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.task-ticket::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 7px;
  content: "";
  background: var(--status-color);
}

.task-ticket:hover,
.task-ticket:focus-within {
  z-index: 2;
  transform: translate(-2px, -3px) rotate(-0.25deg);
  box-shadow: 8px 9px 0 var(--ink);
}

.task-ticket:nth-child(3n + 2) { transform: translateY(7px) rotate(0.3deg); }
.task-ticket:nth-child(3n + 2):hover,
.task-ticket:nth-child(3n + 2):focus-within { transform: translate(-2px, 3px) rotate(0deg); }

.ticket-top,
.ticket-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ticket-id,
.ticket-due,
.project-label,
.assignee {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ticket-id { color: var(--muted); }

.priority {
  padding: 4px 7px;
  border: 1px solid var(--ink);
  background: var(--priority-color, var(--paper));
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.57rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ticket-main {
  min-width: 0;
  padding: 22px 0 18px;
}

.project-label {
  margin: 0 0 8px;
  color: var(--status-color);
  filter: saturate(1.35) brightness(0.78);
}

.ticket-main h3 {
  margin: 0;
  font-size: clamp(1.12rem, 1.65vw, 1.55rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.assignee {
  max-width: 48%;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.open-task {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  transition: background-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.open-task:hover {
  transform: translateX(2px);
  background: var(--ink);
  color: #fff;
}

.empty-state {
  max-width: 650px;
  margin: 28px auto 0;
  padding: 44px;
  border: 2px dashed var(--ink);
  text-align: center;
}

.empty-state[hidden] { display: none; }
.empty-icon { font-size: 3rem; }
.empty-state h2 { margin: 8px 0; font-size: 2rem; letter-spacing: -0.04em; text-wrap: balance; }
.empty-state > p:not(.eyebrow) { max-width: 480px; margin: 0 auto 22px; color: var(--muted); }
.empty-state button {
  padding: 12px 17px;
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  background: var(--yellow);
  font-weight: 800;
}
.empty-state button:hover { background: #ffe876; }

footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 0 calc(24px + env(safe-area-inset-bottom));
  border-top: 2px solid var(--ink);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
}

.inspection-dialog {
  width: min(620px, 100%);
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0 0 0 auto;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: -12px 0 0 rgba(23, 23, 20, 0.18);
  overscroll-behavior: contain;
}

.inspection-dialog[open] { animation: slide-in 230ms cubic-bezier(0.2, 0.7, 0.2, 1); }

.inspection-dialog::backdrop {
  background: rgba(23, 23, 20, 0.58);
  backdrop-filter: blur(3px);
}

@keyframes slide-in {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.detail-card {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 22px;
  border-bottom: 2px solid var(--ink);
  background: var(--ink);
  color: #fff;
}

.detail-kicker,
.detail-project {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.65rem;
  text-transform: uppercase;
}

.detail-project { margin-top: 4px; color: #c8c5bc; }

.close-button {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border: 1px solid #fff;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font-size: 1.7rem;
  line-height: 1;
  transition: background-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.close-button:hover { transform: rotate(6deg); background: #fff; color: var(--ink); }

.detail-scroll {
  position: relative;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 42px 42px calc(52px + env(safe-area-inset-bottom));
}

.status-stamp {
  position: absolute;
  top: 30px;
  right: 30px;
  padding: 9px 12px;
  transform: rotate(5deg);
  border: 3px double var(--ink);
  background: var(--status-color);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
}

.detail-scroll > h2 {
  max-width: 470px;
  margin: 44px 0 32px;
  padding-right: 40px;
  font-size: clamp(2.35rem, 5vw, 4.2rem);
  line-height: 0.93;
  letter-spacing: -0.065em;
  text-wrap: balance;
}

.detail-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0;
  border-top: 1px solid var(--ink);
  border-left: 1px solid var(--ink);
}

.detail-facts div {
  min-width: 0;
  padding: 14px;
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.detail-facts dt {
  margin-bottom: 5px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.detail-facts dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }

.route-control {
  display: grid;
  grid-template-columns: 1fr 190px;
  gap: 18px;
  align-items: end;
  margin-top: 24px;
  padding: 22px;
  border: 2px solid var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
  background: var(--status-color);
  transition: background-color 180ms ease;
}

.route-control h3,
.detail-body h3 { margin: 0; font-size: 1.3rem; letter-spacing: -0.03em; }

.detail-select-wrap select {
  width: 100%;
  height: 44px;
  padding: 0 32px 0 11px;
  border: 2px solid var(--ink);
  border-radius: 0;
  background-color: #fffdf5;
  color: var(--ink);
  font-weight: 700;
}

.route-feedback {
  grid-column: 1 / -1;
  min-height: 1.25em;
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
}

.detail-body {
  margin-top: 42px;
  padding-top: 22px;
  border-top: 2px solid var(--ink);
}

.detail-body #detail-body { margin-top: 18px; font-size: 1.04rem; line-height: 1.65; }
.detail-body #detail-body p { margin: 0 0 1em; }
.detail-body #detail-body p:last-child { margin-bottom: 0; font-weight: 650; }

.tag-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.tag {
  padding: 6px 9px;
  border: 1px solid var(--ink);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
}

.toast {
  position: fixed;
  z-index: 90;
  right: 24px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  max-width: min(390px, calc(100% - 32px));
  padding: 14px 18px;
  transform: translateY(140%);
  border: 2px solid var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
  background: var(--yellow);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  opacity: 0;
  transition: transform 180ms ease, opacity 180ms ease;
}

.toast.is-visible { transform: translateY(0); opacity: 1; }

@media (max-width: 900px) {
  .task-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .control-deck { grid-template-columns: 1fr 1fr; }
  .manifest-readout { grid-column: 1 / -1; padding: 14px 0 0; border-top: 1px solid rgba(255,255,255,.35); border-left: 0; }
  .manifest-readout strong { grid-column: 2; grid-row: span 2; }
}

@media (max-width: 620px) {
  .topbar {
    min-height: 58px;
    grid-template-columns: 1fr auto;
    padding: 0 18px;
  }
  .shift-note { display: none; }
  .date-stamp { font-size: 0.58rem; }
  .brand-word { font-size: 0.9rem; }
  .brand-mark { width: 30px; height: 25px; }
  main,
  footer { width: min(100% - 32px, 1320px); }
  .hero { min-height: 234px; padding: 36px 0 28px; gap: 10px; }
  h1 { font-size: clamp(2.65rem, 13vw, 4rem); }
  .depot-sign { width: 74px; height: 106px; padding: 7px; box-shadow: 4px 4px 0 var(--ink); }
  .depot-sign span { font-size: 0.52rem; }
  .depot-sign strong { font-size: 2.6rem; }
  .depot-sign small { display: none; }
  .control-deck { grid-template-columns: 1fr; gap: 15px; padding: 15px; box-shadow: 5px 5px 0 var(--ink); }
  .input-shell,
  .select-shell { height: 48px; }
  .manifest-readout { grid-column: auto; padding-top: 10px; }
  .manifest-readout strong { font-size: 2.5rem; }
  .route-board { padding: 46px 0 54px; }
  .route-heading-row { align-items: flex-start; flex-direction: column; gap: 20px; }
  .legend { justify-content: flex-start; }
  .legend-item { font-size: 0.54rem; padding: 5px 7px; }
  .belt { margin-top: 20px; }
  .task-grid { grid-template-columns: 1fr; gap: 14px; }
  .task-ticket,
  .task-ticket:nth-child(3n + 2) { min-height: 195px; transform: none; }
  .task-ticket:hover,
  .task-ticket:focus-within,
  .task-ticket:nth-child(3n + 2):hover,
  .task-ticket:nth-child(3n + 2):focus-within { transform: translateY(-2px); }
  .ticket-main h3 { font-size: 1.35rem; }
  footer { flex-direction: column; gap: 5px; }
  footer p { margin: 0; }
  .inspection-dialog { width: 100%; }
  .inspection-dialog[open] { animation-name: rise-in; }
  @keyframes rise-in {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
  .detail-header { padding: calc(12px + env(safe-area-inset-top)) 16px 12px; }
  .detail-scroll { padding: 28px 20px calc(40px + env(safe-area-inset-bottom)); }
  .status-stamp { top: 22px; right: 20px; }
  .detail-scroll > h2 { margin: 50px 0 26px; padding-right: 0; font-size: 2.6rem; }
  .detail-facts { grid-template-columns: 1fr 1fr; }
  .route-control { grid-template-columns: 1fr; padding: 18px; }
  .route-feedback { grid-column: auto; }
  .toast { right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
