/* =====================================================================
   Brand base · reset, typography, layout, components, motion utilities.
   Requires tokens.css first. Plain CSS, no build step.
   Class names are documented in docs/business/marca.md and
   sites/_brand/README.md.
   ===================================================================== */

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--nav-height) + var(--space-21));
  hanging-punctuation: first last;
  overflow-x: clip;
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
body {
  min-height: 100vh;
  overflow-x: clip;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img, picture, video, canvas, svg { display: block; max-width: 100%; }
img { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
p, h1, h2, h3, h4, h5, h6, li, figcaption, blockquote { overflow-wrap: break-word; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
::selection { background: var(--color-selection); }
[hidden] { display: none !important; }

/* ---------- typography ---------- */
h1, h2, h3, h4, .display, .h1, .h2, .h3, .h4 {
  font-family: var(--font-display);
  font-variation-settings: var(--font-display-settings);
  font-weight: var(--font-weight-display);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
  color: var(--color-text);
}
.display {
  font-size: var(--text-7xl);
  font-weight: var(--font-weight-display);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tighter);
}
h1, .h1 { font-size: var(--text-6xl); font-weight: var(--font-weight-display); line-height: var(--leading-tight); letter-spacing: var(--tracking-tighter); }
h2, .h2 { font-size: var(--text-5xl); line-height: 1.1; }
h3, .h3 { font-size: var(--text-3xl); }
h4, .h4 { font-size: var(--text-xl); }
/* emphasis inside headlines carries the accent color (Manrope has no italic) */
:is(h1, h2, h3, .display, .h1, .h2, .h3) em {
  font-style: normal;
  color: var(--color-accent-text);
}

p { text-wrap: pretty; }
.lead { font-size: var(--text-lg); line-height: var(--leading-relaxed); color: var(--color-text-muted); max-width: var(--measure); }
.prose { max-width: var(--measure); line-height: var(--leading-relaxed); }
.prose > * + * { margin-top: 1em; }
.eyebrow {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--color-accent-text);
}
.text-muted { color: var(--color-text-muted); }
.text-subtle { color: var(--color-text-subtle); }
.text-accent { color: var(--color-accent-text); }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.tabular { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.serif { font-family: var(--font-display); font-variation-settings: var(--font-display-settings); }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
.link {
  color: var(--color-accent-text);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  transition: text-decoration-color var(--duration-base) var(--ease-standard);
}
.link:hover { text-decoration-color: currentColor; }

:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: var(--radius-5);
}
:focus:not(:focus-visible) { outline: none; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--space-13); top: var(--space-13); z-index: var(--z-toast);
  padding: var(--space-8) var(--space-13);
  border-radius: var(--radius-8);
  background: var(--color-inverse); color: var(--color-on-inverse);
  transform: translateY(-200%);
}
.skip-link:focus-visible { transform: none; }

/* ---------- layout ---------- */
.container {
  width: 100%;
  max-width: calc(var(--container-wide) + 2 * var(--space-gutter));
  margin-inline: auto;
  padding-inline: max(var(--space-gutter), env(safe-area-inset-left, 0px)) max(var(--space-gutter), env(safe-area-inset-right, 0px));
}
.container--base { max-width: calc(var(--container-base) + 2 * var(--space-gutter)); }
.container--narrow { max-width: calc(var(--container-narrow) + 2 * var(--space-gutter)); }

.section { padding-block: var(--space-section); background: var(--color-bg); color: var(--color-text); }
.section--tight { padding-block: calc(var(--space-section) * 0.618); }
.section--sunken { background: var(--color-surface-sunken); }
.section__head { display: grid; gap: var(--space-13); margin-bottom: var(--space-55); max-width: 46rem; }
.section__head--center { margin-inline: auto; text-align: center; justify-items: center; }

.stack { display: flex; flex-direction: column; gap: var(--stack-gap, var(--space-21)); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cluster-gap, var(--space-13)); }

