/* OpenSeat W&M — shared tokens and components.
   Layout concept: a campus "departure board" — spot cards read like live status rows,
   occupancy is always encoded as a coloured pill + number, data in mono. Mobile first. */

@import url("https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,700;12..96,800&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@500;700&display=swap");

:root {
  /* colour */
  --bg: #f3f6f4;
  --surface: #ffffff;
  --surface-2: #e8eeea;
  --fg: #12201a;
  --fg-muted: #56665e;
  --line: #d3ddd7;
  --brand: #115740;          /* deep campus green */
  --brand-ink: #ffffff;
  --brand-soft: #dcebe4;
  --accent: #b9975b;         /* old gold */
  --accent-soft: #f3ead9;
  --focus: #1f7a5a;

  /* occupancy semantics */
  --occ-low: #1f8a4c;
  --occ-low-bg: #dff3e6;
  --occ-medium: #a77a00;
  --occ-medium-bg: #fbf0cf;
  --occ-high: #c4560f;
  --occ-high-bg: #fde5d4;
  --occ-full: #b3261e;
  --occ-full-bg: #fbdcd9;
  --occ-none: #6b7a72;
  --occ-none-bg: #e6ebe8;

  --star: #c99a2e;
  --star-empty: #cfd8d3;
  --danger: #b3261e;
  --success: #1f8a4c;

  /* type */
  --font-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-md: 1rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.75rem;
  --fs-2xl: clamp(2rem, 6vw, 3.25rem);

  /* shape */
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 1px 2px rgb(18 32 26 / 0.06), 0 4px 16px rgb(18 32 26 / 0.06);
  --maxw: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1411; --surface: #151f1a; --surface-2: #1c2822; --fg: #e6eee9; --fg-muted: #98a89f;
    --line: #2a3832; --brand: #3fae83; --brand-ink: #06120d; --brand-soft: #173a2c;
    --accent: #d4b67e; --accent-soft: #352c1c; --focus: #6fd3a8;
    --occ-low: #5fd08f; --occ-low-bg: #15321f; --occ-medium: #e9c252; --occ-medium-bg: #352b10;
    --occ-high: #f29254; --occ-high-bg: #3a2312; --occ-full: #f2756b; --occ-full-bg: #3b1714;
    --occ-none: #98a89f; --occ-none-bg: #222e28;
    --star: #e8bd57; --star-empty: #34433b; --danger: #f2756b; --success: #5fd08f;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 4px 16px rgb(0 0 0 / 0.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1411; --surface: #151f1a; --surface-2: #1c2822; --fg: #e6eee9; --fg-muted: #98a89f;
  --line: #2a3832; --brand: #3fae83; --brand-ink: #06120d; --brand-soft: #173a2c;
  --accent: #d4b67e; --accent-soft: #352c1c; --focus: #6fd3a8;
  --occ-low: #5fd08f; --occ-low-bg: #15321f; --occ-medium: #e9c252; --occ-medium-bg: #352b10;
  --occ-high: #f29254; --occ-high-bg: #3a2312; --occ-full: #f2756b; --occ-full-bg: #3b1714;
  --occ-none: #98a89f; --occ-none-bg: #222e28;
  --star: #e8bd57; --star-empty: #34433b; --danger: #f2756b; --success: #5fd08f;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 4px 16px rgb(0 0 0 / 0.25);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--fs-md);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.1; margin: 0; text-wrap: balance; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-2xl); font-weight: 800; }
h2 { font-size: var(--fs-xl); font-weight: 700; }
h3 { font-size: var(--fs-lg); font-weight: 700; }
p { margin: 0; }
a { color: var(--brand); text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.mono, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--fg-muted); }
.eyebrow {
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-muted);
}
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* ---------- header / footer ---------- */
.site-header {
  position: sticky; top: 0; z-index: 1000;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 12px; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--fg); }
.brand-mark {
  width: 22px; height: 22px; border-radius: 6px; background: var(--brand);
  box-shadow: inset 0 -7px 0 var(--accent);
}
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; letter-spacing: -0.02em; }
.brand-tag { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--fg-muted); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.site-nav { display: flex; gap: 4px; }
.site-nav a { text-decoration: none; color: var(--fg-muted); font-weight: 500; font-size: var(--fs-sm); padding: 6px 10px; border-radius: var(--radius-sm); }
.site-nav a:hover { color: var(--fg); background: var(--surface-2); }
.site-nav a[aria-current="page"] { color: var(--fg); background: var(--surface-2); }

