/* ===========================================================
   DevBox — Marketing Site
   Design tokens, theming, layout, components
   =========================================================== */

:root {
  /* Brand */
  --brand: #6366f1;
  --brand-2: #8b5cf6;
  --brand-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);

  /* Light theme */
  --bg: #ffffff;
  --bg-soft: #f7f8fb;
  --bg-elev: #ffffff;
  --bg-code: #0f1117;
  --border: #e6e8ef;
  --border-strong: #d4d8e3;
  --text: #444444;
  --text-muted: #6b7280;
  --text-subtle: #8a92a3;
  --shadow-sm: 0 1px 2px rgba(15, 17, 23, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 17, 23, 0.08);
  --shadow-lg: 0 24px 60px rgba(15, 17, 23, 0.12);

  /* Layout */
  --container: 1200px;
  --radius: 14px;
  --radius-lg: 22px;

  /* Type */
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
}

[data-theme="dark"] {
  --bg: #0a0b0f;
  --bg-soft: #11131a;
  --bg-elev: #14161e;
  --bg-code: #06070a;
  --border: #232634;
  --border-strong: #2f3344;
  --text: #eeeeee;
  --text-muted: #b0b6c7;
  --text-subtle: #7a8298;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.6);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0b0f;
    --bg-soft: #11131a;
    --bg-elev: #14161e;
    --bg-code: #06070a;
    --border: #232634;
    --border-strong: #2f3344;
    --text: #f3f5fb;
    --text-muted: #b0b6c7;
    --text-subtle: #7a8298;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.6);
  }
}

/* ===========================================================
   Accessibility
   =========================================================== */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.visually-hidden:focus,
.visually-hidden:focus-visible {
  position: fixed;
  top: 8px;
  left: 8px;
  width: auto;
  height: auto;
  padding: 0.65rem 1.1rem;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
  background: var(--bg);
  color: var(--brand);
  font-weight: 600;
  border-radius: 8px;
  border: 2px solid var(--brand);
  z-index: 9999;
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

/* ===========================================================
   Reset & base
   =========================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  /* clip (not hidden) preserves sticky positioning while still
     preventing any descendant from pushing the viewport wider. */
  overflow-x: clip;
  max-width: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color 0.25s ease, color 0.25s ease;
  overflow-x: clip;
  max-width: 100%;
  position: relative;
}

/* Defense against any rogue overflow from images, code, or wide blocks */
img, svg, video, canvas, iframe { max-width: 100%; }
pre, code { max-width: 100%; }

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--brand);
  text-decoration: none;
  transition: color 0.15s ease, opacity 0.15s ease;
}
a:hover,
a:focus-visible {
  color: var(--brand-2);
}

button {
  font-family: inherit;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 6px;
}

h1,
h2,
h3,
h4 {
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 0.6em;
  color: var(--text);
}

h1 {
  font-size: clamp(1.85rem, 5vw + 0.75rem, 3.75rem);
  letter-spacing: -0.035em;
  overflow-wrap: break-word;
  word-wrap: break-word;
}
h2 {
  font-size: clamp(1.45rem, 2.4vw + 0.85rem, 2.4rem);
  overflow-wrap: break-word;
}
h3 {
  font-size: clamp(1.08rem, 0.8vw + 0.95rem, 1.4rem);
  overflow-wrap: break-word;
}

p {
  margin: 0 0 1rem;
  color: var(--text-muted);
}

