/* =====================================================================
   Ticketset — buyer storefront
   ---------------------------------------------------------------------
   Direction: the paper ticket. Perforated edges, tear lines, stubs and
   serial numbers, in school-blazer bottle green and crest gold on
   programme paper. The buyer is a parent on a phone who followed a
   WhatsApp link, so it is mobile-first and light by default - the whole
   thing is meant to read as a physical object.

   The signature is .tear: the hold countdown is drawn as a solid rule
   that perforates as the ten minutes run out. Ticketing's one unique
   state, in the subject's own vernacular.
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@600;800&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --paper:      #f2f4f1;     /* programme paper, faintly green */
  --card:       #ffffff;
  --ink:        #12211a;     /* near-black with green in it */
  --ink-soft:   #5a6b62;
  --blazer:     #1f5d45;     /* school blazer bottle green */
  --blazer-dk:  #16452F;
  --gold:       #a8891f;     /* crest gold, used sparingly */
  --marker:     #c0431f;     /* ticket-roll red - countdown only */
  --rule:       #d3dad4;
  --rule-soft:  #e6eae6;

  --radius:     14px;
  --notch:      11px;
  --shadow:     0 1px 2px rgba(18,33,26,.06), 0 8px 24px -12px rgba(18,33,26,.18);

  --display: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --body:    system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono:    'IBM Plex Mono', ui-monospace, 'Cascadia Mono', monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:     #0e1613;
    --card:      #17231e;
    --ink:       #e8efe9;
    --ink-soft:  #9aaba2;
    --blazer:    #6cc39c;
    --blazer-dk: #8ad3b2;
    --gold:      #d9b641;
    --marker:    #f0805c;
    --rule:      #2c3d35;
    --rule-soft: #223029;
    --shadow:    0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
  }
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blazer); }
:focus-visible {
  outline: 2px solid var(--blazer);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --- shell ---------------------------------------------------------- */
.wrap { max-width: 34rem; margin: 0 auto; padding: 0 1.15rem 6rem; }

.masthead {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.15rem 0 1.75rem;
}
.wordmark {
  font-family: var(--display); font-weight: 800; font-size: .95rem;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--blazer); text-decoration: none;
}
.wordmark span { color: var(--gold); }

.back {
  font-family: var(--mono); font-size: .78rem; color: var(--ink-soft);
  text-decoration: none;
}
.back:hover { color: var(--ink); }

/* --- type ----------------------------------------------------------- */
h1 {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(1.9rem, 7.5vw, 2.75rem);
  line-height: 1.04; letter-spacing: -.022em;
  margin: 0 0 .5rem;
  text-wrap: balance;
}
.dek { color: var(--ink-soft); margin: 0 0 2rem; font-size: 1rem; }
.dek b { color: var(--ink); font-weight: 600; }

.eyebrow {
  font-family: var(--mono); font-size: .7rem; font-weight: 500;
  letter-spacing: .17em; text-transform: uppercase;
  color: var(--ink-soft);
  display: flex; align-items: center; gap: .7rem;
  margin: 2.25rem 0 .85rem;
}
.eyebrow::after {
  content: ''; flex: 1; height: 1px; background: var(--rule);
}

.mono { font-family: var(--mono); }
.amount { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* --- the ticket object ---------------------------------------------
   Notches bitten out of both sides, so every card on the site reads as
   a torn-off stub rather than a rounded rectangle.                     */
.ticket {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: .7rem;
}
.ticket--notched {
  background:
    radial-gradient(circle at 0 50%,   rgba(0,0,0,0) var(--notch), var(--card) calc(var(--notch) + .5px)) left  / 51% 100% no-repeat,
    radial-gradient(circle at 100% 50%, rgba(0,0,0,0) var(--notch), var(--card) calc(var(--notch) + .5px)) right / 51% 100% no-repeat;
}

/* --- session / ticket-type rows -------------------------------------- */
.row {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.1rem;
}
.row__main { flex: 1; min-width: 0; }
.row__name {
  font-family: var(--display); font-weight: 600; font-size: 1.02rem;
  letter-spacing: -.01em;
}
.row__note { color: var(--ink-soft); font-size: .84rem; margin-top: .12rem; }
.row__price {
  font-family: var(--mono); font-size: .95rem; font-weight: 500;
  white-space: nowrap;
}

/* selectable showtime */
.pick {
  display: block; width: 100%; text-align: left;
  border: 1.5px solid var(--rule); background: var(--card);
  border-radius: var(--radius); padding: .9rem 1.05rem;
  margin-bottom: .55rem; cursor: pointer; color: inherit;
  font: inherit;
  transition: border-color .12s ease, background .12s ease;
}
.pick:hover { border-color: var(--blazer); }
.pick[aria-pressed="true"] {
  border-color: var(--blazer);
  background: color-mix(in srgb, var(--blazer) 7%, var(--card));
}
.pick__when {
  font-family: var(--display); font-weight: 600; font-size: 1.05rem;
}
.pick__left {
  font-family: var(--mono); font-size: .76rem; color: var(--ink-soft);
  margin-top: .18rem;
}
.pick__left.is-low { color: var(--marker); }

/* --- stepper --------------------------------------------------------- */
.step { display: flex; align-items: center; gap: .1rem; }
.step button {
  width: 2.1rem; height: 2.1rem; flex: none;
  border: 1.5px solid var(--rule); background: var(--card);
  color: var(--ink); border-radius: 50%;
  font-size: 1.15rem; line-height: 1; cursor: pointer;
  display: grid; place-items: center;
  transition: border-color .12s ease, color .12s ease;
}
.step button:hover:not(:disabled) { border-color: var(--blazer); color: var(--blazer); }
.step button:disabled { opacity: .3; cursor: not-allowed; }
.step output {
  width: 2.2rem; text-align: center;
  font-family: var(--mono); font-size: 1rem; font-variant-numeric: tabular-nums;
}

/* --- sticky summary --------------------------------------------------- */
.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--rule);
  padding: .8rem 1.15rem calc(.8rem + env(safe-area-inset-bottom));
}
.bar__inner {
  max-width: 34rem; margin: 0 auto;
  display: flex; align-items: center; gap: 1rem;
}
.bar__count { flex: 1; font-size: .88rem; color: var(--ink-soft); }
.bar__count b {
  display: block; color: var(--ink); font-family: var(--mono);
  font-size: 1.15rem; font-weight: 500;
}

