/* ---------- tokens ---------- */
:root {
  --bg: #0b0e10;
  --surface: #12181a;
  --surface-raised: #161d20;
  --line: rgba(243, 241, 234, 0.14);
  --line-strong: rgba(243, 241, 234, 0.3);
  --ink: #f3f1ea;
  --muted: #9aa6a1;
  --accent: #f5a623;
  --accent-ink: #1a1204;
  --free: #7cc99a;
  --paper: #ece5d4;
  --paper-ink: #201a10;

  --font-display: Futura, "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  --font-body: -apple-system, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  --sp-4: 4px;
  --sp-8: 8px;
  --sp-12: 12px;
  --sp-16: 16px;
  --sp-24: 24px;
  --sp-32: 32px;
  --sp-48: 48px;
  --sp-64: 64px;
  --sp-96: 96px;
  --sp-128: 128px;

  --radius-sm: 4px;
  --radius-md: 10px;
  --radius-lg: 18px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  overflow-x: clip;
}

h1, h2, h3 { font-family: var(--font-display); margin: 0; }
p { margin: 0; }
a { color: inherit; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: var(--sp-12) var(--sp-16);
  font-weight: 700;
  z-index: 100;
}
.skip-link:focus-visible {
  left: var(--sp-16);
  top: var(--sp-16);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- header / hero ---------- */
.board-header {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.board-header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-16);
  padding: var(--sp-16) var(--sp-32);
  max-width: 1280px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: var(--sp-8);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.02em;
}
.brand__mark { color: var(--accent); }

.board-nav {
  display: flex;
  gap: var(--sp-8);
  overflow-x: auto;
  max-width: 100%;
  padding-inline-end: var(--sp-24);
  scrollbar-width: thin;
}
.board-nav a {
  display: flex;
  align-items: center;
  white-space: nowrap;
  padding: var(--sp-12) var(--sp-16);
  min-height: 44px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: var(--radius-sm);
  color: var(--muted);
}
@media (hover: hover) and (pointer: fine) {
  .board-nav a:hover { color: var(--ink); background: var(--surface); }
}
.board-nav a:active { transform: scale(0.97); }
.board-nav a:focus-visible { outline-offset: -2px; }

.hero {
  padding: var(--sp-64) var(--sp-32) var(--sp-96);
  max-width: 1280px;
  margin: 0 auto;
}
.hero__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: var(--sp-32);
  align-items: start;
}
.hero__lede { max-width: 62ch; }

.hero__eyebrow {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--sp-16);
}

.hero__title {
  font-size: clamp(2.75rem, 6vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: var(--sp-24);
}

.flap-strip {
  display: flex;
  align-items: center;
  gap: var(--sp-12);
  margin-bottom: var(--sp-24);
  font-family: var(--font-mono);
}
.flap-strip__label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.flap-strip__track {
  position: relative;
  display: inline-block;
  height: 1.4em;
  min-width: 9ch;
  overflow: hidden;
  border-bottom: 1px solid var(--line-strong);
}
.flap-strip__track span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  opacity: 0;
  transform: translateY(0.4em);
  animation: flap-cycle 14s steps(1, end) infinite;
  animation-delay: calc(var(--i) * -2s);
}
@keyframes flap-cycle {
  0%, 1% { opacity: 1; transform: translateY(0); }
  13%, 100% { opacity: 0; transform: translateY(-0.4em); }
}

