/* Pulse: tokens, base, shell, shared components (buttons, chips, select, panels, dialog, toast, unlock).
   OWNER: shell. Section files (pulse-*.css) own their own geometry; do not edit this file from a feature module
   unless a shared component changes. Fonts come from /assets/fonts.css (variable Archivo + Geist Mono). */


:root {
  --paper: #F3F2EE;
  --ink: #0D0D0D;
  --grey: #8A8A85;       /* marks only, never small text */
  --grey-t: #5C5C58;     /* secondary text, 6.1:1 on paper */
  --hair: #D9D8D2;
  --mute: #C6C5BF;
  --red: #FF3B1F;
  --red-t: #C4240C;      /* red text, 5:1 on paper */
  --bca: #0060AF;
  --jenius: #20A4DC;
  --manual: #405b65;

  --pad: 32px;
  --gut: 32px;           /* column gutter */
  --maxw: 1376px;        /* content width (1440 minus gutters) */
  --bar-h: 64px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --expo: cubic-bezier(.16, 1, .3, 1);

  --f-display: 'Archivo', 'Arial Narrow', system-ui, sans-serif;
  --f-mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  /* type scale (1.25 minor third-ish, set from 12) */
  --t-xs: 12px;
  --t-sm: 13px;
  --t-md: 16px;
  --t-lg: 20px;
  --t-xl: 28px;
  --t-2xl: 44px;
  --t-3xl: 72px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--bar-h) + 24px); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-display);
  font-size: var(--t-md);
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
::selection { background: var(--ink); color: var(--paper); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: var(--paper); padding: 10px 14px; font: 500 var(--t-sm) var(--f-mono); }
.skip:focus { top: 12px; }
.wrap { padding-left: var(--pad); padding-right: var(--pad); max-width: calc(var(--maxw) + 2 * var(--pad)); margin-left: auto; margin-right: auto; }
kbd { font: 500 11px var(--f-mono); border: 1px solid currentColor; border-radius: 3px; padding: 0 4px; opacity: .7; margin-left: 4px; }

/* ---------- mono label system ---------- */
.sec-num, .hero-label, .filter-label, .label, .field label, .legend, .caption, .summary-sub, .stat-k, .sec-note, .ledger-count, .outside {
  font-family: var(--f-mono);
  font-size: var(--t-xs);
  letter-spacing: .01em;
  font-weight: 400;
}
.sec-num { margin: 0; color: var(--grey-t); }


/* ---------- reveal (clip-path wipes) ---------- */
html.js[data-motion="on"] .reveal { clip-path: inset(0 100% 0 0); transition: clip-path 1.1s var(--expo) var(--d, 0ms); }
html.js[data-motion="on"] .reveal.in { clip-path: inset(0 0 0 0); }
html.js[data-motion="on"] .reveal.done { clip-path: none; }


/* ---------- split sections ---------- */
.sec.split { padding: 96px 0 0; }
.split-in { display: grid; grid-template-columns: minmax(240px, 3fr) 9fr; gap: 48px; }
.sec-side { align-self: start; position: sticky; top: calc(var(--bar-h) + 28px); }
.sec-title {
  margin: 10px 0 0;
  font-size: var(--t-3xl); line-height: .88; font-weight: 720; font-stretch: 62%;
  letter-spacing: -.015em;
}
.sec-title .count {
  display: inline-grid; place-items: center; vertical-align: .9em;
  min-width: 26px; height: 26px; border-radius: 13px; padding: 0 7px;
  background: var(--ink); color: var(--paper);
  font: 500 var(--t-sm) var(--f-mono); letter-spacing: 0;
}
.sec-title .count.zero { background: transparent; color: var(--grey-t); border: 1px solid var(--hair); }
.sec-note { color: var(--grey-t); margin: 16px 0 0; max-width: 30ch; line-height: 1.55; }


