/* Shared styles for the legal pages. Colours mirror the app's tokens in
   Invoice Maker/Styles/AppStyles.swift (AppColors + AppPaywallBrand). */

:root {
  color-scheme: light dark;

  /* AppPaywallBrand: branded fills stay the same in both appearances */
  --brand-deep: #111B63;
  --brand: #2437B8;
  --brand-bright: #536DFF;
  --brand-accent: #C7D2FE;
  --gold: #FFD166;

  /* Appearance-dynamic surfaces and text (light values) */
  --bg: #F4F7FF;
  --card: #FFFFFF;
  --card-warm: #FBFCFF;
  --text: #0F172A;
  --text-muted: #5F6C85;
  --text-soft: #8793AA;
  --ink: #2437B8;
  --border: rgb(0 0 0 / 0.07);
  --line: #CAD8F2;
  --chip-bg: #E9EDFF;
  --chip-text: #3547D4;
  --shadow: 0 1px 2px rgb(15 23 42 / 0.04), 0 12px 32px -12px rgb(30 58 138 / 0.18);

  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1115;
    --card: #1A1D23;
    --card-warm: #202630;
    --text: #F2F4F8;
    --text-muted: #B8C2D1;
    --text-soft: #A3AFC1;
    --ink: #93C5FD;
    --border: rgb(255 255 255 / 0.08);
    --line: #394355;
    --chip-bg: #273451;
    --chip-text: #A5B4FC;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 12px 32px -12px rgb(0 0 0 / 0.5);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 24px; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--ink); }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  color: #FFFFFF;
  background: linear-gradient(135deg, var(--brand-deep) 0%, var(--brand) 55%, var(--brand-bright) 100%);
  padding: 20px 20px 104px;
}

.hero::after {
  /* soft glow, like the paywall header */
  content: "";
  position: absolute;
  inset: auto -10% -60% auto;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(255 255 255 / 0.16), transparent 65%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #FFFFFF;
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.brand img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  box-shadow: 0 6px 16px -4px rgb(0 0 0 / 0.35), 0 0 0 1px rgb(255 255 255 / 0.18);
}

.brand small {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--brand-accent);
  letter-spacing: 0;
}

.tabs {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.12);
  border: 1px solid rgb(255 255 255 / 0.16);
}

.tabs a {
  padding: 7px 16px;
  border-radius: 999px;
  color: #FFFFFF;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0.85;
  transition: background 0.15s, opacity 0.15s;
}

.tabs a:hover { opacity: 1; background: rgb(255 255 255 / 0.1); }

.tabs a[aria-current="page"] {
  opacity: 1;
  background: #FFFFFF;
  color: var(--brand);
}

.hero-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 40px;
  align-items: center;
  margin-top: 44px;
}

.hero-copy { max-width: 620px; }

/* AI Scan / Voice AI card, styled like the paywall's icon tiles */
.ai-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  background: rgb(255 255 255 / 0.1);
  border: 1px solid rgb(255 255 255 / 0.2);
  box-shadow: 0 18px 40px -18px rgb(0 0 0 / 0.45);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--gold);
  color: #3F2B00;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ai-badge svg { width: 12px; height: 12px; }

.ai-feature {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 16px;
}

.ai-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  color: #FFFFFF;
  background: linear-gradient(135deg, rgb(255 255 255 / 0.24), rgb(255 209 102 / 0.22));
  border: 1px solid rgb(255 255 255 / 0.2);
}

.ai-icon svg { width: 22px; height: 22px; }

