/* ==========================================================================
   Compound Reverie Grants - Styles
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties (Design Tokens)
   -------------------------------------------------------------------------- */
:root {
  /* Colors */
  --color-bg: #faf9f7;
  --color-bg-warm: #f8f6f3;
  --color-text: #1a1a1a;
  --color-text-muted: #4a4a4a;
  --color-text-light: #888888;
  --color-blue: #1a365d;
  --color-blue-hover: #234175;
  --color-border: #e5e5e5;
  --color-border-focus: #1a365d;
  --color-cream: #faf9f7;

  /* Typography */
  --font-serif: 'EB Garamond', Georgia, 'Times New Roman', serif;
  --font-mono: 'Inconsolata', 'Courier New', monospace;

  /* Font Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.5rem;
  --text-5xl: 3rem;
  /* Hero text - sized to fit title + subtitle on viewport */
  --text-hero: clamp(2.5rem, 6vw, 5rem);
  --text-hero-subtitle: clamp(1rem, 1.8vw, 1.35rem);

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;
  --space-section: clamp(6rem, 15vh, 10rem);

  /* Layout */
  --max-width-content: 720px;
  --max-width-form: 580px;
  --nav-height: 80px;

  /* Transitions */
  --ease-smooth: cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-out: cubic-bezier(0.0, 0.0, 0.2, 1);
  --duration-fast: 0.2s;
  --duration-normal: 0.4s;
  --duration-slow: 0.8s;
  --duration-slower: 1.2s;

  /* Z-index */
  --z-grain: 9999;
  --z-nav: 1000;
  --z-mobile-menu: 999;
  --z-floating: 10;
}

/* --------------------------------------------------------------------------
   Reset & Base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: 400;
  line-height: 1.75;
  color: var(--color-text);
  background-color: var(--color-bg);
  overflow-x: hidden;
}

/* Smooth scrolling handled by Lenis, but fallback */
html.no-js {
  scroll-behavior: smooth;
}

/* Selection */
::selection {
  background-color: var(--color-blue);
  color: var(--color-cream);
}

/* Focus styles */
:focus-visible {
  outline: 2px solid var(--color-blue);
  outline-offset: 2px;
}

/* Links */
a {
  color: inherit;
  text-decoration: none;
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Buttons reset */
button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* --------------------------------------------------------------------------
   Grain Canvas Overlay
   -------------------------------------------------------------------------- */
#grain-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: var(--z-grain);
  opacity: 0.04;
  mix-blend-mode: overlay;
}

/* --------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-xl);
  z-index: var(--z-nav);
  background: linear-gradient(
    to bottom,
    rgba(250, 249, 247, 0.95) 0%,
    rgba(250, 249, 247, 0) 100%
  );
  transition: opacity var(--duration-normal) var(--ease-smooth);
}

.nav__logo {
  display: flex;
  align-items: center;
  opacity: 0;
  transform: translateY(-10px);
}

.nav__logo-img {
  height: 72px;
  width: auto;
  max-width: 360px;
}

/* Fallback text logo if image fails */
.nav__logo-text {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.nav__links {
  display: flex;
  gap: var(--space-xl);
}

.nav__link {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--color-text-muted);
  position: relative;
  opacity: 0;
  transform: translateY(-10px);
  transition: color var(--duration-fast) var(--ease-smooth);
}

.nav__link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background-color: var(--color-text);
  transition: width var(--duration-normal) var(--ease-smooth);
}

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

.nav__link:hover::after {
  width: 100%;
}

/* Hamburger Menu Button */
.nav__hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  gap: 6px;
  z-index: calc(var(--z-mobile-menu) + 1);
}

.nav__hamburger-line {
  display: block;
  width: 24px;
  height: 1.5px;
  background-color: var(--color-text);
  transition:
    transform var(--duration-normal) var(--ease-smooth),
    opacity var(--duration-fast) var(--ease-smooth);
}

