/* ============================================================
   PurposeWorks — Design System v5 "Ocean Blue and Amber"
   ============================================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&display=swap');

/* ---------- Custom Properties ---------- */
:root {
  /* Light theme (default) */
  --bg: #FBF7F0;
  --sidebar-bg: #F3EDE1;
  --card: #FFFFFF;
  --sand: #F1EADB;
  --text: #1B2638;
  --muted: #5F6B7D;
  --line: #E4DCCB;
  --primary: #1E4F8C;
  --heading: #17406F;
  --accent: #B85C38;
  --gold: #E8A33D;
  --sage: #8FB0A6;
  --on-primary: #FFFFFF;

  /* Direction colors */
  --color-brain: #1E4F8C;
  --color-engine: #B85C38;
  --color-freedom: #E8A33D;
  --color-time: #4F8F8B;
  --color-ai: #7A8BA6;
  --color-build: #8E5A7A;

  /* Typography */
  --font-heading: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-2xl: 4rem;
  --space-3xl: 6rem;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;

  /* Layout */
  --max-width: 1100px;
  --nav-height: 64px;

  color-scheme: light;
}

/* ---------- Dark Theme ---------- */
[data-theme="dark"] {
  --bg: #0E1B30;
  --sidebar-bg: #0A1424;
  --card: #15294A;
  --sand: #1B3560;
  --text: #F4EFE6;
  --muted: #A9B8D0;
  --line: #284675;
  --primary: #E8A33D;
  --heading: #F4EFE6;
  --accent: #E3815A;
  --sage: #6FB3AE;

  --color-brain: #7FA8E0;
  --color-engine: #E3815A;
  --color-freedom: #E8A33D;
  --color-time: #6FB3AE;
  --color-ai: #A7B4CC;
  --color-build: #C58BB0;

  --on-primary: #0E1B30;

  color-scheme: dark;
}

/* Respect OS preference when no manual override */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1B30;
    --sidebar-bg: #0A1424;
    --card: #15294A;
    --sand: #1B3560;
    --text: #F4EFE6;
    --muted: #A9B8D0;
    --line: #284675;
    --primary: #E8A33D;
    --heading: #F4EFE6;
    --accent: #E3815A;
    --sage: #6FB3AE;

    --color-brain: #7FA8E0;
    --color-engine: #E3815A;
    --color-freedom: #E8A33D;
    --color-time: #6FB3AE;
    --color-ai: #A7B4CC;
    --color-build: #C58BB0;

    --on-primary: #0E1B30;

    color-scheme: dark;
  }
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 1rem);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *, *::before, *::after {
    transition-duration: 0ms !important;
    animation-duration: 0ms !important;
  }
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-base), color var(--transition-base);
}

/* ---------- Skip Link ---------- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0.75rem;
  z-index: 1000;
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: var(--on-primary, #FBF7F0);
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 0.875rem;
  transition: top var(--transition-fast);
}
.skip-link:focus {
  top: 0.75rem;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--heading);
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.25rem, 5vw, 3.5rem); font-weight: 700; }
h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 600; }
h3 { font-size: clamp(1.25rem, 3vw, 1.75rem); font-weight: 600; }
h4 { font-size: 1.125rem; font-weight: 600; }

p, li { max-width: 65ch; }

a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--transition-fast);
}
a:hover { color: var(--heading); text-decoration-thickness: 2px; }

/* ---------- Focus ---------- */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

section {
  padding: var(--space-3xl) 0;
}

.section-label {
  display: block;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: var(--space-sm);
}

.section-title {
  margin-bottom: var(--space-lg);
}

.section-intro {
  font-size: 1.125rem;
  color: var(--muted);
  margin-bottom: var(--space-xl);
  max-width: 60ch;
}

/* Darker muted on sand/alt backgrounds for contrast */
/* Muted on sand needs higher contrast in light mode */
.section-alt .section-label,
.section-alt .section-intro {
  color: #4A5568;
}
/* Restore var(--muted) in dark mode (already passes AA on dark sand) */
[data-theme="dark"] .section-alt .section-label,
[data-theme="dark"] .section-alt .section-intro {
  color: var(--muted);
}
/* Also handle OS-level dark mode preference */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .section-alt .section-label,
  :root:not([data-theme="light"]) .section-alt .section-intro {
    color: var(--muted);
  }
}

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  height: var(--nav-height);
  transition: background-color var(--transition-base), border-color var(--transition-base);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.wordmark {
  font-family: var(--font-heading);
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--heading);
  text-decoration: none;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  list-style: none;
}

.nav-links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