/* golden split: 61.8 / 38.2 */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1.618fr) minmax(0, 1fr);
  gap: var(--split-gap, var(--space-55));
  align-items: start;
}
.split--reverse { grid-template-columns: minmax(0, 1fr) minmax(0, 1.618fr); }
.split--center { align-items: center; }
@media (max-width: 860px) {
  .split, .split--reverse { grid-template-columns: minmax(0, 1fr); gap: var(--space-34); }
}
.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--grid-min, 233px)), 1fr));
  gap: var(--grid-gap, var(--space-21));
}

/* ---------- buttons ---------- */
.btn {
  --btn-h: 44px;
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-8);
  min-height: var(--btn-h);
  padding: 0 var(--space-21);
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.005em;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform var(--duration-base) var(--ease-out),
    background-color var(--duration-base) var(--ease-standard),
    border-color var(--duration-base) var(--ease-standard),
    color var(--duration-base) var(--ease-standard),
    box-shadow var(--duration-base) var(--ease-standard);
}
.btn:active { transform: scale(0.97); }
.btn:focus-visible { border-radius: var(--radius-pill); }
.btn svg { width: 1.15em; height: 1.15em; flex: none; }
.btn--sm { --btn-h: 34px; padding: 0 var(--space-13); font-size: var(--text-xs); }
.btn--lg { --btn-h: 55px; padding: 0 var(--space-34); font-size: var(--text-base); }
.btn--block { width: 100%; }

.btn--primary { background: var(--color-inverse); color: var(--color-on-inverse); box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--color-inverse-hover); }
.btn--accent { background: var(--color-accent); color: var(--color-on-accent); box-shadow: var(--shadow-sm); }
.btn--accent:hover { background: var(--color-accent-hover); }
.btn--secondary { background: var(--color-surface-raised); color: var(--color-text); border-color: var(--color-border-strong); }
.btn--secondary:hover { border-color: var(--color-text-subtle); }
.btn--ghost { background: transparent; color: var(--color-text); }
.btn--ghost:hover { background: color-mix(in srgb, var(--color-text) 6%, transparent); }

/* ---------- cards ----------
   Nested radius: children marked .nested get
   max(3px, card radius − card padding). */
.card {
  --card-pad: var(--space-34);
  --card-radius: var(--radius-21);
  position: relative;
  padding: var(--card-pad);
  border-radius: var(--card-radius);
  background: var(--color-surface-raised);
  box-shadow: var(--shadow-ring), var(--shadow-sm);
}
.card--sm { --card-pad: var(--space-21); --card-radius: var(--radius-13); }
.card--lg { --card-pad: var(--space-55); --card-radius: var(--radius-34); }
.card--flat { box-shadow: var(--shadow-ring); background: var(--color-surface); }
.card--sunken { box-shadow: none; background: var(--color-surface-sunken); }
.card--raised { box-shadow: var(--shadow-ring), var(--shadow-md); }
.card--interactive {
  transition: transform var(--duration-slow) var(--ease-out), box-shadow var(--duration-slow) var(--ease-out);
}
.card--interactive:hover { transform: translateY(-3px); box-shadow: var(--shadow-ring), var(--shadow-lg); }
.card--inset { --card-pad: var(--space-8); }
.nested {
  border-radius: max(var(--radius-3), calc(var(--card-radius, var(--radius-21)) - var(--card-pad, var(--space-8))));
  overflow: hidden;
}

/* ---------- pills / badges ---------- */
.pill {
  display: inline-flex; align-items: center; gap: var(--space-5);
  min-height: 26px;
  padding: 0 var(--space-13);
  border-radius: var(--radius-pill);
  background: var(--color-surface-sunken);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-medium);
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pill--outline { background: transparent; box-shadow: inset 0 0 0 1px var(--color-border-strong); }
.pill--accent { background: var(--color-accent-soft); color: var(--color-accent-text); }
.pill--success { background: var(--color-success-soft); color: var(--color-success); }
.pill--warning { background: var(--color-warning-soft); color: var(--color-warning); }
.pill--danger { background: var(--color-danger-soft); color: var(--color-danger); }
.pill--info { background: var(--color-info-soft); color: var(--color-info); }
.pill__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

/* ---------- wordmark & lockup ----------
   The wordmark is the brand name set in the display font: no artwork. */