code,
kbd,
pre {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

code {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 0.12em 0.42em;
  border-radius: 6px;
  color: var(--text);
}

pre {
  background: var(--bg-code);
  color: #e6e9f2;
  padding: 1.1rem 1.2rem;
  border-radius: var(--radius);
  overflow-x: auto;
  border: 1px solid var(--border);
  margin: 1rem 0 1.5rem;
  font-size: 0.88rem;
  line-height: 1.6;
}
pre code {
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
}

/* token colors for code blocks */
.tok-k { color: #c084fc; }
.tok-s { color: #86efac; }
.tok-c { color: #6b7280; font-style: italic; }
.tok-n { color: #fbbf24; }
.tok-f { color: #60a5fa; }
.tok-v { color: #f9a8d4; }

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}

/* ===========================================================
   Layout helpers
   =========================================================== */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 clamp(0.95rem, 3vw, 1.25rem);
}

.section {
  padding: clamp(2.75rem, 8vw, 6.5rem) 0;
}

.section--soft {
  background: var(--bg-soft);
  box-shadow: inset 0 1px 0 var(--border), inset 0 -1px 0 var(--border);
}

.section-head {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 3rem;
}
.section-head p {
  font-size: 1.05rem;
}

.eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 0.75rem;
  padding: 0.35rem 0.75rem;
  background: color-mix(in srgb, var(--brand) 10%, transparent);
  border-radius: 999px;
}

.muted { color: var(--text-muted); }

.gradient-text {
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ===========================================================
   Header / Nav
   =========================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
.site-header.is-scrolled {
  border-bottom-color: var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--text); }
/* Brand mark = image placeholder. Swap the inline SVG (or use an <img>)
   for the real app icon when it's ready. */
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: none;
  display: grid;
  place-items: center;
  color: #fff;
  overflow: hidden;
  flex-shrink: 0;
}
.brand-mark svg { width: 16px; height: 16px; }
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  display: inline-block;
  -webkit-tap-highlight-color: transparent;
  /* Snap state changes — no fade. Fading the color/background while
     the highlight moves between links creates a perceptible overlap. */
  transition: none;
}
.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--text);
  background: var(--bg-soft);
}
/* Active / current nav link — highlights automatically as the user
   scrolls through sections, or when the link points to the current page.
   We keep the font-weight identical to the resting state so the link's
   width never changes and neighbouring links don't shift. */
.nav-links a[aria-current] {
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 12%, transparent);
}
.nav-links a[aria-current]:hover,
.nav-links a[aria-current]:focus-visible {
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 18%, transparent);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
/* Divider between language switcher and theme toggle */
.lang-switcher {
  border-right: 1px solid var(--border);
  padding-right: 0.55rem;
  margin-right: 0.1rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  transition: background-color 0.15s ease, border-color 0.15s ease,
    transform 0.1s ease;
}
.icon-btn:hover,
.icon-btn:focus-visible {
  background: var(--bg-soft);
  border-color: var(--border-strong);
  color: var(--text);
}
.icon-btn:active { transform: scale(0.96); }
.icon-btn svg { width: 18px; height: 18px; }

/* Menu toggle: highlighted while the mobile drawer is open */
.menu-toggle[aria-expanded="true"] {
  background: color-mix(in srgb, var(--brand) 14%, transparent);
  border-color: color-mix(in srgb, var(--brand) 35%, var(--border));
  color: var(--brand);
}

.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: block; }
[data-theme="dark"] .theme-toggle .sun { display: block; }
[data-theme="dark"] .theme-toggle .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: none; }
}

.menu-toggle { display: none; }

@media (max-width: 880px) {
  .nav-links {
    /* Anchor relative to the sticky header (which establishes a containing
       block via backdrop-filter), and hide via opacity + visibility so the
       drawer is fully removed from view until toggled open. */
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem 1.1rem;
    gap: 0.25rem;
    box-shadow: var(--shadow-md);
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease,
      visibility 0s linear 0.2s;
  }
  .nav-links.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s;
  }
  .nav-links a {
    padding: 0.85rem 1rem;
    border-radius: 10px;
    font-size: 1rem;
  }
  .menu-toggle { display: inline-flex; }
}

/* App Store badge using the appstore.png image */
.appstore-badge-img {
  display: inline-block;
  line-height: 0;
  border-radius: 12px;
}
.appstore-badge-img img {
  height: 60px;
  width: auto;
  display: block;
  border-radius: inherit;
}

/* ===========================================================
   Hero
   =========================================================== */