/* Mobile: full-width clickable nav rows */
@media (max-width: 768px) {
  .nav-links a {
    display: block;
    padding: 0.625rem 0;
    min-height: 44px;
    line-height: 1.5;
  }
}
.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--text);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

/* Theme Toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--line);
  color: var(--text);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition-fast), background var(--transition-fast);
  line-height: 1;
}
.theme-toggle:hover {
  border-color: var(--primary);
  background: var(--sand);
}

/* Theme toggle SVG icons: moon visible in light, sun visible in dark */
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
}

/* Primary Button */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.5rem;
  min-height: 44px;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--on-primary, #FFFFFF);
  background: var(--primary);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  white-space: nowrap;
}
.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}
.btn-primary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.5rem;
  min-height: 44px;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--primary);
  background: transparent;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast);
  white-space: nowrap;
}
.btn-secondary:hover {
  background: var(--primary);
  color: var(--on-primary, #FBF7F0);
}

/* Mobile menu button */
.menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

/* ---------- Hero ---------- */
.hero {
  padding: var(--space-3xl) 0 var(--space-2xl);
  text-align: center;
}

.hero h1 {
  max-width: 14ch;
  margin: 0 auto var(--space-md);
  text-wrap: balance;
}

.hero .lead {
  font-size: clamp(1.0625rem, 2.5vw, 1.25rem);
  color: var(--muted);
  max-width: 55ch;
  margin: 0 auto var(--space-xl);
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- Section backgrounds ---------- */
.section-alt {
  background: var(--sand);
}

/* ---------- Problem ---------- */
.problem-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-xl);
  counter-reset: problem;
}

.problem-step {
  position: relative;
  padding-top: var(--space-xl);
}
.problem-step::before {
  counter-increment: problem;
  content: counter(problem);
  position: absolute;
  top: 0;
  left: 0;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.problem-step h3 {
  margin-bottom: var(--space-sm);
}

/* ---------- Cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-lg);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}

.card h3 {
  margin-bottom: var(--space-sm);
}

.card .card-icon {
  font-size: 1.75rem;
  margin-bottom: var(--space-md);
  display: block;
}

.card-cta {
  display: inline-block;
  margin-top: var(--space-md);
  font-weight: 600;
  font-size: 0.9375rem;
}

/* ---------- Four-step flow ---------- */
.steps-flow {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
  counter-reset: step;
}

.step-item {
  position: relative;
  padding-top: var(--space-xl);
  text-align: center;
}
.step-item::before {
  counter-increment: step;
  content: counter(step);
  display: block;
  width: 40px;
  height: 40px;
  line-height: 40px;
  margin: 0 auto var(--space-md);
  background: var(--primary);
  color: var(--on-primary, #FBF7F0);
  border-radius: 50%;
  font-weight: 700;
  font-size: 1rem;
}

.step-item h4 {
  margin-bottom: var(--space-xs);
}

/* Two-part cards */
.two-part {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
}

.part-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
}

.part-card.brain {
  border-left: 4px solid var(--color-brain);
}
.part-card.engine {
  border-left: 4px solid var(--color-engine);
}

.part-card h3 {
  margin-bottom: var(--space-sm);
}

/* ---------- SPARK method ---------- */
.spark-steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.spark-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-lg);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
}

.spark-letter {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: #FFFFFF;
}

/* Dark-mode SPARK letter text color for contrast */
[data-theme="dark"] .spark-letter {
  color: #0E1B30;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .spark-letter {
    color: #0E1B30;
  }
}

.spark-letter.once { background: var(--color-brain); }
.spark-letter.ongoing { background: var(--color-engine); }

.spark-body h4 {
  margin-bottom: 0.125rem;
}

.spark-body p {
  color: var(--muted);
  font-size: 0.9375rem;
}

.spark-phase-label {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  margin-left: var(--space-sm);
}

.spark-phase-label.once {
  background: rgba(30,79,140,0.1);
  color: var(--color-brain);
}
[data-theme="dark"] .spark-phase-label.once {
  background: rgba(127,168,224,0.15);
}
.spark-phase-label.ongoing {
  background: rgba(184,92,56,0.1);
  color: var(--color-engine);
}
[data-theme="dark"] .spark-phase-label.ongoing {
  background: rgba(227,129,90,0.15);
}

.spark-divider {
  text-align: center;
  padding: var(--space-md) 0;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---------- Promises ---------- */
.promises {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

.promise-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  text-align: center;
}

.promise-card .promise-number {
  display: block;
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: var(--space-sm);
}

/* ---------- Hands-on choice ---------- */
.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
}

