/* Field guide: editorial, Caribbean palette, serif headings. Light by default.
   Mobile first: centered text on phones (lists stay left), editorial left alignment from 768px. */

html { font-size: 100%; scroll-padding-top: 6rem; }
html[data-font-size="md"] { font-size: 112.5%; }
html[data-font-size="lg"] { font-size: 125%; }
html[data-font-size="xl"] { font-size: 137.5%; }

:root,
[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --bg-alt: #effaf8;
  --card: #ffffff;
  --text: #0b2545;
  --muted: #34516b;
  --line: #cde8e6;
  --accent: #0a6f73;
  --accent-strong: #08585c;
  --aqua: #2ec4b6;
  --seafoam: #9be7d8;
  --ocean: #13315c;
  --chip-bg: #e3f6f3;
  --chip-text: #0a5457;
  --btn-bg: #0a6f73;
  --btn-text: #ffffff;
  --coral-text: #a8361b;
  --coral-bg: #fff1ec;
  --coral-line: #ff7f5c;
  --nav-bg: #ffffff;
  --shadow: 0 0.75rem 2rem rgba(19, 49, 92, 0.08), 0 0.125rem 0.375rem rgba(19, 49, 92, 0.06);
  --focus: #e4572e;
  --hero-1: rgba(46, 196, 182, 0.22);
  --hero-2: rgba(19, 49, 92, 0.10);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #061a2b;
  --bg-alt: #0a2438;
  --card: #0d2a40;
  --text: #e6f6f5;
  --muted: #b2ccd4;
  --line: #1f4a5d;
  --accent: #6fdbd0;
  --accent-strong: #8ee6dd;
  --aqua: #2ec4b6;
  --seafoam: #9be7d8;
  --ocean: #8fb8e8;
  --chip-bg: #12364b;
  --chip-text: #b9f0ea;
  --btn-bg: #6fdbd0;
  --btn-text: #052231;
  --coral-text: #ffb3a1;
  --coral-bg: #3a1b16;
  --coral-line: #ff7f5c;
  --nav-bg: #061a2b;
  --shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.35);
  --focus: #ff9b85;
  --hero-1: rgba(46, 196, 182, 0.18);
  --hero-2: rgba(143, 184, 232, 0.10);
}

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

body {
  margin: 0;
  font-family: "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  overflow-wrap: anywhere;
  text-align: center;
}

h1, h2, h3, .brand-name strong {
  font-family: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  font-weight: 600;
  letter-spacing: -0.01em;
}
a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 0.1875rem solid var(--focus); outline-offset: 0.125rem; border-radius: 0.375rem; }

ul, ol, dl { text-align: left; }

.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 60;
  background: var(--btn-bg); color: var(--btn-text);
  padding: 0.6rem 1rem; border-radius: 0.6rem; text-decoration: none; font-weight: 700;
}
.skip:focus { top: calc(env(safe-area-inset-top, 0px) + 0.75rem); }

/* ------------------------------------------------------------ nav */

.nav {
  position: sticky; top: 0; z-index: 40;
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  background: var(--nav-bg);
  background: color-mix(in srgb, var(--nav-bg) 88%, transparent);
  -webkit-backdrop-filter: blur(0.9rem) saturate(1.3);
  backdrop-filter: blur(0.9rem) saturate(1.3);
  border-bottom: 1px solid var(--line);
}
.nav-row {
  padding: 0.6rem clamp(1rem, 3vw, 2.5rem);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 0.5rem 1.25rem;
}
.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--text); text-decoration: none; min-width: 0; text-align: left; }
.brand-mark {
  display: grid; place-items: center; flex: none; color: #ffffff;
  width: 2.25rem; height: 2.25rem; border-radius: 0.7rem;
  background: linear-gradient(135deg, #13315c, #0a6f73 55%, #2ec4b6);
}
.brand-name { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name strong { font-size: 1.1rem; }
.brand-name span { font-size: 0.75rem; color: var(--muted); }
.nav-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem; }
.nav-links a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.875rem; padding: 0.4rem 0.7rem; border-radius: 0.6rem; }
.nav-links a:hover, .nav-links a[aria-current] { color: var(--text); background: var(--chip-bg); }
.prefs { display: flex; align-items: center; gap: 0.5rem; }
.size-group { display: inline-flex; align-items: flex-end; gap: 0.125rem; padding: 0.2rem; border: 1px solid var(--line); border-radius: 0.7rem; background: var(--card); }
.size-btn { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-family: "Figtree", ui-sans-serif, system-ui, sans-serif; font-weight: 700; line-height: 1; width: 2rem; height: 2rem; border-radius: 0.5rem; }
.size-btn.s1 { font-size: 0.75rem; }
.size-btn.s2 { font-size: 0.9rem; }
.size-btn.s3 { font-size: 1.05rem; }
.size-btn.s4 { font-size: 1.2rem; }
.size-btn[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-text); }
.theme-btn { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; cursor: pointer; border-radius: 0.7rem; border: 1px solid var(--line); background: var(--card); color: var(--text); }
[data-theme="dark"] .i-moon, [data-theme="light"] .i-sun { display: none; }

/* ------------------------------------------------------------ hero */

