/* ─────────────────────────────────────────────────────────────
   BASE — reset + shared building blocks used by every component:
   .container .section .section-head .btn .card .input .chip .badge .tag
   ───────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 96px; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: 1.55;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .3s, color .3s;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
/* No grey/blue flash when tapping on phones */
html { -webkit-tap-highlight-color: transparent; }
/* Keyboard focus only (Tab key) — follows each element's own rounded corners */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* ── Pages ──────────────────────────────────────────── */
/* Inner pages: leave room under the floating nav bar */
.page:not(.page--home) { padding-top: calc(var(--nav-h) + 24px); }
.page:not(.page--home) > :first-child .section-head .title { font-size: var(--fs-hero); line-height: .95; letter-spacing: -0.04em; }

/* ── Layout ─────────────────────────────────────────── */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: var(--section-y); }

/* Dark rounded panel that sits inside the page (used for contrast blocks) */
.panel-ink {
  background: var(--surface-ink); color: var(--text-on-ink);
  border-radius: var(--radius-xl);
  /* panel edges line up with the page content (and the nav bar) */
  margin-inline: max(var(--gutter), calc((100% - var(--container)) / 2 + var(--gutter)));
  --text-muted: #a3a3aa; --line: rgba(255,255,255,.1); --line-strong: rgba(255,255,255,.18);
  --surface: #18181a; --surface-2: #222225;
  --accent-em: var(--accent-on-ink);
}
.panel-ink .label::before { --accent: var(--accent-on-ink); }

/* Section heading: small label, huge title, short text */
.section-head { display: grid; gap: var(--space-4); margin-bottom: clamp(40px, 6vw, 72px); max-width: 820px; }
.section-head--split { max-width: none; }
@media (min-width: 900px) {
  .section-head--split { grid-template-columns: 1.4fr 1fr; align-items: end; gap: var(--space-7); }
}
.label {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-size: var(--fs-sm); font-weight: 500; color: var(--text-muted);
}
/* the brand's three express lines, stepping back */
.label::before, .lines {
  content: ""; display: inline-block; flex-shrink: 0; width: 16px; height: 10px;
  background:
    linear-gradient(var(--accent), var(--accent)) right 0 / 100% 2.5px no-repeat,
    linear-gradient(var(--accent), var(--accent)) right 50% / 68% 2.5px no-repeat,
    linear-gradient(var(--accent), var(--accent)) right 100% / 40% 2.5px no-repeat;
}
.title {
  font-family: var(--font-display);
  font-size: var(--fs-2xl); line-height: 0.98; font-weight: 700;
  letter-spacing: var(--tracking-tight); text-wrap: balance;
}
.title em { font-style: normal; color: var(--accent-em, var(--accent-text)); }
.lede { font-size: var(--fs-lg); color: var(--text-muted); max-width: 520px; text-wrap: pretty; }

/* ── Buttons ────────────────────────────────────────── */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  height: 48px; padding: 0 22px; border-radius: var(--radius-pill);
  font-weight: 500; font-size: var(--fs-md); white-space: nowrap; letter-spacing: -0.01em;
  transition: transform .35s var(--spring), background-color .25s var(--ease), color .25s var(--ease), box-shadow .3s var(--ease), opacity .25s;
}
.btn:active { transform: scale(.96); transition-duration: .12s; }
.btn svg { width: 18px; height: 18px; flex-shrink: 0; transition: transform .25s var(--ease); }
.btn:hover svg:last-child { transform: translateX(2px); }
.btn--primary { background: var(--text); color: var(--bg); }
.btn--primary:hover { box-shadow: 0 8px 24px -8px rgba(12,12,13,.5); }
.btn--accent { background: var(--accent); color: var(--accent-ink); }
.btn--accent:hover { background: var(--accent-strong); }
.btn--ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn--ghost:hover { background: var(--surface); }
.btn--sm { height: 40px; padding: 0 16px; font-size: var(--fs-sm); }
.btn--lg { height: 56px; padding: 0 28px; font-size: var(--fs-lg); }
.btn--block { width: 100%; }
.btn--icon { width: 48px; padding: 0; }

