/* TextStyler - style.css: design tokens, reset, layout chrome, prose, footer.
   Common styles shared by every page. Colours are CSS variables; the dark
   scheme is applied via [data-theme] (set by assets/js/theme.js) with a
   system-preference fallback in responsive.css. Media queries live in
   responsive.css so breakpoints are easy to audit in one place. */

:root {
  --bg: #FFFFFF;
  --surface: #F6F7FB;
  --border: #E3E6EE;
  --text: #14161C;
  --muted: #5B6475;
  --accent: #5B5BD6;
  --accent-contrast: #FFFFFF;
  --success: #1E9E5A;
  --success-text: #14713F;   /* darker green: 4.5:1 on light backgrounds */
  --badge-wide-bg: #E7F6EE;
  --badge-wide-text: #14713F;
  --badge-limited-bg: #FBF3E4;
  --badge-limited-text: #7A5200;
  --shadow: 0 1px 2px rgba(20, 22, 28, 0.05);
  --radius: 14px;
  --max-w: 1120px;
  --font-ui: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-out: system-ui, 'Segoe UI Symbol', 'Apple Symbols', 'Noto Sans Math',
    'Noto Sans Symbols 2', sans-serif;
  color-scheme: light dark;
}

/* Manual dark theme (toggle stores the choice in localStorage). */
:root[data-theme="dark"] {
  --bg: #0F1115;
  --surface: #181B22;
  --border: #2A2F3A;
  --text: #F2F4F8;
  --muted: #9AA3B2;
  --accent: #8B8BFF;
  --accent-contrast: #0F1115;
  --success: #4CD38A;
  --success-text: #4CD38A;
  --badge-wide-bg: #1C3327;
  --badge-wide-text: #4CD38A;
  --badge-limited-bg: #332A14;
  --badge-limited-text: #E8B34B;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

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

img, svg { display: block; max-width: 100%; }

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

h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5em; }

h1 { font-size: clamp(1.7rem, 4.5vw, 2.5rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.25rem, 3vw, 1.55rem); margin-top: 2em; letter-spacing: -0.01em; }
h3 { font-size: 1.05rem; }

p { margin: 0 0 1em; }

.wrap { max-width: var(--max-w); margin: 0 auto; padding: 0 16px; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
}

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: var(--accent-contrast);
  padding: 10px 16px; border-radius: 0 0 8px 0; z-index: 100;
}
.skip:focus { left: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ------------------------------------------------------------- header */

.site-head {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.head-row {
  display: flex; align-items: center; gap: 18px;
  min-height: 58px;
}

.logo {
  font-weight: 800; font-size: 1.25rem; letter-spacing: -0.02em;
  color: var(--text);
}
.logo:hover { text-decoration: none; }
.logo span { color: var(--accent); }

.site-head nav {
  display: flex; gap: 4px; margin-left: auto;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.site-head nav a {
  color: var(--muted); font-weight: 500; font-size: 0.95rem;
  padding: 8px 10px; border-radius: 8px; white-space: nowrap;
}
.site-head nav a:hover { color: var(--text); background: var(--surface); text-decoration: none; }

.theme-btn {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); width: 40px; height: 40px; flex: 0 0 auto;
  border-radius: 10px; cursor: pointer;
  display: grid; place-items: center;
}
.theme-btn:hover { border-color: var(--accent); }
.theme-btn svg { width: 18px; height: 18px; }
.theme-btn .i-moon, :root[data-theme="dark"] .theme-btn .i-sun { display: none; }
.theme-btn .i-sun { display: block; }
:root[data-theme="dark"] .theme-btn .i-moon { display: block; }

/* --------------------------------------------------------- breadcrumb */

.crumbs {
  font-size: 0.85rem; color: var(--muted);
  padding: 14px 0 0;
}
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--border); }
.crumbs a { color: var(--muted); }
.crumbs [aria-current] { color: var(--text); font-weight: 500; }

/* -------------------------------------------------------------- prose */

.prose { max-width: 760px; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1em; }
.prose li { margin-bottom: 0.4em; }
.prose strong { font-weight: 650; }

.steps { padding-left: 1.3em; }
.steps li { margin-bottom: 0.5em; }

.faq h3 { font-size: 1rem; margin: 1.4em 0 0.3em; }
.faq p { color: var(--muted); margin-bottom: 0.8em; }

.related-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.related-list a { font-weight: 600; }
.related-list span { display: block; color: var(--muted); font-size: 0.9rem; font-weight: 400; }

.pill-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 1.2em; }
.pill {
  display: inline-block; padding: 7px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-size: 0.9rem; font-weight: 500;
}
.pill:hover { border-color: var(--accent); text-decoration: none; }

/* ---------------------------------------------------------- ad slots */

/* Slots ship hidden. To go live: remove the `hidden` attribute on the
   .ad-slot elements in the tool pages and paste your ad code inside.
   The reserved min-height prevents layout shift when ads load. */
.ad-slot {
  min-height: 90px; display: grid; place-items: center;
  border: 1px dashed var(--border); border-radius: var(--radius);
  color: var(--muted); font-size: 0.8rem;
  margin: 18px 0;
}
.ad-slot[hidden] { display: none; }

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

.site-foot {
  border-top: 1px solid var(--border);
  margin-top: 56px; padding: 32px 0 40px;
  background: var(--surface);
}

.foot-grid {
  display: grid; gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: 24px;
}

.foot-grid h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.foot-grid ul { list-style: none; margin: 0; padding: 0; }
.foot-grid li { margin-bottom: 6px; }
.foot-grid a { color: var(--text); font-size: 0.92rem; }

.foot-note {
  color: var(--muted); font-size: 0.82rem;
  border-top: 1px solid var(--border); padding-top: 16px;
  max-width: 760px;
}

/* -------------------------------------------------------- page intro */

.page-head { padding: 10px 0 4px; }
.page-head .lede { color: var(--muted); font-size: 1.06rem; max-width: 720px; }

.section { padding-top: 8px; }

/* ------------------------------------------------- small shared notes */

/* Screen-reader note shown under forms */
.sr-note {
  color: var(--muted); font-size: 0.82rem; margin-top: 10px;
}

/* Selection colour matches the accent */
::selection { background: var(--accent); color: var(--accent-contrast); }
