/*
 * PDF Manager's legal pages, drawn as app screens. Every value comes from the app's tokens
 * (src/design/tokens.ts, spec §2) and the design board (design/prototype/styles.css): change
 * them there first, then here.
 */

/* DM Sans static cuts, as the app ships them (src/assets/fonts, OFL-1.1). One family per
   optical size, like src/design/fonts.ts picks them. */
@font-face { font-family: "DMSans 12"; font-weight: 600; font-display: swap; src: url("fonts/DMSans-12-SemiBold.ttf") format("truetype"); }
@font-face { font-family: "DMSans 14"; font-weight: 400; font-display: swap; src: url("fonts/DMSans-14-Regular.ttf") format("truetype"); }
@font-face { font-family: "DMSans 14"; font-weight: 600; font-display: swap; src: url("fonts/DMSans-14-SemiBold.ttf") format("truetype"); }
@font-face { font-family: "DMSans 16"; font-weight: 400; font-display: swap; src: url("fonts/DMSans-16-Regular.ttf") format("truetype"); }
@font-face { font-family: "DMSans 16"; font-weight: 600; font-display: swap; src: url("fonts/DMSans-16-SemiBold.ttf") format("truetype"); }
@font-face { font-family: "DMSans 20"; font-weight: 600; font-display: swap; src: url("fonts/DMSans-20-SemiBold.ttf") format("truetype"); }
@font-face { font-family: "DMSans 26"; font-weight: 700; font-display: swap; src: url("fonts/DMSans-26-Bold.ttf") format("truetype"); }

/* ---- tokens: light (tokens.ts `light`) ---- */
:root {
  color-scheme: light;
  --bg: #FAFAF9; --surface: #FFFFFF; --raised: #FFFFFF; --sunken: #F5F5F4;
  --hairline: #E7E5E4; --outline: #8F8882;
  --text: #0C0A09; --muted: #57534E; --subtle: #736C68;
  --inverse: #1C1917; --on-inverse: #FAFAF9;
  --accent: #D92D20; --on-accent: #FFFFFF; --accent-text: #B42318; --accent-soft: #FEE4E2; --on-accent-soft: #912018;
  --success: #15803D; --warning: #B45309; --warning-soft: #FEF3C7; --info: #1D4ED8;
  --glass: rgba(255,255,255,0.72); --glass-solid: #FFFFFF;
  --t-organize: #D92D20; --t-secure: #1C1917; --t-optimize: #B45309; --t-create: #1D4ED8; --t-sign: #6D28D9;
  --wash: 10%;
  --e1: 0px 1px 2px rgba(12,10,9,0.04), 0px 4px 12px rgba(12,10,9,0.04);
  --highlight: 0 0 #0000;
  /* Logo (logo-mark.svg): ink and paper follow the theme, the corner stays brand red. */
  --logo-ink: #1C1917; --logo-paper: #FAFAF9; --brand-red: #E5322D;
  /* radius, space (tokens.ts) */
  --r-chip: 8px; --r-input: 14px; --r-card: 20px; --r-tile: 28px; --r-full: 999px;
  --gutter: 20px;
}

/* ---- tokens: dark (tokens.ts `dark`) ---- */
@media (prefers-color-scheme: dark) {
  :root:not([data-mode="light"]) {
    color-scheme: dark;
    --bg: #0C0A09; --surface: #1C1917; --raised: #292524; --sunken: #0F0D0C;
    --hairline: #2E2A27; --outline: #7C756F;
    --text: #FAFAF9; --muted: #A8A29E; --subtle: #948E88;
    --inverse: #F5F5F4; --on-inverse: #0C0A09;
    --accent: #FF6B5E; --on-accent: #2A0A07; --accent-text: #FF6B5E; --accent-soft: #3B1412; --on-accent-soft: #FFB4AB;
    --success: #4ADE80; --warning: #FBBF24; --warning-soft: #33250A; --info: #60A5FA;
    --glass: rgba(28,25,23,0.72); --glass-solid: #1C1917;
    --t-organize: #FF6B5E; --t-secure: #E7E5E4; --t-optimize: #FBBF24; --t-create: #60A5FA; --t-sign: #A78BFA;
    --wash: 16%;
    --e1: 0 0 #0000;
    --highlight: inset 0px 1px 0px rgba(255,255,255,0.04);
    --logo-ink: #FAFAF9; --logo-paper: #1C1917;
  }
}
:root[data-mode="dark"] {
  color-scheme: dark;
  --bg: #0C0A09; --surface: #1C1917; --raised: #292524; --sunken: #0F0D0C;
  --hairline: #2E2A27; --outline: #7C756F;
  --text: #FAFAF9; --muted: #A8A29E; --subtle: #948E88;
  --inverse: #F5F5F4; --on-inverse: #0C0A09;
  --accent: #FF6B5E; --on-accent: #2A0A07; --accent-text: #FF6B5E; --accent-soft: #3B1412; --on-accent-soft: #FFB4AB;
  --success: #4ADE80; --warning: #FBBF24; --warning-soft: #33250A; --info: #60A5FA;
  --glass: rgba(28,25,23,0.72); --glass-solid: #1C1917;
  --t-organize: #FF6B5E; --t-secure: #E7E5E4; --t-optimize: #FBBF24; --t-create: #60A5FA; --t-sign: #A78BFA;
  --wash: 16%;
  --e1: 0 0 #0000;
  --highlight: inset 0px 1px 0px rgba(255,255,255,0.04);
  --logo-ink: #FAFAF9; --logo-paper: #1C1917;
}