.wordmark {
  font-family: var(--font-display);
  font-variation-settings: var(--font-display-settings);
  font-weight: var(--font-weight-regular);
  letter-spacing: -0.02em;
  line-height: 1;
  white-space: nowrap;
}
.lockup {
  display: inline-flex; align-items: center; gap: 0.42em;
  font-size: var(--text-xl);
  color: var(--color-text);
  text-decoration: none;
}
.lockup__mark { width: auto; height: 1.15em; flex: none; fill: currentColor; overflow: visible; }
.lockup__dot { fill: var(--color-accent); }
/* inline mark markup (name-agnostic, 42×68 = 1:φ):
   <svg class="lockup__mark" viewBox="0 0 42 68" aria-hidden="true">
     <path d="M0 68V21a21 21 0 0 1 42 0v47h-8V21a13 13 0 0 0-26 0v47z"/>
     <circle class="lockup__dot" cx="21" cy="21" r="5"/></svg> */

/* ---------- nav (translucent blur on scroll) ---------- */
.nav {
  position: sticky; top: 0; z-index: var(--z-nav);
  height: var(--nav-height);
  color: var(--color-text);
}
.nav::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--color-nav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(21px);
  backdrop-filter: saturate(180%) blur(21px);
  box-shadow: 0 1px 0 var(--color-border);
  opacity: 0;
  transition: opacity var(--duration-slow) var(--ease-standard);
}
.nav.is-scrolled::before, .nav--solid::before { opacity: 1; }
.nav__inner { height: 100%; display: flex; align-items: center; gap: var(--space-34); }
.nav__brand { display: inline-flex; align-items: center; gap: var(--space-8); font-size: var(--text-lg); text-decoration: none; color: inherit; }
.nav__brand .lockup__mark { height: 1.25em; }
.nav__links { display: flex; align-items: center; gap: var(--space-5); margin-left: auto; list-style: none; padding: 0; }
.nav__link {
  display: inline-flex; align-items: center; min-height: 34px; padding: 0 var(--space-13);
  border-radius: var(--radius-pill);
  font-size: var(--text-sm); color: var(--color-text-muted); text-decoration: none;
  transition: color var(--duration-base) var(--ease-standard), background-color var(--duration-base) var(--ease-standard);
}
.nav__link:hover, .nav__link[aria-current="page"] { color: var(--color-text); background: color-mix(in srgb, var(--color-text) 5%, transparent); }
.nav__actions { display: flex; align-items: center; gap: var(--space-8); margin-left: auto; }
.nav__links + .nav__actions { margin-left: 0; }
@media (max-width: 768px) {
  .nav__links { display: none; }
  .nav__links + .nav__actions { margin-left: auto; }
}

/* ---------- footer ---------- */
.footer {
  padding-block: var(--space-89) var(--space-55);
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}
.footer__inner { display: grid; grid-template-columns: minmax(0, 1.618fr) minmax(0, 1fr); gap: var(--space-55); }
.footer__brand { display: grid; gap: var(--space-13); align-content: start; }
.footer__brand .lockup { font-size: var(--text-2xl); }
.footer__links { display: grid; gap: var(--space-8); align-content: start; list-style: none; padding: 0; }
.footer__links a { text-decoration: none; transition: color var(--duration-base) var(--ease-standard); }
.footer__links a:hover { color: var(--color-text); }
.footer__legal { grid-column: 1 / -1; padding-top: var(--space-21); border-top: 1px solid var(--color-border); font-size: var(--text-xs); color: var(--color-text-subtle); display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-13); }
@media (max-width: 640px) { .footer__inner { grid-template-columns: minmax(0, 1fr); gap: var(--space-34); } }

/* ---------- device frame (phone) ----------
   Fits the 390×844 app screenshots (780×1688 webp). The real screenshot
   starts 6.5% from the top under a status-bar band so the island never
   covers app content. Sized in cqi, so any width works:
   <figure class="device" style="--device-w: 280px">
     <div class="device__body"><div class="device__screen" data-label="Check-in">
       <img src="…" alt="…" loading="lazy"></div></div>
     <figcaption class="device__caption">…</figcaption>
   </figure>
   Nested radius: body 15cqi − padding 3cqi = screen 12cqi. */
