/* ========================================================================
   public-shared.css
   Shared tokens, nav, footer, buttons, and scroll-animation primitives used
   by all public marketing pages (welcome, pricing, enterprise, contact,
   security, blog). Loaded AFTER design-tokens.css.

   The marketing mockups use short token names (--teal, --bg, --t1, etc.).
   This file bridges them to the canonical --color-* tokens in
   design-tokens.css so the mockups work unchanged while the rest of the
   app keeps using the long names.
   ======================================================================== */

:root {
  /* Brand / palette bridge */
  --teal: var(--color-primary);
  --teal-h: var(--color-primary-hover);
  --teal-10: var(--color-primary-100);
  --teal-20: var(--color-primary-200);
  /* AA-compliant variant for foreground use on light surfaces (text, primary-button bg) */
  --teal-text: var(--color-primary-700);

  /* Backgrounds — bridge the short marketing names to the SHARED Voltage
     neutrals (NOT the legacy --color-* literals) so the shared ramp shows.
     NOTE: --bg / --surface / --r-sm / --r-md / --r-lg / --pill ARE package
     token names already; we do NOT redeclare them (a self-reference would
     resolve to empty) — they resolve straight to the shared package values. */
  --bg2: var(--bg-sunken);
  --bg3: var(--surface-raised);
  --surface-h: color-mix(in srgb, var(--accent) 6%, var(--surface));

  /* Text */
  --t1: var(--ink);
  --t2: var(--ink-2);
  --t3: var(--ink-3);
  --t4: var(--ink-faint);

  /* Borders */
  --bd: var(--border);
  --bd-h: var(--border-strong);
  --bd-f: var(--ring-band);

  /* Radii — shared machined radii from the package (no per-app override).
     --r-sm/md/lg come from the package; only the extra short names map here. */
  --r-xl: var(--r-lg);
  --r-full: var(--pill);

  /* Shadows — shared flat hairline elevation from the package */
  --sh-card: var(--sh-1);
  --sh-sm: var(--sh-1);
  --sh-md: var(--sh-2);
  --sh-lg: var(--sh-3);
  --sh-xl: var(--sh-3);

  /* Timings */
  --fast: var(--transition-fast);
  --base: var(--transition-base);

  /* Fonts — Voltage is sans (Geist) + mono (Geist Mono) only; NEVER a serif.
     Point the short names at the shared package type tokens. */
  --font: var(--f-ui);
  --font-mono: var(--f-mono);
  --mono: var(--f-mono);
  --font-serif: var(--f-ui);

  /* Extra radii */
  --r-2xl: var(--radius-2xl, 1.5rem);

  /* Semantic / accent colors (used by security, contact, and suite pages).
     These were previously (mistakenly) declared inside a dark-mode
     `.sec-lbl` selector, so they were undefined in light mode and outside
     those subtrees. Declared here at :root they resolve everywhere. */
  --err: var(--color-error);
  --teal-d: color-mix(in srgb, var(--color-primary) 70%, black);
  /* --indigo / --amber are SHARED package tokens (accent-only per-app override
     rule) — NOT redeclared here; they resolve to the package values directly. */
  --emerald: #059669;
  --rose: #f43f5e;
}

/* Dark-mode brightenings so marketing-page foregrounds meet WCAG AA on dark
   surfaces. The default `--t3` and `--teal-text` are tuned for light bg, so we
   override `--t3` globally and provide a brighter teal `--teal-fg` for text
   usage in dark mode (button backgrounds keep the original `--teal-text`). */
:root { --teal-fg: var(--teal-text); }
html[data-theme="dark"] {
  --t3: #a8a29e;
  --teal-fg: #2dd4bf;
}

html[data-theme="dark"] .sec-lbl,
html[data-theme="dark"] .nav-link.cur {
  color: var(--teal-fg);
}

/* ========================================================================
   Base
   ======================================================================== */

* , *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[x-cloak] { display: none !important; }

