/* ============================================
   aethoflo — design tokens
   ============================================ */

:root {
  /* Core palette — warm, editorial */
  --cream: #FAF5EF;
  --cream-soft: #F5EDE2;
  --cream-deep: #EFE3D2;
  --ink: #1A0F0A;
  --ink-soft: #2A1810;
  --ink-muted: #5A4A3E;
  --ink-fade: #8B7A6E;
  --rule: #E8DCC9;

  /* Accent — the signal */
  --orange: #E87A4E;
  --orange-bright: #FF8A5B;
  --orange-deep: #C85E35;
  --orange-glow: #FFB896;

  /* Dark mode — night sections */
  --night: #1A100B;
  --night-soft: #2A1810;
  --night-card: #33201A;
  --night-rule: #4A3226;

  /* Signal / tech accents */
  --signal: #FF7A3E;
  --signal-dim: rgba(232, 122, 78, 0.15);
  --signal-grid: rgba(232, 122, 78, 0.08);
  --grid: rgba(90, 74, 62, 0.08);
  --grid-dark: rgba(255, 184, 150, 0.06);

  /* Type */
  --serif: 'Source Serif 4', 'Source Serif Pro', 'Iowan Old Style', Georgia, serif;
  --sans: 'Inter Tight', 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', ui-monospace, monospace;

  /* Space */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 96px;
  --s-10: 128px;
  --s-11: 160px;

  /* Radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-pill: 999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(26, 15, 10, 0.04), 0 1px 3px rgba(26, 15, 10, 0.06);
  --shadow-md: 0 4px 12px rgba(26, 15, 10, 0.06), 0 2px 4px rgba(26, 15, 10, 0.04);
  --shadow-lg: 0 24px 48px -12px rgba(26, 15, 10, 0.12), 0 8px 16px -4px rgba(26, 15, 10, 0.06);
  --shadow-glow: 0 0 40px rgba(232, 122, 78, 0.25);

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-signal: cubic-bezier(0.45, 0, 0.15, 1);

  /* Layout */
  --page-max: 1280px;
  --page-pad: clamp(24px, 5vw, 80px);
  --content-max: 1120px;
}

/* ============================================
   Reset + base
   ============================================ */

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--cream);
  overflow-x: hidden;
  font-feature-settings: 'ss01', 'cv11';
}

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

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

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

input, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* ============================================
   Type system
   ============================================ */

.display {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.02em;
  font-size: clamp(48px, 7vw, 104px);
  color: var(--ink);
  text-wrap: balance;
}

.display .italic {
  font-style: italic;
  color: var(--orange);
}

.h1 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.015em;
  font-size: clamp(36px, 4.5vw, 60px);
  text-wrap: balance;
}

.h2 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.01em;
  font-size: clamp(24px, 2.2vw, 32px);
  text-wrap: balance;
}

.h3 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 17px;
  line-height: 1.35;
  letter-spacing: -0.005em;
}

.lead {
  font-size: clamp(17px, 1.3vw, 19px);
  line-height: 1.6;
  color: var(--ink-muted);
  text-wrap: pretty;
  max-width: 56ch;
}

.body {
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--ink-muted);
  text-wrap: pretty;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--orange);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 8px var(--orange);
  animation: pulse-dot 2.4s var(--ease-in-out) infinite;
}

.mono {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--ink-fade);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

/* ============================================
   Layout
   ============================================ */

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

.container {
  max-width: var(--page-max);
  margin: 0 auto;
  padding-left: var(--page-pad);
  padding-right: var(--page-pad);
  width: 100%;
}

.container-narrow {
  max-width: var(--content-max);
  margin: 0 auto;
  padding-left: var(--page-pad);
  padding-right: var(--page-pad);
  width: 100%;
}

section {
  position: relative;
  padding: var(--s-10) 0;
}

section.tight { padding: var(--s-8) 0; }

.section-dark {
  background: var(--night);
  color: var(--cream);
}

.section-dark .h1,
.section-dark .h2,
.section-dark .display { color: var(--cream); }

