/* ═══════════════════════════════════════════
   THE SOVEREIGN HOME — Main Stylesheet
   sovereignhome.org
   ═══════════════════════════════════════════ */

/* ═══════════════════════════════════════════
   BRAND TOKENS
   ═══════════════════════════════════════════ */
:root {
  /* Primary: Deep Forest */
  --color-primary: #2D5016;
  --color-primary-light: #3E6B1F;
  --color-primary-pale: #E8F0E0;

  /* Secondary: Warm Soil */
  --color-secondary: #8B6914;
  --color-secondary-light: #B8912A;

  /* Accent: Terracotta */
  --color-accent: #C4572A;

  /* Neutrals — Light Mode */
  --color-bg: #FAF8F4;
  --color-surface: #FFFFFF;
  --color-surface-alt: #F0EDE6;
  --color-border: #DDD8CC;
  --color-text: #1A1A18;
  --color-text-secondary: #5C5A52;
  --color-text-muted: #8A877D;

  /* Semantic */
  --color-success: #3A7D2C;
  --color-warning: #B8912A;
  --color-error: #C4572A;
  --color-info: #3B6E8F;

  /* Typography */
  --font-heading: 'DM Serif Display', Georgia, serif;
  --font-body: 'Source Sans 3', -apple-system, sans-serif;

  /* Type Scale (fluid) */
  --text-xs: clamp(0.7rem, 0.65rem + 0.25vw, 0.8rem);
  --text-sm: clamp(0.8rem, 0.75rem + 0.25vw, 0.9rem);
  --text-base: clamp(0.95rem, 0.9rem + 0.25vw, 1.1rem);
  --text-lg: clamp(1.1rem, 1rem + 0.5vw, 1.35rem);
  --text-xl: clamp(1.3rem, 1.1rem + 1vw, 1.75rem);
  --text-2xl: clamp(1.6rem, 1.3rem + 1.5vw, 2.4rem);
  --text-3xl: clamp(2rem, 1.5rem + 2.5vw, 3.2rem);
  --text-4xl: clamp(2.4rem, 1.6rem + 4vw, 4.2rem);

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1.25rem;
  --space-lg: 2rem;
  --space-xl: 3.5rem;
  --space-2xl: 6rem;

  /* Layout */
  --max-width: 64rem;
  --radius: 6px;
  --radius-lg: 12px;
}

/* ═══════════════════════════════════════════
   DARK MODE
   ═══════════════════════════════════════════ */
@media (prefers-color-scheme: dark) {
  :root {
    --color-primary: #6BAF3D;
    --color-primary-light: #7EC44E;
    --color-primary-pale: #1E2A16;

    --color-secondary: #D4A83A;
    --color-secondary-light: #E0BE5C;

    --color-accent: #E07A54;

    --color-bg: #141310;
    --color-surface: #1E1D19;
    --color-surface-alt: #262520;
    --color-border: #3A382F;
    --color-text: #EAE8E0;
    --color-text-secondary: #B0ADA3;
    --color-text-muted: #7A776D;

    --color-success: #6BAF3D;
    --color-warning: #D4A83A;
    --color-error: #E07A54;
    --color-info: #5BA4C9;
  }
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

a {
  color: var(--color-primary);
  text-decoration-color: var(--color-primary);
  text-underline-offset: 3px;
  transition: color 0.2s;
}
a:hover { color: var(--color-primary-light); }

/* ═══════════════════════════════════════════
   LAYOUT UTILITIES
   ═══════════════════════════════════════════ */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.section {
  padding: var(--space-2xl) 0;
}

.section + .section {
  border-top: 1px solid var(--color-border);
}

.text-center { text-align: center; }

/* ═══════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes sprout {
  0% { transform: scaleY(0); transform-origin: bottom; opacity: 0; }
  60% { transform: scaleY(1.05); opacity: 1; }
  100% { transform: scaleY(1); opacity: 1; }
}

@keyframes leafGrow {
  0% { transform: scale(0) rotate(-20deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.fade-in {
  opacity: 0;
  animation: fadeUp 0.6s ease-out forwards;
}

.fade-in-d1 { animation-delay: 0.1s; }
.fade-in-d2 { animation-delay: 0.2s; }
.fade-in-d3 { animation-delay: 0.35s; }
.fade-in-d4 { animation-delay: 0.5s; }

/* ═══════════════════════════════════════════
   HEADER / NAV
   ═══════════════════════════════════════════ */
header {
  padding: var(--space-md) 0;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--color-bg) 96%, transparent);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  color: var(--color-text);
}

