/* ============================================================================
 * Penstock — public landing page (penstock.run)
 * Built on the brand design tokens (tokens.css, synced from docs/brand/).
 * Dark mode is the product's home surface (BRAND-IDENTITY.md §9); designed
 * dark-first. Token-driven: consumes --color-* aliases and --pen-* / --space-*
 * / --text-* scales, never raw one-off hex. (DESIGN-SYSTEM.md §2, §9.1)
 * ========================================================================== */

/* --- Self-hosted brand fonts (PEN-92) ----------------------------------------
 * Binaries land at /*.woff2 via PEN-92 (the web root is flat — see
 * deploy/site/README.md). Until then, font-display:swap + the token fallback
 * stacks render the page cleanly in system fonts. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/inter-variable.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 500 600;
  font-display: swap;
  src: url('/space-grotesk-variable.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url('/jetbrains-mono-variable.woff2') format('woff2');
}

/* --- Reset / base ----------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { font-family: var(--font-display); letter-spacing: var(--tracking-tight); line-height: var(--leading-tight); margin: 0; }
p { margin: 0; }
a { color: var(--color-link); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: var(--font-mono); }

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

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--color-brand-strong); color: var(--pen-ink-0);
  padding: var(--space-sm) var(--space-md); border-radius: var(--radius-sm); z-index: 100;
}
.skip-link:focus { left: var(--space-md); top: var(--space-md); }

/* --- Layout primitives ------------------------------------------------------ */
.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--space-md);
}
@media (min-width: 768px)  { .container { padding-inline: var(--space-lg); } }
@media (min-width: 1024px) { .container { padding-inline: var(--space-xl); } }

.section { padding-block: var(--space-3xl); }
.section-alt { background: var(--color-bg-subtle); }
.section-title {
  font-size: var(--text-h2);
  text-align: center;
  max-width: 22ch;
  margin-inline: auto;
}
.section-lede {
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--text-lg);
  max-width: 62ch;
  margin: var(--space-md) auto 0;
}

.eyebrow {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-brand);
  margin-bottom: var(--space-sm);
}
.eyebrow-center { text-align: center; }

/* --- Buttons ---------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  min-height: 44px;
  padding: 0 var(--space-lg);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  line-height: 1;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--duration-fast) var(--ease-standard),
              border-color var(--duration-fast) var(--ease-standard),
              transform var(--duration-fast) var(--ease-standard);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-sm { min-height: 38px; padding: 0 var(--space-md); font-size: var(--text-sm); }
.btn-lg { min-height: 52px; padding: 0 var(--space-xl); font-size: var(--text-lg); }
.btn-block { width: 100%; margin-top: auto; }

/* Primary: solid brand. In dark theme --color-brand-strong is teal-300 (bright
 * on a dark surface) so ink-inverse (near-black) text holds AA. */
.btn-primary { background: var(--color-brand-strong); color: var(--color-text-inverse); border-color: var(--color-brand-strong); }
.btn-primary:hover { background: var(--pen-teal-200); border-color: var(--pen-teal-200); }

.btn-secondary { background: var(--color-surface-raised); color: var(--color-text); border-color: var(--color-border); }
.btn-secondary:hover { border-color: var(--color-brand); }

.btn-ghost { background: transparent; color: var(--color-text); border-color: var(--color-border); }
.btn-ghost:hover { background: var(--color-surface); border-color: var(--color-brand); }

