/* Keystore Studio website — foundation layer.
   Tokens, theming, typography, layout primitives, nav, footer, buttons, motion utilities.
   Section and scene styles live in sections.css, iso.css and pages.css. */

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue",
    "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue",
    "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  /* Surfaces: monochrome, true to the app (zinc light / true-black dark). */
  --bg: #fbfbfd;
  --bg-2: #f5f5f7;
  --bg-3: #ececf0;
  --surface: #ffffff;
  --surface-2: #f7f7f9;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.86);
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.14);

  --ink: #1d1d1f;
  --ink-2: #424245;
  --muted: #6e6e73;
  --faint: #86868b;

  /* Brand is ink; status colours carry the only hue (the app's health semantics). */
  --brand: #1d1d1f;
  --on-brand: #ffffff;
  --ok: #1f9d55;
  --ok-soft: rgba(31, 157, 85, 0.12);
  --warn: #c77700;
  --warn-soft: rgba(199, 119, 0, 0.12);
  --bad: #d92d20;
  --bad-soft: rgba(217, 45, 32, 0.12);
  --info: #0a66d9;
  --info-soft: rgba(10, 102, 217, 0.1);
  --link: #0a66d9;

  /* Isometric face shading (top / left / right) for 3D scenes. */
  --iso-top: #ffffff;
  --iso-left: #e9e9ee;
  --iso-right: #d6d6dd;
  --iso-edge: rgba(0, 0, 0, 0.1);
  --iso-ink-top: #2a2a2d;
  --iso-ink-left: #161618;
  --iso-ink-right: #0b0b0c;
  --iso-floor: rgba(0, 0, 0, 0.06);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 1px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 10px 30px -12px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 40px 80px -30px rgba(0, 0, 0, 0.28), 0 12px 24px -12px rgba(0, 0, 0, 0.1);

  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --radius-xl: 36px;

  --page-max: 1200px;
  --page-wide: 1440px;
  --gutter: clamp(16px, 4vw, 40px);
  --section-y: clamp(88px, 12vw, 168px);
  --nav-h: 56px;

  /* Motion: Apple-like spring-ish curves. */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.36, 0.64, 1);
  --dur-1: 160ms;
  --dur-2: 320ms;
  --dur-3: 640ms;
  --dur-4: 1100ms;
}