/* ── Cards ──────────────────────────────────────────── */
.card { background: var(--surface); border-radius: var(--radius-lg); padding: var(--space-6); box-shadow: var(--shadow-sm); }
.icon-dot { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--surface-2); }
.icon-dot svg { width: 20px; height: 20px; }

/* ── Forms ──────────────────────────────────────────── */
.field { display: grid; gap: 8px; }
.field label { font-size: var(--fs-sm); color: var(--text-muted); }
.input {
  width: 100%; height: 52px; padding: 0 18px;
  background: var(--surface-2); border: 1px solid transparent; border-radius: var(--radius);
  transition: border-color .2s, background-color .2s, box-shadow .2s;
}
/* No resize handle (the two lines in the corner) — it grows with the text instead */
textarea.input { height: auto; min-height: 96px; padding-block: 14px; resize: none; field-sizing: content; max-height: 240px; }
select.input {
  appearance: none; padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 256 256' fill='%239a9aa1'%3E%3Cpath d='M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z'/%3E%3C/svg%3E"); /* Phosphor caret-down */
  background-repeat: no-repeat; background-position: right 18px center;
}
.input::placeholder { color: var(--text-faint); }
.input:hover { border-color: var(--line-strong); }
.input:focus { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
/* Browser autofill: keep our colors and corners instead of the yellow/blue box */
.input:-webkit-autofill, .input:-webkit-autofill:hover {
  -webkit-text-fill-color: var(--text); caret-color: var(--text);
  -webkit-box-shadow: 0 0 0 100px var(--surface-2) inset; transition: background-color 9999s;
}
.input:-webkit-autofill:focus { -webkit-box-shadow: 0 0 0 100px var(--surface) inset, 0 0 0 3px var(--accent-soft); }

/* Segmented control (tabs / filters) */
.segmented { display: inline-flex; gap: 4px; padding: 4px; border-radius: var(--radius-pill); background: var(--surface-2); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented::-webkit-scrollbar { display: none; }
.segmented button {
  flex-shrink: 0; height: 38px; padding: 0 16px; border-radius: var(--radius-pill);
  font-size: var(--fs-sm); font-weight: 500; color: var(--text-muted); transition: background-color .25s var(--ease), color .2s, box-shadow .25s;
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"], .segmented button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }

/* ── Badges ─────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: var(--radius-pill); font-size: var(--fs-xs); font-weight: 500; background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--success { color: var(--success); }
.badge--warning { color: var(--warning); }
.badge--danger { color: var(--danger); }

/* ── States ─────────────────────────────────────────── */
.empty { grid-column: 1 / -1; display: grid; place-items: center; gap: var(--space-3); padding: var(--space-8) var(--space-4); text-align: center; color: var(--text-muted); border-radius: var(--radius-lg); background: var(--surface-2); }
.empty svg { width: 28px; height: 28px; color: var(--text-faint); }
.notice { padding: 14px 18px; border-radius: var(--radius); font-size: var(--fs-sm); }
.notice--error { background: rgba(220, 38, 38, .08); color: var(--danger); }
.notice--ok { background: var(--accent-soft); color: var(--text); }
.mono { font-family: var(--font-mono); font-feature-settings: "tnum"; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Motion (added by js/app.js) ────────────────────── */
.reveal { opacity: 0; transform: translateY(24px); filter: blur(6px); transition: opacity .8s var(--ease), transform .8s var(--ease), filter .8s var(--ease); transition-delay: var(--delay, 0s); }
.reveal.is-visible { opacity: 1; transform: none; filter: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; filter: none; transition: none; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}

/* ── Pop-up messages (js/lib/toast.js) ──────────────── */
.toasts {
  position: fixed; z-index: 1000; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%); width: min(calc(100% - 2 * var(--gutter)), 420px);
  display: flex; flex-direction: column; pointer-events: none;
}
.toast {
  --tone: var(--success);
  position: relative; display: flex; align-items: center; gap: 12px; margin-bottom: 8px;
  padding: 12px 18px 12px 12px; overflow: hidden;
  border-radius: 18px; background: var(--surface); color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 16px 40px -12px rgba(15, 18, 40, .28), 0 0 0 1px var(--line);
  font-size: var(--fs-sm); font-weight: 500; line-height: 1.4;
  pointer-events: auto; cursor: pointer; touch-action: none; user-select: none;
}
.toast--error { --tone: var(--danger); }
.toast--info { --tone: var(--accent); }
.toast__icon {
  display: grid; place-items: center; flex-shrink: 0; width: 34px; height: 34px; border-radius: 11px;
  color: var(--tone); background: color-mix(in srgb, var(--tone) 13%, transparent);
}
.toast__icon svg { width: 20px; height: 20px; }
.toast__text { flex: 1; min-width: 0; }
/* time left */
.toast__time {
  position: absolute; left: 0; right: 0; bottom: 0; height: 3px; transform-origin: left;
  background: color-mix(in srgb, var(--tone) 70%, transparent);
}
[data-theme="dark"] .toast { box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .6), 0 0 0 1px var(--line-strong); }

/* phones: at the top, under the status bar, above the floating top bar */
@media (max-width: 899px) {
  .toasts { top: calc(12px + env(safe-area-inset-top)); bottom: auto; }
  .toast { margin: 0 0 8px; }
}

/* ── Dropdowns (js/lib/select.js) ─────────────────────── */
.dd { position: relative; }
.dd__native { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }
.dd__button { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left; cursor: pointer; }
.dd__value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd__button.is-placeholder .dd__value { color: var(--text-faint); }
.dd__caret { display: grid; flex-shrink: 0; color: var(--text-faint); transition: transform .25s var(--ease); }
.dd__caret svg { width: 18px; height: 18px; }
.dd.is-open .dd__button { background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dd.is-open .dd__caret { transform: rotate(180deg); color: var(--text); }
.dd__list {
  position: fixed; inset: auto; margin: 0; z-index: 900; overflow-y: auto; overscroll-behavior: contain;
  display: none; padding: 6px; border: 0; border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  box-shadow: 0 20px 48px -16px rgba(0, 0, 0, .3), 0 0 0 1px var(--line);
  transform-origin: top center; animation: dd-in .18s var(--ease) both;
}
.dd__list.is-up { transform-origin: bottom center; }
.dd.is-open .dd__list { display: block; }
.dd__option {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 44px; padding: 10px 12px; border-radius: 12px; cursor: pointer; font-size: var(--fs-md);
}
.dd__option svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--accent); }
.dd__option.is-active { background: var(--surface-2); }
.dd__option[aria-selected="true"] { font-weight: 600; }
@keyframes dd-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

/* ── Motion polish ──────────────────────────────────── */
/* Quote-type switch: one white highlight that slides between the options */
.segmented { position: relative; }
.segmented__thumb {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: 0; border-radius: var(--radius-pill);
  background: var(--surface); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); pointer-events: none;
}
.segmented__thumb.is-ready { transition: transform .45s var(--spring), width .45s var(--spring); }
.segmented:has(.segmented__thumb) button { position: relative; z-index: 1; }
.segmented:has(.segmented__thumb) button[aria-selected="true"] { background: transparent; box-shadow: none; }

/* Dropdown list closes smoothly instead of vanishing */
.dd__list.is-closing { display: block; animation: dd-out .16s var(--ease) both; }
@keyframes dd-out { to { opacity: 0; transform: translateY(-4px) scale(.98); } }
.dd__list.is-up { animation-name: dd-in-up; }
@keyframes dd-in-up { from { opacity: 0; transform: translateY(4px) scale(.98); } }

/* Links and chips ease their color changes */
a, .chip, .tab, .nav__links a { transition-timing-function: var(--ease); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