.logo-link:hover { color: var(--color-text); }

.logo-mark {
  flex-shrink: 0;
}

.logo-wordmark {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  line-height: 1.1;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.nav-links {
  display: flex;
  gap: var(--space-md);
  list-style: none;
}

.nav-links a {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  text-decoration: none;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

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

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

/* ═══════════════════════════════════════════
   HERO
   ═══════════════════════════════════════════ */
.hero {
  padding: var(--space-2xl) 0 var(--space-xl);
  text-align: center;
  position: relative;
}

.hero-tagline {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  line-height: 1.15;
  color: var(--color-text);
  margin-bottom: var(--space-md);
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
}

.hero-tagline em {
  font-style: italic;
  color: var(--color-primary);
}

.hero-eyebrow {
  margin: 0 auto var(--space-sm);
  color: var(--color-secondary);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-brandline {
  margin: calc(-1 * var(--space-xs)) auto var(--space-md);
  color: var(--color-primary);
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-style: italic;
}

.hero-sub {
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
  max-width: 34rem;
  margin: 0 auto var(--space-lg);
  line-height: 1.6;
  font-weight: 300;
}

.hero-cta-row {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: var(--space-xl);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.75em 1.5em;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--color-primary-light);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--color-primary) 30%, transparent);
}

.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border: 1.5px solid var(--color-border);
}
.btn-secondary:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.hero-illustration {
  max-width: 36rem;
  margin: 0 auto var(--space-xl);
}

.hero-illustration img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
}

/* ═══════════════════════════════════════════
   INTRO FILM
   ═══════════════════════════════════════════ */
.film { padding-top: var(--space-lg); }

.film-eyebrow {
  text-align: center;
  margin-bottom: var(--space-xs);
  color: var(--color-secondary);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.film-frame {
  position: relative;
  max-width: 56rem;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  /* Matches the film's own paper tone so the frame never flashes dark before load */
  background: #F3F1EC;
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.05),
    0 28px 60px -28px color-mix(in srgb, var(--color-primary) 45%, transparent);
}

.film-frame video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* The whole poster is the play target; the pill sits in the film's empty lower-right corner */
.film-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: clamp(0.75rem, 3%, 1.75rem);
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.film-play[hidden] { display: none; }

.film-play-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.6em 1.1em 0.6em 0.9em;
  border-radius: 999px;
  background: #2D5016;
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(45, 80, 22, 0.35);
  transition: transform 0.2s, background 0.2s;
}

