/* ============================================================
   PEDAL WRENCHER — "Workshop Performance" design system
   Hand-authored CSS (no build step). Served directly as
   /static/css/app.css.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Hanken+Grotesk:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  /* --- core neutrals (warm steel) --- */
  --ink:        oklch(0.21 0.018 256);
  --ink-2:      oklch(0.27 0.020 256);
  --ink-3:      oklch(0.34 0.018 256);
  --paper:      oklch(0.975 0.004 90);
  --surface:    oklch(1 0 0);
  --surface-2:  oklch(0.965 0.005 90);
  --line:       oklch(0.91 0.006 256);
  --line-2:     oklch(0.86 0.008 256);

  /* --- text --- */
  --text:       oklch(0.24 0.018 256);
  --text-2:     oklch(0.47 0.014 256);
  --text-3:     oklch(0.62 0.012 256);
  --on-ink:     oklch(0.97 0.004 90);
  --on-ink-2:   oklch(0.74 0.012 256);

  /* --- accent (Strava-lineage orange) --- */
  --accent:     #ff4d06;
  --accent-600: #e83f00;
  --accent-700: #c43500;
  --accent-soft: oklch(0.95 0.04 45);
  --accent-ink:  oklch(0.55 0.16 40);

  /* --- functional status --- */
  --ok:    oklch(0.66 0.15 155);
  --soon:  oklch(0.74 0.15 75);
  --due:   #ff4d06;
  --ok-soft:   oklch(0.95 0.05 155);
  --soon-soft: oklch(0.95 0.06 80);
  --due-soft:  oklch(0.95 0.045 45);

  /* --- geometry --- */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 30px;
  --maxw: 1140px;

  /* --- shadow --- */
  --sh-sm: 0 1px 2px rgba(20,24,31,.06), 0 1px 3px rgba(20,24,31,.04);
  --sh-md: 0 2px 6px rgba(20,24,31,.06), 0 8px 24px rgba(20,24,31,.06);
  --sh-lg: 0 4px 12px rgba(20,24,31,.08), 0 24px 60px rgba(20,24,31,.14);
  --sh-ink: 0 30px 80px rgba(8,11,16,.55);

  --ease: cubic-bezier(.2,.7,.2,1);

  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Hanken Grotesk', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

/* ---------- dark theme (dormant — no toggle shipped) ---------- */
[data-theme="dark"] {
  --paper:     oklch(0.19 0.018 256);
  --surface:   oklch(0.235 0.02 256);
  --surface-2: oklch(0.21 0.018 256);
  --line:      oklch(0.32 0.02 256);
  --line-2:    oklch(0.38 0.02 256);
  --text:      oklch(0.96 0.004 90);
  --text-2:    oklch(0.74 0.012 256);
  --text-3:    oklch(0.6 0.012 256);
  --sh-sm: 0 1px 2px rgba(0,0,0,.4);
  --sh-md: 0 2px 8px rgba(0,0,0,.4), 0 12px 30px rgba(0,0,0,.35);
  --sh-lg: 0 8px 30px rgba(0,0,0,.5), 0 30px 70px rgba(0,0,0,.5);
  --ok-soft:   oklch(0.32 0.06 155);
  --soon-soft: oklch(0.33 0.07 80);
  --due-soft:  oklch(0.33 0.07 40);
  --accent-soft: oklch(0.33 0.07 40);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent); color: #fff; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--text);
  text-wrap: balance;
}

p { margin: 0; text-wrap: pretty; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

.mono { font-family: var(--font-mono); font-feature-settings: "tnum" 1; }

/* ---------- layout helpers ---------- */
.page { min-height: 100vh; display: flex; flex-direction: column; background: var(--paper); }
.main { flex: 1; display: flex; flex-direction: column; }
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }
.flex { display: flex; }
.col { display: flex; flex-direction: column; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.center { display: flex; align-items: center; gap: 10px; }
.wfull { width: 100%; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-family: var(--font-display); font-weight: 600; font-size: 15px;
  letter-spacing: -0.01em;
  border: 1px solid transparent; border-radius: var(--r-sm);
  padding: 12px 20px; line-height: 1;
  transition: transform .15s var(--ease), background .18s var(--ease), box-shadow .18s var(--ease), border-color .18s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 0 rgba(0,0,0,.05), 0 6px 16px -6px var(--accent); }
.btn-primary:hover { background: var(--accent-600); box-shadow: 0 8px 22px -6px var(--accent); transform: translateY(-1px); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--line-2); box-shadow: var(--sh-sm); }
.btn-ghost:hover { border-color: var(--ink-3); transform: translateY(-1px); }
.btn-onink { background: rgba(255,255,255,.08); color: var(--on-ink); border-color: rgba(255,255,255,.16); backdrop-filter: blur(6px); }
.btn-onink:hover { background: rgba(255,255,255,.14); transform: translateY(-1px); }
.btn-sm { padding: 9px 14px; font-size: 13.5px; border-radius: 10px; }
.btn-lg { padding: 16px 26px; font-size: 17px; }
.btn-block { width: 100%; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-md);
}
.card-pad { padding: 30px; }

