/* OptSEO — legal pages (terms.html, privacy.html, refund.html) and the
   OptSEO-Checker page (checker.html), which uses the same document layout.
   ------------------------------------------------------------------------
   Built on tokens/tokens.css (generated from tokens/tokens.json); every
   colour, size and radius here is a --opt-* token, so the pages switch theme
   with the rest of the site. The header copies landing.css's nav look with
   none of the landing page's hero or audit code.

   CSP: style-src 'self' + Google Fonts, no 'unsafe-inline'. No style=""
   attributes in the pages; everything lives here. */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--opt-bg);
  color: var(--opt-text);
  font-family: var(--opt-font-sans);
  font-size: var(--opt-fs-base);
  line-height: var(--opt-lh-normal);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

a { color: var(--opt-accent); text-underline-offset: 3px; }
a:hover { color: var(--opt-accent-strong); }
::selection { background: var(--opt-accent); color: var(--opt-bg); }

:where(a, button, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--opt-accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -200%;
  z-index: 100;
  padding: 12px 18px;
  border-radius: var(--opt-radius-pill);
  background: var(--opt-btn-bg);
  color: var(--opt-btn-ink);
  font-weight: var(--opt-fw-semibold);
  font-size: 14px;
  text-decoration: none;
}
.skip-link:focus-visible { top: 12px; }

/* ---- nav (same look as landing.css .nav) ------------------------------ */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  background: var(--opt-nav-bg);
  border-bottom: 1px solid var(--opt-border-soft);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1160px;
  margin: 0 auto;
  padding: 14px var(--opt-space-gutter);
}
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a {
  font-size: 14.5px;
  color: var(--opt-text-soft);
  text-decoration: none;
  transition: color var(--opt-duration-fast) var(--opt-ease-out);
}
.nav-links a:hover,
.nav-links a[aria-current="page"] { color: var(--opt-text-bright); }
.nav-links a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--opt-accent-line); }
.nav-actions { display: flex; align-items: center; gap: 12px; }

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand__name {
  font-weight: var(--opt-fw-bold);
  font-size: 19px;
  letter-spacing: var(--opt-ls-tight);
  color: var(--opt-text-bright);
}
.brand-ring {
  width: 1.1em;
  height: 1.1em;
  font-size: 19px;
  border-radius: 50%;
  border: 1.5px solid var(--opt-accent);
  flex: 0 0 auto;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--opt-radius-pill);
  border: 1px solid var(--opt-border);
  background: var(--opt-surface);
  color: var(--opt-text-soft);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--opt-text-bright); border-color: var(--opt-border-input); }
.theme-toggle svg { width: 18px; height: 18px; display: block; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="dark"]) .theme-toggle .icon-moon { display: block; }
}

.btn-accent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: var(--opt-radius-pill);
  background: var(--opt-btn-bg);
  color: var(--opt-btn-ink);
  font-weight: var(--opt-fw-semibold);
  font-size: 14.5px;
  white-space: nowrap;
  text-decoration: none;
  box-shadow: 0 0 36px -10px var(--opt-btn-glow);
}
.btn-accent:hover { background: var(--opt-btn-bg-hover); color: var(--opt-btn-ink); }

/* ---- draft banner ------------------------------------------------------ */

.draft-banner {
  border-bottom: 1px solid var(--opt-warn-line);
  background: var(--opt-warn-bg);
  color: var(--opt-text);
}
.draft-banner__inner {
  max-width: 760px;
  margin: 0 auto;
  padding: var(--opt-space-4) var(--opt-space-gutter);
  display: flex;
  gap: var(--opt-space-3);
  align-items: flex-start;
  font-size: var(--opt-fs-md);
}
.draft-banner__glyph {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border-radius: 50%;
  border: 1.5px solid var(--opt-warn);
  color: var(--opt-warn);
  font-weight: var(--opt-fw-bold);
  font-size: 13px;
  line-height: 1;
}
.draft-banner strong { color: var(--opt-warn); }
.draft-banner p { margin: 0; }

/* ---- document ---------------------------------------------------------- */

.doc {
  max-width: 760px;
  margin: 0 auto;
  padding: var(--opt-space-7) var(--opt-space-gutter) var(--opt-space-8);
}

.doc h1 {
  margin: 0 0 var(--opt-space-3);
  font-weight: var(--opt-fw-semibold);
  font-size: var(--opt-fs-2xl);
  line-height: var(--opt-lh-tight);
  letter-spacing: var(--opt-ls-tight);
  color: var(--opt-text-bright);
}
.doc__meta { margin: 0 0 var(--opt-space-6); color: var(--opt-text-dim); font-size: var(--opt-fs-sm); }
.doc__lede { font-size: var(--opt-fs-lg); color: var(--opt-text-soft); line-height: var(--opt-lh-relaxed); }