.hero {
  position: relative;
  padding: clamp(3.5rem, 7vw, 5.5rem) 0 clamp(3rem, 6vw, 5rem);
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: -20% -10% auto auto;
  width: 70%;
  height: 80%;
  background: radial-gradient(
    closest-side,
    color-mix(in srgb, var(--brand) 40%, transparent),
    transparent 70%
  );
  filter: blur(50px);
  z-index: 0;
  pointer-events: none;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 30% auto -20% -15%;
  width: 60%;
  height: 70%;
  background: radial-gradient(
    closest-side,
    color-mix(in srgb, var(--brand-2) 30%, transparent),
    transparent 70%
  );
  filter: blur(60px);
  z-index: 0;
  pointer-events: none;
}

.hero .container {
  position: relative;
  z-index: 1;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}
@media (max-width: 920px) {
  .hero-grid { grid-template-columns: 1fr; text-align: center; }
  .hero-cta { justify-content: center; }
  .hero-meta { justify-content: center; }
}

.hero h1 { margin-bottom: 1.1rem; }

.hero-lede {
  font-size: clamp(1.05rem, 0.4vw + 1rem, 1.2rem);
  color: var(--text-muted);
  max-width: 560px;
  margin-bottom: 2rem;
}
@media (max-width: 920px) { .hero-lede { margin-inline: auto; } }

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-bottom: 1.75rem;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem 1.5rem;
  color: var(--text-subtle);
  font-size: 0.9rem;
}
.hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.hero-meta svg { width: 16px; height: 16px; color: var(--brand); }

/* Phone mockup */
.device {
  position: relative;
  margin: 0 auto;
  width: min(320px, 80%);
  aspect-ratio: 9 / 19.5;
  background: linear-gradient(160deg, #1e2130 0%, #0a0c12 100%);
  border-radius: 44px;
  padding: 14px;
  box-shadow:
    var(--shadow-lg),
    inset 0 0 0 1.5px rgba(255, 255, 255, 0.08),
    0 0 90px -10px color-mix(in srgb, var(--brand) 40%, transparent);
}

.device-screen {
  width: 100%;
  height: 100%;
  border-radius: 32px;
  background: var(--bg-code);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Tablet placeholder used in features */
.tablet {
  position: relative;
  width: 100%;
  max-width: 540px;
  aspect-ratio: 4 / 3;
  background: linear-gradient(160deg, #1e2130 0%, #0a0c12 100%);
  border-radius: 24px;
  padding: 14px;
  box-shadow:
    var(--shadow-lg),
    inset 0 0 0 1.5px rgba(255, 255, 255, 0.06),
    0 0 70px -10px color-mix(in srgb, var(--brand) 30%, transparent);
  margin: 0 auto;
}
.tablet-screen {
  width: 100%;
  height: 100%;
  border-radius: 14px;
  background: var(--bg-code);
  overflow: hidden;
  position: relative;
}

/* ----------------------------------------------------------
   Theme-adaptive screenshot images
   Two <img> elements per slot (.theme-img-light / .theme-img-dark).
   CSS shows the correct one based on system preference OR the
   explicit data-theme attribute set by the toggle button.
   ---------------------------------------------------------- */
.theme-img-light,
.theme-img-dark {
  display: block;
  width: 100%;
  height: 100%;
  object-position: top center;
  border-radius: inherit;
}

/* Default (system = light): show light, hide dark */
.theme-img-dark { display: none; }

/* System dark + no explicit override → dark */
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .theme-img-light { display: none; }
  html:not([data-theme="light"]) .theme-img-dark  { display: block; }
}

/* Manual override always wins */
[data-theme="dark"]  .theme-img-light { display: none; }
[data-theme="dark"]  .theme-img-dark  { display: block; }
[data-theme="light"] .theme-img-light { display: block; }
[data-theme="light"] .theme-img-dark  { display: none; }

/* ===========================================================
   Logo / language strip
   =========================================================== */
.lang-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem 2rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.lang-strip span {
  color: var(--text-subtle);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.lang-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.95rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.lang-chip .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

/* ===========================================================
   Feature grid
   =========================================================== */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
@media (max-width: 900px) { .feature-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .feature-grid { grid-template-columns: 1fr; } }

.feature {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  box-shadow: var(--shadow-sm);
}
.feature .feature-icon {
  width: 48px;
  height: 48px;
  border-radius: 13px;
  background: color-mix(in srgb, var(--brand) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--brand) 18%, transparent);
  color: var(--brand);
  display: grid;
  place-items: center;
  margin-bottom: 1.1rem;
}
.feature .feature-icon svg { width: 22px; height: 22px; }
.feature h3 { margin-bottom: 0.45rem; }
.feature p { margin: 0; font-size: 0.96rem; }

/* ===========================================================
   Showcase rows
   =========================================================== */
.showcase {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}
.showcase + .showcase { margin-top: clamp(3rem, 6vw, 5rem); }
.showcase--reverse > :first-child { order: 2; }
@media (max-width: 880px) {
  .showcase { grid-template-columns: 1fr; }
  .showcase--reverse > :first-child { order: 0; }
}
.showcase ul {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: grid;
  gap: 0.7rem;
}
.showcase ul li {
  position: relative;
  padding-left: 1.7rem;
  color: var(--text-muted);
}
.showcase ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.26em;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--brand) 15%, transparent);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236366f1' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>");
  background-size: 12px;
  background-repeat: no-repeat;
  background-position: center;
}

