/* ════════════════════════════════════════════════════
   Pennivo — Landing page
   Tokens mirror packages/ui/src/styles/tokens.css
   ════════════════════════════════════════════════════ */

:root {
  /* Fonts */
  --font-ui: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-editor: "Georgia", "Times New Roman", serif;
  --font-mono: "Cascadia Code", "Fira Code", "Consolas", monospace;

  /* Font sizes */
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 17px;
  --text-lg: 20px;
  --text-xl: 28px;
  --text-2xl: 40px;
  --text-3xl: 56px;

  /* Layout */
  --max-w: 1200px;
  --gutter: 32px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;

  /* Transitions */
  --transition-fast: 0.1s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.4s ease;

  /* ── Light theme (default) ── */
  --bg: #fafaf8;
  --bg-surface: #f2f0ec;
  --bg-overlay: #eceae5;
  --text-primary: #1a1a18;
  --text-muted: #7a7872;
  --text-faint: #aeaca6;
  --accent: #4a7c59;
  --accent-hover-solid: #3e6a4b;
  --accent-soft: rgba(74, 124, 89, 0.12);
  --accent-hover: rgba(74, 124, 89, 0.18);
  --border: rgba(0, 0, 0, 0.08);
  --border-mid: rgba(0, 0, 0, 0.13);
  --titlebar-bg: #f0eee9;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.1);
  --shadow-hero: 0 20px 60px rgba(74, 124, 89, 0.14),
    0 8px 24px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] {
  --bg: #141414;
  --bg-surface: #1c1c1c;
  --bg-overlay: #242424;
  --text-primary: #e8e6e1;
  --text-muted: #9a988f;
  --text-faint: #4a4845;
  --accent: #5e9e74;
  --accent-hover-solid: #6eae84;
  --accent-soft: rgba(94, 158, 116, 0.14);
  --accent-hover: rgba(94, 158, 116, 0.22);
  --border: rgba(255, 255, 255, 0.07);
  --border-mid: rgba(255, 255, 255, 0.11);
  --titlebar-bg: #0f0f0f;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.55);
  --shadow-hero: 0 20px 60px rgba(94, 158, 116, 0.18),
    0 8px 24px rgba(0, 0, 0, 0.5);
}

/* ── Reset ── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--transition-slow), color var(--transition-slow);
}

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

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-base);
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 0.15em 0.4em;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--accent);
}

h1,
h2,
h3 {
  font-family: var(--font-editor);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 0;
  color: var(--text-primary);
}

/* ── Utility ── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.sr-only:focus {
  position: static;
  width: auto;
  height: auto;
  padding: 8px 16px;
  margin: 0;
  overflow: visible;
  clip: auto;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ══════════════════════════════════════════
   Header
   ══════════════════════════════════════════ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 32px;
  /* Solid (96%) background instead of backdrop-filter blur.
     backdrop-filter on a sticky header caused progressive GPU memory
     buildup in Chrome on long pages, eventually crashing the tab. */
  background: color-mix(in srgb, var(--bg) 96%, transparent);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-slow),
    border-color var(--transition-slow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-editor);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.brand-logo {
  width: 32px;
  height: 32px;
}

.brand-name {
  font-weight: 600;
}

.site-nav {
  display: flex;
  gap: 28px;
  margin-left: auto;
  font-size: 15px;
  color: var(--text-muted);
}

.site-nav a {
  position: relative;
  padding: 4px 2px;
  transition: color var(--transition-base);
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--accent);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition-base),
    color var(--transition-base), border-color var(--transition-base),
    transform var(--transition-base);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  transition: transform var(--transition-slow);
}

.theme-toggle:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--border);
}

.theme-toggle:hover svg {
  transform: rotate(30deg);
}

[data-theme="dark"] .theme-toggle svg {
  /* When dark, rotate the sun slightly — visual hint that it's "night" */
  transform: rotate(-45deg);
}