.section-dark .body,
.section-dark .lead { color: rgba(250, 245, 239, 0.72); }

.section-dark .mono { color: rgba(250, 245, 239, 0.5); }

.section-dark .eyebrow { color: var(--orange-glow); }

/* ============================================
   Buttons
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 26px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--r-pill);
  transition: transform 240ms var(--ease-out), background 200ms, color 200ms, box-shadow 200ms;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.btn-primary {
  background: var(--orange);
  color: white;
  box-shadow: 0 2px 8px rgba(232, 122, 78, 0.25);
}

.btn-primary:hover {
  background: var(--orange-deep);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(232, 122, 78, 0.35);
}

.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%),
    rgba(255, 255, 255, 0.2), transparent 60%);
  opacity: 0;
  transition: opacity 300ms;
  pointer-events: none;
}

.btn-primary:hover::after { opacity: 1; }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink-soft);
}

.btn-ghost:hover {
  background: var(--ink);
  color: var(--cream);
  transform: translateY(-1px);
}

.section-dark .btn-ghost {
  color: var(--cream);
  border-color: rgba(250, 245, 239, 0.3);
}

.section-dark .btn-ghost:hover {
  background: var(--cream);
  color: var(--ink);
}

.btn-sm {
  padding: 10px 18px;
  font-size: 13.5px;
}

.btn .arrow {
  display: inline-block;
  transition: transform 240ms var(--ease-out);
}

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

/* ============================================
   Cards
   ============================================ */

.card {
  background: white;
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: var(--s-6);
  transition: transform 300ms var(--ease-out), box-shadow 300ms, border-color 300ms;
  position: relative;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--orange-glow);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(400px circle at var(--mx, -100px) var(--my, -100px),
    rgba(232, 122, 78, 0.06), transparent 60%);
  opacity: 0;
  transition: opacity 400ms;
  pointer-events: none;
}

.card:hover::before { opacity: 1; }

.section-dark .card {
  background: var(--night-card);
  border-color: var(--night-rule);
}

.section-dark .card:hover {
  border-color: rgba(232, 122, 78, 0.4);
}

/* ============================================
   Ambient grid background
   ============================================ */

.ambient-grid {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.ambient-grid::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black 40%, transparent 85%);
}

.section-dark .ambient-grid::before {
  background-image:
    linear-gradient(to right, var(--grid-dark) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-dark) 1px, transparent 1px);
}

/* ============================================
   Scroll reveal
   ============================================ */

.reveal {
  opacity: 0;
  transform: translateY(24px);
}

.reveal.in {
  opacity: 1 !important;
  transform: translateY(0) !important;
  animation: reveal-in 800ms var(--ease-out) both;
}

@keyframes reveal-in {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0);   }
}

.reveal-stagger > * {
  opacity: 0;
  transform: translateY(20px);
}

.reveal-stagger.in > * {
  opacity: 1 !important;
  transform: translateY(0) !important;
  animation: reveal-in-small 700ms var(--ease-out) both;
}

@keyframes reveal-in-small {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0);   }
}

.reveal-stagger.in > *:nth-child(1) { animation-delay: 0ms; }
.reveal-stagger.in > *:nth-child(2) { animation-delay: 80ms; }
.reveal-stagger.in > *:nth-child(3) { animation-delay: 160ms; }
.reveal-stagger.in > *:nth-child(4) { animation-delay: 240ms; }
.reveal-stagger.in > *:nth-child(5) { animation-delay: 320ms; }
.reveal-stagger.in > *:nth-child(6) { animation-delay: 400ms; }

/* ============================================
   Motion preferences
   ============================================ */

[data-motion="subtle"] {
  --motion-scale: 0.4;
}

[data-motion="off"] * {
  animation: none !important;
  transition: none !important;
}

[data-motion="off"] .reveal,
[data-motion="off"] .reveal-stagger > * {
  opacity: 1 !important;
  transform: none !important;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .reveal, .reveal-stagger > * {
    opacity: 1 !important;
    transform: none !important;
  }
}
