/*
 * Unpack design system — components.
 * Depends on tokens.css. Shared by the marketing site and the app. Emails
 * don't load this: they use src/design/tokens.ts and inline everything.
 *
 * Sections: base, layout, type helpers, buttons, forms, chips and badges,
 * cards, document list (the app's core), notices, upload, nav and footer,
 * dark band, devices (marketing only), motion.
 */

/* --- base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  /* In-page links animate instead of jumping, and land below the sticky nav. */
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}
body {
  margin: 0; padding: 0;
  font: 17px/1.55 var(--font-text); color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}
img { max-width: 100%; height: auto; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; }
code { font-family: var(--font-mono); font-size: .92em; background: var(--bg-soft); padding: 1px 5px; border-radius: 4px; }

/* --- layout ---------------------------------------------------------------- */
.wrap { max-width: var(--wrap); margin: 0 auto; padding-inline: var(--gutter); position: relative; }
.section { padding-block: clamp(48px, 7vw, 104px); }
.section.soft { background: var(--bg-soft); }
.section.dark { background: var(--dark-surface); color: var(--on-dark); }
.section.dark h2 { color: var(--on-dark); }
.section.dark .lede { color: var(--on-dark-muted); }
.sect-head { display: flex; flex-direction: column; gap: var(--space-3); max-width: 760px; margin-bottom: clamp(24px, 4vw, 48px); }
.grid { display: grid; gap: var(--space-4); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid.cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 960px) { .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.cols-3 { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .grid.cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.cols-2 { grid-template-columns: 1fr; } }
@media (max-width: 460px) { .grid.cols-5, .grid.cols-4 { grid-template-columns: 1fr; } }
.columns { columns: 3 340px; column-gap: var(--space-4); }
.columns > * { break-inside: avoid; margin-bottom: var(--space-4); }

/* --- type helpers ----------------------------------------------------------- */
.lede { color: var(--body); max-width: var(--measure); }
.muted { color: var(--muted); }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--accent-text); }
.mono { font-family: var(--font-mono); }

/* --- buttons ----------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  height: 46px; padding: 0 20px; border-radius: var(--radius-sm);
  font: 600 16px/1 var(--font-text); text-decoration: none; border: 0; cursor: pointer;
  white-space: nowrap; transition: background var(--motion-base) var(--motion-ease), transform var(--motion-base) var(--motion-ease);
  background: var(--accent); color: var(--on-accent);
}
.btn:hover { background: var(--accent-hover); color: var(--on-accent); transform: translateY(-1px); }
.btn.sm { height: 38px; padding: 0 16px; font-size: 15px; }
.btn.xs { height: 32px; padding: 0 12px; font-size: 14px; }
.btn.dark { background: var(--ink); color: var(--bg); }
.btn.dark:hover { background: color-mix(in srgb, var(--ink) 86%, var(--bg)); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: transparent; border-color: var(--ink); }
.btn[disabled] { opacity: .5; pointer-events: none; }
/* Copies an address instead of opening a mail client. Both labels sit in the
   same grid cell, so the button never changes width as they cross-fade. */
.btn.copy { display: inline-grid; align-items: center; }
.btn.copy > span { grid-area: 1 / 1; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); transition: opacity var(--motion-slow) var(--motion-ease), transform var(--motion-slow) var(--motion-ease); }
.btn.copy .state-done { opacity: 0; transform: translateY(5px); }
.btn.copy.done .state-idle { opacity: 0; transform: translateY(-5px); }
.btn.copy.done .state-done { opacity: 1; transform: none; }
.link { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 16px; color: var(--accent-text); text-decoration: none; }
.link:hover { text-decoration: underline; }
.linky { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-text); text-decoration: underline; cursor: pointer; }