body {
  background: var(--bg);
  color: var(--t1);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
/* `color: inherit` is UNLAYERED, so it beats every .hi-btn recipe in
   @layer hiroi.components regardless of specificity — the same trap the
   padding note further down describes. Marketing CTAs are all <a>, so every
   one of them inherited --ink instead of the button's on-fill color: black
   text on the green fill in light (~2.4:1), white-on-green in dark, which is
   why only light looked wrong. Excluding .hi-btn hands the package back its
   own color — including the hover/active/disabled states, which re-asserting
   a single color here would have silently dropped. */
a { text-decoration: none; }
/* `:where()` contributes ZERO specificity, so this stays (0,0,1) — exactly what
   the original bare `a` was. Written as `a:not(.hi-btn)` it would be (0,1,1),
   which beats a plain single-class rule like `.skip-link` / `.nav-link` that
   the original lost to: the skip link went black-on-teal (3.31:1). Keeping the
   weight identical means this only ever removes the `color` declaration from
   .hi-btn links and changes nothing else in the cascade. */
a:not(:where(.hi-btn)) { color: inherit; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* Skip-to-content link — appears on Tab for keyboard users. */
.skip-link {
  position: absolute; top: 0; left: 0;
  transform: translateY(-200%);
  background: var(--teal-text); color: #fff;
  padding: 10px 18px; border-radius: 0 0 var(--r-md) 0;
  font-size: 13px; font-weight: 600;
  z-index: 200;
  transition: transform 180ms cubic-bezier(.16,0,.2,1);
}
.skip-link:focus { transform: translateY(0); outline: none; }

/* ========================================================================
   Scroll animations — add data-a (and optional data-d="1..5") to any element
   ======================================================================== */

/* Progressive enhancement: visible by default so no-JS, slow-JS, search
   crawlers, and screenshot tools always see content. JS adds `js-anim` to
   <html> as soon as it loads, which arms the fade-in below. */
[data-a] {
  opacity: 1;
  transform: none;
  transition:
    opacity .55s cubic-bezier(.16, 0, .2, 1),
    transform .55s cubic-bezier(.16, 0, .2, 1);
}
html.js-anim [data-a]:not(.vis) {
  opacity: 0;
  transform: translateY(16px);
}
[data-a].vis { opacity: 1; transform: none; }
[data-a][data-d="1"] { transition-delay: .07s; }
[data-a][data-d="2"] { transition-delay: .14s; }
[data-a][data-d="3"] { transition-delay: .21s; }
[data-a][data-d="4"] { transition-delay: .28s; }
[data-a][data-d="5"] { transition-delay: .35s; }

@media (prefers-reduced-motion: reduce) {
  [data-a] { opacity: 1; transform: none; transition: none; }
}

/* ========================================================================
   Nav
   ======================================================================== */

.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--bd) 55%, transparent);
}
.nav-in {
  max-width: 1120px; margin: 0 auto; padding: 0 24px;
  height: 56px; display: flex; align-items: center; justify-content: space-between;
}
.nav-brand { display: flex; align-items: center; gap: 9px; }
.nav-icon {
  width: 28px; height: 28px; border-radius: var(--r-md);
  /* Presents-style milled chip (matches presents.hiroi.ai .hs-wordmark-mark):
     a WHITE plate carrying a TEAL glyph — top-lit hairline lip + soft key shadow,
     NOT a teal block. The glyph color comes from `color` (svg uses currentColor). */
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--hi), var(--sh-1);
  display: grid; place-items: center; flex-shrink: 0;
}
.nav-icon svg { width: 15px; height: 15px; }
.nav-wordmark {
  font-family: var(--f-ui);
  font-size: 18px; font-weight: 800;
  color: var(--t1); letter-spacing: -.02em;
}
/* Assistant-site product wordmark "Hiroi Assistant" — shared display face,
   matching the presents.hiroi.ai header (regular Hiroi + bold product). */
.nav-wordmark--product {
  font-family: var(--f-display);
  font-size: 17px; font-weight: 500;
  letter-spacing: -.01em; color: var(--ink);
}
.nav-wordmark--product strong { font-weight: 700; }
/* "Coming soon" — suite apps not yet live (e.g. Campaigns). Renders the row/
   link/button non-interactive + a muted mono pill (neutral, NOT teal — teal is
   reserved for live/active actions). */
