/* Rewritelyapp, Academic-vertical redesign
   Design system: cream canvas, purple ink, editorial serif headlines,
   tight grid, generous whitespace. Built to look like a scholarly press
   crossed with a Linear/Stripe-tier product. */

:root {
  --bg:        hsl(44 50% 97%);
  --bg-soft:   hsl(44 40% 94%);
  --bg-deep:   hsl(262 45% 12%);
  --paper:     #ffffff;

  --ink:       hsl(262 35% 10%);
  --ink-2:     hsl(262 12% 32%);
  --ink-3:     hsl(262 8% 52%);

  --brand:     hsl(262 70% 55%);
  --brand-dk:  hsl(262 70% 38%);
  --brand-soft:hsl(262 70% 96%);

  --accent:    hsl(36 88% 52%);     /* editorial gold for highlight */
  --good:      hsl(150 55% 38%);
  --warn:      hsl(28 90% 50%);
  --bad:       hsl(0 70% 50%);

  --border:    hsl(262 22% 88%);
  --border-2:  hsl(262 18% 80%);

  --serif: 'Source Serif Pro', 'Source Serif 4', 'Iowan Old Style', 'Georgia', serif;
  --sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono:  'JetBrains Mono', 'SF Mono', 'Menlo', monospace;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 24px;

  --shadow-sm: 0 1px 2px rgba(35, 18, 75, 0.04), 0 1px 1px rgba(35, 18, 75, 0.03);
  --shadow-md: 0 6px 24px -10px rgba(45, 22, 95, 0.18), 0 2px 6px -2px rgba(35, 18, 75, 0.06);
  --shadow-lg: 0 24px 60px -24px rgba(45, 22, 95, 0.30);

  --maxw: 1180px;
  --maxw-narrow: 760px;
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Source+Serif+4:opsz,wght@8..60,400;8..60,500;8..60,600;8..60,700&family=JetBrains+Mono:wght@400;500&display=swap');

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 .4em;
}
h1 { font-size: clamp(2.4rem, 4.5vw, 3.6rem); line-height: 1.08; letter-spacing: -0.022em; }
h2 { font-size: clamp(1.7rem, 2.6vw, 2.25rem); line-height: 1.18; letter-spacing: -0.018em; }
h3 { font-size: 1.25rem; line-height: 1.3; }
h4 { font-size: 1.02rem; font-family: var(--sans); font-weight: 600; }

p { margin: 0 0 1em; color: var(--ink-2); }
a { color: var(--brand-dk); text-decoration: none; }
a:hover { color: var(--brand); }

/* ───────── Layout primitives ───────── */
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }
.container.narrow { max-width: var(--maxw-narrow); }
.section { padding: 88px 0; }
.section.tight { padding: 56px 0; }
.eyebrow {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 18px;
  display: inline-block;
}
.lead { font-size: 1.18rem; color: var(--ink-2); line-height: 1.55; max-width: 62ch; }

/* ───────── Header ───────── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: hsla(44, 50%, 97%, 0.86);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 64px; max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }
.brand {
  font-family: var(--serif);
  font-size: 1.22rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.brand .mark {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--brand); color: white;
  font-family: var(--serif); font-weight: 700; font-size: 14px;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.12);
}
.nav-links { display: flex; gap: 30px; align-items: center; }
.nav-links a { color: var(--ink-2); font-size: 0.95rem; font-weight: 500; }
.nav-links a:hover { color: var(--ink); }
.nav-cta { display: flex; gap: 10px; align-items: center; }

/* ───────── Buttons ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px;
  border-radius: var(--r-md);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.96rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .08s ease, background .15s ease, box-shadow .15s ease, border .15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.btn-primary:hover { background: var(--brand-dk); border-color: var(--brand-dk); color: white; }
.btn-brand { background: var(--brand); color: white; border-color: var(--brand); }
.btn-brand:hover { background: var(--brand-dk); border-color: var(--brand-dk); color: white; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--border-2); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-link { background: transparent; color: var(--brand-dk); padding: 8px 0; }
.btn-link:hover { color: var(--brand); }
.btn-lg { padding: 14px 22px; font-size: 1rem; }
.btn-sm { padding: 8px 12px; font-size: 0.86rem; }

.kbd {
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 2px 6px;
  border: 1px solid var(--border-2);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--paper);
  color: var(--ink-2);
}

/* ───────── Cards & boxes ───────── */
.card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}
.card.flat { box-shadow: none; }
.callout {
  background: var(--brand-soft);
  border-left: 3px solid var(--brand);
  padding: 18px 22px;
  border-radius: 0 var(--r-md) var(--r-md) 0;
  color: var(--ink);
  font-size: 0.96rem;
}
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-soft);
  color: var(--ink-2);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
}
.tag.brand { background: var(--brand-soft); color: var(--brand-dk); border-color: hsl(262 50% 86%); }
.tag.good { background: hsl(150 50% 95%); color: var(--good); border-color: hsl(150 40% 80%); }
.tag.warn { background: hsl(36 80% 95%); color: hsl(28 70% 35%); border-color: hsl(36 70% 80%); }

