/* ============================================================
   DRP-OS · Shared Site Stylesheet
   Provides the baseline (CSS vars, reset, nav, buttons,
   section headers, fade-in animations, footer) that every page's
   inline <style> block depends on.
   ============================================================ */

/* ----------------------------------------
   CSS VARIABLES — design tokens
   ---------------------------------------- */
:root {
  /* Paper / Ink */
  --paper:        #faf7f2;
  --paper-pure:   #ffffff;
  --paper-soft:   #f4f0e8;

  --ink:          #1a1714;
  --ink-90:       rgba(26, 23, 20, 0.9);
  --ink-70:       rgba(26, 23, 20, 0.7);
  --ink-50:       rgba(26, 23, 20, 0.5);
  --ink-30:       rgba(26, 23, 20, 0.3);
  --ink-10:       rgba(26, 23, 20, 0.10);
  --ink-05:       rgba(26, 23, 20, 0.05);

  /* Accent */
  --accent:       #c2410c;
  --accent-soft:  #fb923c;
  --accent-deep:  #7c2d12;
  --accent-wash:  rgba(196, 65, 12, 0.10);
  --accent-bg:    rgba(196, 65, 12, 0.08);

  /* Status */
  --positive:     #4d7c0f;
  --warning:      #ca8a04;
  --caution:      #d97706;
  --info:         #1e40af;

  /* Gradient */
  --gradient-vivid: linear-gradient(135deg, #c2410c 0%, #ec4899 45%, #8b5cf6 100%);
  --gradient-soft:  linear-gradient(135deg, rgba(196, 65, 12, 0.10) 0%, rgba(139, 92, 246, 0.06) 100%);

  /* Fonts */
  --font-display: 'Fraunces', 'Times New Roman', serif;
  --font-body:    'Inter Tight', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', 'Menlo', monospace;

  /* Easing */
  --ease-out:     cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out:  cubic-bezier(0.65, 0, 0.35, 1);

  /* Radius */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;

  /* Layout offsets */
  --nav-height: 72px;
}

/* ----------------------------------------
   RESET + BASE
   ---------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: 0;
  background: none;
}

ul {
  list-style: none;
}

/* When user prefers reduced motion, site.js adds .reduce-motion */
.reduce-motion *,
.reduce-motion *::before,
.reduce-motion *::after {
  animation-duration: 0.001s !important;
  animation-delay: 0s !important;
  transition-duration: 0.001s !important;
}

/* ----------------------------------------
   LAYOUT
   ---------------------------------------- */
.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 32px;
}

@media (max-width: 640px) {
  .container { padding: 0 20px; }
}

@media (min-width: 1440px) {
  .container { max-width: 1340px; padding: 0 40px; }
}

@media (min-width: 1920px) {
  .container { max-width: 1560px; padding: 0 60px; }
}

@media (min-width: 2560px) {
  .container { max-width: 1780px; padding: 0 80px; }
}

.section { padding: 120px 0; }

@media (max-width: 720px) {
  .section { padding: 80px 0; }
}

/* ----------------------------------------
   SCROLL PROGRESS BAR (top of viewport)
   ---------------------------------------- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: var(--gradient-vivid);
  z-index: 1000;
  pointer-events: none;
  transition: width 0.1s linear;
  will-change: width;
}

/* ----------------------------------------
   NAV
   ---------------------------------------- */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 18px 0;
  background: rgba(250, 247, 242, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid transparent;
  transition: padding 0.3s var(--ease-out), background 0.3s, border-color 0.3s;
}

.site-nav.scrolled {
  padding: 12px 0;
  background: rgba(250, 247, 242, 0.95);
  border-bottom-color: var(--ink-10);
}

.site-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.wordmark {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  font-style: italic;
  letter-spacing: -0.01em;
  font-variation-settings: 'opsz' 144;
  color: var(--ink);
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: 28px;
  align-items: center;
}

.nav-links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-70);
  transition: color 0.2s;
  position: relative;
}

.nav-links a:hover { color: var(--ink); }

.nav-links a.active {
  color: var(--ink);
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.nav-cta {
  display: flex;
  gap: 10px;
  align-items: center;
}

@media (max-width: 880px) {
  .nav-links { display: none; }
}

/* ----------------------------------------
   BUTTONS
   ---------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 100px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  border: 1px solid transparent;
  transition: transform 0.25s var(--ease-out),
              background 0.25s,
              border-color 0.25s,
              box-shadow 0.25s,
              color 0.25s;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--ink);
  color: var(--paper);
}

.btn-primary:hover {
  background: var(--accent);
  color: white;
}

.btn-secondary {
  background: var(--paper-pure);
  color: var(--ink);
  border-color: var(--ink-10);
}

.btn-secondary:hover {
  border-color: var(--ink-30);
  background: var(--paper);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-70);
  padding: 10px 16px;
}

.btn-ghost:hover {
  background: var(--ink-05);
  color: var(--ink);
}

.btn-gradient {
  background: var(--gradient-vivid);
  color: white;
  box-shadow: 0 6px 18px rgba(196, 65, 12, 0.25);
}

.btn-gradient:hover {
  box-shadow: 0 10px 28px rgba(196, 65, 12, 0.35);
}

.btn-large {
  padding: 14px 28px;
  font-size: 15px;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-arrow {
  display: inline-block;
  transition: transform 0.3s var(--ease-out);
  font-size: 1.1em;
  line-height: 1;
}

.btn:hover .btn-arrow {
  transform: translateX(4px);
}

/* ----------------------------------------
   SECTION HEADERS
   ---------------------------------------- */
.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 18px;
}