/* Dark: true black, like the app's dark theme. Follows the system unless the visitor picked light. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #000000;
    --bg-2: #0b0b0c;
    --bg-3: #161618;
    --surface: #0f0f10;
    --surface-2: #161618;
    --glass: rgba(18, 18, 20, 0.66);
    --glass-strong: rgba(22, 22, 24, 0.86);
    --line: rgba(255, 255, 255, 0.09);
    --line-strong: rgba(255, 255, 255, 0.16);
    --ink: #f5f5f7;
    --ink-2: #d2d2d7;
    --muted: #a1a1a6;
    --faint: #86868b;
    --brand: #f5f5f7;
    --on-brand: #000000;
    --ok: #34d399;
    --ok-soft: rgba(52, 211, 153, 0.14);
    --warn: #fbbf24;
    --warn-soft: rgba(251, 191, 36, 0.14);
    --bad: #f87171;
    --bad-soft: rgba(248, 113, 113, 0.14);
    --info: #60a5fa;
    --info-soft: rgba(96, 165, 250, 0.14);
    --link: #6cb4ff;
    --iso-top: #2a2a2e;
    --iso-left: #1a1a1d;
    --iso-right: #111113;
    --iso-edge: rgba(255, 255, 255, 0.1);
    --iso-ink-top: #f5f5f7;
    --iso-ink-left: #cfcfd4;
    --iso-ink-right: #a9a9b0;
    --iso-floor: rgba(255, 255, 255, 0.05);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.6);
    --shadow-md: 0 10px 30px -12px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.04);
    --shadow-lg: 0 40px 80px -30px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.05);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --bg-2: #0b0b0c;
  --bg-3: #161618;
  --surface: #0f0f10;
  --surface-2: #161618;
  --glass: rgba(18, 18, 20, 0.66);
  --glass-strong: rgba(22, 22, 24, 0.86);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --ink: #f5f5f7;
  --ink-2: #d2d2d7;
  --muted: #a1a1a6;
  --faint: #86868b;
  --brand: #f5f5f7;
  --on-brand: #000000;
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.14);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.14);
  --bad: #f87171;
  --bad-soft: rgba(248, 113, 113, 0.14);
  --info: #60a5fa;
  --info-soft: rgba(96, 165, 250, 0.14);
  --link: #6cb4ff;
  --iso-top: #2a2a2e;
  --iso-left: #1a1a1d;
  --iso-right: #111113;
  --iso-edge: rgba(255, 255, 255, 0.1);
  --iso-ink-top: #f5f5f7;
  --iso-ink-left: #cfcfd4;
  --iso-ink-right: #a9a9b0;
  --iso-floor: rgba(255, 255, 255, 0.05);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.6);
  --shadow-md: 0 10px 30px -12px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.04);
  --shadow-lg: 0 40px 80px -30px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -0.012em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out);
}
img,
svg,
video {
  display: block;
  max-width: 100%;
}
img {
  height: auto;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  font: inherit;
  color: inherit;
}
/* No italics anywhere on the site. */
em,
i,
cite,
var,
dfn,
address {
  font-style: normal;
}
em {
  font-weight: 600;
}
::selection {
  background: var(--ink);
  color: var(--bg);
}
:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- Type scale ---------- */
.display,
h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  margin: 0;
  color: var(--ink);
  font-weight: 700;
}
.display-xl {
  font-size: clamp(48px, 8.4vw, 112px);
  line-height: 1.02;
  letter-spacing: -0.045em;
  font-weight: 700;
}
.display-l {
  font-size: clamp(40px, 6vw, 80px);
  line-height: 1.04;
  letter-spacing: -0.038em;
}
.display-m {
  font-size: clamp(32px, 4.4vw, 56px);
  line-height: 1.07;
  letter-spacing: -0.03em;
}
.display-s {
  font-size: clamp(24px, 2.6vw, 32px);
  line-height: 1.15;
  letter-spacing: -0.022em;
}
.title {
  font-size: 21px;
  line-height: 1.3;
  letter-spacing: -0.016em;
  font-weight: 600;
}
.lede {
  font-size: clamp(19px, 1.7vw, 24px);
  line-height: 1.42;
  letter-spacing: -0.016em;
  color: var(--muted);
  font-weight: 500;
}
.lede strong {
  color: var(--ink);
  font-weight: 600;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: currentColor;
  transform: rotate(45deg);
}
.small {
  font-size: 14px;
  line-height: 1.43;
  color: var(--muted);
}
.mono,
code,
kbd,
pre {
  font-family: var(--font-mono);
  font-size: 0.88em;
  letter-spacing: 0;
}
code {
  padding: 0.12em 0.4em;
  border-radius: 6px;
  background: var(--bg-3);
  color: var(--ink);
}
kbd {
  display: inline-block;
  min-width: 1.7em;
  padding: 0.18em 0.5em;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.8em;
  text-align: center;
}
.gradient-ink {
  background: linear-gradient(180deg, var(--ink) 30%, color-mix(in srgb, var(--ink) 55%, transparent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.text-link {
  color: var(--link);
  font-weight: 500;
}
.text-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.text-link .chev {
  display: inline-block;
  transition: transform var(--dur-1) var(--ease-out);
}
.text-link:hover .chev {
  transform: translateX(3px);
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: calc(var(--page-max) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container-wide {
  width: 100%;
  max-width: calc(var(--page-wide) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.section {
  position: relative;
  padding-block: var(--section-y);
}
.section-tint {
  background: var(--bg-2);
}
.section-head {
  max-width: 820px;
  margin: 0 auto clamp(48px, 6vw, 88px);
  text-align: center;
  display: grid;
  gap: 18px;
  justify-items: center;
}
.section-head.left {
  margin-inline: 0;
  text-align: left;
  justify-items: start;
}
.stack {
  display: grid;
  gap: 16px;
}
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  transition: top var(--dur-1) var(--ease-out);
}
.skip-link:focus {
  top: 12px;
}

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--brand);
  --btn-fg: var(--on-brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 48px;
  padding: 0 24px;
  border-radius: 999px;
  border: 0;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  cursor: pointer;
  transition: transform var(--dur-1) var(--ease-out), box-shadow var(--dur-2) var(--ease-out),
    background-color var(--dur-2) var(--ease-out), opacity var(--dur-1);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset, var(--shadow-sm);
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset, var(--shadow-md);
}
.btn:active {
  transform: translateY(0) scale(0.98);
}
.btn svg {
  width: 18px;
  height: 18px;
  flex: none;
}
.btn-secondary {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.btn-secondary:hover {
  --btn-bg: var(--bg-3);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.btn-sm {
  height: 34px;
  padding: 0 16px;
  font-size: 14px;
}
.btn-lg {
  height: 56px;
  padding: 0 30px;
  font-size: 18px;
}
.btn[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}

/* ---------- Chips / pills ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-soft);
}
.dot.warn {
  background: var(--warn);
  box-shadow: 0 0 0 3px var(--warn-soft);
}
.dot.bad {
  background: var(--bad);
  box-shadow: 0 0 0 3px var(--bad-soft);
}

/* ---------- Cards ---------- */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
}

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: var(--nav-h);
  transition: background-color var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out),
    -webkit-backdrop-filter var(--dur-2), backdrop-filter var(--dur-2);
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled,
.nav.is-open {
  background: var(--glass-strong);
  border-bottom-color: var(--line);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}
.nav-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.02em;
  flex: none;
}
.brand-mark {
  width: 26px;
  height: 26px;
}
/* The <nav> wrapper is the flex item: it takes the free space and centres the links. */
.nav-inner > nav {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  min-width: 0;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav-links a {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--ink-2);
  transition: color var(--dur-1), background-color var(--dur-1);
}
.nav-links a:hover,
.nav-links a[aria-current="true"],
.nav-links a[aria-current="page"] {
  color: var(--ink);
  background: var(--bg-3);
}
.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color var(--dur-1), color var(--dur-1), transform var(--dur-1) var(--ease-out);
}
.icon-btn:hover {
  background: var(--bg-3);
  color: var(--ink);
}
.icon-btn:active {
  transform: scale(0.94);
}
.icon-btn svg {
  width: 18px;
  height: 18px;
}
/* Theme toggle: one icon visible per resolved mode. */
.theme-toggle .i-sun,
.theme-toggle .i-moon,
.theme-toggle .i-auto {
  display: none;
}
:root[data-theme-pref="light"] .theme-toggle .i-sun,
:root[data-theme-pref="dark"] .theme-toggle .i-moon,
:root[data-theme-pref="system"] .theme-toggle .i-auto,
:root:not([data-theme-pref]) .theme-toggle .i-auto {
  display: block;
}
.nav-menu-btn {
  display: none;
}
@media (max-width: 900px) {
  .nav-links {
    position: fixed;
    inset: var(--nav-h) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    padding: 8px var(--gutter) 24px;
    /* Solid: a backdrop-filter nested inside the blurred .nav cannot blur, so the hero would show through. */
    background: var(--bg);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--line);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out),
      visibility 0s linear var(--dur-2);
  }
  .nav.is-open .nav-links {
    transform: none;
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
  }
  .nav-links a {
    height: 48px;
    font-size: 17px;
    border-radius: 12px;
    padding: 0 12px;
  }
  .nav-menu-btn {
    display: inline-grid;
  }
  .nav-inner {
    justify-content: space-between;
  }
  .nav-actions .btn {
    display: none;
  }
}

/* ---------- Footer ---------- */
.footer {
  padding: 72px 0 40px;
  background: var(--bg-2);
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--muted);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(4, 1fr);
  gap: 32px;
}
.footer h4 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink);
  margin-bottom: 14px;
}
.footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.footer a:hover {
  color: var(--ink);
}
.footer-brand p {
  max-width: 300px;
  margin: 14px 0 0;
}
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
  .footer-brand {
    grid-column: 1 / -1;
  }
}

/* ---------- Icon mark (theme-aware app icon) ---------- */
.app-icon {
  filter: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .app-icon {
    filter: invert(1);
  }
}
:root[data-theme="dark"] .app-icon {
  filter: invert(1);
}

/* ---------- Reveal-on-scroll ---------- */
.reveal {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  transition: opacity var(--dur-4) var(--ease-out), transform var(--dur-4) var(--ease-out);
  transition-delay: calc(var(--i, 0) * 70ms);
}
.reveal.is-in {
  opacity: 1;
  transform: none;
}
.reveal-scale {
  opacity: 0;
  transform: scale(0.94);
  transition: opacity var(--dur-4) var(--ease-out), transform var(--dur-4) var(--ease-out);
  transition-delay: calc(var(--i, 0) * 70ms);
}
.reveal-scale.is-in {
  opacity: 1;
  transform: none;
}
/* No-JS fallback: show everything. */
.no-js .reveal,
.no-js .reveal-scale {
  opacity: 1;
  transform: none;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
  .reveal,
  .reveal-scale {
    opacity: 1;
    transform: none;
  }
}