/* ===========================================================
   Code window mock
   =========================================================== */
.code-window {
  background: var(--bg-code);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.code-window-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.code-window-bar .dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #444;
}
.code-window-bar .dot:nth-child(1) { background: #ff5f56; }
.code-window-bar .dot:nth-child(2) { background: #ffbd2e; }
.code-window-bar .dot:nth-child(3) { background: #27c93f; }
.code-window-bar .file {
  margin-left: 0.6rem;
  color: rgba(255, 255, 255, 0.55);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}
.code-window pre { margin: 0; border: 0; border-radius: 0; }

/* ===========================================================
   Steps / how it works
   =========================================================== */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  counter-reset: step;
}
@media (max-width: 880px) { .steps { grid-template-columns: 1fr; } }
.step {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.7rem 1.5rem;
  position: relative;
  box-shadow: var(--shadow-sm);
}
.step::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  position: absolute;
  top: 1.1rem;
  right: 1.2rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: color-mix(in srgb, var(--brand) 55%, var(--text-subtle));
  letter-spacing: 0.05em;
}
.step h3 { margin-bottom: 0.35rem; }
.step p { margin: 0; font-size: 0.95rem; }

/* ===========================================================
   FAQ
   =========================================================== */
.faq {
  max-width: 820px;
  margin: 0 auto;
}
.faq details {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  margin-bottom: 0.7rem;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.faq details:hover {
  border-color: color-mix(in srgb, var(--brand) 30%, var(--border));
}
.faq details[open] {
  border-color: color-mix(in srgb, var(--brand) 45%, var(--border));
  box-shadow: var(--shadow-sm);
}
.faq summary {
  list-style: none;
  cursor: pointer;
  padding: 1rem 1.2rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  -webkit-tap-highlight-color: transparent;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") center/contain no-repeat;
  transition: transform 0.2s ease;
}
.faq details[open] summary::after { transform: rotate(180deg); }
.faq .faq-body {
  padding: 0 1.2rem 1.1rem;
  color: var(--text-muted);
}
.faq .faq-body p:last-child { margin-bottom: 0; }

/* ===========================================================
   CTA banner
   =========================================================== */
.cta-banner {
  background: var(--brand-grad);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: clamp(2.2rem, 4vw, 3.4rem);
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 60px color-mix(in srgb, var(--brand) 35%, transparent);
}
/* Decorative inner highlight */
.cta-banner::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto 20%;
  width: 60%;
  height: 100%;
  background: radial-gradient(closest-side, rgba(255,255,255,.18), transparent 70%);
  pointer-events: none;
}
.cta-banner h2 { color: #fff; margin-bottom: 0.6rem; }
.cta-banner p { color: rgba(255, 255, 255, 0.9); max-width: 560px; margin: 0 auto 1.4rem; }

/* ===========================================================
   Footer
   =========================================================== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 3rem 0 2rem;
  background: var(--bg-soft);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2.5rem;
}
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 460px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-col h4 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-subtle);
  margin-bottom: 1rem;
  font-weight: 600;
}
.footer-col ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.55rem; }
.footer-col a {
  color: var(--text-muted);
  font-size: 0.95rem;
}
.footer-col a:hover { color: var(--text); }
.footer-about p { font-size: 0.95rem; max-width: 320px; }
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--text-subtle);
  font-size: 0.88rem;
}

/* ===========================================================
   Page hero (smaller, for inner pages)
   =========================================================== */
.page-hero {
  padding: clamp(3rem, 6vw, 4.5rem) 0 clamp(2rem, 4vw, 3rem);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.page-hero::before {
  content: "";
  position: absolute;
  inset: -60% 10% auto 10%;
  width: 80%;
  height: 140%;
  background: radial-gradient(
    closest-side,
    color-mix(in srgb, var(--brand) 20%, transparent),
    transparent 70%
  );
  filter: blur(50px);
  z-index: 0;
  pointer-events: none;
}
.page-hero .container { position: relative; z-index: 1; }
.page-hero h1 { font-size: clamp(1.9rem, 3vw + 1rem, 3rem); margin-bottom: 0.7rem; }
.page-hero p { max-width: 640px; margin: 0 auto; font-size: 1.05rem; }

/* ===========================================================
   Contact page (redesigned)
   =========================================================== */
.contact-layout {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 880px) { .contact-layout { grid-template-columns: 1fr; } }

/* Featured "main" contact card */
.contact-hero {
  position: relative;
  border-radius: var(--radius-lg);
  padding: clamp(1.6rem, 3vw, 2.4rem);
  background: var(--brand-grad);
  color: #fff;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.contact-hero::after {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 70%;
  aspect-ratio: 1;
  background: radial-gradient(closest-side, rgba(255,255,255,.18), transparent 70%);
  pointer-events: none;
}
.contact-hero .eyebrow {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}
.contact-hero h2 {
  color: #fff;
  font-size: clamp(1.4rem, 1.6vw + 1rem, 1.9rem);
  margin-bottom: 0.55rem;
}
.contact-hero p {
  color: rgba(255, 255, 255, 0.92);
  margin-bottom: 1.5rem;
  max-width: 36ch;
}
.contact-hero .email-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  padding: 0.85rem 1.1rem;
  border-radius: 12px;
  color: #fff;
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  word-break: break-all;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.contact-hero .email-pill:hover,
.contact-hero .email-pill:focus-visible {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.5);
  color: #fff;
}
.contact-hero .email-pill svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  opacity: 0.9;
}
.contact-hero .email-pill .email-text { user-select: text; -webkit-user-select: text; }

.email-copy {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.7rem;
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  font-weight: 600;
  font-size: 0.82rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}
.email-copy:hover,
.email-copy:focus-visible {
  background: rgba(255, 255, 255, 0.26);
  border-color: rgba(255, 255, 255, 0.55);
  color: #fff;
}
.email-copy:active { transform: scale(0.97); }
.email-copy svg { width: 14px; height: 14px; }
.email-copy.is-copied {
  background: rgba(255, 255, 255, 0.32);
  border-color: rgba(255, 255, 255, 0.7);
}

/* Side cards stack */
.contact-side {
  display: grid;
  gap: 0.85rem;
}
/* Inline info chips */
.info-chip {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
}
.info-chip svg {
  width: 18px;
  height: 18px;
  color: var(--brand);
  flex: 0 0 auto;
}
.info-chip-text { line-height: 1.3; }
.info-chip strong { display: block; color: var(--text); font-size: 0.92rem; }
.info-chip span { color: var(--text-muted); font-size: 0.85rem; }

/* ===========================================================
   Documentation
   =========================================================== */
.docs-content {
  min-width: 0;
  max-width: 780px;
}
.docs-content h2 {
  margin-top: 3.2rem;
  padding-top: 0.5rem;
  scroll-margin-top: 90px;
}
.docs-content h2:first-child { margin-top: 0; }
.docs-content h3 { margin-top: 2rem; scroll-margin-top: 90px; }
.docs-content p, .docs-content li { color: var(--text-muted); }
.docs-content ul, .docs-content ol { padding-left: 1.3rem; }
.docs-content li { margin-bottom: 0.4rem; }
.docs-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
  font-size: 0.95rem;
}
.docs-content th, .docs-content td {
  text-align: left;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--border);
}
.docs-content th { color: var(--text); font-weight: 600; background: var(--bg-soft); }
.docs-content blockquote {
  border-left: 3px solid var(--brand);
  background: color-mix(in srgb, var(--brand) 6%, transparent);
  padding: 0.9rem 1.1rem;
  margin: 1.2rem 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.docs-content blockquote p:last-child { margin-bottom: 0; }

.callout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.85rem;
  align-items: start;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
  margin: 1.3rem 0;
}
.callout-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--brand) 14%, transparent);
  color: var(--brand);
}
.callout-icon svg { width: 16px; height: 16px; }
.callout p { margin: 0; color: var(--text-muted); }
.callout strong { color: var(--text); }