/* ---------- pills / badges ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  letter-spacing: 0.02em; padding: 5px 10px; border-radius: 999px;
  text-transform: uppercase; white-space: nowrap;
}
.pill-due  { background: var(--due-soft);  color: var(--accent-ink); }
.pill-soon { background: var(--soon-soft);  color: oklch(0.5 0.13 70); }
.pill-ok   { background: var(--ok-soft);    color: oklch(0.46 0.13 155); }
.pill-plain { background: var(--surface-2); color: var(--text-2); text-transform: none; }
.dot { width: 7px; height: 7px; border-radius: 999px; flex-shrink: 0; }

/* status text colors */
.txt-due  { color: var(--accent); }
.txt-soon { color: oklch(0.5 0.13 70); }
.txt-ok   { color: oklch(0.46 0.13 155); }

/* eyebrow / kicker */
.eyebrow {
  font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-3);
}

/* section label for tables */
.thlabel {
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3);
}

/* inputs */
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label, label.label { font-weight: 600; font-size: 13.5px; color: var(--text); }
.input {
  background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: 11px; padding: 12px 14px; font-size: 15px; color: var(--text);
  transition: border-color .15s, box-shadow .15s, background .15s;
  width: 100%;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
.input::placeholder { color: var(--text-3); }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; }
textarea.input { resize: vertical; }

/* mini number input used in part rows */
.numin {
  background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: 9px; padding: 8px 11px; font-size: 14px; color: var(--text);
  font-family: var(--font-mono); width: 130px;
  transition: border-color .15s, box-shadow .15s;
}
.numin:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* native checkbox tinted to accent */
.check { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }

/* link-ish actions */
.act { font-size: 13.5px; font-weight: 600; color: var(--text-3); transition: color .15s; cursor: pointer; white-space: nowrap; background: none; border: none; padding: 0; }
.act:hover { color: var(--text); }
.act-accent { color: var(--accent); }
.act-accent:hover { color: var(--accent-600); }

