/* Art direction: Homeowner movement manifesto → trustworthy, grounded, a little rebellious
   Palette: warm off-white + deep teal accent + terra/rust for dialogue emphasis
   Typography: Instrument Serif (display) + DM Sans (body) — trustworthy newspaper meets modern product
   Density: spacious (editorial/landing page feel) */

/* ========== TYPE SCALE ========== */
:root {
  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem  + 0.35vw, 1rem);
  --text-base: clamp(1rem,     0.95rem + 0.25vw, 1.125rem);
  --text-lg:   clamp(1.125rem, 1rem    + 0.75vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1.2rem  + 1.25vw, 2.25rem);
  --text-2xl:  clamp(2rem,     1.2rem  + 2.5vw,  3.5rem);
  --text-3xl:  clamp(2.5rem,   1rem    + 4vw,    5rem);
  --text-hero: clamp(3rem,     0.5rem  + 7vw,    8rem);

  /* ========== SPACING (4px base) ========== */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* ========== FONTS ========== */
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body: 'DM Sans', 'Helvetica Neue', sans-serif;

  /* ========== RADIUS ========== */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* ========== TRANSITIONS ========== */
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  /* ========== CONTENT WIDTHS ========== */
  --content-narrow: 720px;
  --content-default: 960px;
  --content-wide: 1200px;
  --content-full: 100%;
}

/* ========== LIGHT MODE (default) ========== */
:root, [data-theme="light"] {
  /* Surfaces */
  --color-bg:             #FAF9F6;
  --color-surface:        #F0EEEA;
  --color-surface-2:      #E8E6E1;
  --color-surface-offset: #F5F3EF;
  --color-divider:        #D8D5D0;
  --color-border:         #CBC8C2;

  /* Text */
  --color-text:           #1C1C1C;
  --color-text-muted:     #6B6B68;
  --color-text-faint:     #A3A19D;
  --color-text-inverse:   #FAF9F6;

  /* Primary accent — deep teal */
  --color-primary:        #1B6B6D;
  --color-primary-hover:  #155556;
  --color-primary-active: #0F3E3F;
  --color-primary-highlight: #D4E8E8;

  /* Secondary accent — terra/rust (dialogue boxes) */
  --color-terra:          #B85C38;
  --color-terra-hover:    #9E4D2E;
  --color-terra-active:   #7F3E24;
  --color-terra-light:    #F5E6DE;
  --color-terra-text:     #FDF5F0;

  /* Semantic */
  --color-success:        #437a22;
  --color-error:          #a13544;

  /* Shadows (warm-tinted) */
  --shadow-sm: 0 1px 2px oklch(0.2 0.01 80 / 0.06);
  --shadow-md: 0 4px 12px oklch(0.2 0.01 80 / 0.08);
  --shadow-lg: 0 12px 32px oklch(0.2 0.01 80 / 0.12);
}

/* ========== DARK MODE ========== */
[data-theme="dark"] {
  --color-bg:             #1A1A1A;
  --color-surface:        #242424;
  --color-surface-2:      #2C2C2C;
  --color-surface-offset: #202020;
  --color-divider:        #333333;
  --color-border:         #3D3D3D;

  --color-text:           #E8E6E1;
  --color-text-muted:     #9A9894;
  --color-text-faint:     #6B6966;
  --color-text-inverse:   #1A1A1A;

  --color-primary:        #3FA8AB;
  --color-primary-hover:  #2E8C8F;
  --color-primary-active: #1D7073;
  --color-primary-highlight: #2A3E3E;

  --color-terra:          #D4714E;
  --color-terra-hover:    #C16240;
  --color-terra-active:   #A85234;
  --color-terra-light:    #3D2A22;
  --color-terra-text:     #FDF5F0;

  --color-success:        #6daa45;
  --color-error:          #dd6974;

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.2);
  --shadow-md: 0 4px 12px oklch(0 0 0 / 0.3);
  --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.4);
}

/* System preference fallback */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg:             #1A1A1A;
    --color-surface:        #242424;
    --color-surface-2:      #2C2C2C;
    --color-surface-offset: #202020;
    --color-divider:        #333333;
    --color-border:         #3D3D3D;

    --color-text:           #E8E6E1;
    --color-text-muted:     #9A9894;
    --color-text-faint:     #6B6966;
    --color-text-inverse:   #1A1A1A;

    --color-primary:        #3FA8AB;
    --color-primary-hover:  #2E8C8F;
    --color-primary-active: #1D7073;
    --color-primary-highlight: #2A3E3E;

    --color-terra:          #D4714E;
    --color-terra-hover:    #C16240;
    --color-terra-active:   #A85234;
    --color-terra-light:    #3D2A22;
    --color-terra-text:     #FDF5F0;

    --color-success:        #6daa45;
    --color-error:          #dd6974;

    --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.2);
    --shadow-md: 0 4px 12px oklch(0 0 0 / 0.3);
    --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.4);
  }
}

