/* Periodic Table 3D privacy policy.
   Colours mirror the app: "Museum + old chemistry lab" dark theme by default,
   "Paper" light theme for light-mode readers. One accent: brass. */
:root {
  --bg: #F4F0E6;
  --surface: #FBF8F1;
  --surface-high: #EFE9DC;
  --outline: #D9D2C2;
  --text: #1B1F1C;
  --muted: #6B675E;
  --accent: #8F6B1E;
  --copper: #9A5530;
  --success: #4E7D4B;
  --danger: #A0442F;
  --grid: rgba(143, 107, 30, 0.10);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1512;
    --surface: #161E1A;
    --surface-high: #1D2723;
    --outline: #2B3731;
    --text: #EDE8DC;
    --muted: #A39E91;
    --accent: #C8A24A;
    --copper: #B8693D;
    --success: #6E9B6B;
    --danger: #B5553F;
    --grid: rgba(200, 162, 74, 0.07);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0E1512;
  --surface: #161E1A;
  --surface-high: #1D2723;
  --outline: #2B3731;
  --text: #EDE8DC;
  --muted: #A39E91;
  --accent: #C8A24A;
  --copper: #B8693D;
  --success: #6E9B6B;
  --danger: #B5553F;
  --grid: rgba(200, 162, 74, 0.07);
  color-scheme: dark;
}

/* Element category colours (same as the app's tiles). */
:root {
  --alkali: #B5654A;
  --alkaline: #C48A4B;
  --transition: #6F8A9A;
  --post: #7C8F7A;
  --metalloid: #9C8F6E;
  --nonmetal: #5E8C7A;
  --halogen: #A3A35A;
  --noble: #5B8FA3;
  --lanthanide: #A77B73;
  --actinide: #8C6E5E;
}

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

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

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
  /* the draftsman's hairline grid from the app's splash */
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
}

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--copper); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.wrap { max-width: 820px; margin: 0 auto; padding: 0 16px; }

h1, h2, h3 { font-family: "Fraunces", Georgia, "Noto Serif", serif; font-weight: 500; line-height: 1.2; }

/* ---------- header ---------- */
.hero { padding: 44px 16px 20px; }
.brand { display: flex; align-items: center; gap: 16px; }
.logo {
  width: 84px; height: 84px; border-radius: 18px; object-fit: cover;
  border: 1px solid var(--outline);
  animation: settle 0.9s cubic-bezier(0.2, 0, 0, 1) both;
}
@keyframes settle { from { opacity: 0; transform: translateY(10px) rotateX(25deg); } to { opacity: 1; transform: none; } }
.kicker { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin: 0; }
h1 { font-size: clamp(2rem, 7vw, 3rem); margin: 4px 0 6px; }
.meta { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 0.85rem; color: var(--muted); margin: 0; }

.tiles { display: flex; flex-wrap: wrap; gap: 6px; margin: 22px 0 8px; }
.tile {
  width: 52px; height: 52px; border-radius: 4px; position: relative; color: #F3EEE2;
  display: grid; place-items: center; font-family: "Fraunces", Georgia, serif; font-size: 1.3rem;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18);
  animation: rise 0.6s cubic-bezier(0.2, 0, 0, 1) both;
}
.tile small { position: absolute; top: 3px; left: 5px; font: 0.6rem "IBM Plex Mono", monospace; opacity: 0.8; }
.tile:nth-child(2) { animation-delay: 60ms; } .tile:nth-child(3) { animation-delay: 120ms; }
.tile:nth-child(4) { animation-delay: 180ms; } .tile:nth-child(5) { animation-delay: 240ms; }
.tile:nth-child(6) { animation-delay: 300ms; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.pill {
  display: inline-block; padding: 6px 12px; border-radius: 999px; font-size: 0.85rem;
  border: 1px solid var(--outline); background: var(--surface); color: var(--muted);
}
.pill b { color: var(--text); font-weight: 600; }

/* ---------- table of contents ---------- */
.toc {
  list-style: none; padding: 14px 16px; margin: 18px 0 8px; display: flex; flex-wrap: wrap; gap: 6px 18px;
  border: 1px solid var(--outline); border-radius: 12px; background: var(--surface);
}
.toc a { text-decoration: none; font-size: 0.92rem; color: var(--muted); }
.toc a:hover { color: var(--accent); }

/* ---------- sections ---------- */
section {
  background: var(--surface); border: 1px solid var(--outline); border-radius: 12px;
  padding: 6px 22px 16px; margin: 14px 0; scroll-margin-top: 12px;
}
section h2 { font-size: 1.45rem; margin: 16px 0 6px; display: flex; align-items: baseline; gap: 10px; }
section h2 .num { font-family: "IBM Plex Mono", monospace; font-size: 0.8rem; color: var(--accent); }
section h3 { font-size: 1.08rem; margin: 18px 0 4px; }
section p, section li { color: var(--text); }
section ul { padding-left: 1.2rem; }
section li { margin: 4px 0; }
.muted { color: var(--muted); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; margin: 10px 0; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--outline); vertical-align: top; }
th { font-family: "IBM Plex Mono", monospace; font-weight: 500; font-size: 0.78rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent); }

.note {
  border-left: 3px solid var(--accent); background: var(--surface-high);
  padding: 10px 14px; border-radius: 0 8px 8px 0; margin: 12px 0;
}
.warn { border-left-color: var(--danger); }

code { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 0.88em; background: var(--surface-high); padding: 1px 5px; border-radius: 4px; }

.contact { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 10px 0; }
.contact dt { font-family: "IBM Plex Mono", monospace; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding-top: 3px; }
.contact dd { margin: 0; font-weight: 600; }

footer { text-align: center; color: var(--muted); font-size: 0.85rem; padding: 26px 16px 44px; }
footer .mono { font-family: "IBM Plex Mono", monospace; }

.theme-toggle {
  position: fixed; top: 12px; right: 12px; z-index: 5;
  border: 1px solid var(--outline); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 6px 12px; font: 0.8rem "IBM Plex Mono", monospace; cursor: pointer;
}
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 520px) {
  section { padding: 4px 16px 14px; }
  .tile { width: 44px; height: 44px; font-size: 1.1rem; }
  .contact { grid-template-columns: 1fr; gap: 2px; }
  .contact dd { margin-bottom: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .logo, .tile { animation: none; }
}

@media print {
  body { background: #fff; color: #000; }
  .theme-toggle, .toc { display: none; }
  section { border: none; padding: 0; }
}