.hero {
  padding: clamp(2.5rem, 6vw, 5rem) clamp(1.25rem, 4vw, 3rem) clamp(2rem, 4vw, 3rem);
  background:
    radial-gradient(70% 120% at 0% 0%, var(--hero-1), transparent 70%),
    radial-gradient(60% 100% at 100% 0%, var(--hero-2), transparent 70%),
    var(--bg);
  border-bottom: 1px solid var(--line);
}
.hero h1 { margin: 0 0 0.75rem; font-size: clamp(2.25rem, 1.4rem + 3.6vw, 4.5rem); line-height: 1.04; color: var(--ocean); }
[data-theme="dark"] .hero h1 { color: var(--text); }
.lead { margin: 0 auto 1.25rem; font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.3125rem); color: var(--muted); max-width: 52rem; }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 2.75rem; padding: 0.55rem 1.2rem;
  border-radius: 0.8rem; font-weight: 700; text-decoration: none;
}
.btn.primary { background: var(--btn-bg); color: var(--btn-text); box-shadow: var(--shadow); }
.btn.primary:hover { color: var(--btn-text); filter: brightness(1.08); }
.btn.outline { border: 2px solid var(--accent); color: var(--accent); background: var(--card); }
.updated { margin: 1rem 0 0; font-size: 0.8125rem; color: var(--muted); }

.warning {
  margin: 0; padding: 1rem clamp(1.25rem, 4vw, 3rem);
  background: var(--coral-bg); border-bottom: 1px solid var(--coral-line); color: var(--text);
}
.warning p { margin: 0; }
.warning strong { color: var(--coral-text); }

/* ------------------------------------------------------------ contents and articles */

.layout { padding: clamp(1.5rem, 3vw, 2.5rem) clamp(1rem, 3vw, 2.5rem) 3rem; display: grid; gap: 1.5rem; }
.layout > * { min-width: 0; }

.toc { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem; }
.toc a.toc-cat {
  display: inline-block; padding: 0.4rem 0.85rem; border-radius: 999px; font-weight: 600; font-size: 0.875rem;
  background: var(--chip-bg); color: var(--chip-text); text-decoration: none;
}
.toc ol { display: none; }

.category { margin: 0 0 2.5rem; }
.category > h2 {
  margin: 0 0 1rem; font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.4rem); color: var(--ocean);
  padding-bottom: 0.5rem; border-bottom: 2px solid var(--aqua);
}
[data-theme="dark"] .category > h2 { color: var(--text); }
.cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; }

.entry {
  background: var(--card); border: 1px solid var(--line); border-radius: 1.1rem;
  padding: clamp(1.1rem, 2.5vw, 1.6rem); box-shadow: var(--shadow); min-width: 0;
  scroll-margin-top: 6rem;
}
.entry.scam { border-top: 0.3rem solid var(--coral-line); }
.entry.plan { border-top: 0.3rem solid var(--aqua); }
.entry .kind { display: inline-block; margin: 0 0 0.5rem; font-size: 0.8125rem; font-weight: 700; color: var(--chip-text); background: var(--chip-bg); padding: 0.2rem 0.65rem; border-radius: 999px; }
.entry.scam .kind { color: var(--coral-text); background: var(--coral-bg); }
.entry h3 { margin: 0 0 0.5rem; font-size: clamp(1.35rem, 1.15rem + 0.6vw, 1.75rem); line-height: 1.2; color: var(--ocean); }
[data-theme="dark"] .entry h3 { color: var(--text); }
.entry .summary { margin: 0 0 0.9rem; font-size: 1.0625rem; font-weight: 500; color: var(--text); }
.entry .body p { margin: 0 0 0.75rem; color: var(--muted); }
.entry .body ol { margin: 0 0 0.75rem; padding-left: 1.4rem; color: var(--muted); }
.entry .body li { margin-bottom: 0.35rem; }

.facts { margin: 1rem 0 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.5rem; }
.facts div { padding: 0.6rem 0.75rem; border-radius: 0.7rem; background: var(--bg-alt); border: 1px solid var(--line); }
.facts dt { font-size: 0.75rem; font-weight: 700; color: var(--muted); }
.facts dd { margin: 0.1rem 0 0; font-weight: 600; }
.facts .next { background: var(--chip-bg); }

.entry-foot { margin-top: 0.9rem; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; align-items: center; font-size: 0.875rem; }
.entry-foot a { font-weight: 700; }

.fallback { padding: 1rem; }
.foot { padding: 2rem clamp(1.25rem, 4vw, 3rem) calc(2rem + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: var(--bg-alt); color: var(--muted); font-size: 0.875rem; }
.foot p { margin: 0 0 0.5rem; }

/* ------------------------------------------------------------ tablet */

@media (min-width: 768px) {
  body { text-align: left; }
  .hero, .warning { text-align: left; }
  .lead { margin-left: 0; }
  .hero-actions { justify-content: flex-start; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .entry-foot { justify-content: flex-start; }
  .toc { justify-content: flex-start; }
}

/* ------------------------------------------------------------ desktop */

@media (min-width: 1024px) {
  .nav-row { justify-content: space-between; }
  .layout { grid-template-columns: 15rem minmax(0, 1fr); align-items: start; }
  .toc {
    position: sticky; top: calc(env(safe-area-inset-top, 0px) + 5rem);
    display: block; max-height: calc(100vh - 6rem); overflow-y: auto; padding-right: 0.5rem;
  }
  .toc a.toc-cat { display: block; background: transparent; padding: 0.35rem 0; border-radius: 0; color: var(--text); font-size: 0.9375rem; }
  .toc ol { display: block; list-style: none; margin: 0 0 0.75rem; padding: 0 0 0 0.75rem; border-left: 2px solid var(--line); }
  .toc ol a { display: block; padding: 0.2rem 0; color: var(--muted); text-decoration: none; font-size: 0.875rem; line-height: 1.35; }
  .toc ol a:hover { color: var(--accent); }
  .cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 30rem), 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