.nav__hamburger.is-active .nav__hamburger-line:nth-child(1) {
  transform: translateY(7.5px) rotate(45deg);
}

.nav__hamburger.is-active .nav__hamburger-line:nth-child(2) {
  opacity: 0;
}

.nav__hamburger.is-active .nav__hamburger-line:nth-child(3) {
  transform: translateY(-7.5px) rotate(-45deg);
}

/* --------------------------------------------------------------------------
   Mobile Menu
   -------------------------------------------------------------------------- */
.mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 320px;
  height: 100vh;
  background-color: var(--color-bg);
  z-index: var(--z-mobile-menu);
  transform: translateX(100%);
  transition: transform var(--duration-slow) var(--ease-smooth);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-3xl);
}

.mobile-menu.is-open {
  transform: translateX(0);
}

.mobile-menu__nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.mobile-menu__link {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  color: var(--color-text-muted);
  transition: color var(--duration-fast) var(--ease-smooth);
}

.mobile-menu__link:hover {
  color: var(--color-text);
}

/* Mobile menu backdrop */
.mobile-menu-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(26, 26, 26, 0.2);
  z-index: calc(var(--z-mobile-menu) - 1);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--duration-normal) var(--ease-smooth),
    visibility var(--duration-normal);
}

.mobile-menu-backdrop.is-visible {
  opacity: 1;
  visibility: visible;
}

/* --------------------------------------------------------------------------
   Hero Section
   -------------------------------------------------------------------------- */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: var(--nav-height) var(--space-xl) var(--space-2xl);
  overflow: hidden;
}

.hero__image-container {
  position: relative;
  width: 100%;
  max-width: 320px;
  margin-bottom: var(--space-xl);
  opacity: 0;
  transform: scale(0.95);
}

.hero__image {
  width: 100%;
  height: auto;
  animation: heroBreathing 8s ease-in-out infinite;
}

@keyframes heroBreathing {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
}

.hero__image-vignette {
  position: absolute;
  inset: -20%;
  background: radial-gradient(
    ellipse at center,
    transparent 40%,
    var(--color-bg) 70%
  );
  pointer-events: none;
}

.hero__content {
  text-align: center;
  max-width: 90vw;
  width: 100%;
  padding: 0 var(--space-xl);
}

.hero__title {
  font-family: var(--font-serif);
  font-size: var(--text-hero);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-lg);
  /* BLUE title */
  color: var(--color-blue);
  opacity: 0;
  transform: translateY(30px);
}

.hero__ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  opacity: 0;
}

.hero__ornament-line {
  width: 60px;
  height: 1px;
  background-color: var(--color-blue);
  opacity: 0.4;
}

.hero__ornament-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--color-blue);
  opacity: 0.6;
}

.hero__subtitle {
  font-family: var(--font-serif);
  font-size: var(--text-hero-subtitle);
  font-weight: 400;
  line-height: 1.6;
  color: var(--color-text-muted);
  max-width: 520px;
  margin-left: auto;
  margin-right: 5%;
  text-align: right;
  opacity: 0;
  transform: translateY(20px);
}

/* Background Decorative Circles */
.hero__decoration {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.hero__decoration-circle {
  position: absolute;
  border: 1px solid var(--color-blue);
  border-radius: 50%;
  opacity: 0.06;
}

.hero__decoration-circle--1 {
  width: 800px;
  height: 800px;
  top: -200px;
  left: -300px;
  animation: circleFloat 25s ease-in-out infinite, circlePulse 8s ease-in-out infinite;
}

.hero__decoration-circle--2 {
  width: 600px;
  height: 600px;
  bottom: -150px;
  right: -200px;
  animation: circleFloat 30s ease-in-out infinite reverse, circlePulse 10s ease-in-out infinite;
  animation-delay: -2s, -3s;
}

.hero__decoration-circle--3 {
  width: 400px;
  height: 400px;
  top: 30%;
  right: 10%;
  animation: circleFloat 20s ease-in-out infinite, circlePulse 6s ease-in-out infinite;
  animation-delay: -5s, -1s;
}

@keyframes circleFloat {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  25% {
    transform: translate(20px, -30px) scale(1.02);
  }
  50% {
    transform: translate(-10px, 20px) scale(0.98);
  }
  75% {
    transform: translate(-25px, -10px) scale(1.01);
  }
}

@keyframes circlePulse {
  0%, 100% {
    opacity: 0.04;
  }
  50% {
    opacity: 0.08;
  }
}

/* Animated ornament line */
.hero__ornament-line {
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-blue), transparent);
  opacity: 0.4;
  animation: ornamentShimmer 4s ease-in-out infinite;
}