/* ---------- wear gauge (bar) ---------- */
.gauge { position: relative; height: 12px; border-radius: 999px; background: var(--surface-2);
         box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.gauge-fill { position: absolute; inset: 0 auto 0 0; border-radius: 999px;
              transition: width 1.1s var(--ease); }
.gauge-fill.ok   { background: linear-gradient(90deg, oklch(0.7 0.15 155), var(--ok)); }
.gauge-fill.soon { background: linear-gradient(90deg, oklch(0.78 0.15 80), var(--soon)); }
.gauge-fill.due  { background: linear-gradient(90deg, #ff6a2b, var(--accent)); }
.gauge-ticks { position: absolute; inset: 0; display: flex; justify-content: space-between; pointer-events: none; }
.gauge-ticks span { width: 1px; background: var(--line-2); opacity: .6; }

/* ---------- health ring ---------- */
.ring { position: relative; flex-shrink: 0; display: inline-grid; }
.ring svg { transform: rotate(-90deg); }
.ring-label { position: absolute; inset: 0; display: grid; place-items: center;
              font-family: var(--font-mono); font-weight: 700; color: var(--text); }

/* ---------- focus visible ---------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- entrance animation (transform-only: never hides content) ---------- */
@keyframes rise { from { transform: translateY(16px); } to { transform: none; } }
.rise { animation: rise .6s var(--ease) both; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001s !important; transition-duration: .001s !important; }
}

/* scrollbar (webkit) */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; border: 3px solid var(--paper); }

/* ---------- table ---------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; padding: 0 0 14px; }
.tbl td { padding: 16px 0; border-top: 1px solid var(--line); font-size: 15px; }
.tbl tr:first-child td { border-top: none; }
.tbl .right { text-align: right; }
.table-card { padding: 12px 30px 18px; overflow-x: auto; }

/* ============================================================
   NAV
   ============================================================ */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--paper);
  border-bottom: 1px solid transparent;
  transition: border-color .2s, background .2s;
}
.site-header.scrolled {
  background: color-mix(in oklch, var(--paper) 82%, transparent);
  backdrop-filter: blur(12px) saturate(1.4);
  border-bottom-color: var(--line);
}
.site-header .bar { height: 74px; }
.wordmark { display: inline-flex; align-items: center; gap: 11px; background: none; border: none; padding: 0; }
.wordmark span { font-family: var(--font-display); font-weight: 700; font-size: 21px; letter-spacing: -0.02em; color: var(--text); }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-link { background: none; border: 1px solid transparent; color: var(--text-2); font-family: var(--font-body); font-weight: 600; font-size: 15px; padding: 9px 15px; border-radius: 10px; transition: color .15s, background .15s; white-space: nowrap; }
.nav-link:hover { color: var(--text); }
.nav-link.active { background: var(--surface); border-color: var(--line); box-shadow: var(--sh-sm); color: var(--text); }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer { border-top: 1px solid var(--line); margin-top: auto; padding: 26px 0; background: var(--paper); }
.site-footer .inner { flex-wrap: wrap; row-gap: 14px; }
.site-footer .links { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.foot-meta { color: var(--text-2); font-weight: 600; font-size: 14.5px; }
.foot-link { background: none; border: none; color: var(--text-2); font-weight: 600; font-size: 14.5px; padding: 0; }
.foot-link:hover { color: var(--accent); }

/* ============================================================
   HERO + landing structures
   ============================================================ */
.hero-shell { position: relative; overflow: hidden; border-radius: var(--r-xl);
  background: linear-gradient(160deg, var(--ink-2), var(--ink) 60%); box-shadow: var(--sh-lg); }
.hero-grid { position: relative; display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 50px;
  padding: clamp(34px, 5vw, 68px); align-items: center; }
.hero-tex { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .5; }
.hero-badge { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 12.5px;
  font-weight: 600; letter-spacing: 0.06em; color: #ffb595; background: rgba(255,77,6,.13);
  border: 1px solid rgba(255,77,6,.3); padding: 7px 13px; border-radius: 999px; text-transform: uppercase; }
.hero h1 { color: var(--on-ink); font-size: clamp(40px, 6vw, 70px); line-height: .98; margin-top: 24px; }
.hero-sub { color: var(--on-ink-2); font-size: 19px; line-height: 1.55; margin-top: 22px; max-width: 480px; }
.hero-fine { color: var(--on-ink-2); font-size: 14px; margin-top: 22px; font-family: var(--font-mono); }

/* floating product card */
.product-card { background: var(--surface); border-radius: var(--r-lg); padding: 24px;
  box-shadow: var(--sh-ink); border: 1px solid var(--line); position: relative; }
.product-toast { position: absolute; top: -22px; right: 18px; z-index: 3; background: var(--accent); color: #fff;
  border-radius: 12px; padding: 10px 14px; font-weight: 700; font-size: 13.5px; font-family: var(--font-display);
  box-shadow: 0 12px 30px -8px rgba(255,77,6,.7); display: flex; align-items: center; gap: 9px; }

/* divided spec rows */
.divided-grid { display: grid; grid-template-columns: repeat(3,1fr); border-top: 1px solid var(--line-2); }
.why-cell { padding: 30px 30px 30px 0; border-left: 1px solid var(--line); padding-left: 30px; }
.why-cell:first-child { border-left: none; padding-left: 0; }
.why-cell .num { font-family: var(--font-display); font-weight: 700; font-size: 30px; color: var(--line-2); letter-spacing: -0.03em; margin-bottom: 18px; }

/* dark steps band */
.dark-band { background: var(--ink); position: relative; overflow: hidden; padding: 72px 0; }
.steps-grid { display: grid; grid-template-columns: repeat(3,1fr); border-top: 1px solid rgba(255,255,255,.14); }
.step-cell { padding: 28px 28px 28px 0; border-left: 1px solid rgba(255,255,255,.14); padding-left: 28px; position: relative; }
.step-cell:first-child { border-left: none; padding-left: 0; }
.step-cell .knob { position: absolute; top: -8px; left: 28px; width: 15px; height: 15px; border-radius: 999px;
  background: var(--accent); box-shadow: 0 0 0 5px var(--ink); }
.step-cell:first-child .knob { left: 0; }
.step-cell .num { font-family: var(--font-display); font-weight: 700; font-size: 40px; color: rgba(255,255,255,.16); letter-spacing: -0.04em; line-height: 1; }
.protip { display: flex; align-items: center; gap: 12px; margin-top: 44px; padding: 16px 20px; background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.12); border-radius: var(--r-md); flex-wrap: wrap; }
.code-chip { font-family: var(--font-mono); color: var(--on-ink); background: rgba(255,77,6,.16); padding: 2px 8px; border-radius: 6px; }

/* ---------- page header (interior pages) ---------- */
.page-head { margin-bottom: 30px; }
.page-head h1 { font-size: clamp(34px, 5vw, 54px); line-height: 1.02; }
.page-head .sub { color: var(--text-2); font-size: 18px; margin-top: 14px; max-width: 620px; }
.back-link { display: inline-block; margin-bottom: 18px; font-family: var(--font-mono); font-size: 13px; }

