/* SeasonSolve app styles. Colours, fonts, spacing and radii come from brand/tokens.css (the brand kit),
   loaded before this file. DM Sans for anything glanced at, Gelasio for anything read as a sentence. */
:root {
  /* 30% lived-in: a faint paper grain behind every surface */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .21 0 0 0 0 .09 0 0 0 0 .03 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg) var(--grain);
  color: var(--text);
  font: 15px/1.5 var(--font-ui);
}
a { color: var(--accent); }
h1, h2, h3 { color: var(--heading); font-family: var(--font-ui); }
h1 { font-size: 1.85rem; font-weight: 700; line-height: 1.2; margin: 0 0 .35rem; letter-spacing: -.01em; }
/* Section headers: DM Sans bold caps, tracked out, with an amber rule (the brand's structural punctuation) */
h2 {
  font-size: .9rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em;
  margin: 0 0 1rem; padding-bottom: .45rem; border-bottom: 2.5px solid var(--rule);
}
h3 { font-size: 1rem; font-weight: 500; margin: 1.5rem 0 .35rem; }
/* Reading voice: anything meant to be read as a sentence */
.lead, .read, .assumptions p, .card.empty p, .flash { font-family: var(--font-read); }
p { margin: .25rem 0 .75rem; }
code { background: var(--surface-2); padding: .1rem .35rem; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.warn { color: var(--warn); }

/* ---- top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .6rem 1.25rem;
  background: var(--espresso);  /* not --bar-bg: the logo file carries an espresso plate */
  color: var(--bar-text);
  border-bottom: 2.5px solid var(--amber);
}
.brand { display: block; line-height: 0; }
.brand img { height: 30px; width: auto; display: block; }
.logo { color: var(--amber); }
.crumb { color: var(--bar-muted); font-size: .9rem; }
.stages { display: flex; gap: .25rem; margin-left: auto; flex-wrap: wrap; }
.stage {
  padding: .3rem .7rem; border-radius: 999px; font-size: .85rem;
  color: var(--bar-muted); text-decoration: none;
}
.stage b {
  display: inline-grid; place-items: center; width: 1.3rem; height: 1.3rem; margin-right: .25rem;
  border-radius: 50%; border: 1px solid var(--bar-muted); font-size: .75rem;
}
.stage.active { color: var(--amber); font-weight: 700; }
.stage.active b { background: var(--amber); border-color: var(--amber); color: var(--espresso); }
.stage.soon { opacity: .55; cursor: default; }