@keyframes ornamentShimmer {
  0%, 100% {
    width: 60px;
    opacity: 0.4;
  }
  50% {
    width: 80px;
    opacity: 0.6;
  }
}

.hero__ornament-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--color-blue);
  opacity: 0.6;
  animation: dotPulse 3s ease-in-out infinite;
}

@keyframes dotPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.9;
  }
}

/* Decorative Lines */
.hero__decoration-line {
  position: absolute;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-blue), transparent);
  opacity: 0.08;
}

.hero__decoration-line--1 {
  width: 300px;
  top: 15%;
  left: 5%;
  transform: rotate(-15deg);
  animation: lineFloat 15s ease-in-out infinite;
}

.hero__decoration-line--2 {
  width: 200px;
  bottom: 20%;
  right: 10%;
  transform: rotate(25deg);
  animation: lineFloat 18s ease-in-out infinite reverse;
  animation-delay: -5s;
}

@keyframes lineFloat {
  0%, 100% {
    transform: rotate(-15deg) translateX(0);
    opacity: 0.08;
  }
  50% {
    transform: rotate(-15deg) translateX(30px);
    opacity: 0.12;
  }
}

/* Decorative Diamond */
.hero__decoration-diamond {
  position: absolute;
  width: 20px;
  height: 20px;
  top: 25%;
  right: 25%;
  border: 1px solid var(--color-blue);
  transform: rotate(45deg);
  opacity: 0.1;
  animation: diamondPulse 5s ease-in-out infinite;
}

@keyframes diamondPulse {
  0%, 100% {
    transform: rotate(45deg) scale(1);
    opacity: 0.1;
  }
  50% {
    transform: rotate(45deg) scale(1.3);
    opacity: 0.15;
  }
}

/* Golden Ratio Spirals */
.golden-spiral {
  position: absolute;
  color: var(--color-blue);
  opacity: 0.06;
  pointer-events: none;
}

.golden-spiral--1 {
  width: 400px;
  height: 400px;
  top: 5%;
  right: 5%;
  animation: spiralFloat 40s ease-in-out infinite, spiralPulse 12s ease-in-out infinite;
}

.golden-spiral--2 {
  width: 300px;
  height: 300px;
  bottom: 10%;
  left: 8%;
  transform: rotate(180deg);
  animation: spiralFloat 35s ease-in-out infinite reverse, spiralPulse 15s ease-in-out infinite;
  animation-delay: -10s, -5s;
}

@keyframes spiralFloat {
  0%, 100% {
    transform: rotate(0deg) translate(0, 0);
  }
  25% {
    transform: rotate(15deg) translate(10px, -20px);
  }
  50% {
    transform: rotate(-5deg) translate(-15px, 10px);
  }
  75% {
    transform: rotate(10deg) translate(5px, 15px);
  }
}

.golden-spiral--2 {
  animation-name: spiralFloat2, spiralPulse;
}

@keyframes spiralFloat2 {
  0%, 100% {
    transform: rotate(180deg) translate(0, 0);
  }
  25% {
    transform: rotate(195deg) translate(-10px, 15px);
  }
  50% {
    transform: rotate(175deg) translate(20px, -10px);
  }
  75% {
    transform: rotate(190deg) translate(-5px, -20px);
  }
}