/* ========== GLOBAL TYPOGRAPHY ========== */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); font-family: var(--font-body); font-weight: 600; }

p, li { font-size: var(--text-base); }

/* ========== SCROLL ANIMATIONS ========== */
.fade-in {
  opacity: 1;
}

@supports (animation-timeline: scroll()) {
  .fade-in {
    opacity: 0;
    animation: reveal-fade linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 100%;
  }
}

@keyframes reveal-fade {
  to { opacity: 1; }
}

/* ========== LAYOUT ========== */
.container {
  max-width: var(--content-default);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

.container--narrow {
  max-width: var(--content-narrow);
}

.section {
  padding-block: clamp(var(--space-8), 6vw, var(--space-24));
}

/* ========== HEADER ========== */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: oklch(from var(--color-bg) l c h / 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: var(--space-4);
  transition: box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.header--scrolled {
  box-shadow: var(--shadow-sm);
}

.header__inner {
  max-width: var(--content-wide);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header__logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: var(--color-text);
}

.header__logo-text {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 400;
}

.header__nav {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.theme-toggle {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  transition: color var(--transition-interactive),
              background var(--transition-interactive);
}

.theme-toggle:hover {
  color: var(--color-text);
  background: var(--color-surface);
}

/* ========== HERO ========== */
.hero {
  padding-block: clamp(var(--space-12), 10vw, var(--space-32));
  text-align: left;
}

.hero h1 {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-4);
  max-width: 18ch;
}

.hero__subhead {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
  max-width: 48ch;
}

.hero__body {
  margin-bottom: var(--space-8);
  max-width: 55ch;
}

.hero__body p {
  margin-bottom: var(--space-2);
}

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-md);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition-interactive),
              color var(--transition-interactive),
              box-shadow var(--transition-interactive),
              transform var(--transition-interactive);
}

.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-sm); }

.btn--primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}

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

.btn--secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

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

.btn--terra {
  background: var(--color-terra);
  color: var(--color-terra-text);
}

.btn--terra:hover {
  background: var(--color-terra-hover);
}

.hero__secondary {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-4);
}

/* ========== DIALOGUE BOXES (inner monologue / sticky notes) ========== */
.dialogue-box {
  background: var(--color-terra);
  color: var(--color-terra-text);
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-lg);
  transform: rotate(-1.5deg);
  box-shadow: var(--shadow-md);
  font-style: italic;
  position: relative;
  max-width: 380px;
}

.dialogue-box::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 24px;
  width: 20px;
  height: 20px;
  background: var(--color-terra);
  border-radius: var(--radius-sm);
  transform: rotate(45deg);
}

.dialogue-box__name {
  font-weight: 700;
  font-style: normal;
  margin-bottom: var(--space-1);
  font-size: var(--text-sm);
  opacity: 0.85;
}

.dialogue-box__body {
  font-size: var(--text-base);
  line-height: 1.5;
}

.dialogue-box__small {
  font-size: var(--text-xs);
  opacity: 0.75;
  margin-top: var(--space-2);
  font-style: normal;
}

/* ========== INNER VOICE (inline thought bubbles) ========== */
.inner-voice {
  background: var(--color-terra);
  color: var(--color-terra-text);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  transform: rotate(-1deg);
  box-shadow: var(--shadow-sm);
  font-style: italic;
  font-size: var(--text-sm);
  margin-top: var(--space-3);
  display: inline-block;
  max-width: 90%;
}

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

.problem__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
}

@media (min-width: 768px) {
  .problem__grid {
    grid-template-columns: 1fr;
    gap: var(--space-10);
    max-width: var(--content-narrow);
  }
}

.problem__bullets {
  list-style: none;
}

.problem__bullets li {
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--color-divider);
}

.problem__bullets li:last-child {
  border-bottom: none;
}

.problem__bullet-title {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--text-base);
  margin-bottom: var(--space-1);
}

.problem__closer {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-divider);
}

.problem__closer p {
  margin-bottom: var(--space-3);
}

.problem__closer .strong-line {
  font-weight: 600;
  font-size: var(--text-lg);
  font-family: var(--font-body);
}

.micro-cta {
  margin-top: var(--space-6);
}

/* ========== VISION SECTION ========== */
.vision {
  text-align: center;
}

.vision h2 {
  margin-bottom: var(--space-6);
}

.vision p {
  margin-inline: auto;
  margin-bottom: var(--space-4);
  max-width: 60ch;
}

.vision__mission {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-style: italic;
  margin-top: var(--space-6);
}