/* ───────── Hero ───────── */
.hero {
  padding: 110px 0 80px;
  position: relative;
}
.hero h1 .underline { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 6px; text-underline-offset: 6px; }
.hero h1 em { font-style: italic; color: var(--brand-dk); }
.hero .lead { margin: 22px 0 32px; font-size: 1.22rem; }
.hero .cta-row { display: flex; gap: 12px; flex-wrap: wrap; }
.hero .meta-row { margin-top: 30px; display: flex; gap: 28px; flex-wrap: wrap; font-size: 0.88rem; color: var(--ink-3); }
.hero .meta-row span { display: inline-flex; align-items: center; gap: 7px; }
.hero .meta-row svg { width: 16px; height: 16px; color: var(--good); }

/* trust strip */
.trust-strip {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
  padding: 18px 0;
}
.trust-strip .row {
  display: flex; gap: 36px; flex-wrap: wrap; justify-content: center;
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-3);
  font-size: 0.94rem;
}
.trust-strip .row span { display: inline-flex; align-items: center; gap: 8px; }

/* ───────── Verticals grid ───────── */
.vertical-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(2, 1fr);
}
.vertical-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 30px;
  display: flex; flex-direction: column; gap: 16px;
  transition: transform .15s ease, box-shadow .15s ease, border .15s ease;
  text-decoration: none;
  color: inherit;
}
.vertical-card:hover { transform: translateY(-2px); border-color: var(--brand); box-shadow: var(--shadow-md); }
.vertical-card .v-head { display: flex; align-items: center; justify-content: space-between; }
.vertical-card .v-price { font-family: var(--mono); color: var(--ink-3); font-size: 0.86rem; }
.vertical-card h3 { font-size: 1.45rem; margin: 0; }
.vertical-card p { margin: 0; color: var(--ink-2); }
.vertical-card .v-foot { display: flex; gap: 10px; align-items: center; margin-top: 6px; }
.vertical-card .v-foot .arrow { color: var(--brand); }

/* ───────── Method / scientific blocks ───────── */
.method-grid { display: grid; gap: 24px; grid-template-columns: 1.05fr 1fr; align-items: start; }
.method-step {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 18px;
  padding: 18px 0;
  border-top: 1px solid var(--border);
}
.method-step:first-child { border-top: none; }
.method-step .num {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1rem;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  display: grid; place-items: center;
  margin-top: 2px;
}
.method-step h4 { margin: 0 0 6px; }
.method-step p { margin: 0; font-size: 0.95rem; }

/* ───────── Before/after diff viewer ───────── */
.diff {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.diff-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}
.diff-head .tabs { display: flex; gap: 4px; }
.diff-head .tab {
  font-size: 0.84rem; font-weight: 500;
  padding: 6px 12px; border-radius: var(--r-sm);
  color: var(--ink-3); cursor: pointer;
}
.diff-head .tab.active { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-sm); }
.diff-cols { display: grid; grid-template-columns: 1fr 1fr; }
.diff-col { padding: 22px 24px; }
.diff-col + .diff-col { border-left: 1px solid var(--border); background: hsl(150 45% 99%); }
.diff-col h5 {
  margin: 0 0 12px;
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
}
.diff-col p {
  font-family: var(--serif);
  font-size: 1.02rem;
  line-height: 1.65;
  color: var(--ink);
}
.diff-col .ins { background: hsl(150 60% 92%); padding: 0 3px; border-radius: 3px; box-shadow: inset 0 -2px 0 hsl(150 55% 75%); }
.diff-col .del { background: hsl(0 70% 95%); color: hsl(0 35% 35%); padding: 0 3px; border-radius: 3px; text-decoration: line-through; text-decoration-color: hsl(0 50% 60%); }
.diff-col .marker {
  display: inline-block; vertical-align: super;
  font-family: var(--mono); font-size: 0.66rem;
  color: var(--brand-dk); background: var(--brand-soft);
  padding: 1px 5px; border-radius: 4px; margin-left: 2px;
  cursor: help;
}
.diff-foot {
  border-top: 1px solid var(--border);
  padding: 14px 20px;
  background: var(--bg-soft);
  display: flex; gap: 18px; flex-wrap: wrap; align-items: center;
  font-size: 0.85rem; color: var(--ink-2);
}
.diff-foot strong { color: var(--ink); font-weight: 600; }

/* ───────── Score gauges ───────── */
.gauges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 12px; }
.gauge {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
}
.gauge .label { font-size: 0.78rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.gauge .val { font-family: var(--serif); font-size: 1.6rem; font-weight: 700; margin-top: 4px; color: var(--ink); }
.gauge .val .small { font-size: 0.9rem; color: var(--ink-3); font-family: var(--sans); font-weight: 500; }
.bar { height: 6px; background: var(--bg-soft); border-radius: 999px; margin-top: 10px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--good); }
.bar.warn > i { background: var(--warn); }
.bar.bad > i { background: var(--bad); }
.bar.brand > i { background: var(--brand); }