.ai-feature strong {
  display: block;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.ai-feature div > span {
  display: block;
  font-size: 14px;
  line-height: 1.45;
  color: rgb(255 255 255 / 0.78);
}

.ai-foot {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid rgb(255 255 255 / 0.16);
  font-size: 13px;
  color: rgb(255 255 255 / 0.72);
}

.ai-foot a { color: #FFFFFF; font-weight: 600; text-decoration: none; }
.ai-foot a:hover { text-decoration: underline; }

.eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}

.hero h1 {
  margin: 8px 0 12px;
  font-size: clamp(32px, 5vw, 44px);
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.lede {
  margin: 0;
  font-size: 17px;
  color: rgb(255 255 255 / 0.82);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.12);
  border: 1px solid rgb(255 255 255 / 0.16);
  font-size: 13px;
  font-weight: 500;
  color: #FFFFFF;
}

.pill svg { width: 14px; height: 14px; opacity: 0.85; }

/* ---------- Layout ---------- */

.layout {
  position: relative;
  z-index: 2;
  max-width: 1080px;
  margin: -72px auto 0;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

/* ---------- Table of contents ---------- */

.toc {
  position: sticky;
  top: 24px;
  padding: 20px 16px;
}

.toc-title {
  margin: 0 8px 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.toc ol { list-style: none; margin: 0; padding: 0; }

.toc a {
  display: flex;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 10px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.4;
}

.toc a:hover { background: var(--chip-bg); color: var(--chip-text); }

.toc a span {
  flex: none;
  width: 18px;
  font-variant-numeric: tabular-nums;
  color: var(--text-soft);
  font-weight: 600;
}

/* ---------- Document ---------- */

.doc { padding: 44px; }

.glance {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 40px;
  padding: 20px;
  border-radius: var(--radius-md);
  background: var(--card-warm);
  border: 1px solid var(--line);
}

.glance-title {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
}

.glance-item { display: flex; gap: 12px; align-items: flex-start; }

.glance-item p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text-muted); }

.glance-item strong { display: block; color: var(--text); font-size: 15px; }

.icon-tile {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: #FFFFFF;
  background: linear-gradient(135deg, var(--brand), var(--brand-bright));
  box-shadow: 0 6px 14px -6px rgb(36 55 184 / 0.6);
}

.icon-tile svg { width: 18px; height: 18px; }

section { margin-bottom: 36px; }
section:last-child { margin-bottom: 0; }

section + section { padding-top: 36px; border-top: 1px solid var(--border); }

h2 {
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
}

h2 .num {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--chip-bg);
  color: var(--chip-text);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.doc p, .doc ul { margin: 0 0 16px; color: var(--text-muted); }
.doc p:last-child, .doc ul:last-child { margin-bottom: 0; }

.doc ul { padding-left: 0; list-style: none; }

.doc li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 10px;
}

.doc li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.62em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-bright));
}

.doc strong { color: var(--text); font-weight: 600; }

.doc a { font-weight: 600; text-decoration: none; }
.doc a:hover { text-decoration: underline; }

.contact-card {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 4px;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  background: var(--chip-bg);
  text-decoration: none !important;
}

.contact-card .icon-tile { width: 40px; height: 40px; }

.contact-card div > span { display: block; font-size: 13px; font-weight: 500; color: var(--text-muted); }
.contact-card b { color: var(--chip-text); font-size: 15px; overflow-wrap: anywhere; }
.contact-card div { min-width: 0; }

/* ---------- Index page ---------- */

.hub {
  max-width: 1080px;
  margin: -72px auto 0;
  padding: 0 20px;
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.hub-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px;
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}

.hub-card:hover { transform: translateY(-2px); }

.hub-card .icon-tile { width: 48px; height: 48px; border-radius: 14px; }
.hub-card .icon-tile svg { width: 22px; height: 22px; }

.hub-card h2 { margin: 6px 0 0; }
.hub-card p { margin: 0; color: var(--text-muted); }

.hub-card .read {
  margin-top: auto;
  padding-top: 8px;
  color: var(--ink);
  font-weight: 600;
  font-size: 15px;
}

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

.site-footer {
  max-width: 1080px;
  margin: 48px auto 0;
  padding: 28px 20px 48px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--text-soft);
  font-size: 14px;
  border-top: 1px solid var(--border);
}

.site-footer .brand { color: var(--text); font-size: 15px; }
.site-footer .brand img { width: 28px; height: 28px; border-radius: 7px; box-shadow: none; }

.footer-links { display: flex; flex-wrap: wrap; gap: 20px; }
.footer-links a { color: var(--text-muted); text-decoration: none; font-weight: 500; }
.footer-links a:hover { color: var(--ink); }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .hero-main { grid-template-columns: minmax(0, 1fr); gap: 28px; align-items: start; }
  .ai-card { max-width: 560px; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .toc { position: static; }
  .toc ol { columns: 2; column-gap: 8px; }
  .toc li { break-inside: avoid; }
}

@media (max-width: 640px) {
  .hero { padding: 16px 16px 92px; }
  .hero-main { margin-top: 36px; }
  .ai-card { padding: 16px; }
  .ai-icon { width: 42px; height: 42px; border-radius: 12px; }
  .lede { font-size: 16px; }
  .layout, .hub { padding: 0 16px; margin-top: -60px; }
  .hub { grid-template-columns: minmax(0, 1fr); }
  .doc { padding: 24px 20px; }
  .glance { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .toc { display: none; }
  h2 { font-size: 19px; }
  .site-footer { padding: 24px 16px 40px; flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hub-card, .tabs a { transition: none; }
}

@media print {
  body { background: #FFFFFF; color: #000000; }
  .hero { background: none; color: #000000; padding: 0 0 16px; }
  .hero::after, .tabs, .toc, .ai-card, .site-footer .footer-links { display: none; }
  .brand, .pill, .lede { color: #000000; }
  .eyebrow { color: #2437B8; }
  .layout { display: block; margin: 0; padding: 0; }
  .card { box-shadow: none; border: none; }
  .doc { padding: 0; }
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.contact-grid .contact-card { margin-top: 0; }

@media (max-width: 640px) {
  .contact-grid { grid-template-columns: minmax(0, 1fr); }
}