/* ========== LOOPS SECTION ========== */
.loops {
  background: var(--color-surface);
}

.loops__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
  margin-top: var(--space-8);
}

@media (min-width: 768px) {
  .loops__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.loop-card {
  background: var(--color-bg);
  border: 1px solid oklch(from var(--color-text) l c h / 0.08);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.loop-card h3 {
  margin-bottom: var(--space-3);
  color: var(--color-primary);
}

.loop-card p {
  color: var(--color-text-muted);
}

.loops__closer {
  text-align: center;
  margin-top: var(--space-8);
  font-style: italic;
  color: var(--color-text-muted);
}

/* ========== LIFE MOMENTS ========== */
.life-moments p {
  margin-bottom: var(--space-4);
  max-width: 60ch;
}

.life-moments__trigger {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-terra);
  margin-bottom: var(--space-4);
}

/* ========== COMMUNITY ========== */
.community {
  background: var(--color-surface);
}

.community__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  margin-top: var(--space-6);
}

@media (min-width: 768px) {
  .community__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.community-card {
  background: var(--color-bg);
  border: 1px solid oklch(from var(--color-text) l c h / 0.08);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.community-card h3 {
  margin-bottom: var(--space-2);
}

.community__disclaimer {
  margin-top: var(--space-6);
  font-style: italic;
  color: var(--color-text-muted);
}

/* ========== SIGNUP FORM ========== */
.signup {
  text-align: center;
}

.signup h2 {
  margin-bottom: var(--space-4);
}

.signup__intro {
  max-width: 55ch;
  margin-inline: auto;
  margin-bottom: var(--space-8);
  color: var(--color-text-muted);
}

.signup-form {
  max-width: 520px;
  margin-inline: auto;
  text-align: left;
  background: var(--color-surface);
  border: 1px solid oklch(from var(--color-text) l c h / 0.08);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
}

.signup-form h3 {
  text-align: center;
  margin-bottom: var(--space-6);
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 400;
}

.form-group {
  margin-bottom: var(--space-5);
}

.form-group label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  margin-bottom: var(--space-2);
  color: var(--color-text);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  transition: border-color var(--transition-interactive),
              box-shadow var(--transition-interactive);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-highlight);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--color-text-faint);
}

.form-submit {
  width: 100%;
  padding: var(--space-4);
  font-size: var(--text-base);
  font-weight: 600;
  margin-top: var(--space-4);
}

/* ========== POST-SUBMIT / FOUNDING HOME ========== */
.post-submit {
  display: none;
  text-align: center;
  max-width: 520px;
  margin-inline: auto;
  padding: var(--space-8);
  background: var(--color-surface);
  border: 1px solid oklch(from var(--color-text) l c h / 0.08);
  border-radius: var(--radius-xl);
  animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.post-submit.is-visible {
  display: block;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.post-submit h3 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  margin-bottom: var(--space-4);
}

.post-submit p {
  margin-bottom: var(--space-4);
  color: var(--color-text-muted);
  margin-inline: auto;
}

.founding-offer {
  background: var(--color-terra-light);
  border: 1px solid var(--color-terra);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-top: var(--space-6);
}

.founding-offer strong {
  color: var(--color-terra);
}

/* ========== FOOTER ========== */
.footer {
  padding: var(--space-8) var(--space-4);
  border-top: 1px solid var(--color-divider);
  text-align: center;
}

.footer__inner {
  max-width: var(--content-default);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

.footer__links {
  display: flex;
  gap: var(--space-6);
  list-style: none;
}

.footer__links a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: var(--text-sm);
  transition: color var(--transition-interactive);
}

.footer__links a:hover {
  color: var(--color-text);
}

.footer__attribution {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

.footer__attribution a {
  color: var(--color-text-faint);
  text-decoration: underline;
  transition: color var(--transition-interactive);
}

.footer__attribution a:hover {
  color: var(--color-text-muted);
}

/* ========== SKIP LINK ========== */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  z-index: 100;
  text-decoration: none;
  font-size: var(--text-sm);
}

.skip-link:focus {
  top: var(--space-2);
}

/* ========== MOBILE REFINEMENTS ========== */
@media (max-width: 767px) {
  .hero h1 {
    font-size: var(--text-2xl);
  }

  .problem__grid {
    display: flex;
    flex-direction: column-reverse;
  }

  .dialogue-box {
    max-width: 100%;
    transform: rotate(-0.75deg);
  }

  .inner-voice {
    max-width: 100%;
  }

  .signup-form {
    padding: var(--space-5);
  }

  .loops__grid {
    gap: var(--space-4);
  }

  .footer__links {
    flex-direction: column;
    gap: var(--space-3);
    align-items: center;
  }
}