/* ───────── Citation block (EEAT) ───────── */
.citations {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px 22px;
  font-size: 0.88rem;
}
.citations h5 {
  font-family: var(--sans);
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-3); font-weight: 600; margin: 0 0 10px;
}
.citations ol { margin: 0; padding-left: 18px; color: var(--ink-2); }
.citations ol li { margin-bottom: 6px; line-height: 1.5; }
.citations ol li em { color: var(--ink); font-style: normal; font-weight: 600; }

/* ───────── Pricing ───────── */
.price-grid { display: grid; gap: 18px; grid-template-columns: repeat(3, 1fr); }
.price-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 32px 28px;
  display: flex; flex-direction: column;
  position: relative;
}
.price-card.feature {
  border-color: var(--ink);
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}
.price-card .ribbon {
  position: absolute; top: -10px; left: 24px;
  background: var(--ink); color: var(--bg);
  font-size: 0.74rem; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px;
}
.price-card h3 { font-family: var(--sans); font-size: 1rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 16px; }
.price-card .price { font-family: var(--serif); font-size: 2.6rem; font-weight: 600; color: var(--ink); line-height: 1; }
.price-card .price .per { font-family: var(--sans); font-size: 0.92rem; color: var(--ink-3); font-weight: 500; }
.price-card .pitch { color: var(--ink-2); margin: 14px 0 24px; font-size: 0.95rem; min-height: 48px; }
.price-card ul { list-style: none; padding: 0; margin: 0 0 28px; }
.price-card ul li { padding: 9px 0 9px 26px; position: relative; font-size: 0.94rem; color: var(--ink-2); border-top: 1px solid var(--border); }
.price-card ul li:first-child { border-top: none; }
.price-card ul li::before {
  content: ''; position: absolute; left: 0; top: 14px;
  width: 16px; height: 16px;
  background: var(--brand-soft);
  border-radius: 50%;
}
.price-card ul li::after {
  content: ''; position: absolute; left: 4px; top: 18px;
  width: 8px; height: 4px;
  border-left: 2px solid var(--brand-dk);
  border-bottom: 2px solid var(--brand-dk);
  transform: rotate(-45deg);
}
.price-card .btn { width: 100%; margin-top: auto; }

/* ───────── Footer ───────── */
.site-footer {
  background: var(--bg-deep);
  color: hsl(262 15% 78%);
  padding: 64px 0 32px;
  margin-top: 80px;
}
.site-footer .grid {
  display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 40px;
  max-width: var(--maxw); margin: 0 auto; padding: 0 28px;
}
.site-footer h5 {
  font-family: var(--sans);
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: hsl(262 25% 60%); margin: 0 0 16px;
}
.site-footer a { display: block; color: hsl(262 12% 80%); padding: 4px 0; font-size: 0.94rem; }
.site-footer a:hover { color: white; }
.site-footer .brand { color: white; margin-bottom: 12px; }
.site-footer .brand .mark { background: var(--accent); color: var(--bg-deep); }
.site-footer .blurb { font-size: 0.92rem; color: hsl(262 14% 72%); max-width: 36ch; }
.site-footer .bottom {
  max-width: var(--maxw); margin: 40px auto 0; padding: 24px 28px 0;
  border-top: 1px solid hsl(262 22% 22%);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  color: hsl(262 18% 60%); font-size: 0.84rem;
}

/* ───────── Editorial / proof ───────── */
.quote {
  font-family: var(--serif);
  font-size: 1.35rem;
  line-height: 1.45;
  color: var(--ink);
  font-style: italic;
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 22px;
  margin: 0 0 14px;
}
.quote-attr { font-size: 0.9rem; color: var(--ink-3); }
.quote-attr strong { color: var(--ink); font-weight: 600; }

.proof-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.proof-card { background: var(--paper); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 26px; }
.proof-card .stars { color: var(--accent); letter-spacing: 2px; font-size: 0.9rem; margin-bottom: 10px; }

/* ───────── App shell ───────── */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  background: var(--bg);
}
.app-side {
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.app-side .brand { padding: 6px 8px 18px; }
.app-side a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: 0.92rem; font-weight: 500;
}
.app-side a:hover { background: var(--paper); color: var(--ink); }
.app-side a.active { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-sm); }
.app-side a svg { width: 16px; height: 16px; }
.app-side .side-sec { margin-top: 18px; font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); padding: 8px 12px 4px; font-weight: 600; }
.app-side .quota {
  margin-top: auto;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px;
  font-size: 0.85rem;
}
.app-side .quota .lbl { color: var(--ink-3); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; }
.app-side .quota .val { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; margin: 4px 0 8px; }
.app-side .quota .bar { background: var(--bg-soft); }