/* ---------- buttons ---------- */
.btn-solid {
  height: 40px; padding: 0 18px; background: var(--ink); color: var(--paper);
  font: 600 var(--t-sm) var(--f-display); border-radius: 20px;
  transition: background .2s, transform .2s var(--ease);
}
.btn-solid:hover { background: #2b2b2b; }
.btn-solid:active { transform: scale(.97); }
.btn-solid[disabled] { opacity: .5; cursor: progress; }
/* text buttons: .btn-line (ink underline) and .btn-text (quiet grey underline) */
.btn-line, .btn-text {
  font: 500 var(--t-xs) var(--f-mono); color: var(--ink); line-height: 16px; padding: 4px 0;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px;
  transition: color .2s, text-decoration-color .2s;
}
.btn-text { text-underline-offset: 3px; text-decoration-color: var(--grey); }
.btn-line:hover { color: var(--red-t); text-decoration-color: var(--red); }
.btn-text:hover { text-decoration-color: var(--red); }
.btn-line[disabled], .btn-text[disabled] { color: var(--grey-t); text-decoration-color: var(--hair); cursor: default; }
.btn-line[aria-busy="true"], .btn-text[aria-busy="true"] { cursor: progress; }

/* segmented / chips */
.chips { display: flex; gap: 6px; flex-wrap: nowrap; }
.chips-wrap { flex-wrap: wrap; }
.chip {
  height: 30px; padding: 0 12px; border-radius: 15px;
  border: 1px solid var(--hair); background: transparent;
  font: 400 var(--t-xs) var(--f-mono); color: var(--ink); white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .25s, color .25s, border-color .25s;
}
.chip:hover { border-color: var(--ink); }
.chip[aria-checked="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip .mk { font-size: 11px; }
.chip[aria-checked="true"] .mk { color: var(--paper) !important; }

/* custom select (listbox) */
.sel { position: relative; }
.sel-btn {
  width: 100%; height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-bottom: 1px solid var(--ink); text-align: left; font-size: var(--t-md);
}
.sel-btn::after { content: ''; width: 7px; height: 7px; border-right: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); transform: translateY(-3px) rotate(45deg); transition: transform .3s var(--ease); flex: none; }
.sel.open .sel-btn::after { transform: translateY(1px) rotate(225deg); }
.sel-btn.placeholder { color: var(--grey-t); }
.sel-btn[aria-invalid="true"] { border-bottom-color: var(--red); }
.sel-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20;
  list-style: none; margin: 0; padding: 6px 0; background: var(--paper);
  border: 1px solid var(--ink); max-height: 280px; overflow: auto;
  clip-path: inset(0 0 100% 0); visibility: hidden;
  transition: clip-path .35s var(--expo), visibility 0s .35s;
}
.sel.up .sel-list { top: auto; bottom: calc(100% + 4px); clip-path: inset(100% 0 0 0); }
.sel.open .sel-list { clip-path: inset(0 0 0 0); visibility: visible; transition: clip-path .35s var(--expo); }
.sel-opt { padding: 8px 14px; display: flex; justify-content: space-between; gap: 10px; cursor: pointer; font-size: var(--t-sm); }
.sel-opt.active { background: var(--ink); color: var(--paper); }
.sel-opt[aria-selected="true"]::after { content: ''; width: 6px; height: 6px; background: var(--red); align-self: center; }


/* ---------- footer ---------- */
.foot { display: flex; justify-content: flex-end; gap: 24px; align-items: center; margin-top: 140px; padding-top: 18px; padding-bottom: 28px; border-top: 1px solid var(--hair); font: 400 var(--t-xs) var(--f-mono); color: var(--grey-t); }
.foot p { margin: 0; }