/* --- forms ------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 15px; font-weight: 500; }
.input {
  width: 100%; height: 46px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: 400 16px var(--font-text); color: var(--ink); background: var(--card);
}
.input:focus { border-color: var(--accent); outline: 0; box-shadow: 0 0 0 3px var(--accent-tint); }
.field .hint { font-size: 14px; color: var(--muted); }
/* The address form: an input and its button in one rounded field. */
.form {
  display: flex; gap: var(--space-2); align-items: center; width: min(520px, 100%);
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 6px 6px 6px 16px; box-shadow: var(--shadow-1);
}
.form input { flex: 1; min-width: 0; border: 0; font: 500 17px var(--font-text); color: var(--ink); background: transparent; }
.form input:focus { outline: 0; }
.form .btn { height: 42px; flex: none; }
.form .copied {
  color: var(--present); font-size: 14px; font-weight: 600; white-space: nowrap;
  max-width: 0; opacity: 0; overflow: hidden;
  transition: max-width var(--motion-slow) var(--motion-ease), opacity var(--motion-slow) var(--motion-ease);
}
.form.done .copied { max-width: 7em; opacity: 1; }
@media (max-width: 420px) { .form { flex-wrap: wrap; padding: 8px; } .form input { flex-basis: 100%; padding: 6px 8px; } .form .btn { width: 100%; } }

/* --- chips and badges ------------------------------------------------------- */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; padding: 4px 10px; border: 1px solid var(--line); border-radius: var(--radius-pill); color: var(--body); white-space: nowrap; background: var(--card); }
.badge { display: inline-flex; align-items: center; font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: var(--radius-pill); background: var(--accent); color: var(--on-accent); white-space: nowrap; }
.badge.ink { background: var(--ink); color: var(--bg); }
.badge.warn { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--ink); font-weight: 500; }
.tag { position: absolute; left: 14px; top: 14px; z-index: 2; background: rgba(255,255,255,.92); color: var(--ink); border-radius: var(--radius-pill); padding: 4px 10px; font-size: 13px; font-weight: 600; }

/* --- cards ------------------------------------------------------------------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-5) var(--space-6); display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.card h3 { font-size: 18px; font-weight: 600; }
.card p { font-size: 15px; line-height: 1.5; color: var(--body); }
.card .art { height: 118px; border-radius: 12px; background: var(--accent-tint); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.card .art svg { width: 110px; height: 84px; max-width: 90%; }
.card.lift { box-shadow: var(--shadow-2); border-color: transparent; }
/* Stat tile: a number with its label above and its meaning below. */
.stat { border: 1px solid var(--line-on-dark); border-radius: var(--radius-lg); padding: 22px; display: flex; flex-direction: column; gap: var(--space-2); background: rgba(255,255,255,.05); min-width: 0; }
.stat .k { font-size: 14px; color: var(--on-dark-muted); font-weight: 500; }
.stat .v { font-family: var(--font-display); font-size: clamp(38px, 4vw, 56px); font-weight: 500; letter-spacing: -0.015em; line-height: 1; color: var(--accent-light); font-variant-numeric: tabular-nums; }
.stat .d { font-size: 15px; color: var(--on-dark-muted); line-height: 1.45; }
/* Photo slot with a gradient fallback while (or if) the image doesn't load. */
.photo { position: relative; overflow: hidden; border-radius: var(--radius-lg); background: linear-gradient(135deg, var(--accent) 0%, var(--accent-mid) 60%, var(--accent-light) 100%); }
.photo img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* --- the document list (app) ------------------------------------------------ */
.progress { border-left: 3px solid var(--accent); padding: 2px 0 2px 12px; margin: 0 0 var(--space-4); font-size: 15px; color: var(--body); }
.progress.complete { border-left-color: var(--present); }
.progress strong { color: var(--ink); }
.group { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 10px 14px 6px; }
.group h2, .group summary { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 4px; font-weight: 600; }
.group summary { cursor: pointer; list-style: none; }
.group summary::-webkit-details-marker { display: none; }
.group summary::after { content: " +"; }
details.group[open] summary::after { content: " -"; }
details.group[open] summary { margin-bottom: 4px; }
.doc { display: flex; align-items: baseline; gap: var(--space-2); padding: 5px 0; border-top: 1px solid var(--line); font-size: 15px; }
h2 + .doc, summary + .doc { border-top: 0; }
.doc .tick { color: var(--present); font-size: 13px; width: 12px; flex: none; }
.doc .name { flex: 1 1 auto; min-width: 0; word-break: break-word; }
.doc .name a, .doc a.view { color: var(--ink); font-weight: 500; text-decoration: none; }
.doc .name a:hover, .doc a.view:hover { color: var(--accent-text); }
.doc .kind { font-size: 13px; color: var(--muted); flex: none; white-space: nowrap; }
.doc .dl { font-size: 14px; flex: none; }
.doc.missing .tick { color: var(--faint); }
.doc.missing .name { color: var(--muted); }
.doc.missing .pending { font-size: 13px; color: var(--faint); flex: none; }
.group.unsorted { border-color: var(--warn-line); background: var(--warn-bg); }
.group.unsorted h2 { color: var(--ink); }