.site-footer { border-top: 1px solid var(--line); margin-top: 48px; }
.footer-inner { display: grid; gap: 6px; padding-block: 24px; font-size: var(--fs-sm); max-width: 72ch; }

/* ---------- buttons, chips, fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--fg);
  font: 600 var(--fs-sm)/1 var(--font-body); cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { border-color: var(--fg-muted); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--brand); }
.btn-block { width: 100%; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 12px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--fg); font-size: var(--fs-sm); cursor: pointer; user-select: none;
}
.chip[aria-pressed="true"], .chip.is-active { background: var(--brand-soft); border-color: var(--brand); color: var(--fg); }

.field { display: grid; gap: 6px; font-size: var(--fs-sm); font-weight: 500; }
input[type="text"], textarea, select {
  width: 100%; font: 400 var(--fs-md)/1.4 var(--font-body); color: var(--fg);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px;
}
textarea { resize: vertical; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------- occupancy pill ---------- */
.occ-pill {
  --c: var(--occ-none); --cbg: var(--occ-none-bg);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 3px 10px 3px 8px; border-radius: 999px; background: var(--cbg); color: var(--c);
  font-size: var(--fs-xs); font-weight: 600; font-variant-numeric: tabular-nums;
}
.occ-pill[data-level="low"] { --c: var(--occ-low); --cbg: var(--occ-low-bg); }
.occ-pill[data-level="medium"] { --c: var(--occ-medium); --cbg: var(--occ-medium-bg); }
.occ-pill[data-level="high"] { --c: var(--occ-high); --cbg: var(--occ-high-bg); }
.occ-pill[data-level="full"] { --c: var(--occ-full); --cbg: var(--occ-full-bg); }
.occ-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.occ-pill:not([data-level="none"]) .occ-dot { box-shadow: 0 0 0 0 var(--c); animation: occ-pulse 2.4s ease-out infinite; }
@keyframes occ-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c) 60%, transparent); } 70%, 100% { box-shadow: 0 0 0 6px transparent; } }

/* ---------- stars ---------- */
.stars { display: inline-flex; gap: 1px; line-height: 1; }
.stars .star { color: var(--star-empty); }
.stars .star[data-fill="full"] { color: var(--star); }
.stars .star[data-fill="half"] { background: linear-gradient(90deg, var(--star) 50%, var(--star-empty) 50%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stars-sm { font-size: 0.9rem; }
.stars-md { font-size: 1.1rem; }
.stars-lg { font-size: 1.6rem; }

/* ---------- toast ---------- */
#toast-host {
  position: fixed; left: 0; right: 0; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 3000;
  display: grid; justify-items: center; gap: 8px; pointer-events: none;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.toast {
  pointer-events: auto; max-width: 420px; padding: 12px 16px; border-radius: var(--radius);
  background: var(--fg); color: var(--bg); font-size: var(--fs-sm); font-weight: 500; box-shadow: var(--shadow);
  animation: toast-in .25s ease-out;
}
.toast[data-kind="error"] { background: var(--danger); color: #fff; }
.toast[data-kind="success"] { background: var(--success); color: #fff; }
.toast.leaving { opacity: 0; transform: translateY(8px); transition: .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- survey bottom sheet ---------- */
.survey-sheet {
  border: none; padding: 0; margin: auto auto 0; width: min(560px, 100%); max-height: 90vh;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0; background: var(--surface); color: var(--fg); box-shadow: var(--shadow);
}
@media (min-width: 640px) { .survey-sheet { margin: auto; border-radius: var(--radius-lg); } }
.survey-sheet::backdrop { background: rgb(0 0 0 / 0.45); }
.survey-form { display: grid; gap: 16px; padding: 24px max(20px, env(safe-area-inset-left, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)); }
.survey-form fieldset { border: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.survey-form legend { font-weight: 600; margin-bottom: 8px; }
.choice { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; font-size: var(--fs-sm); }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.choice input { accent-color: var(--brand); }
.choice-row { display: flex; gap: 8px; flex-wrap: wrap; }
.choice-inline { flex: 1 1 80px; justify-content: center; }
.survey-actions { display: flex; gap: 8px; justify-content: flex-end; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