.app-main { padding: 28px 36px 80px; }
.app-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.app-topbar h1 { font-size: 1.7rem; margin: 0; }
.app-topbar .sub { color: var(--ink-3); margin-top: 4px; font-size: 0.92rem; }

/* Task picker tiles */
.task-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; max-width: 880px; }
.task-tile {
  position: relative; overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 26px;
  text-decoration: none; color: inherit;
  display: flex; flex-direction: column; gap: 12px;
  min-height: 200px;
  transition: transform .12s, box-shadow .15s, border-color .15s;
}
.task-tile:hover { transform: translateY(-2px); border-color: var(--brand); box-shadow: var(--shadow-md); }
.task-tile.featured { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.task-tile.featured h3, .task-tile.featured p { color: var(--bg); }
.task-tile .ic { width: 36px; height: 36px; border-radius: 9px; background: var(--brand-soft); color: var(--brand-dk); display: grid; place-items: center; font-family: var(--serif); font-weight: 700; }
.task-tile.featured .ic { background: var(--accent); color: var(--ink); }
.task-tile h3 { margin: 0; font-size: 1.25rem; }
.task-tile p { margin: 0; color: var(--ink-3); font-size: 0.94rem; }
.task-tile.featured p { color: hsl(262 18% 78%); }
.task-tile .foot {
  margin-top: auto;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.84rem; color: var(--ink-3);
}
.task-tile.featured .foot { color: hsl(262 18% 78%); }
.task-tile .price-mark { font-family: var(--mono); font-size: 0.82rem; color: var(--brand-dk); background: var(--brand-soft); padding: 2px 8px; border-radius: 5px; }
.task-tile.featured .price-mark { background: var(--accent); color: var(--ink); }

/* App editor pane (statement/paper flow) */
.editor-grid { display: grid; grid-template-columns: 1fr 320px; gap: 22px; }
.editor {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  min-height: 540px;
  display: grid;
  grid-template-rows: auto 1fr auto;
}
.editor-toolbar {
  border-bottom: 1px solid var(--border);
  padding: 12px 18px;
  display: flex; gap: 8px; align-items: center; justify-content: space-between;
  background: var(--bg-soft);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.editor-toolbar .steps {
  display: flex; gap: 4px; align-items: center;
  font-size: 0.84rem; color: var(--ink-3);
}
.editor-toolbar .steps b { color: var(--ink); font-weight: 600; }
.editor-toolbar .steps .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); margin: 0 6px; opacity: .4; }
.editor-toolbar .steps .dot.active { background: var(--brand); opacity: 1; }
.editor-body {
  padding: 26px 32px;
  font-family: var(--serif);
  font-size: 1.06rem;
  line-height: 1.7;
  color: var(--ink);
  overflow: auto;
}
.editor-body .change {
  background: hsl(36 95% 92%);
  border-bottom: 2px solid hsl(36 80% 65%);
  padding: 0 2px;
  cursor: pointer;
}
.editor-body .change.ins { background: hsl(150 60% 92%); border-color: hsl(150 50% 60%); }
.editor-body .change.del { background: hsl(0 70% 95%); border-color: hsl(0 50% 70%); text-decoration: line-through; }
.editor-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.86rem; color: var(--ink-3);
}

.side-panel { display: flex; flex-direction: column; gap: 14px; }
.panel {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 18px;
}
.panel h5 {
  font-family: var(--sans);
  font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-3); margin: 0 0 12px; font-weight: 600;
}
.panel .row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 0.9rem; }
.panel .row b { color: var(--ink); font-weight: 600; }
.panel .strat { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.panel .strat .pill { font-size: 0.78rem; padding: 4px 9px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 999px; color: var(--ink-2); }
.panel .strat .pill.on { background: var(--brand-soft); color: var(--brand-dk); border-color: hsl(262 50% 86%); }

/* ───────── Tables ───────── */
table { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); }
th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); font-weight: 600; }

/* ───────── Article / legal pages ───────── */
.article { max-width: 720px; margin: 0 auto; }
.article h2 { margin-top: 2em; font-size: 1.5rem; }
.article h3 { margin-top: 1.6em; font-size: 1.18rem; }
.article p, .article li { font-family: var(--serif); font-size: 1.06rem; line-height: 1.7; color: var(--ink); }
.article li { margin-bottom: 8px; }
.article .meta { color: var(--ink-3); font-family: var(--sans); font-size: 0.86rem; margin-bottom: 24px; }