.hero__sub {
  color: var(--muted);
  margin-bottom: var(--sp-32);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-16);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 150ms var(--ease), background 150ms var(--ease), border-color 150ms var(--ease);
}
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
@media (hover: hover) and (pointer: fine) {
  .btn--primary:hover { background: #ffb84d; }
  .btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
}
.btn:active { transform: scale(0.97); }

.hero__stat {
  justify-self: end;
  width: 100%;
}
.ticket-tile {
  background: var(--paper);
  color: var(--paper-ink);
  border-radius: var(--radius-lg);
  padding: var(--sp-32);
  margin-right: calc(-1 * var(--sp-32));
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.ticket-tile__label {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(32, 26, 16, 0.72);
}
.ticket-tile__num {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(72px, 9vw, 128px);
  line-height: 1;
  color: var(--accent-ink);
  margin: var(--sp-8) 0;
}
.ticket-tile__unit {
  font-size: 14px;
  color: rgba(32, 26, 16, 0.7);
  margin-bottom: var(--sp-24);
}
.ticket-tile__facts {
  display: grid;
  gap: var(--sp-8);
  border-top: 1px dashed rgba(32, 26, 16, 0.25);
  padding-top: var(--sp-16);
  margin: 0;
}
.ticket-tile__facts div { display: flex; justify-content: space-between; gap: var(--sp-16); }
.ticket-tile__facts dt { font-size: 13px; color: rgba(32, 26, 16, 0.65); }
.ticket-tile__facts dd { margin: 0; font-family: var(--font-mono); font-weight: 700; }

@media (max-width: 900px) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero__stat { justify-self: stretch; }
  .ticket-tile { margin-right: 0; }
}

/* ---------- controls ---------- */
.controls {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: var(--sp-24) var(--sp-32);
}
.controls__row {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: var(--sp-16);
}
.field { display: flex; flex-direction: column; gap: var(--sp-8); }
.field label {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.field--search { flex: 1 1 260px; }
.field--select { flex: 0 1 200px; }

.field input,
.field select {
  min-height: 44px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 16px;
  font-family: var(--font-body);
}
.field input:focus-visible,
.field select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-8);
  min-height: 44px;
  padding: 0 var(--sp-16);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms var(--ease), color 150ms var(--ease), border-color 150ms var(--ease), transform 150ms var(--ease);
}
.toggle-chip__icon { color: var(--muted); transition: color 150ms var(--ease); }
.toggle-chip[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.toggle-chip[aria-pressed="true"] .toggle-chip__icon { color: var(--accent-ink); }
@media (hover: hover) and (pointer: fine) {
  .toggle-chip:hover { border-color: var(--accent); color: var(--ink); }
  .toggle-chip[aria-pressed="true"]:hover { color: var(--accent-ink); }
}
.toggle-chip:active { transform: scale(0.97); }

.controls__count {
  max-width: 1280px;
  margin: var(--sp-16) auto 0;
  color: var(--muted);
  font-size: 14px;
}
.flip-number {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent);
}
.flip-number.is-flipping {
  animation: number-flip 260ms var(--ease);
}
@keyframes number-flip {
  0% { transform: translateY(0); opacity: 1; }
  40% { transform: translateY(-0.5em); opacity: 0; }
  41% { transform: translateY(0.5em); }
  100% { transform: translateY(0); opacity: 1; }
}

/* ---------- ledger ---------- */
.ledger {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--sp-48) var(--sp-32) var(--sp-96);
}

.day-group { margin-bottom: var(--sp-48); }
.day-group__title {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: var(--sp-12);
  border-bottom: 1px solid var(--line-strong);
  margin-bottom: var(--sp-8);
}

.ledger__list { list-style: none; margin: 0; padding: 0; }
.ledger__row {
  border-bottom: 1px solid var(--line);
  position: relative;
}

.ledger__open {
  display: grid;
  grid-template-columns: 96px 1.6fr 132px 90px;
  align-items: center;
  gap: var(--sp-16);
  width: 100%;
  min-height: 64px;
  padding: var(--sp-16) var(--sp-8);
  background: transparent;
  border: none;
  color: var(--ink);
  font-family: var(--font-body);
  text-align: left;
  cursor: pointer;
  transition: background 150ms var(--ease), padding-left 150ms var(--ease);
}
@media (hover: hover) and (pointer: fine) {
  .ledger__open:hover { background: var(--surface); padding-left: var(--sp-16); }
}
.ledger__open:active { transform: scale(0.99); }
.ledger__open:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.ledger__time {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
}
.ledger__main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ledger__title {
  font-weight: 700;
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ledger__meta {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ledger__tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--muted);
  justify-self: start;
  white-space: nowrap;
}
.ledger__price {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  text-align: right;
}
.ledger__price[data-free="true"] { color: var(--free); }
.ledger__saved {
  position: absolute;
  right: var(--sp-8);
  top: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  pointer-events: none;
}