/* --- buttons ---------------------------------------------------------- */
.btn {
  font-family: var(--display); font-weight: 600; font-size: 1rem;
  padding: .82rem 1.4rem; border: 0; border-radius: 10px;
  background: var(--blazer); color: #fff; cursor: pointer;
  letter-spacing: -.005em;
  transition: background .12s ease;
}
.btn:hover:not(:disabled) { background: var(--blazer-dk); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn--wide { width: 100%; }
@media (prefers-color-scheme: dark) { .btn { color: #0e1613; } }

/* --- the tear line: the countdown ------------------------------------
   A solid rule laid over a dashed one. As the hold expires the solid
   part retreats and the perforation shows through - the ticket is
   tearing away from you.                                                */
.hold { padding: 1.15rem 1.1rem 1.25rem; }
.hold__label {
  font-family: var(--mono); font-size: .7rem; letter-spacing: .17em;
  text-transform: uppercase; color: var(--ink-soft);
}
.hold__time {
  font-family: var(--mono); font-size: 2rem; font-weight: 500;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
  margin: .15rem 0 .8rem; color: var(--ink);
}
.hold.is-urgent .hold__time { color: var(--marker); }
.tear {
  height: 2px; width: 100%;
  background-image: linear-gradient(90deg, var(--rule) 55%, rgba(0,0,0,0) 0);
  background-size: 9px 2px; background-repeat: repeat-x;
}
.tear__solid {
  height: 2px; background: var(--blazer);
  transition: width 1s linear;
}
.hold.is-urgent .tear__solid { background: var(--marker); }
@media (prefers-reduced-motion: reduce) {
  .tear__solid { transition: none; }
}
.hold.is-expired .hold__time { color: var(--marker); font-size: 1.25rem; }

/* --- totals ------------------------------------------------------------ */
.tot { padding: .35rem 1.1rem 1.1rem; }
.tot__line {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .42rem 0; font-size: .93rem;
}
.tot__line span:first-child { color: var(--ink-soft); }
.tot__line--sum {
  border-top: 1px solid var(--rule); margin-top: .45rem; padding-top: .75rem;
  font-family: var(--display); font-weight: 600; font-size: 1.15rem;
}
.tot__line--sum span:first-child { color: var(--ink); }
.tot__fee span:first-child { color: var(--blazer); font-weight: 500; }

/* --- form -------------------------------------------------------------- */
.field { margin-bottom: 1.05rem; }
.field label {
  display: block; font-size: .82rem; font-weight: 600;
  margin-bottom: .3rem;
}
.field input {
  width: 100%; padding: .72rem .85rem; font: inherit;
  color: var(--ink); background: var(--card);
  border: 1.5px solid var(--rule); border-radius: 9px;
}
.field input:focus { border-color: var(--blazer); outline: none; }
.field .hint { font-size: .78rem; color: var(--ink-soft); margin-top: .3rem; }

/* --- issued ticket stub -------------------------------------------------- */
.stub { display: flex; align-items: stretch; overflow: hidden; }
.stub__body { flex: 1; padding: 1rem 1.1rem; min-width: 0; }
.stub__type {
  font-family: var(--display); font-weight: 800; font-size: 1.05rem;
  text-transform: uppercase; letter-spacing: .01em;
}
.stub__when { color: var(--ink-soft); font-size: .85rem; margin-top: .15rem; }
.stub__edge {
  width: 4.6rem; flex: none;
  border-left: 2px dashed var(--rule);
  display: grid; place-items: center; text-align: center;
  padding: .6rem .35rem;
}
.stub__edge-label {
  font-family: var(--mono); font-size: .55rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-soft); opacity: .7;
  margin-bottom: .2rem;
}
/* Set in deliberate groups rather than left to wrap - a serial that
   breaks mid-run looks like a rendering accident on the one element
   someone has to read aloud at a door. */
.stub__serial {
  font-family: var(--mono); font-size: .7rem; font-weight: 500;
  letter-spacing: .02em; color: var(--ink); line-height: 1.45;
}

/* --- status notes -------------------------------------------------------- */
.note {
  border-left: 3px solid var(--rule); padding: .7rem 0 .7rem .9rem;
  font-size: .9rem; color: var(--ink-soft); margin: 1.25rem 0;
}
.note--warn  { border-left-color: var(--marker); color: var(--ink); }
.note--good  { border-left-color: var(--blazer); color: var(--ink); }
.note b { color: var(--ink); }

.stamp {
  display: inline-block;
  font-family: var(--display); font-weight: 800; font-size: .75rem;
  letter-spacing: .16em; text-transform: uppercase;
  border: 2px solid var(--blazer); color: var(--blazer);
  padding: .22rem .6rem; border-radius: 4px;
  transform: rotate(-1.5deg);
  margin-bottom: .9rem;
}
.stamp--pending { border-color: var(--gold); color: var(--gold); }

.spin { color: var(--ink-soft); font-size: .92rem; padding: 2rem 0; }