/* Blog list */
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.post-card { background: var(--paper); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.post-card .cover { height: 160px; background: linear-gradient(135deg, hsl(262 60% 75%), hsl(38 80% 80%)); }
.post-card .cover.b { background: linear-gradient(135deg, hsl(180 60% 75%), hsl(262 60% 80%)); }
.post-card .cover.c { background: linear-gradient(135deg, hsl(330 60% 80%), hsl(38 60% 80%)); }
.post-card .meta { padding: 18px 20px 0; color: var(--ink-3); font-size: 0.82rem; }
.post-card h3 { padding: 6px 20px 0; font-size: 1.18rem; line-height: 1.3; }
.post-card p { padding: 8px 20px 20px; color: var(--ink-2); font-size: 0.94rem; margin: 0; }

/* responsive */
@media (max-width: 900px) {
  .vertical-grid, .price-grid, .proof-grid, .post-grid, .editor-grid, .task-grid, .diff-cols { grid-template-columns: 1fr; }
  .method-grid { grid-template-columns: 1fr; }
  .site-footer .grid { grid-template-columns: 1fr 1fr; }
  .app-shell { grid-template-columns: 1fr; }
  .app-side { display: none; }
  .nav-links { display: none; }
}

/* ============================================================
   PHASE 2, Conversion components
   ============================================================ */

/* Proof table, detector pass-rate (the signature visual) */
.proof-table {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.proof-table .proof-head {
  background: var(--ink);
  color: var(--bg);
  padding: 20px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.proof-table .proof-head h3 { font-family: var(--serif); margin: 0; color: var(--bg); font-size: 1.1rem; }
.proof-table .proof-head .stamp {
  font-family: var(--mono); font-size: 0.78rem;
  color: hsl(262 18% 78%);
  background: hsla(0,0%,100%,0.06);
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid hsla(0,0%,100%,0.12);
}
.proof-table table { width: 100%; }
.proof-table table th, .proof-table table td { padding: 14px 18px; }
.proof-table table th { background: var(--bg-soft); color: var(--ink-3); font-size: 0.74rem; }
.proof-table table tbody tr:hover { background: var(--bg-soft); }
.proof-table .product-cell { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--ink); }
.proof-table .product-cell .logo { width: 22px; height: 22px; border-radius: 5px; background: var(--brand-soft); color: var(--brand-dk); display: grid; place-items: center; font-family: var(--serif); font-weight: 700; font-size: 11px; }
.proof-table .product-cell.ours { color: var(--brand-dk); }
.proof-table .product-cell.ours .logo { background: var(--brand); color: white; }
.proof-table .score { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.score.good { color: var(--good); }
.score.warn { color: var(--warn); }
.score.bad  { color: var(--bad); }
.score .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* Comparison table, vs- pages */
.compare {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.compare table { width: 100%; }
.compare th { padding: 18px 16px; font-size: 0.84rem; text-transform: none; letter-spacing: 0; color: var(--ink); font-weight: 600; border-bottom: 1px solid var(--border); }
.compare th.our { background: var(--brand-soft); color: var(--brand-dk); }
.compare td { padding: 14px 16px; vertical-align: top; border-bottom: 1px solid var(--border); font-size: 0.94rem; }
.compare td.feat { color: var(--ink-2); }
.compare td.our { background: hsl(262 70% 98%); color: var(--ink); }
.compare .yes { color: var(--good); font-weight: 600; }
.compare .no { color: var(--bad); font-weight: 600; }
.compare .meh { color: var(--warn); font-weight: 600; }

/* ICP toggle */
.icp-toggle {
  display: inline-flex;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  gap: 2px;
}
.icp-toggle button {
  border: none; background: transparent;
  padding: 8px 18px; font-size: 0.92rem; font-weight: 600;
  border-radius: 999px; cursor: pointer;
  color: var(--ink-3);
}
.icp-toggle button.active {
  background: var(--ink); color: var(--bg);
  box-shadow: var(--shadow-sm);
}

/* Live counter */
.live-counter {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px 6px 8px;
  font-size: 0.86rem;
  color: var(--ink-2);
  box-shadow: var(--shadow-sm);
}
.live-counter .pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 0 hsla(150, 55%, 38%, 0.6);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 hsla(150, 55%, 38%, 0.5); }
  70% { box-shadow: 0 0 0 10px hsla(150, 55%, 38%, 0); }
  100% { box-shadow: 0 0 0 0 hsla(150, 55%, 38%, 0); }
}
.live-counter strong { font-family: var(--serif); color: var(--ink); font-weight: 700; }

/* Verified badge */
.verified {
  display: inline-flex; align-items: center; gap: 4px;
  background: hsl(220 80% 96%);
  color: hsl(220 70% 38%);
  border: 1px solid hsl(220 60% 86%);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 600;
}
.verified::before { content: '✓'; font-size: 0.78rem; }

/* Paywall modal */
.modal-back {
  position: fixed; inset: 0;
  background: hsla(262, 30%, 12%, 0.6);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  z-index: 100;
}
.modal {
  width: min(560px, 92vw);
  background: var(--paper);
  border-radius: var(--r-xl);
  padding: 36px;
  box-shadow: var(--shadow-lg);
  position: relative;
}
.modal .close { position: absolute; top: 16px; right: 18px; background: transparent; border: none; font-size: 22px; color: var(--ink-3); cursor: pointer; }
.modal h3 { font-size: 1.6rem; margin-bottom: 10px; }
.modal .modal-actions { display: flex; gap: 10px; margin-top: 24px; }

/* Tool sandbox boxes */
.tool-input {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  min-height: 200px;
}
.tool-input textarea {
  width: 100%; min-height: 200px;
  border: none; resize: vertical;
  font-family: var(--serif); font-size: 1.02rem; line-height: 1.65;
  color: var(--ink); background: transparent;
  outline: none;
}
.tool-result {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 20px;
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.6;
}

/* Filter chips (examples / changelog) */
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  background: var(--paper);
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.86rem;
  color: var(--ink-2);
  cursor: pointer;
}
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip:hover:not(.active) { border-color: var(--ink); }

/* Changelog entry */
.changelog-entry {
  border-left: 3px solid var(--brand);
  padding: 4px 0 24px 22px;
  margin-left: 6px;
  position: relative;
}
.changelog-entry::before {
  content: ''; position: absolute;
  left: -8px; top: 6px;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--brand);
  border: 3px solid var(--bg);
}
.changelog-entry .v { font-family: var(--mono); font-size: 0.84rem; color: var(--brand-dk); font-weight: 600; }
.changelog-entry h4 { margin: 6px 0 8px; font-size: 1.05rem; }
.changelog-entry time { color: var(--ink-3); font-size: 0.82rem; }