[data-theme="dark"] .theme-toggle:hover svg {
  transform: rotate(0deg);
}

/* ══════════════════════════════════════════
   Hero
   ══════════════════════════════════════════ */

.hero {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 56px;
  align-items: center;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 80px var(--gutter) 96px;
}

.eyebrow {
  display: inline-block;
  margin: 0 0 18px;
  padding: 5px 14px;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft);
  border-radius: 999px;
}

.hero-title {
  font-size: clamp(44px, 6.5vw, var(--text-3xl));
  line-height: 1.05;
  margin: 0 0 24px;
}

.hero-title-accent {
  display: block;
  color: var(--accent);
  font-style: italic;
}

.hero-lead {
  max-width: 520px;
  margin: 0 0 36px;
  font-size: 19px;
  line-height: 1.65;
  color: var(--text-muted);
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 22px;
}

.hero-meta {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-faint);
}

#version-badge,
#version-badge-2 {
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--accent);
}

.hero-visual {
  position: relative;
}

.hero-visual img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-mid);
  box-shadow: var(--shadow-hero);
  transition: border-color var(--transition-slow),
    box-shadow var(--transition-slow);
}

/* Subtle floating glow behind the hero image.
   Uses only a radial-gradient — no filter: blur(), which was causing a
   large GPU compositor layer and tab crashes in Chrome. */
.hero-visual::before {
  content: "";
  position: absolute;
  inset: -10px;
  background: radial-gradient(
    ellipse at center,
    var(--accent-soft) 0%,
    transparent 65%
  );
  z-index: -1;
  pointer-events: none;
  transition: background var(--transition-slow);
}

/* ══════════════════════════════════════════
   Buttons
   ══════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 24px;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(74, 124, 89, 0.28),
    0 1px 3px rgba(74, 124, 89, 0.16);
}

[data-theme="dark"] .btn-primary {
  box-shadow: 0 4px 14px rgba(94, 158, 116, 0.22),
    0 1px 3px rgba(0, 0, 0, 0.3);
}

.btn-primary:hover {
  background: var(--accent-hover-solid);
  border-color: var(--accent-hover-solid);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(74, 124, 89, 0.34),
    0 2px 6px rgba(74, 124, 89, 0.2);
}

.btn-ghost {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-mid);
}

.btn-ghost:hover {
  background: var(--bg-surface);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-lg {
  padding: 16px 32px;
  font-size: 16px;
}

/* ══════════════════════════════════════════
   Three-column pillars
   ══════════════════════════════════════════ */

.pillars {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 24px var(--gutter) 40px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 48px;
}

.pillar {
  text-align: left;
}

.pillar-title {
  font-family: var(--font-editor);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 12px;
  color: var(--text-primary);
  position: relative;
  padding-left: 16px;
}

.pillar-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 2px;
  background: var(--accent);
}

.pillar p {
  margin: 0;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-muted);
}

.pillar p code {
  font-size: 0.9em;
}

/* ══════════════════════════════════════════
   Philosophy line (subtle band)
   ══════════════════════════════════════════ */

.philosophy-line {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 48px var(--gutter) 72px;
  text-align: center;
}

.philosophy-line p {
  font-family: var(--font-editor);
  font-size: clamp(22px, 3vw, 30px);
  font-style: italic;
  line-height: 1.4;
  color: var(--text-muted);
  margin: 0;
  letter-spacing: 0.01em;
}

/* ══════════════════════════════════════════
   Section heads
   ══════════════════════════════════════════ */

.section-head {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 56px;
}

.section-head h2 {
  font-size: clamp(30px, 4vw, 44px);
  margin: 0 0 16px;
}

.section-head .eyebrow {
  margin-bottom: 16px;
}

.section-lead {
  font-size: 18px;
  color: var(--text-muted);
  margin: 16px 0 0;
  line-height: 1.6;
}

/* ══════════════════════════════════════════
   Features
   ══════════════════════════════════════════ */