/* ===========================================================
   Open-source attribution page
   =========================================================== */
.oss-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
@media (max-width: 760px) { .oss-list { grid-template-columns: 1fr; } }

.oss-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.3rem;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.oss-card:hover,
.oss-card:focus-within {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.oss-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}
.oss-head h3 { margin: 0; font-size: 1.05rem; }
.oss-license {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 10%, transparent);
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}
.oss-card p {
  margin: 0 0 0.7rem;
  font-size: 0.93rem;
}
.oss-link {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  word-break: break-all;
}
.oss-link:hover, .oss-link:focus-visible { color: var(--brand); }

/* ===========================================================
   Mobile refinements
   =========================================================== */
@media (max-width: 880px) {
  html { scroll-padding-top: 72px; }
  .nav { height: 60px; }
}

@media (max-width: 600px) {
  /* Tighter section vertical rhythm */
  .section-head { margin-bottom: 1.75rem; }
  .section-head p { font-size: 0.98rem; }

  /* Hero: device tighter, keep readable */
  .hero { padding: 2rem 0 1.75rem; }
  .hero-grid { gap: 1.75rem; }
  .hero h1 { margin-bottom: 0.85rem; }
  .hero-lede { font-size: 0.98rem; margin-bottom: 1.4rem; }
  .hero-meta {
    font-size: 0.84rem;
    gap: 0.5rem 1rem;
    flex-direction: column;
    align-items: center;
  }

  /* Stack CTAs full-width for finger-friendly taps */
  .hero-cta { flex-direction: column; align-items: stretch; gap: 0.65rem; margin-bottom: 1.4rem; }

  /* Device mockup: much smaller on phone */
  .device { width: min(220px, 65%); border-radius: 32px; padding: 9px; }
  .device::before { width: 68px; height: 19px; top: 16px; border-radius: 12px; }
  .device-screen { border-radius: 23px; }

  /* Page hero */
  .page-hero { padding: 2.25rem 0 1.5rem; }
  .page-hero p { font-size: 1rem; }

  /* Brand text smaller on tiny screens */
  .brand { font-size: 1rem; }
  .brand-mark { width: 30px; height: 30px; font-size: 0.85rem; }

  /* Eyebrow */
  .eyebrow { font-size: 0.72rem; }

  /* Code window / pre */
  pre { font-size: 0.78rem; padding: 0.9rem 0.95rem; line-height: 1.55; border-radius: var(--radius); }
  .code-window-bar { padding: 0.55rem 0.8rem; }
  .code-window-bar .file { font-size: 0.72rem; }
  .code-window-bar .dot { width: 9px; height: 9px; }
  .code-window { border-radius: var(--radius); }

  /* Feature cards tighter */
  .feature { padding: 1.3rem; border-radius: var(--radius); }
  .feature .feature-icon { width: 40px; height: 40px; border-radius: 10px; }
  .feature .feature-icon svg { width: 20px; height: 20px; }

  /* Steps */
  .step { padding: 1.4rem 1.2rem; border-radius: var(--radius); }
  .step::before { top: 0.85rem; right: 1rem; font-size: 0.78rem; }

  /* Showcase gap and order */
  .showcase + .showcase { margin-top: 2.5rem; }
  .showcase ul li { padding-left: 1.5rem; font-size: 0.95rem; }

  /* Lang strip */
  .lang-strip { padding: 1.5rem 0; gap: 0.6rem 1rem; }
  .lang-strip span { width: 100%; text-align: center; }
  .lang-chip { padding: 0.4rem 0.8rem; font-size: 0.85rem; }

  /* FAQ */
  .faq summary { padding: 0.9rem 1rem; font-size: 0.97rem; }
  .faq .faq-body { padding: 0 1rem 1rem; font-size: 0.93rem; }

  /* CTA banner */
  .cta-banner { padding: 1.8rem 1.3rem; border-radius: var(--radius); }

  /* Contact hero refinements */
  .contact-hero { padding: 1.6rem 1.4rem; border-radius: var(--radius); }
  .contact-hero h2 { font-size: 1.4rem; }
  .contact-hero p { font-size: 0.95rem; max-width: none; margin-bottom: 1.2rem; }
  .contact-hero .email-pill {
    width: 100%;
    padding: 0.8rem 0.95rem;
    font-size: 0.85rem;
    justify-content: flex-start;
    word-break: break-all;
  }
  .contact-hero .email-pill svg { width: 16px; height: 16px; }

  .info-chip { padding: 0.8rem 0.9rem; }
  .info-chip strong { font-size: 0.88rem; }
  .info-chip span { font-size: 0.82rem; }

  /* OSS cards */
  .oss-card { padding: 1.05rem 1.1rem; }
  .oss-head h3 { font-size: 1rem; }
  .oss-license { font-size: 0.7rem; padding: 0.2rem 0.5rem; }

  /* Footer */
  .footer-bottom { flex-direction: column; align-items: flex-start; font-size: 0.82rem; gap: 0.4rem; }
  .footer-grid { gap: 1.6rem; margin-bottom: 1.8rem; }

  /* Site header */
  .icon-btn { width: 38px; height: 38px; }
  .icon-btn svg { width: 17px; height: 17px; }
}