.soon-badge {
  display: inline-flex; align-items: center; vertical-align: middle;
  font-family: var(--font-mono); font-size: 10px; font-weight: 600; line-height: 1;
  letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 7px; border-radius: var(--r-full);
  color: var(--ink-3); background: var(--bg-sunken);
  border: 1px solid var(--border);
  margin-left: 8px;
}
.is-soon { pointer-events: none; cursor: default; }
.btn-app.is-soon {
  background: var(--bg-sunken); color: var(--ink-3);
  border: 1px solid var(--border); box-shadow: none;
}

.nav-links { display: flex; align-items: center; gap: 1px; }
.nav-link {
  font-size: 13px; font-weight: 500; color: var(--t2);
  padding: 6px 11px; border-radius: var(--r-sm);
  transition: color var(--fast), background var(--fast);
  letter-spacing: -.01em;
}
.nav-link:hover { color: var(--t1); background: var(--teal-10); }
.nav-link.cur { color: var(--teal-text); position: relative; }
.nav-link.cur::after {
  content: '';
  position: absolute;
  left: 11px; right: 11px; bottom: 0;
  height: 2px; border-radius: 2px;
  background: var(--teal-text);
}
html[data-theme="dark"] .nav-link.cur { color: var(--teal-fg); }
html[data-theme="dark"] .nav-link.cur::after { background: var(--teal-fg); }

.theme-btn {
  background: none; border: 1px solid transparent; cursor: pointer;
  color: var(--ink-3, var(--t3)); padding: 6px; border-radius: var(--r-md);
  display: inline-flex; align-items: center;
  transition: color var(--fast), background var(--fast), border-color var(--fast);
}
.theme-btn:hover { color: var(--voltage-text); background: var(--color-surface-hover); }
.theme-btn svg { width: 15px; height: 15px; }
.sun, .moon { display: none; }
[data-theme="dark"] .sun { display: inline-block; }
:root:not([data-theme="dark"]) .moon { display: inline-block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sun { display: inline-block; }
  :root:not([data-theme="light"]) .moon { display: none; }
}

.nav-ham {
  display: none;
  background: none; border: 1px solid transparent; cursor: pointer;
  color: var(--t2); padding: 6px; border-radius: var(--r-md);
  -webkit-tap-highlight-color: transparent;
}
.nav-ham:hover { color: var(--voltage-text); background: var(--color-surface-hover); }
.nav-ham svg { width: 20px; height: 20px; }

/* Mobile drawer */
.mobile-drawer {
  position: fixed; top: 56px; left: 0; right: 0; bottom: 0; z-index: 99;
  opacity: 0; pointer-events: none;
  transition: opacity 180ms cubic-bezier(.16,0,.2,1);
}
.mobile-drawer.open { opacity: 1; pointer-events: auto; }
.mobile-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.mobile-menu {
  position: absolute; top: 0; left: 0; right: 0;
  background: var(--surface); border-bottom: 1px solid var(--bd);
  padding: 8px 16px 16px;
  display: flex; flex-direction: column; gap: 4px;
  box-shadow: var(--sh-lg);
  transform: translateY(-8px);
  transition: transform 220ms cubic-bezier(.16,0,.2,1);
}
.mobile-drawer.open .mobile-menu { transform: translateY(0); }
.mob-link {
  font-size: 15px; font-weight: 500; color: var(--t2);
  padding: 12px 16px; border-radius: var(--r-sm);
  transition: color var(--fast), background var(--fast);
  -webkit-tap-highlight-color: transparent;
}
.mob-link:hover, .mob-link:active { color: var(--t1); background: var(--teal-10); }

@media (max-width: 860px) {
  .nav-links .nav-link { display: none; }
  .nav-ham { display: inline-flex; align-items: center; justify-content: center; }
}

/* ========================================================================
   Buttons — .btn base + .btn-p primary / .btn-s secondary
   ======================================================================== */

/* Legacy .btn recipes apply ONLY when the real hiroi-ui .hi-btn isn't present.
   Where a button carries `hi-btn hi-btn--primary/--secondary`, the shipped
   component (taller, --r-lg, voltage treatment) renders instead of this
   approximation. New markup should use the .hi-btn classes directly. */
