/*
 * linear.css — Linear-style, editorial-restrained treatment layer for fo-scraper-miwi.
 *
 * Loaded AFTER eyerest.css/fonts.css/layout.css so it wins the cascade. It does three things:
 *   1. Swaps the EyeRest gold palette for the Linear palette (dark-first) by redefining the same
 *      color tokens in the SAME selectors eyerest.css uses (later source order → override).
 *   2. Overrides layout tokens (shell/prose widths, radii) and adds a type + motion system.
 *   3. Provides the bespoke landing + dashboard components.
 * Rule: one accent (--primary) for CTA/focus/link only; one hero glow; nothing else glows.
 * Tokens are the design source of truth in docs/plans/003-mvp-landing-dashboard.md.
 */

/* ============================ 1. Palette override ============================ */

/* Light (default :root — matches eyerest.css :root) */
:root {
  --bg: #fcfcfd;
  --surface: #f5f6f6;
  --surface-lift: #ffffff;
  --border: #e2e4e7;
  --text: #111213;
  --text-muted: #6a6f78;
  --primary: #4c56c0;
  --primary-hover: #5e6ad2;
  --primary-on: #ffffff;
  --glow: rgba(94, 106, 210, 0.06);
  --depth-inset: inset 0 1px 0 rgba(0, 0, 0, 0.02);
}

/* Dark via system preference (matches eyerest.css @media dark :root:not([data-theme=light])) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #08090a;
    --surface: #0f1011;
    --surface-lift: #141516;
    --border: #23252a;
    --text: #f7f8f8;
    --text-muted: #8a8f98;
    --primary: #5e6ad2;
    --primary-hover: #828fff;
    --primary-on: #ffffff;
    --glow: rgba(94, 106, 210, 0.1);
    --depth-inset: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  }
}

/* Dark via explicit toggle (matches eyerest.css :root[data-theme=dark]) */
:root[data-theme="dark"] {
  --bg: #08090a;
  --surface: #0f1011;
  --surface-lift: #141516;
  --border: #23252a;
  --text: #f7f8f8;
  --text-muted: #8a8f98;
  --primary: #5e6ad2;
  --primary-hover: #828fff;
  --primary-on: #ffffff;
  --glow: rgba(94, 106, 210, 0.1);
  --depth-inset: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* ============================ 2. Layout + type system ============================ */

:root {
  --shell: 1120px;
  --prose: 680px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --section-pad: clamp(4rem, 8vw, 8rem); /* 64–128px vertical section rhythm */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 {
  font-family: var(--font-sans);
  font-feature-settings: "cv01", "ss03";
  font-weight: 600;
  margin: 0;
}
h1 { font-size: clamp(2.5rem, 5vw + 1rem, 4.5rem); line-height: 1.05; letter-spacing: -0.03em; }
h2 { font-size: clamp(1.5rem, 2vw + 1rem, 2.25rem); line-height: 1.15; letter-spacing: -0.02em; }
h3 { font-size: 1.125rem; line-height: 1.3; letter-spacing: -0.015em; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* Mono eyebrow / stat label — the one recurring editorial signal. */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0;
}

.shell { max-width: var(--shell); margin-inline: auto; padding-inline: 24px; }
.prose { max-width: var(--prose); }
.muted { color: var(--text-muted); }

/* Buttons — accent only on primary. */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 160ms var(--ease), background 160ms var(--ease),
    border-color 160ms var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: var(--primary); color: var(--primary-on); }
.btn--primary:hover { background: var(--primary-hover); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn--ghost:hover { border-color: var(--text-muted); }

/* Focus — never color alone; visible ring on any keyboard target. */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Depth recipe: lifted surface + hairline border + inset highlight. */
.panel {
  background: var(--surface-lift);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--depth-inset);
}

/* ============================ Motion ============================ */

.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 500ms var(--ease), transform 500ms var(--ease);
}
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ============================ Theme toggle (EyeRest contract) ============================ */

#theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 160ms var(--ease), color 160ms var(--ease);
}
#theme-toggle:hover { border-color: var(--text-muted); color: var(--text); }
#theme-toggle .theme-glyph { font-size: 14px; }

/* ============================ 3a. Landing ============================ */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 60px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.02em; }
.brand-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--primary); }
.nav-actions { display: flex; align-items: center; gap: 12px; }

.hero { position: relative; padding: clamp(5rem, 12vw, 10rem) 0 var(--section-pad); overflow: hidden; }
.hero-glow {
  position: absolute;
  inset: -20% 0 auto 0;
  height: 620px;
  background: radial-gradient(60% 60% at 50% 0%, var(--glow), transparent 70%);
  pointer-events: none;
  z-index: -1;
}
.hero .eyebrow { margin-bottom: 20px; }
.hero h1 { max-width: 16ch; }
.hero-sub { margin: 24px 0 32px; font-size: 1.125rem; color: var(--text-muted); max-width: 46ch; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.cta-note { font-size: 0.875rem; color: var(--text-muted); }

/* Real stat strip — mono, no fabricated numbers. */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.stat { background: var(--bg); padding: 24px; }
.stat-num { font-family: var(--font-mono); font-size: 1.75rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-label { display: block; margin-top: 6px; font-size: 0.8125rem; color: var(--text-muted); }

.section { padding-block: var(--section-pad); border-top: 1px solid var(--border); }
.section .eyebrow { margin-bottom: 16px; }
.section h2 { margin-bottom: 20px; }
.section p { color: var(--text-muted); font-size: 1.0625rem; }

/* Dashboard sample frame on the landing. */
.sample-frame { margin-top: 32px; padding: 20px; }
.sample-row {
  display: grid;
  grid-template-columns: 96px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px 8px;
  border-top: 1px solid var(--border);
  font-size: 0.9375rem;
}
.sample-row:first-child { border-top: 0; }
.sample-row .when { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--text-muted); }
.sample-row .tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
}