@media (max-width: 380px) {
  .hero h1 { font-size: 1.75rem; }
  .device { width: min(220px, 70%); }
  .feature { padding: 1.15rem; }
  .step { padding: 1.2rem 1.05rem; }
  .nav-actions { gap: 0.35rem; }
}

/* Make tables horizontally scrollable on narrow screens
   so they never push the page wider than the viewport */
.docs-content table {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.docs-content table thead,
.docs-content table tbody,
.docs-content table tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}
@media (min-width: 720px) {
  .docs-content table { display: table; }
  .docs-content table thead,
  .docs-content table tbody,
  .docs-content table tr { display: revert; table-layout: auto; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ===========================================================
   Language switcher
   =========================================================== */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: .1rem;
}
.lang-opt {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  padding: .25rem .42rem;
  border-radius: 5px;
  color: var(--text-muted);
  text-decoration: none;
  line-height: 1;
  transition: color .15s, background .15s;
}
.lang-opt:hover {
  color: var(--text);
  background: var(--bg-soft);
}
.lang-opt.is-active {
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 10%, transparent);
}

/* Collapse to a compact icon-only row on very small screens */
@media (max-width: 400px) {
  .lang-switcher { gap: 0; }
  .lang-opt { padding: .22rem .32rem; font-size: .68rem; }
}
