/* ============================================================
   Design System Token — from design-claude-watermark.md 3.2
   Style: Technical-doc (NOT generic AI SaaS)
   ============================================================ */
:root {
  --bg: #FFFFFF;
  --surface: #F7F8FA;
  --text: #1A1D21;
  --text-muted: #5B6470;
  --accent: #2B6CB0;       /* single blue, no purple gradient */
  --border: #E3E6EA;
  --warn: #B7791F;
  --font-head: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --font-body: "Source Serif 4", Georgia, serif;
  --radius: 4px;
  --grid: 4px;
  --maxw: 1100px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-head);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  font-size: 16px;
}

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

/* Layout */
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; }
.brand { font-weight: 600; font-size: 18px; }
.nav { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: flex-end; }
.nav a { color: var(--text-muted); font-size: 14px; }
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); font-weight: 600; }

footer {
  border-top: 1px solid var(--border);
  margin-top: 64px;
  padding: 24px 0;
  color: var(--text-muted);
  font-size: 14px;
}
footer .container { display: flex; gap: 16px; flex-wrap: wrap; }

/* Hero — left aligned, NO centered hero + 3 cards */
.hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 32px;
  align-items: start;
  padding: 48px 0 32px;
}
.hero h1 { font-size: 32px; line-height: 1.2; margin: 0 0 12px; }
.hero .subhead { font-size: 18px; color: var(--text-muted); margin: 0 0 20px; }
.hero .benefits { list-style: none; padding: 0; margin: 0; }
.hero .benefits li {
  padding: 8px 0 8px 24px;
  position: relative;
  border-bottom: 1px solid var(--border);
}
.hero .benefits li::before { content: "→"; position: absolute; left: 0; color: var(--accent); }

/* Tool card (right side of hero) */
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.tool-card h3 { margin: 0 0 8px; font-size: 16px; }
.tool-card textarea {
  width: 100%; min-height: 120px;
  font-family: var(--font-mono); font-size: 13px;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px; resize: vertical;
}
.btn {
  display: inline-block; background: var(--accent); color: #fff;
  border: none; border-radius: var(--radius);
  padding: 10px 18px; font-size: 15px; cursor: pointer; font-family: var(--font-head);
}
.btn:hover { opacity: .92; text-decoration: none; }
.btn:disabled { cursor: not-allowed; opacity: .55; }
.btn-secondary {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
}

/* Nav cards (not decorative — real H2 + summary) */
.nav-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 24px 0 48px; }
.nav-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; background: var(--surface);
}
.nav-card h3 { margin: 0 0 6px; font-size: 16px; }
.nav-card p { margin: 0; color: var(--text-muted); font-size: 14px; }