/* ---- layout ---- */
.page { max-width: 1180px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.25rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 700; color: var(--muted); margin: 0; }
.eyebrow a { color: var(--muted); text-decoration: none; }
.lead { color: var(--text); opacity: .85; max-width: 46rem; font-size: 1.02rem; }
.hero { margin: 1rem 0 1.5rem; }
.two-col { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1.25rem; }
.footnote { margin-top: 1rem; font-size: .8rem; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; margin-bottom: 1.25rem; box-shadow: var(--shadow);
}
.card.empty { text-align: center; padding: 2.5rem 1.25rem; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.stack { display: grid; gap: .9rem; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .5rem .95rem; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 500;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn.primary:hover { background: var(--warm-brown); border-color: var(--warm-brown); }
@media (prefers-color-scheme: dark) { .btn.primary:hover { background: #F4C04A; border-color: #F4C04A; } }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger:hover { color: var(--bad); }
.btn.small { padding: .25rem .6rem; font-size: .85rem; }
.buttons { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ---- pills, flashes ---- */
.pill {
  display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 700;
  letter-spacing: .04em; background: var(--accent-soft); color: var(--heading);
}
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }
.code {
  font-size: .75rem; font-weight: 700; padding: .05rem .4rem; border-radius: 4px;
  background: var(--surface-2); color: var(--muted); vertical-align: middle;
}
/* Callouts follow the pull-quote rule: an amber rule at the left margin, no heavy box */
.flash {
  padding: .7rem 1rem; margin-bottom: 1rem; background: var(--surface);
  border-left: 3px solid var(--amber); border-radius: 0 var(--radius) var(--radius) 0;
}
.flash.bad { border-left-color: var(--bad); }
.flash.bad { background: var(--bad-soft); color: var(--bad); }
.flash ul { margin: .35rem 0 0; padding-left: 1.2rem; }
.alert-bad { border-color: var(--bad); }

/* ---- home ---- */
.season-list { list-style: none; margin: 0; padding: 0; }
.season-list a {
  display: flex; justify-content: space-between; align-items: center; padding: .75rem .5rem;
  border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none;
}
.season-list a:hover { background: var(--surface-2); }
.season-name { font-weight: 600; }

/* ---- gym cards ---- */
.gym-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.25rem; margin-bottom: 1.25rem; }
.gym { margin: 0; display: flex; flex-direction: column; }
.gym header { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.gym h2 { margin: 0; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: .2rem .9rem; margin: .5rem 0 1rem; font-size: .9rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.gym footer { margin-top: auto; display: flex; gap: .5rem; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; }
.hours { width: 100%; font-size: .9rem; }
.hours th, .hours td { padding: .45rem .6rem; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.hours thead th { color: var(--muted); font-weight: 600; font-size: .8rem; }
.hours td.closed { color: var(--muted); }
.hours .num { text-align: right; }
.mark { color: var(--mark); font-weight: 700; }
.caption { color: var(--muted); font-size: .8rem; margin-top: .4rem; }
.note { color: var(--warn); font-size: .85rem; }

.heat { font-size: .7rem; }
.heat th[scope=row] { text-align: left; padding-right: .6rem; white-space: nowrap; font-size: .8rem; }
.heat .hour { text-align: left; font-weight: 600; color: var(--muted); padding-bottom: .2rem; }
.heat .c {
  width: 20px; min-width: 20px; height: 24px; text-align: center; padding: 0;
  border: 1px solid var(--surface); font-weight: 700;
}
.heat .c.h { border-left: 2px solid var(--surface); }
.l0 { background: var(--h0); color: transparent; }
.l1 { background: var(--h1); color: var(--h-ink-light); }
.l2 { background: var(--h2); color: var(--h-ink-light); }
.l3 { background: var(--h3); color: var(--h-ink-light); }
.l4 { background: var(--h4); color: var(--h-ink-dark); }
.l5 { background: var(--h5); color: var(--h-ink-dark); }
/* Brand guide known issue: parchment numbers on dark-theme levels 2-3 are too faint; use espresso there. */
@media (prefers-color-scheme: dark) { .l2, .l3 { color: var(--espresso); } }
.c.r, .swatch.r {
  background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 3px, var(--mark) 3px, var(--mark) 4px);
  color: var(--mark);
}
.swatch { display: inline-block; padding: 0 .3rem; border-radius: 3px; }

.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.segmented a { padding: .3rem .8rem; color: var(--muted); text-decoration: none; font-size: .85rem; }
.segmented a.on { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.inline-form { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.inline-form input { padding: .25rem .4rem; }

.confirm-box {
  margin-top: 1.25rem; padding: 1rem; border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--warn-soft); border-left: 3px solid var(--amber); display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.confirm-box p { margin: 0; }
.confirm-box.done { background: var(--surface-2); }

/* ---- assumptions ---- */
.assumptions { list-style: none; padding: 0; margin: 0; }
.assumptions li {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .7rem 0; border-bottom: 1px solid var(--border);
}
.assumptions p { margin: .15rem 0 0; }
.aid { font-weight: 700; color: var(--heading); margin-right: .4rem; font-size: .8rem; letter-spacing: .04em; }
.resolved .aid { color: var(--muted); }
details summary { cursor: pointer; color: var(--muted); margin-top: .75rem; }

/* ---- forms ---- */
.form-layout { display: grid; grid-template-columns: 190px 1fr; gap: 1.5rem; align-items: start; }
.toc { position: sticky; top: 76px; display: grid; gap: .15rem; }
.toc a { padding: .35rem .6rem; border-radius: 6px; color: var(--muted); text-decoration: none; font-size: .9rem; }
.toc a:hover { background: var(--surface-2); color: var(--heading); box-shadow: inset 2px 0 0 var(--amber); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .9rem 1.1rem; margin-bottom: .9rem; }
.grid.three { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.field { display: flex; flex-direction: column; gap: .25rem; min-width: 0; margin: 0; padding: 0; border: 0; }
.field.wide { grid-column: 1 / -1; }
.label { font-weight: 600; font-size: .88rem; }
.star { color: var(--amber-deep); }
.help { color: var(--muted); font-size: .8rem; }
.error { color: var(--bad); font-size: .82rem; font-weight: 600; }
.has-error input, .has-error select { border-color: var(--bad); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: .45rem .6rem; width: 100%;
}
input, select, textarea { background: var(--field-bg); }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; border-color: var(--mid-brown); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); }
input:disabled { opacity: .45; }
.check { display: flex; gap: .55rem; align-items: flex-start; margin: .35rem 0 .6rem; cursor: pointer; }
.check input { margin-top: .3rem; }
.check .help { display: block; }
.yesno legend { padding: 0; margin-bottom: .25rem; }
.radios { display: flex; gap: 1rem; flex-wrap: wrap; padding: .35rem 0; }
.radios label { display: flex; gap: .35rem; align-items: center; cursor: pointer; }

.week { display: grid; gap: .35rem; margin: .5rem 0 1rem; }
.day-row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.day { display: flex; align-items: center; gap: .4rem; width: 4.5rem; font-weight: 600; }
.time-pair { display: inline-flex; align-items: center; gap: .45rem; }
.time-pair input { width: 8.5rem; }
.dash { color: var(--muted); font-size: .85rem; }

.repeat { display: grid; gap: .75rem; }
.repeat-item { border: 1px dashed var(--mid-brown); border-radius: var(--radius); padding: .8rem; }
.repeat-item.row, .repeat-item .row { display: flex; gap: .9rem; align-items: flex-end; flex-wrap: wrap; }
.repeat-item.row > .field, .repeat-item .row > .field { flex: 1 1 160px; }
.repeat > .btn { justify-self: start; }

.savebar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; justify-content: flex-end; gap: .75rem;
  margin: 0 -1.25rem; padding: .8rem 1.25rem;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(6px);
  border-top: 1px solid var(--border);
}

[hidden] { display: none !important; }

@media (max-width: 820px) {
  .two-col, .form-layout { grid-template-columns: 1fr; }
  .toc { display: none; }
  .stages { margin-left: 0; }
  .page-head { flex-direction: column; align-items: flex-start; }
}

/* ---- accounts ---- */
.usermenu { display: flex; align-items: center; gap: 1rem; font-size: .85rem; margin-left: auto; }
.stages + .usermenu { margin-left: 1.25rem; padding-left: 1.25rem; border-left: 1px solid rgba(196, 168, 130, .35); }
details.rename { margin-top: .75rem; }
details.rename form { margin-top: .4rem; }
details.rename input { width: auto; min-width: 16rem; }
.usermenu a { color: var(--bar-text); text-decoration: none; }
.usermenu a:hover { color: var(--amber); }
.usermenu form { margin: 0; }
.linkish {
  background: none; border: 0; padding: 0; font: inherit; color: var(--bar-muted); cursor: pointer;
}
.linkish:hover { color: var(--amber); }
.auth-page { max-width: 560px; }
.auth-card { margin-top: 2rem; padding: 2rem; }
.auth-card h1 { margin-bottom: .25rem; }
.flash.info { border-left-color: var(--mid-brown); }
.flash .buttons { margin-top: .6rem; }
.copy-link { display: flex; gap: .5rem; margin-top: .5rem; font-family: var(--font-ui); }
.copy-link input { font-size: .8rem; }
ul.plain { margin: 0; padding-left: 1.1rem; }
ul.plain li { margin: .2rem 0; }
h2.spaced { margin-top: 1.5rem; }
pre.yaml {
  margin: 0; padding: 1rem; overflow-x: auto; font-size: .8rem; line-height: 1.45;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
}
.people td, .people th { vertical-align: middle; }
.people select { width: auto; padding: .25rem .4rem; }
.actions { display: flex; gap: .25rem; justify-content: flex-end; flex-wrap: wrap; }
.actions form { margin: 0; }
.roles { grid-template-columns: 6rem 1fr; }
.add-season { margin-top: .9rem; }
.add-season input, .invite input, .invite select { width: auto; }