/* --- notices ------------------------------------------------------------------ */
.note { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: var(--radius-md); padding: 10px 14px; font-size: 14px; }
.note strong { font-size: 15px; }
.note p { margin: 2px 0; }
.note ul { margin: 4px 0 0; padding-left: 18px; }
.note li { margin-bottom: 2px; word-break: break-all; }
.note .why { color: var(--muted); word-break: normal; }
.note .why::before { content: "· "; }
.notice { display: flex; gap: var(--space-3); align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; font-size: 15px; background: var(--card); }
.notice .ic { width: 30px; height: 30px; border-radius: 8px; flex: none; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-tint); color: var(--accent-text); }
.notice.warn .ic { background: var(--warn-bg); color: var(--warn-text); }
.notice b { display: block; margin-bottom: 2px; }
.notice span { color: var(--body); }

/* --- upload ------------------------------------------------------------------- */
.dropzone {
  padding: 10px 14px; border: 2px dashed var(--line); border-radius: var(--radius-md);
  font-size: 14px; color: var(--muted); transition: border-color var(--motion-fast), background var(--motion-fast);
  display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap;
}
.dropzone.over { border-color: var(--accent); background: var(--accent-tint); }
.dropzone strong { color: var(--ink); font-size: 15px; }
.dropzone .limits { font-size: 13px; color: var(--faint); flex: 1 1 100%; }
.dropzone .btn { margin-left: auto; }

/* --- nav and footer ------------------------------------------------------------ */
.announce { background: var(--dark-surface); color: var(--on-dark); font-size: 14px; text-align: center; padding: 9px 16px; }
.announce a { color: inherit; text-decoration: none; }
.announce a:hover { text-decoration: underline; }
.nav { background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; }
.nav .wrap { display: flex; align-items: center; gap: 28px; height: 68px; }
.nav ul { display: flex; gap: 26px; list-style: none; margin: 0; padding: 0; font-size: 15px; font-weight: 500; }
.nav ul a { color: var(--ink); text-decoration: none; }
.nav .right { margin-left: auto; display: flex; align-items: center; gap: 18px; font-size: 15px; }
.nav .btn { height: 38px; padding: 0 16px; font-size: 15px; }
@media (max-width: 960px) { .nav ul, .nav .right .hide-narrow { display: none; } }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; font-weight: 600; font-size: 21px; letter-spacing: -0.01em; }
.brand .wm { display: block; height: 26px; width: auto; flex: none; }
.mark { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), var(--accent-mid)); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.footer { background: var(--dark-surface); color: var(--on-dark-muted); padding-block: 44px 32px; font-size: 15px; }
.footer .cols { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 28px; }
@media (max-width: 760px) { .footer .cols { grid-template-columns: 1fr 1fr; } }
@media (max-width: 420px) { .footer .cols { grid-template-columns: 1fr; } }
.footer h4 { margin: 0 0 10px; color: var(--on-dark); font-size: 14px; text-transform: uppercase; letter-spacing: .06em; }
.footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.footer a { color: var(--on-dark-muted); text-decoration: none; }
.footer a:hover { color: var(--on-dark); }
.footer .credits { margin-top: 32px; padding-top: 18px; border-top: 1px solid var(--line-on-dark); font-size: 13px; opacity: .65; line-height: 1.6; }
/* App page header: address, sub line, actions. */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; padding: 22px 0 14px; }
.page-head h1 { font-size: 24px; line-height: 1.2; }
.page-head .rest { font-size: 18px; font-weight: 400; color: var(--muted); margin-left: 6px; }
.page-head .sub { color: var(--muted); font-size: 14px; }