@keyframes spiralPulse {
  0%, 100% {
    opacity: 0.04;
  }
  50% {
    opacity: 0.08;
  }
}

/* Scroll Indicator */
.hero__scroll-indicator {
  position: absolute;
  bottom: var(--space-2xl);
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
}

.hero__scroll-line {
  display: block;
  width: 1px;
  height: 50px;
  background: linear-gradient(
    to bottom,
    var(--color-text-muted) 0%,
    transparent 100%
  );
  animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
  0%, 100% {
    opacity: 0.3;
    transform: scaleY(1);
  }
  50% {
    opacity: 0.7;
    transform: scaleY(1.2);
  }
}

/* --------------------------------------------------------------------------
   Walking Path Section (Transition between Hero and Content)
   -------------------------------------------------------------------------- */
.path-section {
  position: relative;
  height: 40vh;
  min-height: 250px;
  max-height: 400px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.walking-path {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: 200px;
  height: 100%;
  z-index: 1;
}

.walking-path__line {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  transition: stroke-dashoffset 0.1s linear;
}

.walking-path__dot {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.path-section.is-active .walking-path__dot {
  opacity: 1;
}

/* Path Decorations - floating images along the path */
.path-decoration {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
  z-index: 2;
}

.path-decoration.is-visible {
  opacity: 0.6;
  transform: translateY(0);
}

.path-decoration--1 {
  left: 8%;
  top: 20%;
  width: clamp(150px, 20vw, 280px);
}

.path-decoration--2 {
  right: 8%;
  top: 50%;
  width: clamp(150px, 22vw, 320px);
}

.path-decoration--3 {
  left: 50%;
  bottom: -10%;
  transform: translateX(-50%);
  width: clamp(100px, 15vw, 180px);
}

.path-decoration__img {
  width: 100%;
  height: auto;
  filter: grayscale(10%);
  border-radius: 8px;
}

.path-decoration__img--abstract {
  filter: grayscale(20%) opacity(0.6);
  animation: gentleSpin 60s linear infinite;
}

@keyframes gentleSpin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Second path section (to form) */
.path-section--to-form {
  height: 25vh;
  min-height: 150px;
  max-height: 250px;
}

.walking-path--short {
  height: 100%;
  width: 150px;
}

/* Mobile: hide path decorations */
@media (max-width: 1024px) {
  .path-decoration {
    display: none;
  }

  .path-section {
    height: 50vh;
    min-height: 300px;
  }

  .path-section--to-form {
    height: 20vh;
    min-height: 120px;
  }
}

/* --------------------------------------------------------------------------
   Content Section (Why Micro Grants)
   -------------------------------------------------------------------------- */
.content {
  position: relative;
  padding: var(--space-section) var(--space-xl);
  overflow: visible;
}

.content__container {
  max-width: var(--max-width-content);
  margin: 0 auto;
}

.content__heading {
  font-family: var(--font-serif);
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  color: var(--color-blue);
  margin-bottom: var(--space-4xl);
  opacity: 0;
  transform: translateY(30px);
}

.content__body {
  /* Container for paragraphs */
}

.content__paragraph {
  margin-bottom: 2.5em;
  opacity: 0;
  transform: translateY(20px);
}

.content__paragraph--lead {
  font-size: 1.1em;
}

/* Drop Cap - elegant first letter */
.content__paragraph--lead::first-letter {
  float: left;
  font-family: var(--font-serif);
  font-size: 4.5em;
  line-height: 0.8;
  font-weight: 500;
  color: var(--color-blue);
  padding-right: 0.1em;
  margin-top: 0.05em;
}

.content__paragraph:last-child {
  margin-bottom: 0;
}

.content__paragraph em {
  font-style: italic;
}

/* Content Links */
.content__link {
  color: var(--color-blue);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: opacity 0.3s var(--ease-smooth);
}

.content__link:hover {
  opacity: 0.7;
}

/* --------------------------------------------------------------------------
   Floating Images
   -------------------------------------------------------------------------- */
.floating-image {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  z-index: var(--z-floating);
  will-change: transform, opacity;
}

.floating-image--left {
  left: 2%;
  top: 5%;
  width: clamp(160px, 18vw, 280px);
  animation: floatDrift 20s ease-in-out infinite;
}

.floating-image--right {
  right: 2%;
  top: 18%;
  width: clamp(150px, 16vw, 260px);
  animation: floatDrift 25s ease-in-out infinite reverse;
}

.floating-image--left-mid {
  left: 3%;
  top: 33%;
  width: clamp(140px, 15vw, 240px);
  animation: floatDrift 22s ease-in-out infinite;
  animation-delay: -8s;
}

.floating-image--right-mid {
  right: 3%;
  top: 48%;
  width: clamp(150px, 16vw, 260px);
  animation: floatDrift 28s ease-in-out infinite reverse;
  animation-delay: -12s;
}

.floating-image--left-bottom {
  left: 2%;
  top: 65%;
  width: clamp(160px, 18vw, 280px);
  animation: floatDriftAlt 30s ease-in-out infinite;
  animation-delay: -15s;
}

.floating-image--right-bottom {
  right: 2%;
  top: 82%;
  width: clamp(140px, 15vw, 240px);
  animation: floatDriftAlt 26s ease-in-out infinite reverse;
  animation-delay: -5s;
}

@keyframes floatDrift {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
  }
  25% {
    transform: translate(10px, -15px) rotate(0.5deg);
  }
  50% {
    transform: translate(-5px, 10px) rotate(-0.5deg);
  }
  75% {
    transform: translate(-15px, -5px) rotate(0.3deg);
  }
}

@keyframes floatDriftAlt {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
  20% {
    transform: translate(15px, -20px) rotate(1deg) scale(1.02);
  }
  40% {
    transform: translate(-8px, 15px) rotate(-0.5deg) scale(0.98);
  }
  60% {
    transform: translate(-20px, -10px) rotate(0.8deg) scale(1.01);
  }
  80% {
    transform: translate(5px, 20px) rotate(-0.3deg) scale(0.99);
  }
}

.floating-image__img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(26, 54, 93, 0.15);
}

