/* Custody design system, draft 2
   Reference: Notion (sole). Borrowed: white page with warm grey washes, plain-spoken bold sans headlines,
   pastel "tag" colors used as callouts and status, toggles, checklists, and hand-drawn ink annotations.
   Custody's own: Figtree instead of Notion's Inter, a handwritten Caveat voice for margin notes, and our own doodles.
   Layout: centered hero only; everything after it is left-aligned in a 1080px column, like a well-kept document. */

/* Self-hosted variable fonts (all SIL Open Font License) */
@font-face { font-family: "Bricolage Grotesque"; src: url("fonts/bricolage-grotesque.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Figtree"; src: url("fonts/figtree.woff2") format("woff2"); font-weight: 300 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Caveat"; src: url("fonts/caveat.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }

:root {
  --paper: #FFFFFF;
  --wash: #F7F6F3;
  --wash-2: #EFEEEA;
  --ink: #191918;
  --ink-2: #55534E;
  --ink-3: #6F6D67;
  --line: #E9E8E4;
  --line-strong: #D3D1CB;
  --accent: #2463D1;        /* links and the one primary button */
  --accent-hover: #1D52B0;
  --accent-ink: #FFFFFF;

  /* Pastel tags: background / text pairs */
  --yellow: #FBF3DB; --yellow-ink: #6E5110;
  --blue: #E7F1F8;   --blue-ink: #1F557F;
  --green: #EDF3EC;  --green-ink: #2C6436;
  --red: #FDEBEC;    --red-ink: #9A2C2A;
  --purple: #F4F0F8; --purple-ink: #5A3C86;
  --orange: #FBECDD; --orange-ink: #84470F;

  --fill-bg: #FFF3A8; --fill-ink: #5B4A00;
  --shadow-card: 0 1px 2px rgba(25, 25, 24, .06), 0 12px 32px -16px rgba(25, 25, 24, .18);

  --font-display: "Bricolage Grotesque", "Figtree", ui-sans-serif, system-ui, sans-serif;
  --font: "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --hand: "Caveat", "Bradley Hand", "Segoe Print", cursive;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --t-display: clamp(40px, 6vw, 72px);
  --t-h2: clamp(30px, 3.6vw, 44px);
  --t-h3: 20px;
  --t-lede: clamp(18px, 1.5vw, 21px);
  --t-body: 17px;
  --t-small: 15px;
  --t-meta: 13.5px;
  --t-hand: 24px;

  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px;
  --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px;
  --section: 104px;
  --max: 1080px;

  --r-tag: 4px;
  --r-callout: 6px;
  --r-btn: 8px;
  --r-card: 12px;
  --r-block: 16px;

  --dur-fast: 120ms;
  --dur: 240ms;
  --ease: cubic-bezier(.3, .7, .3, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #191919; --wash: #202020; --wash-2: #2A2A29; --ink: #EDEDEC; --ink-2: #B5B3AD; --ink-3: #9A9891;
    --line: #2F2F2D; --line-strong: #43423F;
    --accent: #6AA2F5; --accent-hover: #8AB6F7; --accent-ink: #0D1830;
    --yellow: #3A3020; --yellow-ink: #F0D58A; --blue: #1D2D3C; --blue-ink: #A2C9EE;
    --green: #1F2E22; --green-ink: #A6D6AC; --red: #3A2224; --red-ink: #F2AAA8;
    --purple: #2C2536; --purple-ink: #CFB9EF; --orange: #3A2A1C; --orange-ink: #F0BE8E;
    --fill-bg: #3B3410; --fill-ink: #F4E08A;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -16px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #191919; --wash: #202020; --wash-2: #2A2A29; --ink: #EDEDEC; --ink-2: #B5B3AD; --ink-3: #9A9891;
  --line: #2F2F2D; --line-strong: #43423F;
  --accent: #6AA2F5; --accent-hover: #8AB6F7; --accent-ink: #0D1830;
  --yellow: #3A3020; --yellow-ink: #F0D58A; --blue: #1D2D3C; --blue-ink: #A2C9EE;
  --green: #1F2E22; --green-ink: #A6D6AC; --red: #3A2224; --red-ink: #F2AAA8;
  --purple: #2C2536; --purple-ink: #CFB9EF; --orange: #3A2A1C; --orange-ink: #F0BE8E;
  --fill-bg: #3B3410; --fill-ink: #F4E08A;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -16px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

/* Base */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); font-size: var(--t-body); line-height: 1.6; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; font-weight: 700; text-wrap: balance; }
h1, h2 { font-family: var(--font-display); }
h1 { font-size: var(--t-display); line-height: 1.02; letter-spacing: -0.035em; font-weight: 700; }
h2 { font-size: var(--t-h2); line-height: 1.08; letter-spacing: -0.03em; font-weight: 650; }
h3 { font-size: var(--t-h3); line-height: 1.3; letter-spacing: -0.01em; font-weight: 650; }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap {
  max-width: calc(var(--max) + 64px); margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
@media (min-width: 720px) { .wrap { padding-left: max(32px, env(safe-area-inset-left, 0px)); padding-right: max(32px, env(safe-area-inset-right, 0px)); } }
@media (max-width: 720px) { :root { --section: 64px; } }
.section { padding-block: var(--section); }

/* Text roles */
.kicker { font-size: var(--t-small); font-weight: 600; color: var(--ink-3); }
.lede { font-size: var(--t-lede); line-height: 1.55; color: var(--ink-2); max-width: 56ch; }
.muted { color: var(--ink-2); }
.small { font-size: var(--t-small); }
.meta { font-size: var(--t-meta); color: var(--ink-3); }
.hand { font-family: var(--hand); font-size: var(--t-hand); line-height: 1.1; color: var(--ink-2); font-weight: 500; }
.fill { background: var(--fill-bg); color: var(--fill-ink); padding: 0 .3em; border-radius: var(--r-tag); border: 1px dashed currentColor; font-weight: 600; white-space: nowrap; }
.section-head { display: grid; gap: var(--s-3); max-width: 720px; margin-bottom: var(--s-7); }

/* Scribble underline: a hand-drawn stroke under one phrase */
.scribble { position: relative; white-space: nowrap; }
.scribble svg { position: absolute; left: -2%; bottom: -0.16em; width: 104%; height: .32em; overflow: visible; pointer-events: none; }
.scribble path { fill: none; stroke: var(--accent); stroke-width: 5; stroke-linecap: round; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 46px; padding: 0 18px; border-radius: var(--r-btn);
  font: 600 16px/1 var(--font); text-decoration: none; cursor: pointer; border: 1px solid transparent;
  transition: background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn:active, .btn.is-active { transform: translateY(1px); }
.btn:disabled, .btn.is-disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled), .btn-primary.is-hover { background: var(--accent-hover); }
.btn-secondary { background: var(--wash-2); color: var(--ink); }
.btn-secondary:hover, .btn-secondary.is-hover { background: var(--line-strong); }
.btn-quiet { background: transparent; color: var(--ink-2); }
.btn-quiet:hover, .btn-quiet.is-hover { background: var(--wash); color: var(--ink); }
.btn-sm { min-height: 44px; padding: 0 14px; font-size: 15px; }

/* Header */
.site-header { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--paper); border-bottom: 1px solid transparent; transition: border-color var(--dur) var(--ease); }
.site-header.is-scrolled { border-bottom-color: var(--line); }
.nav { display: flex; align-items: center; gap: var(--s-4); min-height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 19px; letter-spacing: -0.02em; text-decoration: none; color: var(--ink); }
.logo svg { width: 26px; height: 26px; flex: none; }
.logo .lk-frame { fill: var(--paper); stroke: var(--ink); stroke-width: 2; }
.logo .lk-core { fill: var(--ink); }
.nav nav { margin-left: auto; }
.nav-links { display: flex; gap: 2px; list-style: none; padding: 0; margin: 0; }
.nav-links a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; color: var(--ink-2); text-decoration: none; font-size: 15px; font-weight: 500; border-radius: var(--r-btn); }
.nav-links a:hover { background: var(--wash); color: var(--ink); }
@media (max-width: 860px) { .nav nav { display: none; } .nav > .btn { margin-left: auto; } }