.device {
  container-type: inline-size;
  position: relative;
  width: var(--device-w, 100%);
  max-width: 100%;
  margin: 0;
}
.device__body {
  position: relative;
  padding: 3cqi;
  border-radius: 15cqi;
  background: linear-gradient(160deg, #3b3934 0%, var(--color-device) 38%);
  box-shadow:
    inset 0 0 0 0.4cqi var(--color-device-edge),
    inset 0 0.6cqi 0.8cqi rgb(255 255 255 / 0.08),
    var(--shadow-lg);
}
.device__screen {
  position: relative;
  aspect-ratio: 390 / 844;
  overflow: hidden;
  border-radius: 12cqi;
  background: var(--color-device-statusbar);
  isolation: isolate;
}
.device__screen::after { /* dynamic island */
  content: ""; position: absolute; z-index: 3;
  top: 1.5%; left: 50%; width: 30%; height: 3.6%;
  transform: translateX(-50%);
  border-radius: var(--radius-pill);
  background: #0b0b0a;
}
.device__screen > img {
  position: absolute; left: 0; top: 6.5%;
  width: 100%; height: 93.5%;
  object-fit: cover; object-position: top;
}
.device__screen.is-missing > img { visibility: hidden; }
.device__screen.is-missing::before {
  content: attr(data-label);
  position: absolute; inset: 0; z-index: 2;
  display: grid; place-items: center; padding: 13%;
  text-align: center;
  font: 500 7cqi/1.25 var(--font-display);
  color: var(--color-neutral-600);
  background: var(--color-neutral-100);
}
.device__caption {
  margin-top: var(--space-13);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-align: center;
}

/* ---------- browser frame (desktop screenshots, 16:10 ≈ φ) ---------- */
.browser {
  --card-radius: var(--radius-13);
  overflow: hidden;
  border-radius: var(--radius-13);
  background: var(--color-surface-raised);
  box-shadow: var(--shadow-ring), var(--shadow-lg);
}
.browser__bar {
  display: flex; align-items: center; gap: var(--space-5);
  height: 34px; padding: 0 var(--space-13);
  background: var(--color-surface-sunken);
  border-bottom: 1px solid var(--color-border);
}
.browser__bar > i { width: 8px; height: 8px; border-radius: 50%; background: var(--color-border-strong); }
.browser__url {
  margin-inline: auto; max-width: 61.8%;
  padding: var(--space-3) var(--space-13);
  border-radius: var(--radius-pill);
  background: var(--color-surface-raised);
  font-size: 11px; color: var(--color-text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.browser__view { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--color-surface-sunken); }
.browser__view > img { width: 100%; height: 100%; object-fit: cover; object-position: top; }

/* ---------- reveal utilities ----------
   motion.js adds .has-motion to <html> (only when motion is allowed) and
   .is-revealed to each [data-reveal] element as it enters the viewport.
   Without JS or with reduced motion, everything is simply visible.
   Variants: data-reveal="" (rise), "fade", "scale", "left", "right".
   Stagger: put data-reveal-stagger on a parent; its children reveal in turn. */
.has-motion [data-reveal] {
  opacity: 0;
  transform: translate3d(0, var(--reveal-distance), 0);
  transition:
    opacity var(--duration-slower) var(--ease-out) var(--reveal-delay, 0ms),
    transform var(--duration-slowest) var(--ease-out) var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}
.has-motion [data-reveal="fade"] { transform: none; }
.has-motion [data-reveal="scale"] { transform: scale(0.96); }
/* sideways reveals only where there is room; on phones they rise like the default */
@media (min-width: 861px) {
  .has-motion [data-reveal="left"] { transform: translate3d(calc(var(--reveal-distance) * -1.618), 0, 0); }
  .has-motion [data-reveal="right"] { transform: translate3d(calc(var(--reveal-distance) * 1.618), 0, 0); }
}
.has-motion [data-reveal].is-revealed { opacity: 1; transform: none; will-change: auto; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
}
