/* Shared styles for Mianote's legal + support pages.
   Tokens mirror site/index.html (and the app's Theme.swift) so these pages
   read as part of mianote.app. */
:root {
  --amber:      #C8932E;
  --amber-deep: #A6751B;
  --amber-soft: #E3CE9E;
  --paper:      #F6F0E2;
  --paper-warm: #EFE7D4;
  --surface:    #FCF8EE;
  --ink:        #2B2620;
  --ink-soft:   #6B6253;
  --ink-faint:  #A99E89;
  --line:       rgba(43, 38, 32, 0.10);
  --line-amber: rgba(200, 147, 46, 0.28);
  --nav-bg:     rgba(246, 240, 226, 0.92);

  --serif: 'Newsreader', 'Georgia', 'Times New Roman', serif;
  --sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --wrap: 1080px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

:root[data-theme="dark"] {
  --amber:      #E0AC45;
  --amber-deep: #E9BC5F;
  --amber-soft: #E3CE9E;
  --paper:      #181512;
  --paper-warm: #211D17;
  --surface:    #221E18;
  --ink:        #EEE7D7;
  --ink-soft:   #B4AB95;
  --ink-faint:  #7E7560;
  --line:       rgba(238, 231, 215, 0.10);
  --line-amber: rgba(224, 172, 69, 0.30);
  --nav-bg:     rgba(24, 21, 18, 0.85);
}

html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  font-weight: 400;
}
a { color: var(--amber-deep); text-underline-offset: 2px; }
a:hover { color: var(--amber); }
img { max-width: 100%; height: auto; display: block; }

/* ---------- Top bar ---------- */
.topbar {
  border-bottom: 1px solid var(--line);
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  position: sticky; top: 0; z-index: 50;
}
.topbar-inner {
  max-width: var(--wrap); margin: 0 auto; padding: 16px 28px;
  display: flex; align-items: center; gap: 18px;
}
.topbar .wordmark { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.topbar .wordmark img { height: 26px; width: 26px; border-radius: 6px; }
.topbar .wordmark .mark-text { font-family: var(--serif); font-weight: 600; font-size: 19px; color: var(--ink); }
.topbar .spacer { flex: 1; }
.topbar nav { display: flex; gap: 22px; }
.topbar nav a { color: var(--ink-soft); text-decoration: none; font-size: 14px; font-weight: 500; }
.topbar nav a:hover { color: var(--amber-deep); }

/* ---------- Layout with sticky TOC ---------- */
.layout {
  max-width: var(--wrap); margin: 0 auto; padding: clamp(40px, 6vw, 72px) 28px clamp(64px, 8vw, 110px);
  display: grid; grid-template-columns: 220px 1fr; gap: clamp(32px, 5vw, 68px); align-items: start;
}
.toc { position: sticky; top: 96px; }
.toc-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-faint); margin: 0 0 14px;
}
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { margin: 0 0 2px; }
.toc a {
  display: block; padding: 6px 12px; border-left: 2px solid var(--line);
  color: var(--ink-soft); text-decoration: none; font-size: 13.5px; line-height: 1.4;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.toc a:hover { color: var(--amber-deep); border-left-color: var(--line-amber); }
.toc a.active { color: var(--ink); border-left-color: var(--amber); font-weight: 500; }

/* ---------- Document ---------- */
.doc { max-width: 720px; }
.doc h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(34px, 5vw, 48px); color: var(--ink); margin: 0 0 6px; line-height: 1.1; }
.doc .updated { font-size: 14px; color: var(--ink-faint); margin: 0 0 36px; }
.doc h2 {
  font-family: var(--serif); font-weight: 500; font-size: clamp(22px, 2.6vw, 28px); color: var(--ink);
  margin: 44px 0 12px; line-height: 1.2; scroll-margin-top: 96px;
}
.doc h3 { font-family: var(--serif); font-weight: 500; font-size: 19px; color: var(--ink); margin: 28px 0 8px; }
.doc p { margin: 0 0 16px; }
.doc ul, .doc ol { margin: 0 0 16px; padding-left: 22px; }
.doc li { margin: 0 0 8px; }
.doc strong { color: var(--ink); font-weight: 600; }
.doc a { font-weight: 500; }
.doc .lead { font-size: 18px; color: var(--ink-soft); margin-bottom: 28px; }
.doc .callout {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--amber);
  border-radius: 12px; padding: 18px 22px; margin: 0 0 24px;
}
.doc .callout p:last-child { margin-bottom: 0; }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }

/* ---------- Footer ---------- */
.legal-footer {
  border-top: 1px solid var(--line); background: var(--paper);
}
.legal-footer .inner {
  max-width: var(--wrap); margin: 0 auto; padding: 28px;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px;
  font-size: 13px; color: var(--ink-faint);
}
.legal-footer a { color: var(--ink-faint); text-decoration: none; margin-left: 18px; }
.legal-footer a:hover { color: var(--amber-deep); }

/* ---------- Theme toggle ---------- */
.theme-toggle {
  position: fixed; left: clamp(16px, 3vw, 28px); bottom: clamp(16px, 3vw, 28px); z-index: 60;
  width: 46px; height: 46px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
  background: var(--surface); color: var(--amber-deep); border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(43, 38, 32, 0.05), 0 14px 30px -16px rgba(166, 117, 27, 0.4);
  transition: border-color 0.2s var(--ease), transform 0.18s var(--ease);
}
.theme-toggle:hover { border-color: var(--amber); transform: translateY(-2px); }
.theme-toggle:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
.theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }

/* ---------- Mobile ---------- */
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; gap: 8px; }
  .toc {
    position: static; top: auto;
    background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
    padding: 18px 20px; margin-bottom: 28px;
  }
  .toc a { border-left: 0; padding: 5px 0; }
  .toc a.active { border-left: 0; }
}
@media (max-width: 520px) {
  .topbar nav { gap: 16px; }
  .legal-footer .inner { flex-direction: column; align-items: flex-start; }
  .legal-footer a { margin-left: 0; margin-right: 18px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
