@font-face { font-family: "Oswald"; src: url("assets/oswald.ttf") format("truetype"); font-weight: 200 700; font-display: swap; }
@font-face { font-family: "Work Sans"; src: url("assets/work-sans.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("assets/ibm-plex-mono.ttf") format("truetype"); font-weight: 400; font-display: swap; }

:root {
  --yellow: #f4c430;
  --yellow-deep: #d9a800;
  --navy: #13213c;
  --navy-deep: #0a1426;
  --navy-line: #2a3a5c;
  --cream: #f5f0e1;
  --ink: #101828;
  --muted: #4a5470;
  --muted-on-navy: #a9b4cf;

  --t-todo: #f5f0e1;
  --t-in-progress: #ffc83d;
  --t-blocked: #ff8a80;
  --t-done: #7be0ae;

  --p-todo: #13213c;
  --p-in-progress: #7a5000;
  --p-blocked: #b3261e;
  --p-done: #17794f;

  --display: "Oswald", "Arial Narrow", Impact, sans-serif;
  --text: "Work Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --flap: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;

  --tw: 15px; --th: 25px; --tf: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html:has(dialog[open]) { overflow: hidden; }
body {
  margin: 0;
  background: var(--yellow);
  color: var(--ink);
  font: 400 16px/1.5 var(--text);
  min-height: 100vh;
}
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--navy); outline-offset: 3px; }
.board :focus-visible, .sign :focus-visible, .toast :focus-visible, .stub :focus-visible { outline-color: var(--yellow); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.skip { position: absolute; left: 12px; top: -60px; background: var(--navy); color: var(--yellow); padding: 8px 14px; z-index: 50; border-radius: 4px; }
.skip:focus { top: 12px; }

/* ---------- sign ---------- */
.sign {
  background: var(--navy);
  color: var(--cream);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 40px;
  padding: 22px clamp(16px, 4vw, 56px);
  border-bottom: 8px solid var(--navy-deep);
  box-shadow: 0 6px 0 var(--ink);
}
.brand { display: flex; align-items: center; gap: 18px; min-width: 0; }
.plane { width: 56px; height: 56px; color: var(--yellow); flex: none; transform: rotate(-6deg); }
h1 {
  margin: 0; font: 600 clamp(40px, 6vw, 68px)/0.95 var(--display);
  letter-spacing: 0.02em; color: var(--yellow);
}
.tagline { margin: 6px 0 0; color: var(--muted-on-navy); font-size: 15px; max-width: 34ch; }

.gates { display: flex; flex-wrap: wrap; gap: 10px; }
.gate {
  appearance: none; cursor: pointer;
  display: grid; grid-template-columns: auto auto; align-items: center; gap: 4px 10px;
  background: var(--navy-deep); border: 2px solid var(--navy-line); border-radius: 6px;
  padding: 8px 12px 8px 10px; color: var(--cream); text-align: left;
  min-height: 48px;
}
.gate:hover { border-color: var(--cream); }
.gate[aria-pressed="true"] { background: var(--yellow); color: var(--ink); border-color: var(--yellow); }
.gate[aria-pressed="true"] .tile { background: var(--ink); }
.gate .g-name { font: 500 15px/1.1 var(--display); letter-spacing: 0.04em; }
.gate .flaps { --tw: 13px; --th: 22px; --tf: 14px; }

/* ---------- controls ---------- */
main { padding: 28px clamp(16px, 4vw, 56px) 64px; max-width: 1560px; margin: 0 auto; }
.controls { display: flex; flex-wrap: wrap; align-items: end; gap: 16px 20px; margin-bottom: 22px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 200px; }
.field.grow { flex: 1 1 320px; max-width: 560px; }
.field label { font: 500 17px/1.1 var(--display); letter-spacing: 0.03em; }
input[type="search"], #filter {
  height: 52px; border: 3px solid var(--navy); border-radius: 6px; background: var(--cream);
  padding: 0 14px; font-size: 17px; width: 100%;
}
#filter, #status-control {
  appearance: none; -webkit-appearance: none; padding-right: 44px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 6l5 5 5-5' fill='none' stroke='%2313213c' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 16px;
}
input[type="search"]::placeholder { color: #6b7391; }
.count { margin: 0 0 14px; font-weight: 600; margin-left: auto; }

/* ---------- board ---------- */
.board {
  background: var(--navy); color: var(--cream); border-radius: 10px;
  border: 4px solid var(--navy-deep); box-shadow: 0 8px 0 var(--ink);
  overflow: hidden;
}
.board-head, .row {
  display: grid; grid-template-columns: 112px minmax(0, 1fr) 96px 130px 196px; column-gap: 20px; align-items: center;
}
.board-head {
  padding: 12px 22px; background: var(--navy-deep);
  font: 500 15px/1 var(--display); letter-spacing: 0.06em; color: var(--yellow);
}
.list { list-style: none; margin: 0; padding: 0; }
.row { position: relative; padding: 12px 22px; border-top: 2px solid var(--navy-line); }
.row:hover { background: #1b2d52; }
.row::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: transparent; }
.row:hover::before { background: var(--yellow); }
.title-cell { min-width: 0; }
.open {
  appearance: none; background: none; border: 0; padding: 0; margin: 0; text-align: left; cursor: pointer;
  font: 500 19px/1.25 var(--text); color: var(--cream);
}
.open::after { content: ""; position: absolute; inset: 0; }
.open:focus-visible { outline: none; }
.row:has(.open:focus-visible) { outline: 3px solid var(--yellow); outline-offset: -3px; background: #1b2d52; }
.sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 4px; font-size: 14px; color: var(--muted-on-navy); }
.sub .tag { border: 1px solid var(--navy-line); border-radius: 99px; padding: 0 8px; line-height: 1.5; }
.owner { font-size: 15px; }
.prio { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.meter { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.meter i { width: 5px; background: var(--navy-line); display: block; }
.meter i:nth-child(1) { height: 5px; } .meter i:nth-child(2) { height: 9px; } .meter i:nth-child(3) { height: 14px; }
.meter i.on { background: var(--yellow); }

/* split-flap tiles: characters live in data-c so text content stays clean */
.flaps { display: inline-flex; gap: 2px; vertical-align: middle; }
.tile {
  position: relative; display: inline-block; width: var(--tw); height: var(--th);
  background: linear-gradient(#10192e 0 49%, #060c1a 51% 100%); border-radius: 3px;
  color: var(--cream); font: 400 var(--tf)/var(--th) var(--flap); text-align: center;
  transform-origin: 50% 50%;
}
.tile::before { content: attr(data-c); }
.tile::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgba(0,0,0,.75); }
.blank::before { content: ""; }
[data-status="todo"] .tile { color: var(--t-todo); }
[data-status="in-progress"] .tile { color: var(--t-in-progress); }
[data-status="blocked"] .tile { color: var(--t-blocked); }
[data-status="done"] .tile { color: var(--t-done); }
.due .tile, .gate .tile { color: var(--cream); }
.gate[aria-pressed="true"] .tile { color: var(--yellow); }
.gate[aria-pressed="true"] .tile::after { background: rgba(0,0,0,.9); }
.flaps.big { --tw: 22px; --th: 36px; --tf: 24px; flex-wrap: nowrap; }

/* ---------- empty ---------- */
.empty { padding: 56px 24px 60px; text-align: center; }
.empty-mark { width: 72px; color: var(--yellow); }
.empty h2 { margin: 10px 0 4px; font: 600 34px/1.1 var(--display); color: var(--yellow); }
.empty p { margin: 0 auto 22px; max-width: 46ch; color: var(--muted-on-navy); }
.btn {
  appearance: none; cursor: pointer; min-height: 48px; padding: 0 22px;
  background: var(--yellow); color: var(--ink); border: 0; border-radius: 6px;
  font: 600 18px/1 var(--display); letter-spacing: 0.04em;
}
.btn:hover { background: #ffd65c; }

/* ---------- dialog / boarding pass ---------- */
dialog {
  border: 0; padding: 0; background: transparent; color: var(--ink);
  width: min(940px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 32px);
  overflow: visible; filter: drop-shadow(0 10px 0 rgba(10,20,38,.55));
}
dialog::backdrop { background: rgba(10, 20, 38, .72); }
dialog[open] .pass { animation: land .28s cubic-bezier(.2,.9,.3,1.2); }
@keyframes land { from { transform: translateY(28px) rotate(-1.5deg); opacity: 0; } to { transform: none; opacity: 1; } }

.pass {
  --cut: calc(100% - 300px);
  display: grid; grid-template-columns: minmax(0, 1fr) 300px;
  background: var(--cream); border-radius: 14px; max-height: calc(100dvh - 32px); overflow: hidden;
  -webkit-mask:
    radial-gradient(circle 15px at var(--cut) 0, #0000 97%, #000),
    radial-gradient(circle 15px at var(--cut) 100%, #0000 97%, #000);
  -webkit-mask-composite: source-in;
  mask:
    radial-gradient(circle 15px at var(--cut) 0, #0000 97%, #000),
    radial-gradient(circle 15px at var(--cut) 100%, #0000 97%, #000);
  mask-composite: intersect;
}
.pass-main { display: flex; flex-direction: column; min-width: 0; overflow-y: auto; max-height: calc(100dvh - 32px); }
.pass-top {
  display: flex; align-items: center; gap: 14px; background: var(--navy); color: var(--yellow);
  padding: 8px 10px 8px 28px; font: 500 18px/1 var(--display); letter-spacing: 0.06em;
}
.pass-id { color: var(--muted-on-navy); font: 400 14px/1 var(--flap); letter-spacing: 0; flex: 1; }
.close {
  appearance: none; cursor: pointer; width: 48px; height: 48px; display: grid; place-items: center;
  background: transparent; color: var(--cream); border: 2px solid var(--navy-line); border-radius: 8px;
}
.close:hover { background: var(--yellow); color: var(--ink); border-color: var(--yellow); }
.close:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.close svg { width: 20px; height: 20px; }
.pass h2 {
  margin: 0; padding: 26px 28px 8px; font: 600 clamp(30px, 4.2vw, 46px)/1.05 var(--display);
  letter-spacing: 0.005em; color: var(--navy); text-wrap: balance;
}
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px 20px; margin: 0; padding: 14px 28px 18px; }
.facts dt { font: 500 14px/1.2 var(--display); letter-spacing: 0.05em; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 600; font-size: 16px; }
.pass-body {
  white-space: pre-line; margin: 0 28px; padding: 18px 0 6px; border-top: 3px dashed #b9b19a;
  font-size: 17px; line-height: 1.65; max-width: 62ch;
}
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 14px 28px 28px; }
.tags li { border: 2px solid var(--navy); border-radius: 99px; padding: 1px 12px; font-size: 14px; font-weight: 600; }

.stub {
  position: relative; background: #ece5d0; border-left: 3px dashed #b9b19a;
  padding: 26px 24px 24px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto;
  max-height: calc(100dvh - 32px);
}
.stub-label { margin: 0; font: 500 17px/1 var(--display); letter-spacing: 0.05em; color: var(--muted); }
.stub .flaps.big { background: var(--navy); padding: 10px; border-radius: 8px; align-self: flex-start; --tw: 18px; --tf: 22px; }
.stamp {
  align-self: flex-start; transform: rotate(-7deg); margin: 2px 0 2px 6px;
  border: 4px double currentColor; border-radius: 6px; padding: 4px 16px 2px;
  font: 600 30px/1.1 var(--display); letter-spacing: 0.06em; color: var(--p-todo); opacity: .85;
  text-transform: uppercase;
}
.stamp[data-status="in-progress"] { color: var(--p-in-progress); }
.stamp[data-status="blocked"] { color: var(--p-blocked); }
.stamp[data-status="done"] { color: var(--p-done); }
.stamp.thump { animation: thump .38s cubic-bezier(.2,.8,.2,1); }
@keyframes thump { 0% { transform: rotate(-14deg) scale(2.1); opacity: 0; } 60% { transform: rotate(-7deg) scale(.92); opacity: 1; } 100% { transform: rotate(-7deg) scale(1); opacity: .85; } }
.stub-field { display: flex; flex-direction: column; gap: 6px; }
.stub-field label { font: 500 17px/1.1 var(--display); letter-spacing: 0.03em; }
#status-control {
  height: 52px; border: 3px solid var(--navy); border-radius: 6px; background-color: var(--cream);
  padding: 0 14px; font-size: 17px; font-weight: 600; width: 100%;
}
#status-control:focus-visible { outline: 3px solid var(--navy); outline-offset: 3px; }
.stub-msg { margin: 0; min-height: 3em; font-size: 15px; font-weight: 600; line-height: 1.4; }
.stub-msg button {
  appearance: none; background: none; border: 0; padding: 4px 2px; margin-left: 6px; cursor: pointer;
  font-weight: 700; text-decoration: underline; text-underline-offset: 3px; color: var(--navy);
}
.stub-msg button:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }
.barcode { width: 100%; max-width: 220px; height: 44px; margin-top: auto; color: var(--ink); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 140%);
  background: var(--navy); color: var(--yellow); border: 3px solid var(--ink);
  padding: 12px 18px; border-radius: 8px; font-weight: 600; max-width: min(92vw, 560px);
  transition: transform .25s ease; z-index: 10; pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); }

/* ---------- tablet & mobile ---------- */
@media (max-width: 900px) {
  .board-head { display: none; }
  .row {
    grid-template-columns: auto 1fr; grid-template-areas: "due status" "title title" "meta meta";
    row-gap: 10px; padding: 16px 16px 16px 20px;
  }
  .due { grid-area: due; }
  .stat { grid-area: status; justify-self: end; }
  .title-cell { grid-area: title; }
  .row > .owner, .row > .prio { grid-area: meta; }
  .row > .prio { justify-self: end; }
  .open { font-size: 19px; }
  .controls { align-items: stretch; }
  .count { margin: 0; }
}
@media (max-width: 600px) {
  :root { --tw: 13px; --th: 22px; --tf: 14px; }
  .sign { padding-top: 18px; padding-bottom: 18px; gap: 16px; }
  .plane { width: 40px; height: 40px; }
  .gates { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .gate { padding: 6px 10px; }
  .field, .field.grow { min-width: 0; flex: 1 1 100%; max-width: none; }
  main { padding-top: 20px; }

  dialog { width: 100vw; max-height: 100dvh; height: 100dvh; margin: 0; filter: none; }
  .pass {
    --cut: 0; grid-template-columns: 1fr; grid-template-rows: auto auto; align-content: start; border-radius: 0;
    max-height: 100dvh; height: 100dvh; overflow-y: auto; -webkit-mask: none; mask: none;
  }
  .pass-main { max-height: none; overflow: visible; }
  .stub { max-height: none; overflow: visible; border-left: 0; border-top: 3px dashed #b9b19a; padding-bottom: 32px; }
  .pass-top { position: sticky; top: 0; z-index: 2; padding-left: 20px; }
  .pass h2 { padding: 20px 20px 6px; }
  .facts, .tags { padding-left: 20px; padding-right: 20px; }
  .pass-body { margin: 0 20px; }
  .barcode { margin-top: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  dialog[open] .pass, .stamp.thump { animation: none; }
  .toast { transition: none; }
}