.btn:not(.hi-btn) {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font); font-weight: 600; border: none; cursor: pointer;
  border-radius: var(--r-sm); letter-spacing: -.006em;
  transition: background var(--fast), transform var(--fast), box-shadow var(--fast), border-color var(--fast), color var(--fast);
  text-decoration: none; white-space: nowrap;
}
/* --ring-band is the token tuned for exactly this: a non-text UI band that must
   clear 3:1. --teal-text is --color-primary-700, a LITERAL (#0f766e) that
   design-tokens.css never restates for dark — its dark block covers
   --color-primary/-hover/-active/-bg but not the numbered -50..-900 ramp — so
   the outline kept a light-theme teal on dark surfaces (3.27:1 on --surface). */
.btn:not(.hi-btn):focus-visible {
  outline: 2px solid var(--ring-band);
  outline-offset: 2px;
}
.btn-p:not(.hi-btn) { background: linear-gradient(180deg, color-mix(in oklch, var(--teal-fill) 88%, #fff 12%) 0%, var(--teal-fill) 62%); color: var(--teal-on); padding: 8px 20px; font-size: 13px; box-shadow: var(--hi-fill), var(--sh-1); }
.btn-p:not(.hi-btn):hover { background: var(--color-primary-active); transform: translateY(-1px); box-shadow: var(--hi-fill), var(--sh-2); }
.btn-p:not(.hi-btn):active { transform: translateY(0); box-shadow: var(--sh-1); }

.btn-s:not(.hi-btn) { background: var(--surface); color: var(--ink); border: 1px solid var(--border); padding: 8px 20px; font-size: 13px; font-weight: 500; box-shadow: var(--hi), var(--sh-1); }
.btn-s:not(.hi-btn):hover { background: var(--color-surface-hover); border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--hi), var(--sh-2); color: var(--ink); }
.btn-s:not(.hi-btn):active { transform: translateY(0); box-shadow: var(--sh-1); }
html[data-theme="dark"] .btn-s:not(.hi-btn) { border-color: var(--bd-h); }
html[data-theme="dark"] .btn-s:not(.hi-btn):hover { border-color: var(--teal-fg); color: var(--teal-fg); }

/* The hard reset at the top of this file (`* { padding:0 }`) is UNLAYERED, so
   it outranks hiroi-ui's .hi-btn padding — that recipe lives in
   @layer hiroi.components, and any unlayered rule beats a layered one
   regardless of specificity. The shipped buttons therefore render edge-to-edge
   (no horizontal padding). Re-assert the per-size paddings here, unlayered, so
   they win. Values mirror hiroi.css (.hi-btn / --sm / --lg); --md == base. */
.hi-btn { padding: 0 var(--s-4); }
.hi-btn--sm { padding: 0 var(--s-3); }
.hi-btn--lg { padding: 0 var(--s-5); }
/* Icon-only buttons are fixed-width and stay padding-free — keep this LAST so it
   wins over the size rules above for an .hi-btn--icon.hi-btn--sm/--lg. */
.hi-btn--icon { padding: 0; }

/* ========================================================================
   Footer
   ======================================================================== */

.footer {
  border-top: 1px solid var(--bd);
  background: var(--bg2);
  padding: 36px 0;
  margin-top: 96px;
}
.footer-in {
  max-width: 1120px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
  font-size: 12.5px; color: var(--t3);
}
.footer-copy { color: var(--t3); letter-spacing: -.005em; }
.footer-links { display: flex; gap: 22px; flex-wrap: wrap; }
.footer-links a {
  color: var(--t3);
  transition: color var(--fast);
  padding: 2px 0;
}
.footer-links a:hover { color: var(--t1); }
/* --ring-band, for the same reason as .btn:focus-visible above: --teal-text is a
   light-only literal, and the footer sits on --bg-sunken in both themes. */
.footer-links a:focus-visible {
  outline: 2px solid var(--ring-band); outline-offset: 3px;
  border-radius: 2px; color: var(--t1);
}
.footer .clim {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--t3);
  transition: color var(--fast);
}
.footer .clim:hover { color: var(--teal-text); }
html[data-theme="dark"] .footer .clim:hover { color: var(--teal-fg); }