/* Tags (Notion-style property pills) */
.tag { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: var(--r-tag); font-size: 13.5px; font-weight: 500; line-height: 1.5; white-space: nowrap; }
.tag-yellow { background: var(--yellow); color: var(--yellow-ink); }
.tag-blue { background: var(--blue); color: var(--blue-ink); }
.tag-green { background: var(--green); color: var(--green-ink); }
.tag-red { background: var(--red); color: var(--red-ink); }
.tag-purple { background: var(--purple); color: var(--purple-ink); }
.tag-orange { background: var(--orange); color: var(--orange-ink); }
.tag-grey { background: var(--wash-2); color: var(--ink-2); }

/* Callouts */
.callout { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: var(--s-3); padding: 14px 16px; border-radius: var(--r-callout); font-size: 15px; background: var(--wash); color: var(--ink); }
.callout svg { width: 20px; height: 20px; margin-top: 2px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.callout strong { font-weight: 650; }
.callout-yellow { background: var(--yellow); color: var(--yellow-ink); }
.callout-blue { background: var(--blue); color: var(--blue-ink); }
.callout-red { background: var(--red); color: var(--red-ink); }

/* Card: the product page frame */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-card); overflow: hidden; min-width: 0; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2) var(--s-3); padding: 12px 18px; border-bottom: 1px solid var(--line); font-size: var(--t-meta); color: var(--ink-3); }
.card-head strong { color: var(--ink); font-weight: 650; font-size: 15px; }
.card-cols { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); }
.card-col { padding: 20px; display: grid; gap: var(--s-3); align-content: start; min-width: 0; }
.card-col + .card-col { border-left: 1px solid var(--line); }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--line); background: var(--wash); font-size: var(--t-small); color: var(--ink-2); margin: 0; }
.card-foot strong { color: var(--ink); font-weight: 650; }
@media (max-width: 900px) {
  .card-cols { grid-template-columns: 1fr; }
  .card-col + .card-col { border-left: 0; border-top: 1px solid var(--line); }
}
.col-title { font-size: var(--t-meta); font-weight: 600; color: var(--ink-3); }