.features {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 80px var(--gutter);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.feature-card {
  padding: 32px 28px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: transform var(--transition-base),
    border-color var(--transition-base), box-shadow var(--transition-base),
    background var(--transition-slow);
}

.feature-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

/* Signature feature card — subtly elevated */
.feature-card-signature {
  background: linear-gradient(
    180deg,
    var(--accent-soft) 0%,
    var(--bg-surface) 100%
  );
  border-color: var(--accent-soft);
  position: relative;
}

.feature-card-signature::after {
  content: "Signature";
  position: absolute;
  top: 16px;
  right: 16px;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--bg);
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--accent-soft);
}

.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 20px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color: var(--accent);
}

.feature-icon svg {
  width: 22px;
  height: 22px;
}

.feature-card h3 {
  font-size: 20px;
  line-height: 1.3;
  margin: 0 0 10px;
}

.feature-card p {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0;
}

/* ══════════════════════════════════════════
   Audience band
   ══════════════════════════════════════════ */

.audience-band {
  max-width: 880px;
  margin: 32px auto 0;
  padding: 64px var(--gutter) 40px;
  text-align: center;
}

.audience-band p {
  font-family: var(--font-editor);
  font-size: clamp(22px, 2.6vw, 28px);
  line-height: 1.5;
  color: var(--text-primary);
  margin: 0;
  font-weight: 500;
}

/* ══════════════════════════════════════════
   Showcase gallery
   ══════════════════════════════════════════ */

.showcase {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 80px var(--gutter);
}

.showcase-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
}

.showcase-item {
  margin: 0;
  padding: 0;
}

.showcase-item img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-mid);
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-base),
    box-shadow var(--transition-base);
}

.showcase-item:hover img {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.showcase-item figcaption {
  margin-top: 14px;
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
}

/* ══════════════════════════════════════════
   Download section
   ══════════════════════════════════════════ */

.download {
  padding: 100px var(--gutter);
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-slow),
    border-color var(--transition-slow);
}

.download-inner {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}

.download-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  margin: 36px 0 20px;
}

.download-meta {
  font-size: var(--text-sm);
  color: var(--text-faint);
  margin: 0;
}

/* ══════════════════════════════════════════
   Footer
   ══════════════════════════════════════════ */

.site-footer {
  padding: 48px var(--gutter);
  border-top: 1px solid var(--border);
  background: var(--bg);
  transition: background var(--transition-slow),
    border-color var(--transition-slow);
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-editor);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  justify-content: center;
  font-size: 14px;
  color: var(--text-muted);
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-copy {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-faint);
}

/* ══════════════════════════════════════════
   Responsive
   ══════════════════════════════════════════ */

@media (max-width: 960px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 48px;
    padding: 56px 24px 72px;
    text-align: center;
  }

  .hero-lead {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-ctas {
    justify-content: center;
  }

  .eyebrow {
    margin-left: auto;
    margin-right: auto;
  }

  .feature-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .pillars {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 16px 24px 24px;
  }

  .philosophy-line {
    padding: 32px 24px 56px;
  }

  .audience-band {
    padding: 48px 24px 24px;
  }
}

@media (max-width: 640px) {
  .site-header {
    padding: 12px 20px;
    gap: 12px;
  }

  .site-nav {
    display: none;
  }

  .hero {
    padding: 48px 20px 64px;
  }

  .hero-title {
    font-size: 40px;
  }

  .feature-grid,
  .showcase-grid {
    grid-template-columns: 1fr;
  }

  .features,
  .showcase {
    padding: 60px 20px;
  }

  .download {
    padding: 72px 20px;
  }

  .footer-links {
    gap: 16px 20px;
  }
}

/* ══════════════════════════════════════════
   Scroll reveal
   ══════════════════════════════════════════ */

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ══════════════════════════════════════════
   Reduced motion
   ══════════════════════════════════════════ */

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

  .theme-toggle:hover svg,
  [data-theme="dark"] .theme-toggle svg {
    transform: none;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