.floating-image__img--round {
  border-radius: 50%;
  box-shadow: 0 25px 80px rgba(26, 54, 93, 0.2);
}

/* --------------------------------------------------------------------------
   Form Section
   -------------------------------------------------------------------------- */
.form-section {
  padding: var(--space-section) var(--space-xl);
  padding-bottom: calc(var(--space-section) * 1.5);
}

.form-section__container {
  max-width: var(--max-width-form);
  margin: 0 auto;
}

.form-section__heading {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 500;
  line-height: 1.3;
  color: var(--color-blue);
  margin-bottom: var(--space-3xl);
  text-align: center;
  opacity: 0;
  transform: translateY(20px);
}

/* Form Styles */
.form {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.form__honeypot {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

.form__group {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  opacity: 0;
  transform: translateY(15px);
}

.form__label {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-cream);
  background-color: var(--color-blue);
  padding: var(--space-xs) var(--space-md);
  border-radius: 3px;
  width: fit-content;
}

.form__input,
.form__textarea,
.form__select {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  line-height: 1.6;
  color: var(--color-text);
  background-color: transparent;
  border: 1px solid var(--color-border);
  padding: var(--space-md) var(--space-lg);
  border-radius: 4px;
  transition:
    border-color var(--duration-fast) var(--ease-smooth),
    box-shadow var(--duration-fast) var(--ease-smooth);
}

.form__input::placeholder,
.form__textarea::placeholder {
  color: var(--color-text-light);
  font-style: italic;
}

.form__input:focus,
.form__textarea:focus,
.form__select:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.1);
}