/* ---------- panels ---------- */
.scrim { position: fixed; inset: 0; background: rgba(13, 13, 13, .22); z-index: 40; opacity: 0; transition: opacity .4s var(--ease); }
.scrim.on { opacity: 1; }
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 50;
  width: min(460px, 100vw); background: var(--paper);
  border-left: 1px solid var(--ink);
  transform: translateX(100%); transition: transform .6s var(--expo);
  overflow-y: auto; overscroll-behavior: contain;
}
.panel.on { transform: none; }
.panel-in { padding: 22px 32px 40px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; }
.btn-close { font: 500 var(--t-xs) var(--f-mono); border-bottom: 1px solid var(--ink); padding: 3px 0; }
.panel-title { font-size: var(--t-2xl); font-weight: 720; font-stretch: 62%; line-height: .95; margin: 0 0 28px; }
.field { margin-bottom: 16px; }
.field label, .field .label { display: block; color: var(--grey-t); margin-bottom: 6px; }
.field input:not([type=search]) {
  width: 100%; height: 40px; border: 0; border-bottom: 1px solid var(--ink); background: transparent; border-radius: 0;
  font-size: var(--t-md); padding: 0; outline: none;
}
.field input:focus { border-bottom: 2px solid var(--red); }
.field input[aria-invalid="true"] { border-bottom-color: var(--red); }
.field input[type=datetime-local] { font-family: var(--f-mono); font-size: var(--t-sm); }
.field input[type=datetime-local]::-webkit-calendar-picker-indicator { opacity: .6; cursor: pointer; }
.amount-in { display: flex; align-items: baseline; gap: 8px; border-bottom: 1px solid var(--ink); }
.amount-in:focus-within { border-bottom: 2px solid var(--red); }
.amount-in span { font-size: var(--t-lg); font-weight: 600; }
.field-amount .amount-in input { border: 0 !important; height: auto; font-size: 64px; font-weight: 720; font-stretch: 66%; line-height: 1.05; letter-spacing: -.01em; }
.err { margin: 4px 0 0; font: 400 var(--t-xs) var(--f-mono); color: var(--red-t); height: 16px; line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-actions { display: flex; gap: 24px; align-items: center; margin-top: 24px; }


/* ---------- custom cursor ---------- */
.cursor { position: fixed; left: 0; top: 0; z-index: 90; pointer-events: none; display: none; }
html.has-cursor .cursor { display: block; }
.cursor-dot {
  position: absolute; left: -18px; top: -18px; width: 36px; height: 36px;
  border-radius: 50%; background: var(--ink);
  transform: scale(calc(.28 * var(--cp, 1)));
  transition: transform .3s var(--expo), background .3s, border-color .3s, opacity .2s;
  border: 1.5px solid transparent;
}
.cursor.mag .cursor-dot { transform: scale(var(--cp, 1)); background: transparent; border-color: var(--red); }
.cursor.press { --cp: .8; }
@media (pointer: coarse), (hover: none) { .cursor { display: none !important; } }
.cursor.text .cursor-dot, .cursor.gone .cursor-dot { opacity: 0; }
html.has-cursor, html.has-cursor a, html.has-cursor button, html.has-cursor [role=slider], html.has-cursor [role=option], html.has-cursor .chart { cursor: none; }
html.has-cursor input, html.has-cursor textarea { cursor: text; }
html.has-cursor input[type=datetime-local] { cursor: auto; }


/* ---------- motion off ---------- */
html[data-motion="off"] *, html[data-motion="off"] *::before, html[data-motion="off"] *::after {
  transition-duration: 0s !important; transition-delay: 0s !important;
  animation-duration: 0s !important; animation-iteration-count: 1 !important;
}
html[data-motion="off"] svg.intro .tk-v { transform: none; }
html[data-motion="off"] svg.intro .tk-r, html[data-motion="off"] svg.intro .tk-n { opacity: 1; }
html[data-motion="off"] svg.intro .draw { stroke-dashoffset: 0; }
html[data-motion="off"] svg.intro .c-area, html[data-motion="off"] svg.intro .c-proj, html[data-motion="off"] svg.intro .c-today, html[data-motion="off"] svg.intro .c-enddot, html[data-motion="off"] svg.intro .lbl { opacity: 1; }


/* ---------- shell ---------- */
#app { min-height: 100vh; }
main#main { outline: none; }
main#main[data-state="loading"] .sec { opacity: .55; }
.sec { transition: opacity .3s var(--ease); }
.split-in > * { min-width: 0; }
.slot { flex: none; min-width: 0; }
.reveal-bar { animation: barIn 1.1s var(--expo) both; }
@keyframes barIn { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
/* loading / empty / error notice: fixed to the viewport so it can never move page content */
.statebar {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 70;
  display: flex; align-items: center; gap: 16px; max-width: calc(100vw - 32px);
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 4px;
  font: 400 var(--t-xs) var(--f-mono);
}
.statebar[hidden] { display: none; }
.statebar[data-state="error"] { background: var(--red-t); }
.statebar .btn-line { color: var(--paper); text-decoration-color: var(--paper); }
.skip:focus { top: 12px; }

/* ---------- dialog (native <dialog id="modal">) ---------- */
dialog#modal {
  border: 1px solid var(--ink); background: var(--paper); color: var(--ink); padding: 0;
  width: min(560px, calc(100vw - 24px)); max-height: calc(90vh - 24px); overflow: auto; overscroll-behavior: contain;
  margin-top: 10vh; margin-bottom: auto; /* top-anchored: content loading in never moves the dialog */
}
dialog#modal::backdrop { background: rgba(13, 13, 13, .32); }
#modal-close { position: absolute; top: 14px; right: 18px; font: 500 20px/1 var(--f-mono); width: 32px; height: 32px; }
#modal-content { padding: 28px 32px 32px; }
#modal-content h2 { font-size: var(--t-xl); font-weight: 720; font-stretch: 70%; margin: 6px 0 18px; line-height: 1; }
#modal-content label { display: block; margin: 0 0 14px; font: 400 var(--t-xs) var(--f-mono); color: var(--grey-t); }
#modal-content input:not([type=checkbox]), #modal-content select { display: block; width: 100%; height: 40px; margin-top: 6px; border: 0; border-bottom: 1px solid var(--ink); background: transparent; border-radius: 0; font: 400 var(--t-md) var(--f-display); color: var(--ink); outline: none; }
#modal-content input:focus, #modal-content select:focus { border-bottom: 2px solid var(--red); }
.eyebrow { font: 400 var(--t-xs) var(--f-mono); color: var(--grey-t); margin: 0; }
.form-note { font: 400 var(--t-xs) var(--f-mono); color: var(--grey-t); margin: 10px 0; }
.form-error { font: 400 var(--t-xs) var(--f-mono); color: var(--red-t); margin: 8px 0; min-height: 16px; line-height: 16px; }
.modal-actions { display: flex; gap: 20px; align-items: center; justify-content: flex-end; margin-top: 18px; }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 72px; z-index: 80; transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  max-width: calc(100vw - 32px); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 4px;
  font: 400 var(--t-xs) var(--f-mono); transition: opacity .3s var(--ease), transform .4s var(--expo);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast[data-tone="error"] { background: var(--red-t); }

/* ---------- unlock ---------- */
/* Pulse layout: wordmark + huge condensed headline on the left, numbered steps (01 passkey, 02 token) on the right.
   Every box that shows changing text (passkey note, origin link, error) has a reserved height: zero shift. */
.unlock { min-height: 100vh; display: grid; align-items: start; padding: 14vh var(--pad) 48px; }
.unlock-in { width: 100%; max-width: var(--maxw); margin: 0 auto; display: grid; grid-template-columns: minmax(0, 7fr) minmax(320px, 5fr); gap: 48px; align-items: start; }
.unlock-intro { min-width: 0; }
.unlock-forms { min-width: 0; max-width: 460px; border-top: 1px solid var(--ink); padding-top: 18px; }
.unlock-brand { margin: 0 0 56px; font-weight: 800; font-stretch: 62%; font-size: 26px; letter-spacing: -.01em; line-height: 1; display: inline-flex; align-items: flex-end; }
.unlock-brand i { width: 7px; height: 7px; background: var(--red); display: inline-block; margin-left: 2px; margin-bottom: 3px; }
.unlock-title { font-size: clamp(56px, 8.4vw, 128px); line-height: .86; font-weight: 720; font-stretch: 62%; margin: 14px 0 22px; letter-spacing: -.02em; max-width: 9ch; }
.unlock-sub { margin: 0; color: var(--grey-t); font: 400 var(--t-sm) var(--f-mono); }
.unlock-step { margin: 0 0 14px; color: var(--ink); }
.unlock-step span { color: var(--red-t); margin-right: 6px; }
.passkey-login { display: grid; gap: 10px; justify-items: start; align-content: start; min-height: 172px; margin-bottom: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--hair); }
.passkey-button, .token-button { display: inline-flex; align-items: center; gap: 14px; }
.passkey-button[disabled], .token-button[disabled] { opacity: .45; cursor: not-allowed; }
.unlock .btn-text { font: 500 var(--t-xs) var(--f-mono); color: var(--ink); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; padding: 4px 0; }
.unlock .btn-text:hover { color: var(--red-t); text-decoration-color: var(--red); }
#unlock-form { margin-bottom: 22px; }
#unlock-form label { display: block; font: 400 var(--t-xs) var(--f-mono); color: var(--grey-t); }
#unlock-form input { display: block; width: 100%; height: 44px; margin: 6px 0 4px; border: 0; border-bottom: 1px solid var(--ink); background: transparent; border-radius: 0; font: 400 var(--t-md) var(--f-mono); letter-spacing: .08em; outline: none; color: var(--ink); }
#unlock-form input:focus { border-bottom: 2px solid var(--red); }
#unlock-form .form-error { margin: 4px 0 14px; min-height: 32px; }
.unlock-boundary { font: 400 var(--t-xs) var(--f-mono); color: var(--grey-t); margin: 8px 0 0; }
@media (max-width: 900px) {
  .unlock { padding-top: 8vh; }
  .unlock-in { grid-template-columns: 1fr; gap: 36px; }
  .unlock-brand { margin-bottom: 36px; }
  .unlock-forms { max-width: none; }
}

/* ---------- responsive (shared) ---------- */
@media (max-width: 1100px) {
  .split-in { grid-template-columns: 1fr; gap: 28px; }
  .sec-side { position: static; }
  .sec-note { max-width: 52ch; }
}
@media (max-width: 760px) {
  :root { --pad: 20px; --bar-h: 144px; --t-3xl: 56px; --t-2xl: 36px; --t-xl: 22px; }
  .sec.split { padding-top: 80px; }
  .chips { overflow-x: auto; margin: 0 calc(var(--pad) * -1); padding: 2px var(--pad); scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chips-wrap { flex-wrap: nowrap; }
  .panel-in { padding: 18px 20px 40px; }
  .field-amount .amount-in input { font-size: 52px; }
  .foot { flex-direction: column; align-items: flex-end; gap: 10px; margin-top: 96px; padding-bottom: 84px; }
  #modal-content { padding: 24px 20px 28px; }
}

.unlock .form-note { min-height: 48px; margin: 0; }
#unlock-origin[hidden] { display: block; visibility: hidden; }