/* --- Header ----------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 64px; }
.brand-logo { display: block; height: 36px; width: auto; }
.site-nav { display: flex; align-items: center; gap: var(--space-lg); }
.site-nav a:not(.btn) { color: var(--color-text-muted); font-size: var(--text-sm); font-weight: var(--weight-medium); }
.site-nav a:not(.btn):hover { color: var(--color-text); text-decoration: none; }
@media (max-width: 640px) {
  .site-nav a:not(.btn) { display: none; }
}

/* --- Hero ------------------------------------------------------------------- */
.hero { position: relative; padding-block: var(--space-3xl); overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background: var(--pen-gradient-flow);
  opacity: 0.14;
  -webkit-mask-image: radial-gradient(120% 80% at 80% 0%, #000 0%, transparent 70%);
          mask-image: radial-gradient(120% 80% at 80% 0%, #000 0%, transparent 70%);
}
.hero-grid {
  position: relative; z-index: 1;
  display: grid; gap: var(--space-2xl);
  align-items: center;
}
@media (min-width: 1024px) { .hero-grid { grid-template-columns: 1.05fr 0.95fr; gap: var(--space-3xl); } }

.hero-title { font-size: clamp(2.25rem, 6vw, 3rem); margin-bottom: var(--space-md); }
.hero-sub { font-size: var(--text-lg); color: var(--color-text-muted); max-width: 56ch; }
.trust-line {
  display: flex; gap: var(--space-sm); align-items: flex-start;
  margin-top: var(--space-lg);
  padding: var(--space-md);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-brand);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-sm);
  max-width: 56ch;
}
.inline-icon { color: var(--color-brand); flex: 0 0 auto; margin-top: 1px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--space-md); margin-top: var(--space-xl); }
.hero-note { margin-top: var(--space-md); font-size: var(--text-sm); color: var(--color-text-muted); }

/* Hero code card */
.code-card {
  background: var(--pen-ink-950);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.code-card-head {
  display: flex; align-items: center; gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--color-border);
  background: var(--pen-ink-900);
}
.dot { width: 10px; height: 10px; border-radius: var(--radius-pill); display: inline-block; }
.dot-teal { background: var(--pen-teal-400); }
.code-card-title { font-size: var(--text-xs); color: var(--color-text-muted); font-family: var(--font-body); }
pre.code {
  margin: 0; padding: var(--space-lg);
  overflow-x: auto;
  font-size: var(--text-sm);
  line-height: 1.55;
  color: var(--pen-ink-200);
  tab-size: 2;
}
.c-comment { color: var(--pen-ink-400); }
.c-key { color: var(--pen-teal-300); }
.c-str { color: var(--pen-gold-300); }

/* --- How it works (steps) --------------------------------------------------- */
.steps {
  list-style: none; padding: 0; margin: var(--space-2xl) 0 0;
  display: grid; gap: var(--space-lg);
}
@media (min-width: 768px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step {
  position: relative;
  padding: var(--space-xl) var(--space-lg) var(--space-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-pill);
  background: var(--pen-gradient-flow);
  color: var(--pen-ink-0);
  font-family: var(--font-display); font-weight: var(--weight-semibold);
  margin-bottom: var(--space-md);
}
.step-title { font-size: var(--text-h4); font-family: var(--font-body); font-weight: var(--weight-semibold); letter-spacing: 0; margin-bottom: var(--space-sm); }
.step p { color: var(--color-text-muted); font-size: var(--text-sm); }

/* --- Features --------------------------------------------------------------- */
.feature-grid {
  margin-top: var(--space-2xl);
  display: grid; gap: var(--space-lg);
  grid-template-columns: 1fr;
}
@media (min-width: 640px)  { .feature-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .feature-grid { grid-template-columns: repeat(3, 1fr); } }

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}
.feature { display: flex; flex-direction: column; }
.feature-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: var(--radius-md);
  background: var(--color-bg-subtle);
  color: var(--color-brand);
  border: 1px solid var(--color-border);
  margin-bottom: var(--space-md);
}
.feature h3 { font-size: var(--text-h4); font-family: var(--font-body); font-weight: var(--weight-semibold); letter-spacing: 0; margin-bottom: var(--space-sm); display: flex; align-items: center; gap: var(--space-sm); flex-wrap: wrap; }
.feature p { color: var(--color-text-muted); font-size: var(--text-sm); }

.badge {
  font-family: var(--font-body);
  font-size: 0.6875rem; font-weight: var(--weight-semibold);
  text-transform: uppercase; letter-spacing: var(--tracking-wide);
  padding: 2px 8px; border-radius: var(--radius-pill);
  white-space: nowrap;
}
/* Gold accent always takes INK text, never white (BRAND-IDENTITY.md §4.5) */
.badge-accent { background: var(--pen-gold-400); color: var(--pen-ink-900); }