/* --- devices (marketing only) --------------------------------------------------- */
.mac { background: var(--card); border-radius: var(--radius-lg); border: 1px solid var(--line); box-shadow: var(--shadow-2); overflow: hidden; min-width: 0; font-family: var(--font-system); font-size: 15px; }
.mac .bar { position: relative; display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); background: linear-gradient(var(--bg-off), var(--bg-soft)); font-size: 14px; color: var(--muted); }
.mac .bar .dots { display: flex; gap: 7px; }
.mac .bar .dots i { width: 12px; height: 12px; border-radius: 50%; display: block; box-shadow: inset 0 0 0 .5px rgba(0,0,0,.12); }
.mac .bar .dots i:nth-child(1) { background: #FF5F57; } .mac .bar .dots i:nth-child(2) { background: #FEBC2E; } .mac .bar .dots i:nth-child(3) { background: #28C840; }
.mac .bar .title { position: absolute; left: 50%; transform: translateX(-50%); color: var(--ink); font-weight: 500; white-space: nowrap; }
@media (max-width: 1100px) { .mac .bar .title { display: none; } }
.mac .bar .badge { margin-left: auto; position: relative; }
.iphone { position: relative; width: 100%; aspect-ratio: 9 / 18.6; background: linear-gradient(160deg, #E9E9EE, #C9C9D2); border-radius: 17.5cqw; padding: 2.25cqw; box-shadow: var(--shadow-3), inset 0 0 0 .75cqw rgba(255,255,255,.6); container-type: inline-size; font-family: var(--font-system); }
.iphone .bezel { background: #000; border-radius: 15.5cqw; height: 100%; padding: 2.25cqw; }
.iphone .screen { position: relative; background: var(--card); border-radius: 13.5cqw; height: 100%; overflow: hidden; padding: 15.5cqw 5cqw 7.5cqw; font-size: 4.75cqw; display: flex; flex-direction: column; gap: 3.5cqw; }
.iphone .island { position: absolute; left: 50%; top: 3.75cqw; transform: translateX(-50%); width: 27%; height: 6.5cqw; background: #000; border-radius: 5cqw; }
.iphone .status { position: absolute; left: 0; right: 0; top: 4cqw; display: flex; justify-content: space-between; padding: 0 8cqw; font-size: 4.75cqw; font-weight: 600; color: var(--ink); }
.iphone .home { position: absolute; left: 50%; bottom: 2.25cqw; transform: translateX(-50%); width: 32%; height: 1.4cqw; background: var(--ink); border-radius: 2cqw; opacity: .9; }

/* --- motion --------------------------------------------------------------------- */
.dash { fill: none; stroke: var(--accent-mid); stroke-width: 2; stroke-dasharray: 2 8; stroke-linecap: round; opacity: .8; animation: march var(--motion-march); }
@keyframes march { to { stroke-dashoffset: -20; } }
.float { animation: float var(--motion-float); }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.glow { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .32; background: var(--accent); pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  .dash, .float, .glow { animation: none; }
  .btn { transition: none; }
  html { scroll-behavior: auto; }
  .form .copied, .btn.copy > span { transition: none; }
}