.doc h2 {
  margin: var(--opt-space-7) 0 var(--opt-space-3);
  padding-top: var(--opt-space-2);
  font-weight: var(--opt-fw-semibold);
  font-size: var(--opt-fs-xl);
  line-height: var(--opt-lh-snug);
  letter-spacing: var(--opt-ls-snug);
  color: var(--opt-text-bright);
  scroll-margin-top: 88px;
}
.doc h3 {
  margin: var(--opt-space-5) 0 var(--opt-space-2);
  font-weight: var(--opt-fw-semibold);
  font-size: var(--opt-fs-base);
  color: var(--opt-text-bright);
}
.doc p,
.doc li { color: var(--opt-text-soft); line-height: var(--opt-lh-relaxed); }
.doc li + li { margin-top: var(--opt-space-2); }
.doc strong { color: var(--opt-text); }

.toc {
  margin: var(--opt-space-5) 0 0;
  padding: var(--opt-space-4) var(--opt-space-5);
  border: 1px solid var(--opt-border);
  border-radius: var(--opt-radius-md);
  background: var(--opt-surface);
}
.toc__title { margin: 0 0 var(--opt-space-2); font-weight: var(--opt-fw-semibold); font-size: var(--opt-fs-sm); color: var(--opt-text); }
.toc ol { margin: 0; padding-left: 1.3em; columns: 2 220px; column-gap: var(--opt-space-6); }
.toc li { font-size: var(--opt-fs-sm); }
.toc li + li { margin-top: 4px; }

/* Text the owner or a lawyer still has to supply. Loud on purpose. */
.ph {
  padding: 0 4px;
  border-radius: 4px;
  background: var(--opt-warn-bg);
  outline: 1px dashed var(--opt-warn-line);
  color: var(--opt-warn);
  font-family: var(--opt-font-mono);
  font-size: 0.9em;
  overflow-wrap: anywhere;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.callout {
  margin: var(--opt-space-5) 0;
  padding: var(--opt-space-4) var(--opt-space-5);
  border-left: 3px solid var(--opt-accent);
  border-radius: 0 var(--opt-radius-sm) var(--opt-radius-sm) 0;
  background: var(--opt-accent-soft);
}
.callout p { margin: 0; color: var(--opt-text); }
.callout p + p { margin-top: var(--opt-space-2); }

.review-note {
  margin: var(--opt-space-3) 0;
  font-size: var(--opt-fs-sm);
  color: var(--opt-warn);
}

.price-table { width: 100%; border-collapse: collapse; margin: var(--opt-space-4) 0; font-size: var(--opt-fs-md); }
.price-table th,
.price-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--opt-border); color: var(--opt-text-soft); }
.price-table th { color: var(--opt-text); font-weight: var(--opt-fw-semibold); }

/* Inline code and copyable blocks (checker.html: the User-Agent string,
   the robots.txt example). Wraps instead of scrolling the page sideways. */
.doc code {
  font-family: var(--opt-font-mono);
  font-size: 0.9em;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--opt-surface-inset);
  color: var(--opt-text);
  overflow-wrap: anywhere;
}
.code-block {
  margin: var(--opt-space-3) 0 var(--opt-space-4);
  padding: var(--opt-space-4) var(--opt-space-5);
  border: 1px solid var(--opt-border);
  border-radius: var(--opt-radius-md);
  background: var(--opt-surface);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.code-block code { padding: 0; background: none; font-size: var(--opt-fs-md); color: var(--opt-text-bright); }

/* ---- footer ------------------------------------------------------------ */

.site-footer {
  padding: var(--opt-space-6) var(--opt-space-gutter);
  border-top: 1px solid var(--opt-border-soft);
  background: var(--opt-bg-alt);
}
.site-footer__inner {
  max-width: 1160px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--opt-space-4) var(--opt-space-6);
  font-size: 14px;
  color: var(--opt-text-dim);
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: var(--opt-space-5); }
.site-footer a { color: var(--opt-text-dim); text-decoration: none; }
.site-footer a:hover,
.site-footer a[aria-current="page"] { color: var(--opt-text); }
.site-footer p { margin: 0; }

/* ---- responsive (gutter never below 16px) ------------------------------ */

@media (max-width: 900px) {
  :root { --opt-space-gutter: 24px; }
}
@media (max-width: 560px) {
  .nav-inner { flex-wrap: wrap; gap: 12px 16px; padding: 12px var(--opt-space-gutter); }
  .nav-links { order: 3; width: 100%; gap: 20px; flex-wrap: wrap; }
  .nav-links a { font-size: 13.5px; }
  .doc { padding-top: var(--opt-space-6); }
  .price-table th,
  .price-table td { padding: 8px 6px; }
}
@media (max-width: 400px) {
  :root { --opt-space-gutter: 16px; }
  .nav-actions { gap: 8px; }
  .nav-actions .btn-accent { padding: 10px 14px; font-size: 13.5px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

@media print {
  .nav, .skip-link, .site-footer nav, .theme-toggle { display: none; }
  body { background: #fff; color: #000; }
  .doc p, .doc li { color: #000; }
}