/* Approval steps 01/02/03. */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-top: 32px; }
.step { padding: 24px; }
.step-num { font-family: var(--font-mono); color: var(--primary); font-size: 0.875rem; letter-spacing: 0.05em; }
.step h3 { margin: 12px 0 8px; }
.step p { font-size: 0.9375rem; }

/* Request-access form. */
.form-card { margin-top: 32px; padding: 28px; max-width: 520px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 0.875rem; font-weight: 500; }
.field input, .field select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font: inherit;
  transition: border-color 160ms var(--ease);
}
.field input:focus { outline: none; border-color: var(--primary); }
.field .err { font-size: 0.8125rem; color: #e5484d; min-height: 1em; }
.field input[aria-invalid="true"] { border-color: #e5484d; }
.turnstile-mount { margin: 4px 0 16px; }
.turnstile-mount:empty { margin: 0; }
.form-status { margin-top: 4px; font-size: 0.9375rem; }
.form-confirm { text-align: center; padding: 8px 0; }
.form-confirm .check {
  width: 44px; height: 44px; border-radius: 999px; margin: 0 auto 16px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--primary) 16%, transparent);
  color: var(--primary); font-size: 22px;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 40px;
  color: var(--text-muted);
  font-size: 0.875rem;
}
.footer-inner { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; }

/* ============================ 3b. Dashboard ============================ */

.app-header { border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px); }
.app-header .nav-inner { height: 64px; }
.app-main { padding-block: 40px 80px; }
.app-title { margin-bottom: 4px; }
.app-sub { color: var(--text-muted); margin: 0 0 28px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 24px; }
.toolbar .field { margin-bottom: 0; }
.toolbar label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); font-family: var(--font-mono); }
.toolbar select, .toolbar input {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 10px; font: inherit; font-size: 0.875rem;
}
.count { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--text-muted); margin-left: auto; }
.field--chk { justify-content: end; }
.chk { display: inline-flex; align-items: center; gap: 8px; font-size: 0.875rem; color: var(--text); cursor: pointer; text-transform: none; letter-spacing: normal; font-family: var(--font-sans); }
.chk input { accent-color: var(--primary); width: 15px; height: 15px; }

.view-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.view-toggle button {
  background: transparent; color: var(--text-muted); border: 0; padding: 8px 14px;
  font: inherit; font-size: 0.8125rem; cursor: pointer;
}
.view-toggle button[aria-pressed="true"] { background: var(--surface-lift); color: var(--text); }

.group-head { font-family: var(--font-mono); font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin: 28px 0 12px; }

.events-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.event-card { padding: 18px; position: relative; }
.event-when { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--primary); }
.event-title { font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.015em; margin: 8px 0 4px; padding-right: 28px; }
.event-org { color: var(--text-muted); font-size: 0.9375rem; margin-bottom: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.03em;
  color: var(--text-muted); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px;
}

/* Provenance "?" affordance + popover. */
.prov-btn {
  position: absolute; top: 16px; right: 14px;
  width: 22px; height: 22px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted); font-size: 12px; line-height: 1; cursor: pointer;
  display: grid; place-items: center;
  transition: border-color 160ms var(--ease), color 160ms var(--ease);
}
.prov-btn:hover, .prov-btn[aria-expanded="true"] { border-color: var(--primary); color: var(--primary); }
.prov-popover {
  position: absolute; top: 44px; right: 12px; z-index: 30; width: min(320px, 88vw);
  padding: 16px; font-size: 0.8125rem;
  background: var(--surface-lift); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28), var(--depth-inset);
}
.prov-popover[hidden] { display: none; }
.prov-popover dt { font-family: var(--font-mono); font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-top: 10px; }
.prov-popover dt:first-child { margin-top: 0; }
.prov-popover dd { margin: 2px 0 0; word-break: break-word; }
.prov-verified { color: var(--primary); }

/* Month calendar. */
.calendar { margin-top: 8px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.cal-head h3 { font-family: var(--font-mono); font-weight: 700; letter-spacing: 0.02em; }
.cal-nav { display: flex; gap: 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.cal-dow { background: var(--surface); color: var(--text-muted); font-family: var(--font-mono); font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 8px; text-align: center; }
.cal-cell { background: var(--bg); min-height: 88px; padding: 8px; font-size: 0.8125rem; }
.cal-cell.is-out { background: var(--surface); color: var(--text-muted); }
.cal-date { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); }
.cal-ev { margin-top: 4px; font-size: 0.75rem; line-height: 1.3; color: var(--text);
  border-left: 2px solid var(--primary); padding-left: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-more { color: var(--text-muted); font-size: 0.6875rem; margin-top: 2px; }

.empty { color: var(--text-muted); text-align: center; padding: 48px 0; }

/* ============================ Invite gate (/gate.html) ============================ */

.gate-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate-card { width: 100%; max-width: 420px; padding: 32px; }
.gate-card .eyebrow { margin-bottom: 14px; }
.gate-title { font-size: 1.75rem; letter-spacing: -0.02em; margin-bottom: 10px; }
.gate-card p { color: var(--text-muted); }
.gate-form { display: flex; gap: 10px; margin-top: 20px; }
.gate-form input {
  flex: 1;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font: inherit;
}
.gate-form input:focus { outline: none; border-color: var(--primary); }
.gate-err { margin-top: 14px; color: #e5484d; font-size: 0.875rem; }