/* ---- base (board `.app`) ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 16px/24px "DMSans 16", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
a { color: var(--accent-text); text-underline-offset: 2px; overflow-wrap: anywhere; }
strong { font-weight: 600; }
code {
  font: inherit; font-size: 0.9em; background: var(--sunken); border-radius: 6px; padding: 1px 6px;
  box-shadow: inset 0 0 0 1px var(--hairline); overflow-wrap: anywhere;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.skip {
  position: absolute; left: 8px; top: -60px; z-index: 30; padding: 12px 16px; border-radius: var(--r-full);
  background: var(--inverse); color: var(--on-inverse); font-weight: 600; text-decoration: none;
}
.skip:focus { top: 8px; }

/* ---- type roles (tokens.ts `type`) ---- */
.t-title { font: 700 26px/32px "DMSans 26", system-ui, sans-serif; letter-spacing: -0.4px; margin: 0; }
.t-head { font: 600 20px/26px "DMSans 20", system-ui, sans-serif; letter-spacing: -0.2px; margin: 0; }
.t-body { font-size: 16px; line-height: 24px; }
.t-strong { font-weight: 600; }
.t-sub { font: 400 14px/20px "DMSans 14", system-ui, sans-serif; }
.t-label { font: 600 14px/20px "DMSans 14", system-ui, sans-serif; letter-spacing: 0.1px; }
.t-micro { font: 600 12px/16px "DMSans 12", system-ui, sans-serif; letter-spacing: 0.4px; text-transform: uppercase; }
.c-muted { color: var(--muted); } .c-subtle { color: var(--subtle); }

/* ---- screen frame ---- */
.screen { max-width: 680px; margin: 0 auto; padding: 0 var(--gutter) 40px; }

/* Title bar (board `.appbar`), glass over content like the app's floating chrome. */
.appbar {
  position: sticky; top: 0; z-index: 10; height: 56px;
  background: var(--glass); -webkit-backdrop-filter: blur(24px) saturate(1.4); backdrop-filter: blur(24px) saturate(1.4);
  border-bottom: 1px solid var(--hairline);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .appbar { background: var(--glass-solid); }
}
.appbar-in { max-width: 680px; height: 56px; margin: 0 auto; padding: 0 8px 0 12px; display: flex; align-items: center; gap: 10px; }
.brand { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; color: var(--text); text-decoration: none; font: 600 16px/24px "DMSans 16", system-ui, sans-serif; }
.brand svg { width: 36px; height: 36px; flex: none; }
.appbar .spacer { flex: 1; }

.bigtitle { padding: 20px 0 4px; }
.bigtitle .promise { color: var(--muted); margin-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* Chip (board `.chip`): 36 high, 8 radius, hairline ring. */
.chip {
  min-height: 36px; border-radius: var(--r-chip); padding: 0 12px; display: inline-flex; align-items: center; gap: 6px;
  font: 600 14px/20px "DMSans 14", system-ui, sans-serif; color: var(--text); text-decoration: none;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--hairline);
}
a.chip { min-height: 44px; }
.chip svg { width: 16px; height: 16px; color: var(--subtle); }
.chip.confirm { background: var(--warning-soft); box-shadow: none; }
.chip.confirm svg { color: var(--warning); }

