/* ─────────────────────────────────────────────────────────────────────
   Sitapur Physical Academy — shared design system
   Direction: Editorial (Monocle / FT). Tokens bound verbatim.
   Every surface (website, student app, admin consoles) imports this file
   so the palette and type contract cannot drift between screens.
   ───────────────────────────────────────────────────────────────────── */

:root {
  /* ─── the six ─────────────────────────────────────────────────── */
  --bg:      oklch(98% 0.004 95);
  --surface: oklch(100% 0.002 95);
  --fg:      oklch(20% 0.018 70);
  --muted:   oklch(48% 0.012 70);
  --border:  oklch(90% 0.006 95);
  --accent:  oklch(52% 0.10 28);

  /* ─── derived ─────────────────────────────────────────────────── */
  --accent-soft: color-mix(in oklch, var(--accent) 14%, transparent);
  --fg-soft:     color-mix(in oklch, var(--fg) 6%, transparent);

  /* ─── semantic state colours (status pills only, never decoration) */
  --ok:        oklch(46% 0.10 150);
  --ok-soft:   color-mix(in oklch, var(--ok) 13%, transparent);
  --warn:      oklch(56% 0.11 75);
  --warn-soft: color-mix(in oklch, var(--warn) 15%, transparent);
  --danger:      oklch(48% 0.15 25);
  --danger-soft: color-mix(in oklch, var(--danger) 13%, transparent);

  /* ─── type ────────────────────────────────────────────────────── */
  --font-display: 'Iowan Old Style', 'Charter', Georgia, 'Times New Roman', serif;
  --font-body:    -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono:    ui-monospace, 'JetBrains Mono', 'SF Mono', Menlo, monospace;

  --fs-h1: clamp(44px, 6vw, 76px);
  --fs-h2: clamp(32px, 4vw, 48px);
  --fs-h3: 22px;
  --fs-lead: 19px;
  --fs-body: 16px;
  --fs-meta: 13px;

  /* ─── spacing — 8pt grid ──────────────────────────────────────── */
  --gap-xs: 8px;  --gap-sm: 12px; --gap-md: 20px; --gap-lg: 32px;
  --gap-xl: 56px; --gap-2xl: 96px;
  --container: 1120px;
  --gutter: 32px;
  --radius: 10px;
  --radius-lg: 16px;
}

/* ─── reset & 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-body);
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ─── layout primitives ─────────────────────────────────────────── */
.container { max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: clamp(48px, 8vw, var(--gap-2xl)); }
.section + .section { border-top: 1px solid var(--border); }
.stack { display: flex; flex-direction: column; }
.stack > * + * { margin-top: var(--gap-md); }
.row { display: flex; align-items: center; gap: var(--gap-md); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--gap-md); }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap-lg); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap-lg); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap-md); }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: var(--gap-xl); align-items: start; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: var(--gap-xl); align-items: start; }
@media (max-width: 920px) {
  .grid-2, .grid-3, .grid-4, .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
}

/* ─── type ──────────────────────────────────────────────────────── */
.h1, h1 { font-family: var(--font-display); font-size: var(--fs-h1); line-height: 1.04; letter-spacing: -0.02em; margin: 0; }
.h2, h2 { font-family: var(--font-display); font-size: var(--fs-h2); line-height: 1.1; letter-spacing: -0.015em; margin: 0; }
.h3, h3 { font-size: var(--fs-h3); font-weight: 600; line-height: 1.3; letter-spacing: -0.005em; margin: 0; }
.lead { font-size: var(--fs-lead); line-height: 1.55; color: var(--muted); max-width: 60ch; margin: 0; }
.eyebrow {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 var(--gap-md);
}
.meta { font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--muted); }
.num  { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ─── chrome ────────────────────────────────────────────────────── */
.topnav {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in oklch, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topnav-inner { display: flex; align-items: center; justify-content: space-between; padding-block: 12px; gap: var(--gap-md); }
.topnav .logo {
  font-family: var(--font-display); font-size: 19px; font-weight: 600;
  letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px;
}
.topnav .logo img { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border); }
.topnav nav { display: flex; gap: var(--gap-lg); }
.topnav nav a { font-size: 14px; color: var(--muted); }
.topnav nav a:hover { color: var(--fg); }
@media (max-width: 860px) { .topnav nav { display: none; } }

.pagefoot { padding-block: var(--gap-xl); color: var(--muted); font-size: 13px; border-top: 1px solid var(--border); }
.pagefoot .row-between { flex-wrap: wrap; gap: var(--gap-md); align-items: flex-start; }
.pagefoot a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ─── buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--radius); border: 1px solid transparent;
  font-size: 15px; font-weight: 500; letter-spacing: -0.005em;
  transition: transform .05s ease, background .15s ease, border-color .15s ease, color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--surface); border-color: var(--accent); }