/* ---------- grids ---------- */
.trio { display: grid; grid-template-columns: repeat(2,1fr); gap: 20px; }
.adminstats { display: grid; grid-template-columns: repeat(5,1fr); gap: 14px; }
.stat-card { padding: 24px 20px; text-align: center; }
.stat-card .n { font-family: var(--font-display); font-weight: 700; font-size: 42px; letter-spacing: -0.03em; }

/* admin tabs */
.tab { background: none; color: var(--text-2); border: none; font-family: var(--font-body); font-weight: 600; font-size: 15px; padding: 8px 15px; border-radius: 10px; transition: all .15s; white-space: nowrap; }
.tab.active { background: var(--accent); color: #fff; }

/* faq accordion (CSS-only via <details>) */
.faq-item { padding: 0; overflow: hidden; }
.faq-item > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 22px 26px; cursor: pointer; }
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item summary .q { font-family: var(--font-display); font-weight: 700; font-size: 19px; }
.faq-item summary .plus { font-size: 22px; color: var(--accent); transition: transform .25s var(--ease); flex-shrink: 0; line-height: 1; }
.faq-item[open] summary .plus { transform: rotate(45deg); }
.faq-item .a { padding: 0 26px 24px; color: var(--text-2); font-size: 16.5px; line-height: 1.6; max-width: 640px; }

/* blog */
.post-card { padding: 28px; text-align: left; display: block; width: 100%; transition: transform .15s var(--ease), box-shadow .2s; }
.post-card:hover { transform: translateY(-2px); box-shadow: var(--sh-lg); }
.prose { color: var(--text); font-size: 18.5px; line-height: 1.7; }
.prose p { margin-bottom: 22px; }
.prose h2, .prose h3 { margin: 28px 0 14px; }
.prose h2 { font-size: 28px; } .prose h3 { font-size: 24px; }
.prose ul, .prose ol { margin: 0 0 22px; padding-left: 22px; }
.prose li { margin-bottom: 8px; }
.prose a { color: var(--accent); text-decoration: underline; }
.prose strong { color: var(--text); }
.prose blockquote { border-left: 3px solid var(--accent); padding-left: 20px; margin: 30px 0; font-style: italic; color: var(--text-2); font-size: 20px; }
.prose code { font-family: var(--font-mono); font-size: .85em; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; }

/* empty state */
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 48px 0; text-align: center; }
.empty .badge-ico { width: 56px; height: 56px; border-radius: 999px; background: var(--surface-2); display: grid; place-items: center; font-size: 24px; }
.empty p.lead { font-weight: 700; font-family: var(--font-display); font-size: 18px; color: var(--text); }
.empty p.note { color: var(--text-2); font-size: 15px; max-width: 380px; }

/* flash */
.flash { margin-bottom: 24px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent-ink);
  border: 1px solid color-mix(in oklch, var(--accent) 25%, transparent); padding: 13px 18px; font-weight: 600; font-size: 14.5px; }

/* part row */
.part-row { padding: 22px 0; border-top: 1px solid var(--line); }
.part-fields { display: flex; align-items: center; gap: 20px; margin-top: 16px; flex-wrap: wrap; }
.part-fields .field { width: 130px; gap: 6px; }
.part-fields .field label { font-size: 12px; color: var(--text-3); font-weight: 600; }

/* toggle */
.toggle { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; }
.toggle .track { width: 38px; height: 22px; border-radius: 999px; padding: 2px; display: flex; background: var(--line-2); transition: background .2s var(--ease); }
.toggle input { display: none; }
.toggle .knob { width: 18px; height: 18px; border-radius: 999px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s var(--ease); }
.toggle input:checked + .track { background: var(--accent); }
.toggle input:checked + .track .knob { transform: translateX(16px); }
.toggle .lbl { font-size: 14px; font-weight: 600; color: var(--text-2); white-space: nowrap; }

/* utility spacing */
.sticky-save { position: sticky; bottom: 16px; display: flex; justify-content: flex-end; z-index: 5; }

/* big 404 */
.big404 { font-family: var(--font-display); font-weight: 700; font-size: clamp(90px, 18vw, 180px); line-height: 1; color: var(--accent); letter-spacing: -0.04em; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; }
  .nav-links { gap: 0; }
  .nav-link { font-size: 14px; padding: 8px 10px; }
}
@media (max-width: 840px) {
  .trio { grid-template-columns: 1fr; }
  .adminstats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .divided-grid, .steps-grid { grid-template-columns: 1fr; }
  .why-cell { border-left: none; padding-left: 0; border-top: 1px solid var(--line); }
  .why-cell:first-child { border-top: none; }
  .step-cell { border-left: none; padding-left: 0; border-top: 1px solid rgba(255,255,255,.14); }
  .step-cell .knob { left: 0; }
  .nav-hideable { display: none; }
}
@media (max-width: 720px) {
  .wrap { padding: 0 18px; }
}