.film-play:hover .film-play-pill { background: #3E6B1F; transform: translateY(-1px); }

.film-play:focus-visible { outline: none; }
.film-play:focus-visible .film-play-pill {
  outline: 3px solid var(--color-secondary-light);
  outline-offset: 3px;
}

.film-play-time {
  font-weight: 400;
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}

.film-chapters {
  list-style: none;
  max-width: 56rem;
  margin: var(--space-lg) auto 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0 var(--space-md);
}

.film-chapters button {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: var(--space-xs) 0 var(--space-sm);
  border: none;
  border-top: 1px solid var(--color-border);
  background: none;
  color: var(--color-text-secondary);
  font: inherit;
  font-size: var(--text-sm);
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.film-chapters button:hover { color: var(--color-text); border-top-color: var(--color-text-muted); }

.film-chapters button[aria-current] {
  color: var(--color-primary);
  border-top: 2px solid var(--color-primary);
  margin-top: -1px;
}

.film-chapters button:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.chap-time {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.film-chapters button[aria-current] .chap-time { color: inherit; }

@media (max-width: 700px) {
  .film-chapters { grid-template-columns: repeat(2, 1fr); }
}

/* On phones the poster is small; a compact pill stays clear of the title */
@media (max-width: 600px) {
  .film-play { padding: 0.5rem; }
  .film-play-pill { padding: 0.4em 0.75em 0.4em 0.6em; font-size: var(--text-xs); }
  .film-play-pill svg { width: 14px; height: 14px; }
  .film-play-label {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .film-play-time { opacity: 1; font-weight: 600; }
}

/* Soft-launch status line under the hero CTAs */
.launch-note {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  margin: calc(-1 * var(--space-lg)) auto var(--space-xl);
  padding: 0.35em 0.95em;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: 1.4;
}

.launch-dot {
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-secondary-light);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--color-secondary-light) 55%, transparent);
  animation: launchPulse 2.4s ease-out infinite;
}

@keyframes launchPulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--color-secondary-light) 55%, transparent); }
  70%, 100% { box-shadow: 0 0 0 7px transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .launch-dot { animation: none; }
}

@media (max-width: 600px) {
  .launch-note { border-radius: var(--radius-lg); text-align: left; }
}

/* ═══════════════════════════════════════════
   PROBLEM SECTION
   ═══════════════════════════════════════════ */
.problem { background: var(--color-surface-alt); }

.problem-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: var(--space-lg);
  margin-top: var(--space-lg);
}

.problem-card {
  padding: var(--space-lg);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}

.problem-card h3 {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  margin-bottom: var(--space-xs);
  color: var(--color-text);
}

.problem-card p {
  color: var(--color-text-secondary);
  font-size: var(--text-base);
  line-height: 1.6;
}

.problem-icon {
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: var(--space-sm);
  color: var(--color-accent);
}

/* ═══════════════════════════════════════════
   APP SUITE
   ═══════════════════════════════════════════ */
.section-heading {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  margin-bottom: var(--space-xs);
  color: var(--color-text);
  text-align: center;
}

.section-sub {
  color: var(--color-text-secondary);
  text-align: center;
  max-width: 32rem;
  margin: 0 auto var(--space-xl);
  font-size: var(--text-lg);
  font-weight: 300;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: var(--space-md);
}

.app-card {
  padding: var(--space-lg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  transition: border-color 0.2s, box-shadow 0.2s;
  position: relative;
  display: flex;
  flex-direction: column;
  color: var(--color-text);
  text-decoration: none;
}

a.app-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 2px 16px color-mix(in srgb, var(--color-primary) 10%, transparent);
  color: var(--color-text);
}

.app-card:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--color-primary) 35%, transparent);
  outline-offset: 3px;
}

.app-card-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-sm);
  font-size: 1.3rem;
}

/* App icon background utilities */
.icon-bg-primary   { background: var(--color-primary-pale); }
.icon-bg-success   { background: color-mix(in srgb, var(--color-success) 12%, transparent); }
.icon-bg-secondary { background: color-mix(in srgb, var(--color-secondary) 12%, transparent); }
.icon-bg-accent    { background: color-mix(in srgb, var(--color-accent) 12%, transparent); }
.icon-bg-info      { background: color-mix(in srgb, var(--color-info) 12%, transparent); }
.icon-bg-muted     { background: var(--color-surface-alt); }

.app-card h3 {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  margin-bottom: 0.25rem;
}

.app-card p {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: 1.55;
}

.app-card-cta {
  margin-top: auto;
  padding-top: var(--space-md);
  color: var(--color-primary);
  font-size: var(--text-sm);
  font-weight: 600;
}

.app-card-cta-soon {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  color: var(--color-text-muted);
  font-weight: 500;
}

.app-card-cta-soon::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-secondary-light);
}