.btn-primary:hover {
  background: color-mix(in oklch, var(--accent) 82%, black);
  border-color: color-mix(in oklch, var(--accent) 82%, black);
  color: var(--surface);
}
.btn-secondary { background: transparent; color: var(--fg); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--fg); background: var(--fg-soft); color: var(--fg); }
.btn-ghost { background: transparent; color: var(--fg); border-color: transparent; padding-inline: 10px; }
.btn-ghost:hover { color: var(--fg); background: var(--fg-soft); }
.btn-arrow::after { content: '→'; transition: transform .15s ease; }
.btn-arrow:hover::after { transform: translateX(2px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn[disabled]:hover { background: transparent; border-color: var(--border); color: var(--fg); }
.btn-primary[disabled]:hover { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 8px; }

/* ─── surfaces ──────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px; }
.card-flat { background: transparent; border: 0; padding: 0; }
.card-rule { background: transparent; border: 0; border-top: 1px solid var(--fg); padding: 24px 0 0; border-radius: 0; }

.feature .feature-mark {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: 10px; color: var(--fg); margin-bottom: var(--gap-md);
}
.feature .feature-mark svg { width: 18px; height: 18px; }
.feature h3 { margin-bottom: 6px; }
.feature p { margin: 0; color: var(--muted); font-size: 15px; }

/* ─── stat ──────────────────────────────────────────────────────── */
.stat .stat-num {
  font-family: var(--font-display); font-size: clamp(40px, 5vw, 64px);
  line-height: .95; letter-spacing: -0.04em; font-weight: 600;
}
.stat .stat-label { color: var(--muted); font-size: 13px; margin-top: 8px; max-width: 26ch; }
.stat .stat-unit { font-size: .5em; opacity: .7; margin-left: 2px; }

/* ─── quote ─────────────────────────────────────────────────────── */
.quote {
  font-family: var(--font-display); font-size: clamp(24px, 2.6vw, 34px);
  line-height: 1.32; letter-spacing: -0.01em; max-width: 30ch; margin: 0;
}
.quote-author { color: var(--muted); font-size: 14px; margin-top: var(--gap-md); }
.quote-mark { font-family: var(--font-display); font-size: 140px; line-height: .7; color: var(--accent); opacity: .18; margin-bottom: -28px; }

/* ─── pill / tag / status ───────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  background: var(--accent-soft); color: var(--accent); border-radius: 999px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em; text-transform: uppercase;
}
.tag {
  display: inline-flex; align-items: center; padding: 4px 10px; background: transparent;
  color: var(--muted); border: 1px solid var(--border); border-radius: 999px; font-size: 12px;
}
.status {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap;
}
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-ok     { background: var(--ok-soft);     color: var(--ok); }
.status-warn   { background: var(--warn-soft);   color: var(--warn); }
.status-danger { background: var(--danger-soft); color: var(--danger); }
.status-idle   { background: var(--fg-soft);     color: var(--muted); }

/* ─── forms ─────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); }
.input, .textarea, select.input {
  width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--fg); font: inherit; font-size: 15px;
}
.input:focus, .textarea:focus, select.input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.input[readonly] { background: var(--fg-soft); color: var(--muted); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.55; }

/* ─── table ─────────────────────────────────────────────────────── */
.ds-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ds-table th, .ds-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.ds-table th {
  color: var(--muted); font-weight: 500; font-family: var(--font-mono);
  font-size: 11px; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap;
}
.ds-table tbody tr:hover { background: var(--fg-soft); }
.ds-table .num-col { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; }
.ds-table .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; border-top: 1px solid var(--fg); }

/* ─── images ────────────────────────────────────────────────────── */
.content-img {
  display: block; max-width: 100%; max-height: min(70vh, 720px);
  width: auto; height: auto; object-fit: contain; border-radius: var(--radius-lg);
}

/* ─── dividers ──────────────────────────────────────────────────── */
.rule { border: 0; border-top: 1px solid var(--border); margin: 0; }
.rule-strong { border: 0; border-top: 1px solid var(--fg); margin: 0; }

/* ─── hero ──────────────────────────────────────────────────────── */
.hero { padding-block: clamp(56px, 9vw, 120px); }
.hero-center { text-align: center; max-width: 34ch; margin-inline: auto; }
.hero h1 { margin-bottom: var(--gap-md); }
.hero .lead { margin-bottom: var(--gap-lg); }
.hero-cta { display: inline-flex; gap: var(--gap-sm); flex-wrap: wrap; }
.hero-center .hero-cta { justify-content: center; }
.hero-split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap-xl); align-items: center; }
@media (max-width: 920px) { .hero-split { grid-template-columns: 1fr; } }

/* ─── log row ───────────────────────────────────────────────────── */
.log-row {
  display: grid; grid-template-columns: 120px 1fr 110px; gap: var(--gap-lg);
  padding: 22px 0; border-top: 1px solid var(--border); align-items: baseline;
}
.log-row h3 { font-size: 19px; }
.log-row .pull { text-align: right; }
@media (max-width: 920px) {
  .log-row { grid-template-columns: 1fr; gap: 6px; }
  .log-row .pull { text-align: left; }
}

/* ─── sample-data marker (honesty affordance, used by admin consoles) */
.sample-flag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted);
  border: 1px dashed var(--border); border-radius: 999px; padding: 3px 10px;
}