@media (max-width: 720px) {
  .ledger__open {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "time price"
      "main main"
      "tag tag";
    row-gap: 6px;
  }
  .ledger__time { grid-area: time; }
  .ledger__price { grid-area: price; }
  .ledger__main { grid-area: main; }
  .ledger__tag { grid-area: tag; }
}

.empty-state {
  text-align: center;
  padding: var(--sp-64) var(--sp-24);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
}
.empty-state__flap {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: var(--sp-8);
}
.empty-state p { color: var(--muted); margin-bottom: var(--sp-16); }
.empty-state button {
  min-height: 44px;
  padding: 0 var(--sp-24);
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  transition: background 150ms var(--ease), transform 150ms var(--ease);
}
@media (hover: hover) and (pointer: fine) {
  .empty-state button:hover { background: #ffb84d; }
}
.empty-state button:active { transform: scale(0.97); }

/* ---------- about (inverted breather band) ---------- */
.about {
  background: var(--paper);
  color: var(--paper-ink);
  padding: var(--sp-96) var(--sp-32);
}
.about__inner {
  max-width: 68ch;
  margin: 0 auto;
}
.about h2 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-24);
}
.about p { margin-bottom: var(--sp-16); color: rgba(32, 26, 16, 0.85); }
.about__disclaimer { font-size: 14px; color: rgba(32, 26, 16, 0.72); }

.site-footer {
  padding: var(--sp-32);
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- dialog ---------- */
.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 9, 0.72);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--sp-32) var(--sp-16);
  overflow-y: auto;
  z-index: 50;
}
.dialog-backdrop[hidden] { display: none; }

.dialog {
  background: var(--surface-raised);
  color: var(--ink);
  width: 100%;
  max-width: 560px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line-strong);
  position: relative;
  margin-top: var(--sp-32);
  animation: dialog-in 220ms var(--ease);
}
@keyframes dialog-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.dialog__close {
  position: absolute;
  top: var(--sp-16);
  right: var(--sp-16);
  display: flex;
  align-items: center;
  gap: var(--sp-8);
  min-height: 44px;
  padding: 0 var(--sp-16);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: background 150ms var(--ease), color 150ms var(--ease);
  z-index: 1;
}
@media (hover: hover) and (pointer: fine) {
  .dialog__close:hover { background: var(--bg); color: var(--ink); }
}
.dialog__close:active { transform: scale(0.97); }
.dialog__close span[aria-hidden] { font-size: 20px; line-height: 1; }

.ticket { padding: var(--sp-32); padding-top: var(--sp-64); }
.ticket__cat {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--sp-8);
}
.ticket__title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-24);
}
.ticket__facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-16);
  margin: 0 0 var(--sp-24);
}
.ticket__facts div:nth-child(1) { grid-column: 1 / -1; }
.ticket__facts dt {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}
.ticket__facts dd {
  margin: 0;
  font-weight: 600;
  font-size: 15px;
}
.ticket__perforation {
  height: 0;
  border-top: 1px dashed var(--line-strong);
  margin: 0 calc(-1 * var(--sp-32)) var(--sp-24);
}
.ticket__body {
  color: var(--muted);
  margin-bottom: var(--sp-32);
}
.ticket__body p { margin-bottom: var(--sp-12); }

.save-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-8);
  width: 100%;
  min-height: 48px;
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  transition: background 150ms var(--ease), color 150ms var(--ease), transform 150ms var(--ease);
}
.save-toggle[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
@media (hover: hover) and (pointer: fine) {
  .save-toggle:hover { background: rgba(245, 166, 35, 0.12); }
  .save-toggle[aria-pressed="true"]:hover { background: #ffb84d; }
}
.save-toggle:active { transform: scale(0.98); }

@media (max-width: 480px) {
  .ticket { padding: var(--sp-24); padding-top: var(--sp-64); }
  .ticket__perforation { margin: 0 calc(-1 * var(--sp-24)) var(--sp-24); }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .flap-strip__track span { animation: none !important; opacity: 0; transform: none; }
  .flap-strip__track span[style*="--i:0"] { opacity: 1; }
  .dialog { animation: none; }
}