.form__input.is-invalid,
.form__textarea.is-invalid,
.form__select.is-invalid {
  border-color: #c53030;
}

.form__textarea {
  min-height: 150px;
  resize: vertical;
}

/* Select dropdown styling */
.form__select {
  width: 100%;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231a365d' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-lg) center;
  padding-right: calc(var(--space-lg) * 2 + 12px);
}

.form__select option {
  background-color: var(--color-bg);
  color: var(--color-text);
  padding: var(--space-md);
}

.form__error {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: #c53030;
  min-height: 1.2em;
}

/* Submit Button */
.form__submit {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: 400;
  color: var(--color-cream);
  background-color: var(--color-blue);
  padding: var(--space-md) var(--space-2xl);
  border-radius: 4px;
  margin-top: var(--space-md);
  position: relative;
  overflow: hidden;
  transition:
    background-color var(--duration-fast) var(--ease-smooth),
    transform var(--duration-fast) var(--ease-smooth),
    box-shadow var(--duration-normal) var(--ease-smooth);
  opacity: 0;
  transform: translateY(15px);
}

.form__submit::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  transition: left 0.6s var(--ease-smooth);
}

.form__submit:hover {
  background-color: var(--color-blue-hover);
  transform: scale(0.98);
  box-shadow: 0 10px 40px rgba(26, 54, 93, 0.3);
}

.form__submit:hover::before {
  left: 100%;
}

.form__submit:active {
  transform: scale(0.96);
}

.form__submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.form__submit-text {
  transition: opacity var(--duration-fast);
}

.form__submit.is-loading .form__submit-text {
  opacity: 0;
}

.form__submit-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--duration-fast);
}

.form__submit.is-loading .form__submit-loading {
  opacity: 1;
}

.form__spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(250, 249, 247, 0.3);
  border-top-color: var(--color-cream);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --------------------------------------------------------------------------
   Form Success State
   -------------------------------------------------------------------------- */
.form-success {
  text-align: center;
  padding: var(--space-4xl) 0;
}

.form-success[hidden] {
  display: none;
}

.form-success__content {
  opacity: 0;
  transform: translateY(20px);
}

.form-success.is-visible .form-success__content {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity var(--duration-slow) var(--ease-smooth),
    transform var(--duration-slow) var(--ease-smooth);
}

.form-success__line {
  width: 40px;
  height: 1px;
  background-color: var(--color-text-muted);
  margin: 0 auto var(--space-xl);
}

.form-success__title {
  font-family: var(--font-serif);
  font-size: var(--text-3xl);
  font-weight: 400;
  margin-bottom: var(--space-md);
}

.form-success__message {
  font-size: var(--text-base);
  color: var(--color-text-muted);
}

/* --------------------------------------------------------------------------
   Quote Section
   -------------------------------------------------------------------------- */
.quote-section {
  padding: var(--space-section) var(--space-xl);
  padding-top: 0;
}

.quote {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
  position: relative;
}

.quote__marks {
  font-family: var(--font-serif);
  font-size: clamp(4rem, 10vw, 8rem);
  font-weight: 400;
  color: var(--color-blue);
  opacity: 0.15;
  line-height: 0.5;
  user-select: none;
}

.quote__marks--open {
  text-align: left;
  margin-bottom: -1rem;
}

.quote__marks--close {
  text-align: right;
  margin-top: -2rem;
}

.quote__text {
  font-family: var(--font-serif);
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 400;
  font-style: italic;
  line-height: 1.8;
  color: var(--color-text-muted);
  padding: 0 var(--space-2xl);
}

.quote__attribution {
  margin-top: var(--space-2xl);
  display: flex;
  justify-content: center;
}

.quote__line {
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-blue), transparent);
  opacity: 0.4;
}

