/* ==========================================================================
   InterestMe — Legal pages
   Brand tokens mirror the app theme (see Design/DESIGN-HANDOFF.md §2).
   Mobile-first: these pages are opened from inside the app on a phone.
   ========================================================================== */

/* Light is the default. The dark palette is applied either by the OS setting
   or, when the app passes ?theme=dark (its in-app ThemeMode overrides the OS),
   by the data-theme attribute. Both paths must exist, so the dark token block
   is declared twice on purpose. */

:root {
  color-scheme: light;
  --bg-primary: #F5F7FA;
  --bg-card: #FFFFFF;
  --text-primary: #1A1D23;
  --text-secondary: #64748B;
  --text-tertiary: #94A3B8;
  --text-inverse: #FFFFFF;
  --green-primary: #52A875;
  --green-dark: #1E4D35;
  --green-light: #E8F5EE;
  --blue-teal: #2B6CB0;
  --blue-teal-light: #EBF4FF;
  --border-light: #E2E8F0;
  --logo-tile: #F5F7FA;
  --shadow-card: 0 1px 3px rgba(16, 24, 40, 0.06), 0 4px 16px rgba(16, 24, 40, 0.05);
}

/* Forced by the app: ?theme=dark */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-primary: #0F1117;
  --bg-card: #1A1D23;
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-tertiary: #64748B;
  --green-primary: #6FCD94;
  --green-dark: #7FCE9B;
  --green-light: #1B2A21;
  --blue-teal: #7FB4E8;
  --blue-teal-light: #151F31;
  --border-light: #2D3748;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* OS setting, unless the app forced light with ?theme=light */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg-primary: #0F1117;
    --bg-card: #1A1D23;
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-tertiary: #64748B;
    --green-primary: #6FCD94;
    --green-dark: #7FCE9B;
    --green-light: #1B2A21;
    --blue-teal: #7FB4E8;
    --blue-teal-light: #151F31;
    --border-light: #2D3748;
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.4);
  }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---- Header ------------------------------------------------------------- */
/* Static on phones so it does not permanently consume vertical space.       */

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

.header-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  min-height: 44px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--logo-tile);
  padding: 3px;
  flex: none;
  display: block;
}

.brand-name {
  display: block;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.brand-tagline {
  display: block;
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.3;
}

/* ---- Document sheet ----------------------------------------------------- */
/* Full-bleed on phones: maximum reading width for dense legal text.         */

main.container {
  padding-top: 0;
  padding-bottom: 32px;
}

.doc-card {
  background: var(--bg-card);
  padding: 24px 16px 8px;
  margin: 0 -16px;
}

.doc-header {
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 18px;
  margin-bottom: 20px;
}

.doc-kicker {
  margin: 0 0 6px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--green-dark);
}

.doc-header h1 {
  margin: 0 0 8px;
  font-size: clamp(1.5rem, 6vw, 2.2rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.doc-meta {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.doc-meta time {
  font-weight: 600;
  color: var(--text-primary);
}

.doc-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--green-dark);
  background: var(--green-light);
  border-radius: 999px;
  padding: 4px 10px;
}

.lead {
  font-size: 1rem;
  color: var(--text-secondary);
  margin: 0 0 22px;
}

/* ---- Table of contents -------------------------------------------------- */
/* Hidden on phones: 10 anchors would push the actual text a screen down.    */

.toc {
  display: none;
}

/* ---- Sections ----------------------------------------------------------- */

section {
  margin: 0 0 24px;
  scroll-margin-top: 24px;
}

section h2 {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 1.12rem;
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin: 0 0 10px;
}

section h2 .num {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--green-dark);
  background: var(--green-light);
  border-radius: 999px;
  width: 26px;
  height: 26px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

section p {
  margin: 0 0 12px;
}

section ul {
  margin: 0 0 12px;
  padding-left: 20px;
}

section li {
  margin-bottom: 8px;
}

section li:last-child {
  margin-bottom: 0;
}

a {
  color: var(--blue-teal);
}

/* Long e-mail addresses must not overflow a 320 dp screen. */
section a {
  overflow-wrap: anywhere;
}

/* ---- Callout ------------------------------------------------------------ */

.callout {
  border-radius: 12px;
  padding: 14px 16px;
  margin: 0 0 22px;
  background: var(--green-light);
}

.callout p {
  margin: 0;
}

.callout .callout-title {
  font-weight: 700;
  margin-bottom: 4px;
  display: block;
}

/* ---- Footer ------------------------------------------------------------- */

.site-footer {
  padding: 24px 16px 32px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.footer-langs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 14px;
  margin: 0 0 14px;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--border-light);
}

.footer-langs a,
.footer-langs span {
  font-size: 0.85rem;
  text-decoration: none;
  padding: 6px 2px;
  color: var(--text-secondary);
}

.footer-langs a:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

.footer-langs .current {
  color: var(--text-primary);
  font-weight: 700;
}

/* ---- Landing page ------------------------------------------------------- */

.page-title {
  text-align: center;
  margin: 32px 0 0;
}

.page-title h1 {
  margin: 0 0 8px;
  font-size: clamp(1.6rem, 6vw, 2.6rem);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-title p {
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto;
  font-size: 0.95rem;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 28px;
}

.grid a {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  box-shadow: var(--shadow-card);
  padding: 16px;
  text-decoration: none;
  color: inherit;
  min-height: 48px;
}

.grid .grid-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--green-dark);
}

.grid .grid-title {
  font-size: 1rem;
  font-weight: 700;
}

.grid .grid-langs {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   Tablet / desktop
   ========================================================================== */

@media (min-width: 700px) {
  .container {
    padding: 0 20px;
  }

  .site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: color-mix(in srgb, var(--bg-card) 88%, transparent);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }

  .header-inner {
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
  }

  .brand-name {
    font-size: 1.05rem;
  }

  main.container {
    padding-top: 32px;
    padding-bottom: 48px;
  }

  .doc-card {
    border: 1px solid var(--border-light);
    border-radius: 20px;
    box-shadow: var(--shadow-card);
    padding: 48px;
    margin: 0;
  }

  .doc-header {
    padding-bottom: 24px;
    margin-bottom: 24px;
  }

  .lead {
    font-size: 1.06rem;
    margin-bottom: 24px;
  }

  .toc {
    display: block;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 18px 22px;
    margin: 0 0 32px;
  }

  .toc-title {
    margin: 0 0 8px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
  }

  .toc ol {
    margin: 0;
    padding: 0;
    list-style: none;
    columns: 2;
    column-gap: 32px;
  }

  .toc a {
    display: inline-block;
    padding: 4px 0;
    text-decoration: none;
    font-size: 0.92rem;
  }

  .toc a:hover {
    text-decoration: underline;
  }

  section {
    margin-bottom: 28px;
    scroll-margin-top: 96px;
  }

  section h2 {
    font-size: 1.28rem;
    gap: 12px;
  }

  section h2 .num {
    font-size: 1rem;
    width: 30px;
    height: 30px;
  }

  .callout {
    border-radius: 14px;
    padding: 16px 20px;
    margin-bottom: 28px;
  }

  .grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 40px;
  }

  .page-title {
    margin-top: 56px;
  }
}

/* ---- Print -------------------------------------------------------------- */

@media print {
  .site-header,
  .toc,
  .footer-langs {
    display: none !important;
  }

  body {
    background: #FFFFFF;
    color: #000000;
    font-size: 11pt;
  }

  .doc-card {
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
  }

  section h2 .num {
    background: none;
    color: #000000;
  }

  main.container {
    padding: 0;
  }

  a {
    color: #000000;
    text-decoration: underline;
  }
}