/* Properties list (Notion page properties) */
.props { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; font-size: 15px; }
.props dt { color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.props dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.quote { border-left: 3px solid var(--ink); padding: 2px 0 2px 14px; font-size: 15.5px; }
.msg { font-size: 15.5px; }

/* Simple table */
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th, .table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table thead th { font-size: var(--t-meta); font-weight: 500; color: var(--ink-3); }
.table tbody th { font-weight: 400; color: var(--ink-3); width: 38%; }
.table td { font-variant-numeric: tabular-nums; }
.table .sub { display: block; color: var(--ink-3); font-size: 13.5px; }
.tbl-scroll { overflow-x: auto; }

/* Filter pills (tabs) */
.pills { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-5); }
.pills [role="tab"] {
  min-height: 44px; padding: 0 16px; border-radius: var(--r-pill, 999px); border: 1px solid var(--line-strong);
  background: var(--paper); color: var(--ink-2); font: 600 15px/1 var(--font); cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.pills [role="tab"]:hover { background: var(--wash); color: var(--ink); }
.pills [role="tab"][aria-selected="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* Checklist */
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.checklist li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: var(--s-3); align-items: start; }
.checklist li::before { content: ""; width: 18px; height: 18px; margin-top: 4px; border: 1.5px solid var(--ink-3); border-radius: 4px; }
.checklist li.done::before { background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat; border-color: var(--accent); }

/* Toggles (FAQ) */
.toggle { border-radius: var(--r-callout); }
.toggle summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: var(--s-2); align-items: center; min-height: 48px; padding: 8px 8px 8px 4px; border-radius: var(--r-callout); font-weight: 600; }
.toggle summary:hover { background: var(--wash); }
.toggle summary::-webkit-details-marker { display: none; }
.toggle summary::before { content: ""; justify-self: center; border-left: 7px solid var(--ink-2); border-top: 5px solid transparent; border-bottom: 5px solid transparent; transition: transform var(--dur) var(--ease); }
.toggle[open] summary::before { transform: rotate(90deg); }
.toggle p { padding: 0 8px 14px 34px; color: var(--ink-2); max-width: 64ch; }

/* Washed block: pastel section panel */
.block { border-radius: var(--r-block); padding: var(--s-7); }
.block-blue { background: var(--blue); }
.block-wash { background: var(--wash); }
@media (max-width: 720px) { .block { padding: var(--s-6) var(--s-5); } }

/* Forms */
.field { display: grid; gap: 6px; min-width: 0; }
.field label { font-weight: 600; font-size: 15px; }
.field .hint { font-size: 13.5px; color: var(--ink-3); font-weight: 400; }
.field input, .field textarea, .input {
  width: 100%; min-height: 46px; padding: 11px 13px; font: 16px/1.4 var(--font); color: var(--ink);
  background: var(--paper); border: 1px solid var(--line-strong); border-radius: var(--r-btn);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.field textarea { min-height: 112px; resize: vertical; }
.field input:focus, .field textarea:focus, .input.is-focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.field[data-invalid="true"] input, .field[data-invalid="true"] textarea, .input.is-error { border-color: var(--red-ink); }
.err { font-size: 13.5px; color: var(--red-ink); font-weight: 500; }

/* Footer */
.footer { padding-block: var(--s-8); border-top: 1px solid var(--line); font-size: var(--t-small); color: var(--ink-2); background: var(--wash); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: var(--s-6); }
.footer h3 { font-size: var(--t-small); font-weight: 650; margin-bottom: var(--s-3); }
.footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.footer a { color: var(--ink-2); text-decoration: none; }
.footer a:hover { color: var(--ink); text-decoration: underline; }
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr; } }