.quote__author {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-style: normal;
  color: var(--color-text-muted);
  letter-spacing: 0.05em;
  margin-left: var(--space-md);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.footer {
  padding: var(--space-4xl) var(--space-xl) var(--space-3xl);
  text-align: center;
}

.footer__icon {
  width: 60px;
  height: 60px;
  margin: 0 auto var(--space-2xl);
  opacity: 0.4;
}

.footer__icon-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.footer__divider {
  width: 40px;
  height: 1px;
  background-color: var(--color-border);
  margin: 0 auto var(--space-xl);
}

.footer__copyright {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-light);
  letter-spacing: 0.05em;
}

/* --------------------------------------------------------------------------
   Responsive Design
   -------------------------------------------------------------------------- */

/* Tablet */
@media (max-width: 1199px) {
  :root {
    --nav-height: 70px;
  }

  .floating-image--left {
    width: 180px;
    left: 1%;
  }

  .floating-image--right {
    width: 160px;
    right: 1%;
  }

  .floating-image--left-mid,
  .floating-image--right-mid,
  .floating-image--left-bottom,
  .floating-image--right-bottom {
    width: 140px;
  }
}

/* Mobile */
@media (max-width: 767px) {
  :root {
    --nav-height: 60px;
    --space-section: 5rem;
  }

  body {
    font-size: var(--text-base);
  }

  .nav__links {
    display: none;
  }

  .nav__hamburger {
    display: flex;
  }

  .hero {
    padding: var(--nav-height) var(--space-lg) var(--space-2xl);
  }

  .hero__image-container {
    max-width: 300px;
    margin-bottom: var(--space-2xl);
  }

  .hero__title {
    font-size: clamp(1.75rem, 8vw, 2.5rem);
    letter-spacing: -0.02em;
  }

  .hero__subtitle {
    font-size: var(--text-base);
    max-width: 100%;
    text-align: center;
    margin-left: auto;
    margin-right: auto;
  }

  .hero__subtitle br {
    display: none;
  }

  .content {
    padding: var(--space-section) var(--space-lg);
  }

  .content__heading {
    font-size: var(--text-2xl);
  }

  /* Show floating images behind text on mobile - very faded */
  .content {
    position: relative;
  }

  .content__container {
    position: relative;
    z-index: 2;
  }

  .floating-image {
    position: absolute;
    z-index: 1;
    opacity: 0.12;
    pointer-events: none;
    animation: none;
  }

  /* Only show select images on mobile, positioned as background decoration */
  .floating-image--left {
    left: 50%;
    top: 5%;
    transform: translateX(-50%);
    width: 200px;
  }

  .floating-image--right {
    right: 10%;
    top: 25%;
    width: 150px;
  }

  .floating-image--left-mid {
    display: none;
  }

  .floating-image--right-mid {
    left: 5%;
    right: auto;
    top: 45%;
    width: 120px;
  }

  .floating-image--left-bottom {
    left: 50%;
    transform: translateX(-50%);
    top: 65%;
    width: 180px;
  }

  .floating-image--right-bottom {
    display: none;
  }

  .form-section {
    padding: var(--space-section) var(--space-lg);
  }

  .form-section__heading {
    font-size: var(--text-2xl);
  }

  .form__input,
  .form__textarea {
    padding: var(--space-md);
  }

  .form__submit {
    width: 100%;
  }
}

/* Small mobile */
@media (max-width: 374px) {
  .hero__title {
    font-size: 1.5rem;
  }
}

/* --------------------------------------------------------------------------
   Reduced Motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }

  #grain-canvas {
    display: none;
  }

  .hero__image {
    animation: none;
  }

  .floating-image {
    animation: none;
  }
}

/* --------------------------------------------------------------------------
   Print Styles
   -------------------------------------------------------------------------- */
@media print {
  #grain-canvas,
  .nav,
  .hero__scroll-indicator,
  .floating-image {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  .hero {
    min-height: auto;
    padding: 2rem;
  }

  .content,
  .form-section {
    padding: 2rem;
  }
}