.section-eyebrow::before {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--accent);
  display: inline-block;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin-bottom: 20px;
  font-variation-settings: 'opsz' 144;
  max-width: 820px;
}

.section-title em {
  font-style: italic;
  background: var(--gradient-vivid);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.section-intro {
  font-size: 18px;
  color: var(--ink-70);
  max-width: 640px;
  line-height: 1.55;
}

.lede {
  font-size: clamp(18px, 1.6vw, 21px);
  line-height: 1.5;
  color: var(--ink-70);
  max-width: 680px;
}

/* h1 base for page heroes that don't override */
h1 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variation-settings: 'opsz' 144;
}

h1 em,
h2 em {
  font-style: italic;
  background: var(--gradient-vivid);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.hero-headline {
  font-size: clamp(40px, 7vw, 88px);
}

/* ----------------------------------------
   FADE-IN ANIMATIONS — driven by site.js
   site.js adds .in-view when element scrolls into view
   ---------------------------------------- */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
  will-change: opacity, transform;
}

.fade-in.in-view {
  opacity: 1;
  transform: translateY(0);
}

.fade-in-stagger > * {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
  will-change: opacity, transform;
}

.fade-in-stagger.in-view > *:nth-child(1) { transition-delay: 0.05s; opacity: 1; transform: translateY(0); }
.fade-in-stagger.in-view > *:nth-child(2) { transition-delay: 0.15s; opacity: 1; transform: translateY(0); }
.fade-in-stagger.in-view > *:nth-child(3) { transition-delay: 0.25s; opacity: 1; transform: translateY(0); }
.fade-in-stagger.in-view > *:nth-child(4) { transition-delay: 0.35s; opacity: 1; transform: translateY(0); }
.fade-in-stagger.in-view > *:nth-child(5) { transition-delay: 0.45s; opacity: 1; transform: translateY(0); }
.fade-in-stagger.in-view > *:nth-child(6) { transition-delay: 0.55s; opacity: 1; transform: translateY(0); }
.fade-in-stagger.in-view > *:nth-child(n+7) { transition-delay: 0.6s; opacity: 1; transform: translateY(0); }

.reduce-motion .fade-in,
.reduce-motion .fade-in-stagger > * {
  opacity: 1;
  transform: none;
}

/* ----------------------------------------
   DARK CONTEXT — CSS var scoping
   On dark-bg sections (background: var(--ink)), --ink-XX
   opacity tokens need to flip from black to WHITE-based
   so text stays visible. Each page's dark section is listed.
   ---------------------------------------- */
.modules-section,
.how-section,
.site-footer,
.module-block.future {
  --ink-90: rgba(255, 255, 255, 0.9);
  --ink-70: rgba(255, 255, 255, 0.7);
  --ink-50: rgba(255, 255, 255, 0.5);
  --ink-30: rgba(255, 255, 255, 0.3);
  --ink-10: rgba(255, 255, 255, 0.10);
  --ink-05: rgba(255, 255, 255, 0.05);
}

/* index.html + features.html have dark .cta-band — modules.html + about.html have a light one.
   The dark ones set `background: var(--ink)` in their inline CSS; detect via that. */
.cta-band[style*="--ink"],
section.cta-band > .container > .fade-in {
  /* no-op — kept for documentation */
}

/* Specifically: when a body has the dark-cta-band layout, opt in via this class.
   index.php and features.php will get it added. */
.cta-band.is-dark,
body.has-dark-cta-band .cta-band {
  --ink-90: rgba(255, 255, 255, 0.9);
  --ink-70: rgba(255, 255, 255, 0.7);
  --ink-50: rgba(255, 255, 255, 0.5);
  --ink-30: rgba(255, 255, 255, 0.3);
  --ink-10: rgba(255, 255, 255, 0.10);
  --ink-05: rgba(255, 255, 255, 0.05);
}

/* ----------------------------------------
   FORM ELEMENTS — shared
   ---------------------------------------- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-70);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 13px 16px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  background: var(--paper-pure);
  border: 1px solid var(--ink-10);
  border-radius: var(--r-md);
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.form-select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%231a1714' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 42px;
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.55;
  font-family: var(--font-body);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-bg);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--ink-50);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 540px) {
  .form-row { grid-template-columns: 1fr; }
}

/* ----------------------------------------
   FOOTER
   ---------------------------------------- */
.site-footer {
  background: var(--ink);
  color: rgba(255, 255, 255, 0.7);
  padding: 80px 0 30px;
  position: relative;
}

.site-footer .wordmark {
  color: var(--paper);
  font-size: 24px;
  display: inline-block;
  margin-bottom: 16px;
}

.footer-top {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 48px;
  padding-bottom: 48px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-brand p {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.5);
  max-width: 320px;
}

.footer-col h5 {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 16px;
}

.footer-col ul {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-col a {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.75);
  transition: color 0.2s;
}

.footer-col a:hover {
  color: white;
}

.footer-bottom {
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-family: var(--font-mono);
  color: rgba(255, 255, 255, 0.4);
  gap: 20px;
  flex-wrap: wrap;
}

.footer-bottom a {
  color: rgba(255, 255, 255, 0.5);
  transition: color 0.2s;
}

.footer-bottom a:hover {
  color: white;
}

@media (max-width: 960px) {
  .footer-top {
    grid-template-columns: 1fr 1fr;
    gap: 40px;
  }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 540px) {
  .footer-top {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}