/* ============================================================
   RESPONSIVE, Mobile & tablet hardening (added after rename)
   Targets:
   - all inline grid-template-columns: <N>fr <M>fr style="..."
   - tablet (≤ 900px), collapses 2/3-col grids
   - mobile (≤ 640px), typography, spacing, table scroll, nav
   - phone (≤ 420px), tighter still
   ============================================================ */

/* ---- Tablet & smaller (≤ 900px): aggressive collapse ---- */
@media (max-width: 900px) {
  .container, .container.narrow { padding: 0 20px; }
  .section { padding: 56px 0; }
  .section.tight { padding: 40px 0; }
  .hero { padding: 64px 0 48px; }

  /* Collapse every common multi-col layout, including inline ones */
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns: 1fr 1.6fr"],
  [style*="grid-template-columns: 1fr 2fr"],
  [style*="grid-template-columns: 1.05fr 1fr"],
  [style*="grid-template-columns: 1.4fr 1fr"],
  [style*="grid-template-columns: 1.5fr 1fr"],
  [style*="grid-template-columns: 2fr 1fr"],
  [style*="grid-template-columns: 1fr 320px"],
  [style*="grid-template-columns: 240px 1fr"],
  [style*="grid-template-columns: 80px 1fr"],
  [style*="grid-template-columns: repeat(3, 1fr)"],
  [style*="grid-template-columns: repeat(4, 1fr)"] {
    grid-template-columns: 1fr !important;
  }

  .nav { height: 56px; padding: 0 16px; }
  .nav-links { display: none; }
  .nav-cta .btn { padding: 8px 14px; font-size: 0.86rem; }
  .brand { font-size: 1.08rem; }

  /* App pages */
  .app-shell { grid-template-columns: 1fr; }
  .app-side { display: none; }
  .app-main { padding: 20px 18px 60px; }
  .app-topbar { flex-direction: column; align-items: flex-start; gap: 12px; }
  .app-topbar .sub { font-size: 0.86rem; }

  .editor-grid { grid-template-columns: 1fr !important; gap: 16px; }
  .editor-toolbar { flex-direction: column; align-items: flex-start; gap: 10px; padding: 12px 14px; }
  .editor-body { padding: 18px 20px; font-size: 0.98rem; }
  .editor-footer { flex-direction: column; align-items: flex-start; gap: 6px; padding: 12px 16px; font-size: 0.82rem; }

  /* Section paddings */
  .card { padding: 22px; }
  .price-card { padding: 26px 22px; }
  .price-card.feature { transform: none; }

  /* Diff viewer stacks */
  .diff-cols { grid-template-columns: 1fr; }
  .diff-col + .diff-col { border-left: none; border-top: 1px solid var(--border); }
  .diff-foot { flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px 16px; font-size: 0.82rem; }

  /* Footer */
  .site-footer .grid { grid-template-columns: 1fr 1fr; gap: 28px; padding: 0 20px; }
  .site-footer .bottom { flex-direction: column; align-items: flex-start; padding: 22px 20px 0; }

  /* Tables, horizontal scroll inside card */
  .card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .proof-table table, .compare table { min-width: 600px; }
  table { font-size: 0.86rem; }
  th, td { padding: 10px 12px; white-space: nowrap; }

  /* Diff/proof header tabs wrap */
  .diff-head, .proof-table .proof-head { flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px 16px; }
  .diff-head .tabs { overflow-x: auto; max-width: 100%; }
  .diff-head .tab { white-space: nowrap; }

  /* Hero CTA buttons full-width */
  .hero .cta-row { gap: 8px; }
  .hero .cta-row .btn { width: 100%; }
  .hero .meta-row { gap: 14px; font-size: 0.84rem; }

  /* Pricing card transforms reset */
  .price-card.feature .ribbon { left: 18px; }
  .price-card .price { font-size: 2.2rem; }

  /* Diff column padding */
  .diff-col { padding: 18px 20px; }

  /* Reduce huge headlines */
  h1 { font-size: clamp(1.9rem, 7vw, 2.6rem) !important; }
  h2 { font-size: clamp(1.4rem, 5vw, 1.9rem) !important; }
  .hero .lead, .lead { font-size: 1.04rem; }

  /* Method steps */
  .method-step { grid-template-columns: 28px 1fr; gap: 12px; padding: 14px 0; }
  .method-step .num { width: 26px; height: 26px; font-size: 0.86rem; }

  /* Trust strip */
  .trust-strip .row { gap: 18px; font-size: 0.86rem; }

  /* Task tiles in app picker */
  .task-grid { grid-template-columns: 1fr; }
  .task-tile { min-height: 0; padding: 22px; }

  /* Modal */
  .modal { padding: 28px 22px; width: calc(100% - 32px); }
  .modal .modal-actions { flex-direction: column; }
  .modal .modal-actions .btn { width: 100%; }

  /* Tool sandbox grids */
  .tool-input textarea { min-height: 160px; }

  /* Auth split, stack */
  body[data-page="auth"] > div,
  div[style*="grid-template-columns: 1fr 1fr"][style*="min-height"] {
    display: block !important;
  }

  /* Chip rows scroll */
  .chip-row { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
  .chip { white-space: nowrap; flex-shrink: 0; }

  /* Padding for any inline padded element */
  [style*="padding: 60px"] { padding: 32px 22px !important; }
  [style*="padding: 48px"] { padding: 28px 22px !important; }
  [style*="padding: 40px"] { padding: 24px 20px !important; }
  [style*="padding: 36px"] { padding: 24px 20px !important; }
  [style*="padding: 32px"] { padding: 22px 20px !important; }

  /* Quote scaling */
  .quote { font-size: 1.08rem; padding-left: 16px; }
}

/* ---- Phone (≤ 640px) ---- */
@media (max-width: 640px) {
  .container, .container.narrow { padding: 0 16px; }
  .section { padding: 44px 0; }
  .section.tight { padding: 32px 0; }
  .hero { padding: 44px 0 36px; }
  .card { padding: 18px; }

  .site-footer { padding: 44px 0 24px; margin-top: 56px; }
  .site-footer .grid { grid-template-columns: 1fr; gap: 24px; }

  /* Vertical card price line wraps */
  .vertical-card .v-head { flex-direction: column; align-items: flex-start; gap: 8px; }

  /* Hide ribbons on phones to stop overflow */
  .price-card.feature { padding-top: 36px; }

  /* Tighter app shell */
  .app-main { padding: 16px 14px 60px; }

  /* Smaller live counter */
  .live-counter { font-size: 0.78rem; padding: 4px 10px 4px 6px; }
  .live-counter .pulse { width: 6px; height: 6px; }

  /* Tag wrapping */
  .tag { font-size: 0.72rem; padding: 3px 8px; }

  /* App topbar tag overflow */
  .app-topbar div[style*="display: flex"] { flex-wrap: wrap; }

  /* Method/section spacing in legal pages */
  .article p, .article li { font-size: 1rem; line-height: 1.65; }
}

/* ---- Phone (≤ 420px) ---- */
@media (max-width: 420px) {
  .nav-cta { gap: 6px; }
  .nav-cta .btn { padding: 7px 10px; font-size: 0.82rem; }
  .nav-cta .btn-ghost { display: none; } /* keep only primary CTA */
  .brand { font-size: 1rem; }
  .brand .mark { width: 24px; height: 24px; font-size: 12px; }

  .hero { padding: 32px 0 28px; }
  .editor-body { font-size: 0.94rem; padding: 14px 16px; }
  .price-card .price { font-size: 1.8rem; }
  h1 { font-size: clamp(1.7rem, 8vw, 2.2rem) !important; }
}

/* ---- Touch targets ---- */
@media (hover: none) and (pointer: coarse) {
  .btn, .chip, summary, .nav-links a, .icp-toggle button {
    min-height: 44px;
  }
  .btn-sm { min-height: 36px; }
}

/* ---- Prevent horizontal scroll from any rogue element ---- */
html, body { overflow-x: hidden; max-width: 100%; }
img, svg, video { max-width: 100%; height: auto; }


/* ============================================================
   RESPONSIVE — broader catchall (added after audit)
   The earlier attribute selectors missed literal multi-fr patterns
   like "1fr 1fr 1fr". This catches anything with grid-template-columns.
   ============================================================ */

@media (max-width: 900px) {
  /* Catch every inline grid-template-columns — collapse to 1 column.
     Safe because already-1fr stays 1fr; safer for the long tail. */
  [style*="grid-template-columns"]:not(.app-shell) {
    grid-template-columns: 1fr !important;
  }
  /* App shell stays a special case (already handled above) */
  .app-shell { grid-template-columns: 1fr !important; }

  /* Flex rows with large gaps + align-items center → stack on mobile.
     This catches the app-billing annual-upgrade banner pattern. */
  [style*="display: flex"][style*="gap: 24px"][style*="align-items: center"],
  [style*="display: flex"][style*="gap: 40px"][style*="align-items: center"],
  [style*="display: flex"][style*="gap: 18px"][style*="align-items: center"] {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 14px !important;
  }
  /* Flex with justify-content: space-between often needs wrapping on mobile */
  [style*="display: flex"][style*="justify-content: space-between"] {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Stat rows (3-column metric grids) get tighter padding */
  .card [style*="grid-template-columns"] { gap: 12px !important; }
}


/* ============================================================
   RESPONSIVE — stronger mobile rules (round 3)
   Specifically catches app-billing patterns the earlier passes
   missed: button rows, plan-header rows, multi-button flex bars.
   ============================================================ */

@media (max-width: 900px) {

  /* Any inline flex inside a card stacks vertically on mobile */
  .card [style*="display: flex"]:not(.icp-toggle):not(.modal-actions) {
    flex-direction: column;
    align-items: stretch !important;
    gap: 12px !important;
  }
  .card [style*="display: flex"][style*="justify-content: space-between"] {
    flex-direction: row;            /* keep two-item rows side-by-side */
    flex-wrap: wrap;
    align-items: flex-start !important;
  }

  /* Button rows inside cards: every button full-width, no margin-left:auto */
  .card [style*="display: flex"][style*="gap: 10px"] .btn,
  .card [style*="display: flex"][style*="gap: 8px"] .btn,
  .card [style*="display: flex"][style*="gap: 12px"] .btn,
  .card [style*="display: flex"][style*="gap: 14px"] .btn {
    width: 100%;
    margin-left: 0 !important;
  }

  /* Topbar in every app page should stack */
  .app-topbar { align-items: flex-start; }
  .app-topbar > * { width: 100%; }

  /* Buttons row in app-topbar */
  .app-topbar [style*="display: flex"] { width: 100%; }
  .app-topbar [style*="display: flex"] .btn { flex: 1; }

  /* Make tables truly horizontally scrollable inside cards */
  .card { overflow-x: auto; }
  table { min-width: 480px; }
}


/* ============================================================
   PHASE 5 — Mobile app nav
   The sidebar is hidden ≤900px; this is the replacement.
   Bottom fixed tab bar with the 5 most-used destinations.
   ============================================================ */

.mobile-app-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--paper);
  border-top: 1px solid var(--border);
  z-index: 90;
  padding: 6px 0;
  padding-bottom: max(6px, env(safe-area-inset-bottom));
  box-shadow: 0 -2px 12px rgba(35, 18, 75, 0.06);
}
.mobile-app-nav .row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
}
.mobile-app-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 4px;
  text-decoration: none;
  color: var(--ink-3);
  font-size: 0.66rem;
  font-weight: 500;
  border-radius: var(--r-sm);
  text-align: center;
}
.mobile-app-nav a.active { color: var(--brand-dk); }
.mobile-app-nav a:hover { color: var(--ink); }
.mobile-app-nav .ic-wrap {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  color: currentColor;
}
.mobile-app-nav .ic-wrap svg { width: 20px; height: 20px; }

@media (max-width: 900px) {
  .mobile-app-nav { display: block; }
  /* Add bottom padding so content isn't hidden behind the tab bar */
  .app-shell .app-main { padding-bottom: 88px; }
}

/* Hamburger overlay for full nav (the rest of the side links) */
.mobile-app-more {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 86vw);
  background: var(--paper);
  border-left: 1px solid var(--border);
  z-index: 95;
  padding: 20px;
  transform: translateX(100%);
  transition: transform 0.2s ease;
  box-shadow: -8px 0 24px rgba(35, 18, 75, 0.12);
  overflow-y: auto;
}
.mobile-app-more.open { transform: translateX(0); }
.mobile-app-more .close {
  display: flex; justify-content: flex-end;
  margin-bottom: 14px;
}
.mobile-app-more a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  text-decoration: none;
  font-size: 0.94rem;
  font-weight: 500;
}
.mobile-app-more a.active { background: var(--brand-soft); color: var(--brand-dk); }
.mobile-app-more .side-sec {
  margin-top: 14px;
  font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-3); padding: 8px 12px 4px; font-weight: 600;
}
.mobile-app-more-back {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(35, 18, 75, 0.5);
  z-index: 94;
}
.mobile-app-more-back.open { display: block; }