.app-card-featured {
  border-color: color-mix(in srgb, var(--color-primary) 45%, var(--color-border));
  box-shadow: inset 0 3px 0 var(--color-primary);
}

.suite-note {
  max-width: 48rem;
  margin: var(--space-xl) auto 0;
  padding: var(--space-lg);
  border-left: 4px solid var(--color-primary);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  background: var(--color-primary-pale);
}

.suite-note h3 {
  margin-bottom: var(--space-xs);
  font-family: var(--font-heading);
  font-size: var(--text-lg);
}

.suite-note p {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.suite-note p + p {
  margin-top: var(--space-sm);
}

.badge {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2em 0.6em;
  border-radius: 3px;
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
}

.badge-available {
  background: var(--color-primary-pale);
  color: var(--color-primary);
}

.badge-preview {
  background: color-mix(in srgb, var(--color-secondary) 14%, transparent);
  color: var(--color-secondary);
}

.badge-planned,
.badge-soon {
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
}

/* ═══════════════════════════════════════════
   HOW IT WORKS
   ═══════════════════════════════════════════ */
.how-it-works { background: var(--color-surface-alt); }

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: var(--space-lg);
  margin-top: var(--space-lg);
  counter-reset: step;
}

.step {
  text-align: center;
  counter-increment: step;
  position: relative;
}

.step::before {
  content: counter(step);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  margin: 0 auto var(--space-sm);
}

.step h3 {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  margin-bottom: 0.35rem;
}

.step p {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: 1.55;
  max-width: 16rem;
  margin: 0 auto;
}

/* connector lines between steps */
@media (min-width: 700px) {
  .step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 1.375rem;
    left: calc(50% + 2rem);
    width: calc(100% - 4rem);
    height: 1.5px;
    background: var(--color-border);
  }
}

/* ═══════════════════════════════════════════
   PHILOSOPHY
   ═══════════════════════════════════════════ */
.philosophy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: var(--space-lg);
  margin-top: var(--space-lg);
}

.philosophy-item h3 {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  margin-bottom: var(--space-xs);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.philosophy-item p {
  color: var(--color-text-secondary);
  line-height: 1.65;
}

.phi-icon {
  width: 1.5rem;
  height: 1.5rem;
  color: var(--color-primary);
  flex-shrink: 0;
}

.philosophy-img {
  width: 100%;
  max-width: 36rem;
  height: auto;
  border-radius: var(--radius-lg);
  margin: 0 auto var(--space-lg);
  display: block;
}

.section-coda {
  text-align: center;
  margin-top: var(--space-xl);
  color: var(--color-text-secondary);
}

/* ═══════════════════════════════════════════
   ABOUT
   ═══════════════════════════════════════════ */
.about-inner {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-xl);
  align-items: start;
  max-width: 44rem;
  margin: 0 auto;
}

@media (max-width: 600px) {
  .about-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }
}

.about-avatar {
  width: 6rem;
  height: 6rem;
  border-radius: 50%;
  background: var(--color-primary-pale);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  border: 2px solid var(--color-primary);
}

.about-text h3 {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  margin-bottom: var(--space-xs);
}

.about-text p {
  color: var(--color-text-secondary);
  line-height: 1.65;
  margin-bottom: var(--space-sm);
}

.about-text a {
  font-weight: 500;
}

#about .section-heading {
  margin-bottom: var(--space-xl);
}

/* ═══════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════ */
footer {
  padding: var(--space-xl) 0 var(--space-lg);
  border-top: 1px solid var(--color-border);
  text-align: center;
}

.footer-links {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
}

.footer-links a {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  text-decoration: none;
}
.footer-links a:hover { color: var(--color-primary); }

.footer-note {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
}

.footer-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  margin-top: var(--space-sm);
  padding: 0.3em 0.8em;
  border-radius: var(--radius);
  background: var(--color-surface-alt);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ═══════════════════════════════════════════
   SCROLL REVEAL
   ═══════════════════════════════════════════ */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