.choice-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
}

.choice-card h3 {
  margin-bottom: var(--space-sm);
}

/* ---------- Services ---------- */
.service-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
}

.service-card h3 {
  margin-bottom: var(--space-xs);
}

.service-card .service-tier {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: var(--space-xs);
}

.service-card .service-delivery {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: var(--space-md);
}

.service-card p {
  flex: 1;
  margin-bottom: var(--space-md);
}

/* ---------- Founding Partners ---------- */
.founding-partners {
  background: var(--card);
  border: 2px solid var(--gold);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  text-align: center;
  max-width: 720px;
  margin: 0 auto;
}

.founding-partners h3 {
  color: var(--accent);
  margin-bottom: var(--space-sm);
}

.founding-partners .exact-offer {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--space-md);
  color: var(--text);
}

.founding-partners ul {
  list-style: none;
  text-align: left;
  max-width: 480px;
  margin: 0 auto var(--space-lg);
}

.founding-partners ul li {
  padding: 0.375rem 0;
  padding-left: 1.5rem;
  position: relative;
}
.founding-partners ul li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 600;
}

.founding-note {
  font-size: 0.875rem;
  color: var(--muted);
  font-style: italic;
}

/* ---------- Built in public ---------- */
.built-public {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  border-left: 4px solid var(--color-build);
}

/* ---------- About ---------- */
.about-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-xl);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  align-items: center;
}

.about-photo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--sand);
  border: 2px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.75rem;
  flex-shrink: 0;
}

.about-photo img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

/* ---------- Final CTA ---------- */
.final-cta {
  text-align: center;
  padding: var(--space-3xl) 0;
}

.final-cta h2 {
  margin-bottom: var(--space-md);
}

/* ---------- Contact Form ---------- */
.contact-form {
  max-width: 500px;
  margin: var(--space-xl) auto 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
}

.contact-form .form-group {
  margin-bottom: var(--space-md);
}

.contact-form label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
  color: var(--text);
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.625rem 0.75rem;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  transition: border-color var(--transition-fast);
}
.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.contact-form textarea {
  min-height: 100px;
  resize: vertical;
}

.form-disconnected {
  font-size: 0.8125rem;
  color: var(--muted);
  font-style: italic;
  text-align: center;
  margin-top: var(--space-sm);
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--sidebar-bg);
  border-top: 1px solid var(--line);
  padding: var(--space-2xl) 0 var(--space-lg);
  transition: background-color var(--transition-base);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
}

.footer-left .wordmark {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-bottom: var(--space-sm);
}

.footer-left p {
  font-size: 0.875rem;
  color: var(--muted);
  max-width: 40ch;
}

.footer-right {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  align-items: flex-end;
  justify-content: center;
}

.footer-contact {
  font-size: 0.875rem;
  color: var(--muted);
}

.footer-contact a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.footer-bottom {
  max-width: var(--max-width);
  margin: var(--space-lg) auto 0;
  padding: var(--space-md) var(--space-lg) 0;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 0.8125rem;
  color: var(--muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  :root {
    --nav-height: 56px;
  }

  .menu-btn { display: flex; }

  .nav-inner { gap: 0.75rem; }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    padding: var(--space-md);
    gap: var(--space-sm);
    z-index: 99;
  }

  .nav-links.open {
    display: flex;
  }

  .problem-steps { grid-template-columns: 1fr; }
  .steps-flow { grid-template-columns: 1fr 1fr; }
  .two-part { grid-template-columns: 1fr; }
  .promises { grid-template-columns: 1fr; }
  .choice-grid { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr; }
  .about-card { grid-template-columns: 1fr; text-align: center; }
  .about-photo { margin: 0 auto; }
  .footer-inner { grid-template-columns: 1fr; text-align: center; }
  .footer-right { align-items: center; }

  .spark-row {
    flex-direction: column;
    text-align: center;
  }
  .spark-letter { margin: 0 auto; }

  section {
    padding: var(--space-2xl) 0;
  }
}

@media (max-width: 480px) {
  .container { padding: 0 var(--space-md); }
  .nav-inner { padding: 0 var(--space-md); gap: 0.75rem; }
  .nav-right { gap: 0.5rem; }
  .nav-right .btn-primary { padding: 0.5rem 0.75rem; font-size: 0.8125rem; }
  .steps-flow { grid-template-columns: 1fr; }
  .hero-actions { flex-direction: column; align-items: center; }
  .btn-secondary { width: 100%; max-width: 280px; }
}

@media (max-width: 400px) {
  .nav-right .btn-primary { display: none; }
}