/* Group heading (board `.ghead`): micro label above a card. */
.ghead { margin: 24px 4px 8px; color: var(--subtle); }

/* Grouped list card (board `.group-s`) and its rows (`.rowline`). */
.group {
  background: var(--raised); border-radius: var(--r-card); padding: 0 16px; margin: 0; list-style: none;
  box-shadow: var(--e1), var(--highlight), inset 0 0 0 1px var(--hairline);
}
.row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 0; }
.group > li + li, .group > .row + .row { border-top: 1px solid var(--hairline); }
.row .grow { flex: 1; min-width: 0; }
a.row { color: var(--text); text-decoration: none; }
a.row .caret { width: 20px; height: 20px; color: var(--subtle); flex: none; }
.row .num { width: 28px; flex: none; color: var(--subtle); font: 600 14px/20px "DMSans 14", system-ui, sans-serif; }

/* Icon tile (board `.ic`): tint washed over the surface. */
.ic {
  --tint: var(--t-organize);
  width: 40px; height: 40px; border-radius: var(--r-input); flex: none; align-self: flex-start;
  display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--tint) var(--wash), var(--surface)); color: var(--tint);
}
.ic svg { width: 24px; height: 24px; }
.cat-organize { --tint: var(--t-organize); } .cat-secure { --tint: var(--t-secure); } .cat-optimize { --tint: var(--t-optimize); }
.cat-create { --tint: var(--t-create); } .cat-sign { --tint: var(--t-sign); }

/* Icons (board `svg.i`): 1.5 stroke, round caps. */
svg.i { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* Section card (board `.card-s`). */
.card {
  background: var(--raised); border-radius: var(--r-card); padding: 8px 18px; margin-top: 12px;
  box-shadow: var(--e1), var(--highlight), inset 0 0 0 1px var(--hairline);
}
.card > .t-head { display: flex; gap: 10px; align-items: baseline; margin: 10px 0 4px; }
.card > .t-head .n { color: var(--subtle); font: 600 14px/20px "DMSans 14", system-ui, sans-serif; flex: none; min-width: 20px; }
.card h3 { font: 600 16px/24px "DMSans 16", system-ui, sans-serif; margin: 16px 0 0; }
.card p, .card ul { margin: 10px 0; }
.card ul { padding-left: 22px; }
.card li { margin: 6px 0; }
.card li::marker { color: var(--accent); }

/* Banner (board `.banner`), for notes and the points still to confirm. */
.note {
  display: flex; gap: 12px; border-radius: var(--r-card); padding: 14px 16px; margin: 12px 0;
  background: var(--sunken); box-shadow: inset 0 0 0 1px var(--hairline);
}
.note svg { width: 20px; height: 20px; flex: none; margin-top: 2px; color: var(--info); }
.note.warn { background: var(--warning-soft); box-shadow: none; }
.note.warn svg { color: var(--warning); }
mark.confirm {
  background: var(--warning-soft); color: var(--text); border-radius: 6px; padding: 1px 6px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warning) 40%, transparent);
}

/* Buttons (board `.btn`): 52 high pill; `sm` is 44 here so it stays a full touch target. */
.btn {
  min-height: 52px; border-radius: var(--r-full); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 22px; font: 600 16px/20px "DMSans 16", system-ui, sans-serif; letter-spacing: 0.1px; text-decoration: none;
  transition: transform 90ms;
}
.btn:active { transform: scale(0.97); }
.btn.accent { background: var(--accent); color: var(--on-accent); }
.btn.tonal { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--hairline), var(--e1); }
.btn.sm { min-height: 44px; padding: 0 16px; font-size: 14px; }
.btn svg { width: 20px; height: 20px; }
.btns { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 10px; }

/* Back to top: a 48 icon button (board `.ib`). */
.ib {
  width: 48px; height: 48px; border-radius: var(--r-full); flex: none;
  display: inline-flex; align-items: center; justify-content: center; color: var(--text);
}
.ib:hover { background: var(--sunken); }
.ib svg { width: 24px; height: 24px; }

.foot { margin-top: 28px; text-align: center; }
.foot .group { text-align: left; }
.foot .meta { margin-top: 16px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .btn:active { transform: none; }
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
@media (min-width: 720px) {
  .bigtitle { padding-top: 32px; }
}