/* --- Pricing ---------------------------------------------------------------- */
.pricing-grid {
  margin-top: var(--space-2xl);
  display: grid; gap: var(--space-lg);
  grid-template-columns: 1fr;
  align-items: stretch;
}
@media (min-width: 900px) { .pricing-grid { grid-template-columns: repeat(3, 1fr); } }
.price-card { display: flex; flex-direction: column; }
.price-card-featured {
  border-color: var(--color-brand);
  box-shadow: 0 0 0 1px var(--color-brand), var(--shadow-md);
  position: relative;
}
.price-flag {
  font-size: var(--text-xs); font-weight: var(--weight-semibold);
  text-transform: uppercase; letter-spacing: var(--tracking-wide);
  color: var(--color-brand);
  margin-bottom: var(--space-xs);
}
.price-name { font-size: var(--text-h3); margin-bottom: var(--space-xs); }
.price-for { color: var(--color-text-muted); font-size: var(--text-sm); margin-bottom: var(--space-lg); }
.price-list { list-style: none; padding: 0; margin: 0 0 var(--space-lg); display: grid; gap: var(--space-sm); }
.price-list li {
  position: relative; padding-left: 1.6rem;
  font-size: var(--text-sm); color: var(--color-text);
}
.price-list li::before {
  content: ""; position: absolute; left: 0; top: 0.45em;
  width: 0.65rem; height: 0.65rem;
  background: var(--color-brand);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M9 16.2l-3.5-3.5L4 14.2 9 19l11-11-1.4-1.4z'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M9 16.2l-3.5-3.5L4 14.2 9 19l11-11-1.4-1.4z'/%3E%3C/svg%3E") center/contain no-repeat;
}
.pricing-foot { text-align: center; margin-top: var(--space-xl); color: var(--color-text-muted); font-size: var(--text-sm); }

/* --- Inline code ------------------------------------------------------------ */
.inline-code {
  font-size: 0.85em; padding: 0.1em 0.4em;
  background: var(--color-bg-subtle); border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); color: var(--color-text);
}

/* --- CTA band --------------------------------------------------------------- */
.cta-band { background: var(--pen-gradient-flow); }
.cta-inner { text-align: center; padding-block: var(--space-3xl); }
.cta-title { color: var(--pen-ink-0); font-size: var(--text-h1); }
.cta-sub { color: var(--pen-teal-50); font-size: var(--text-lg); max-width: 52ch; margin: var(--space-md) auto 0; }
.cta-actions { justify-content: center; }
/* On the bright gradient, the primary button inverts to a light surface w/ ink text */
.cta-band .btn-primary { background: var(--pen-ink-0); color: var(--pen-navy-700); border-color: var(--pen-ink-0); }
.cta-band .btn-primary:hover { background: var(--pen-teal-50); border-color: var(--pen-teal-50); }
.cta-band .btn-ghost { color: var(--pen-ink-0); border-color: color-mix(in srgb, var(--pen-ink-0) 55%, transparent); }
.cta-band .btn-ghost:hover { background: color-mix(in srgb, var(--pen-ink-0) 12%, transparent); border-color: var(--pen-ink-0); }

/* --- Footer ----------------------------------------------------------------- */
.site-footer { background: var(--pen-ink-950); border-top: 1px solid var(--color-border); padding-block: var(--space-2xl); }
.footer-inner { display: flex; flex-wrap: wrap; gap: var(--space-lg); justify-content: space-between; align-items: flex-start; }
.footer-brand { display: flex; gap: var(--space-md); align-items: center; max-width: 42ch; }
.footer-tagline { color: var(--color-text-muted); font-size: var(--text-sm); }
.footer-meta { color: var(--color-text-muted); font-size: var(--text-xs); text-align: right; }
.footer-copy { margin-top: var(--space-xs); }
@media (max-width: 640px) { .footer-meta { text-align: left; } }