/* Tool page result states */
.result { margin-top: 16px; padding: 12px; border-radius: var(--radius); font-size: 14px; }
.result.likely { background: #F0F4FF; border: 1px solid var(--accent); }
.result.not { background: var(--surface); border: 1px solid var(--border); }
.result.uncertain { background: #FFF8EB; border: 1px solid var(--warn); }
.disclaimer { font-size: 12px; color: var(--text-muted); margin-top: 8px; }
.error { color: #C53030; }

/* Article page */
.article-layout { display: grid; grid-template-columns: 240px 720px; gap: 32px; padding: 32px 0; }
.toc { font-size: 14px; position: sticky; top: 16px; align-self: start; }
.toc a { display: block; padding: 4px 0; color: var(--text-muted); }
.toc a:hover { color: var(--text); }
.article h1 { font-size: 28px; }
.article h2 { font-size: 21px; margin-top: 32px; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.article p, .article li { font-family: var(--font-body); font-size: 17px; }
.article table { width: 100%; border-collapse: collapse; margin: 16px 0; font-family: var(--font-head); font-size: 15px; }
.article th, .article td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
.article code, .article pre { font-family: var(--font-mono); background: var(--surface); padding: 2px 4px; border-radius: var(--radius); }
.faq details { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; margin: 8px 0; }
.faq summary { cursor: pointer; font-weight: 600; }

/* Legal page */
.legal { max-width: 720px; margin: 32px auto; padding: 0 16px; }
.legal h1 { font-size: 26px; }
.legal h2 { font-size: 19px; margin-top: 24px; }

/* Authentication and member account */
.auth-shell {
  min-height: calc(100vh - 180px);
  display: grid;
  place-items: start center;
  padding: 56px 16px;
}
.auth-shell-wide { align-items: start; }
.auth-panel {
  width: min(100%, 520px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  background: var(--bg);
}
.auth-shell-wide .auth-panel { width: min(100%, 680px); }
.auth-panel h1 { margin: 0 0 8px; font-size: 26px; }
.auth-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
}
.auth-intro { margin: 0 0 20px; color: var(--text-muted); }
.auth-command { width: 100%; }
.auth-status { min-height: 24px; margin: 16px 0 0; color: var(--text-muted); font-size: 14px; }
.auth-status.error { color: #C53030; }
.auth-recovery { margin: 20px 0 0; }
.auth-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.account-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 20px 0 0;
  border-top: 1px solid var(--border);
}
.account-details div { padding: 16px 0; border-bottom: 1px solid var(--border); }
.account-details div:nth-child(odd) { padding-right: 20px; }
.account-details dt { color: var(--text-muted); font-size: 13px; }
.account-details dd { margin: 4px 0 0; overflow-wrap: anywhere; font-weight: 600; }

/* Responsive — mobile */
@media (max-width: 768px) {
  .site-header .container { align-items: flex-start; flex-direction: column; gap: 8px; }
  .nav { justify-content: flex-start; width: 100%; }
  .hero { grid-template-columns: 1fr; }
  .nav-cards { grid-template-columns: 1fr; }
  .article-layout { grid-template-columns: 1fr; }
  .toc { position: static; }
  .hero h1 { font-size: 26px; }
  .auth-shell { padding: 32px 16px; }
  .account-details { grid-template-columns: 1fr; }
  .account-details div:nth-child(odd) { padding-right: 0; }
}

/* Phase 4 member interface */
.btn-danger { background: #B42318; }
.btn-danger:hover { background: #8F1D14; }
.nav-cards { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.auth-form { display: grid; gap: 8px; }
.auth-form label, .rewrite-controls label { font-size: 14px; font-weight: 600; }
.auth-form input, .rewrite-controls select {
  width: 100%; min-height: 42px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); color: var(--text); font: inherit; padding: 8px 10px;
}
.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--text-muted); font-size: 13px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.account-details progress { width: 100%; height: 8px; margin-top: 10px; accent-color: var(--accent); }
.account-menu { position: relative; display: inline-block; color: var(--text-muted); font-size: 14px; }
.account-menu summary { cursor: pointer; list-style: none; }
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu summary::after { content: "v"; margin-left: 4px; }
.account-menu-panel {
  position: absolute; z-index: 10; top: calc(100% + 8px); right: 0; min-width: 150px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg);
  box-shadow: 0 4px 12px rgba(26, 29, 33, .12); padding: 8px;
}
.account-menu-panel a, .account-menu-panel button {
  display: block; width: 100%; border: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 14px; padding: 8px; text-align: left;
}
.account-menu-panel button { cursor: pointer; }
.account-menu-panel a:hover, .account-menu-panel button:hover { background: var(--surface); text-decoration: none; }
.upgrade-notice, .account-billing, .account-danger-zone, .tool-separator { margin-top: 28px; border-top: 1px solid var(--border); padding-top: 20px; }
.upgrade-notice { color: var(--text-muted); }
.upgrade-notice h2, .account-billing h2, .account-danger-zone h2, .tool-separator h2 { color: var(--text); font-size: 18px; margin: 0 0 8px; }
.account-billing p { color: var(--text-muted); font-size: 14px; }
.account-danger-zone { max-width: 560px; }
.account-danger-zone p { color: var(--text-muted); font-size: 14px; }
.delete-confirmation { margin-top: 16px; border-left: 3px solid #B42318; padding-left: 12px; }
.rewrite-layout { padding-top: 40px; padding-bottom: 16px; }
.rewrite-header { max-width: 720px; margin-bottom: 24px; }
.rewrite-header h1 { margin: 0 0 8px; font-size: 28px; }
.rewrite-header p:last-child { margin: 0; color: var(--text-muted); }
.rewrite-notice, .rewrite-status {
  max-width: 920px; margin: 16px 0; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 12px;
}
.rewrite-notice p { margin: 0 0 12px; color: var(--text-muted); }
.rewrite-workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 280px); gap: 20px; max-width: 920px; align-items: start; }
.rewrite-input-column, .rewrite-controls, .rewrite-result { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); padding: 16px; }
.field-heading { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.field-heading label { font-size: 14px; font-weight: 600; }
.field-heading span { color: var(--text-muted); font-size: 13px; overflow-wrap: anywhere; }
.rewrite-input-column textarea, .rewrite-result textarea {
  display: block; width: 100%; min-height: 300px; margin-top: 10px; resize: vertical;
  border: 1px solid var(--border); border-radius: var(--radius); color: var(--text);
  font-family: var(--font-body); font-size: 16px; line-height: 1.55; padding: 12px;
}
.rewrite-result textarea { background: var(--surface); }
.rewrite-controls { display: grid; gap: 8px; margin: 0; min-width: 0; }
.rewrite-controls legend { padding: 0 4px; font-size: 15px; font-weight: 600; }
.field-hint { margin: 10px 0 0; color: var(--text-muted); font-size: 13px; }
.rewrite-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.rewrite-workspace > .rewrite-actions { grid-column: 1 / -1; }
.rewrite-status { font-size: 14px; }
.rewrite-status.error { border-color: #C53030; background: #FFF5F5; }
.rewrite-result { max-width: 920px; margin-top: 20px; }
.rewrite-result h2 { margin: 0; font-size: 18px; }
.tool-card-link { margin: 14px 0 0; font-size: 14px; }

@media (max-width: 768px) {
  .rewrite-layout { padding-top: 28px; }
  .rewrite-workspace { grid-template-columns: 1fr; }
  .rewrite-workspace > .rewrite-actions { grid-column: auto; }
  .rewrite-input-column textarea, .rewrite-result textarea { min-height: 240px; }
  .field-heading { align-items: flex-start; flex-direction: column; gap: 2px; }
  .account-menu-panel { right: auto; left: 0; }
}
