:root {
  --bg: #f3f7ed;
  --bg-soft: #ffffff;
  --text: #16221f;
  --muted: #65736c;
  --primary: #24745d;
  --primary-dark: #165244;
  --accent: #d9953f;
  --card: rgba(255, 255, 255, 0.78);
  --border: rgba(22, 34, 31, 0.12);
  --shadow: 0 24px 70px rgba(31, 69, 57, 0.16);
}

body.night {
  --bg: #07171f;
  --bg-soft: #102936;
  --text: #ecfff8;
  --muted: #a5bdb6;
  --primary: #7de0c2;
  --primary-dark: #b9f5e3;
  --accent: #ffd37a;
  --card: rgba(16, 41, 54, 0.82);
  --border: rgba(236, 255, 248, 0.14);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 10%, rgba(125, 224, 194, 0.18), transparent 28rem),
    radial-gradient(circle at 88% 18%, rgba(217, 149, 63, 0.18), transparent 25rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: background 0.35s ease, color 0.35s ease;
}

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

.ambient {
  position: fixed;
  z-index: -1;
  width: 22rem;
  height: 22rem;
  border-radius: 999px;
  filter: blur(24px);
  opacity: 0.32;
  pointer-events: none;
}

.ambient-one {
  top: 8rem;
  left: -8rem;
  background: #8de8c8;
}

.ambient-two {
  right: -9rem;
  bottom: 4rem;
  background: #e7b86a;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  justify-content: space-between;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  backdrop-filter: blur(18px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand img {
  display: block;
}

.nav {
  display: flex;
  gap: 0.4rem;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-soft) 70%, transparent);
}

.nav a {
  padding: 0.62rem 0.9rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.95rem;
}

.nav a:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
}

.theme-toggle,
.button,
.note {
  font: inherit;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.48rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.62rem 0.9rem;
  color: var(--text);
  background: var(--card);
  cursor: pointer;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
  padding: clamp(4rem, 9vw, 7.5rem) clamp(1rem, 5vw, 5rem) 3rem;
}

.hero__content {
  max-width: 720px;
}

.eyebrow {
  margin: 0 0 0.9rem;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(3rem, 7vw, 6.8rem);
  line-height: 0.93;
  letter-spacing: -0.075em;
}

.hero__lead {
  max-width: 58rem;
  margin: 1.4rem 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  line-height: 1.75;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 2rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.8rem 1.15rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-weight: 800;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 16px 36px rgba(36, 116, 93, 0.25);
}

.button-secondary {
  background: var(--card);
  color: var(--text);
}

.hero__art {
  filter: drop-shadow(var(--shadow));
}

.hero__art svg {
  display: block;
  width: 100%;
  height: auto;
}

.stars circle {
  fill: #fff8c7;
  opacity: 0.78;
  animation: twinkle 3.6s ease-in-out infinite;
}

.stars circle:nth-child(2n) {
  animation-delay: 1.2s;
}

.fireflies circle {
  fill: #fff08a;
  filter: drop-shadow(0 0 12px #fff08a);
  animation: float 4.8s ease-in-out infinite;
}

.fireflies circle:nth-child(2n) {
  animation-delay: 1.4s;
}

.section {
  padding: clamp(3rem, 8vw, 6rem) clamp(1rem, 5vw, 5rem);
}

.section__intro {
  max-width: 760px;
  margin-bottom: 2rem;
}

.section__intro h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1;
  letter-spacing: -0.055em;
}

.section__intro p {
  color: var(--muted);
  line-height: 1.75;
  font-size: 1.05rem;
}

.story-grid,
.glyph-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.story-card,
.note-panel,
.glyph-card {
  border: 1px solid var(--border);
  border-radius: 1.6rem;
  background: var(--card);
  box-shadow: var(--shadow);
}

.story-card {
  padding: 1.4rem;
}

.story-card__icon {
  display: grid;
  width: 3rem;
  height: 3rem;
  place-items: center;
  margin-bottom: 1rem;
  border-radius: 1rem;
  color: var(--primary-dark);
  background: color-mix(in srgb, var(--primary) 18%, transparent);
  font-size: 1.35rem;
  font-weight: 900;
}

.story-card h3 {
  margin: 0;
  font-size: 1.35rem;
}

.story-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.notes {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 1rem;
  align-items: end;
}

.notes .section__intro {
  grid-column: 1 / -1;
}

.note-list {
  display: grid;
  gap: 0.75rem;
}

.note {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  color: var(--text);
  background: var(--card);
  cursor: pointer;
  text-align: left;
}

.note span {
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 999px;
  color: var(--primary-dark);
  background: color-mix(in srgb, var(--primary) 18%, transparent);
  font-weight: 900;
}

.note.is-active {
  outline: 2px solid color-mix(in srgb, var(--primary) 50%, transparent);
}

.note-panel {
  min-height: 220px;
  padding: clamp(1.4rem, 4vw, 2.25rem);
}

.note-panel h3 {
  margin: 0 0 0.8rem;
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  letter-spacing: -0.04em;
}

.note-panel p {
  color: var(--muted);
  line-height: 1.8;
  font-size: 1.08rem;
}

.glyph-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.glyph-card {
  display: grid;
  gap: 0.75rem;
  place-items: center;
  padding: 1.25rem;
  text-align: center;
  color: var(--muted);
  font-weight: 800;
}

.glyph-card svg {
  width: min(8rem, 60%);
  fill: color-mix(in srgb, var(--primary) 72%, var(--accent));
}

.glyph-card .line {
  fill: none;
  stroke: var(--bg-soft);
  stroke-width: 5;
  stroke-linecap: round;
}

.glyph-card .cut {
  fill: var(--bg-soft);
}

.footer {
  padding: 2rem clamp(1rem, 5vw, 5rem) 3rem;
  color: var(--muted);
  text-align: center;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.35; transform: scale(0.92); }
  50% { opacity: 1; transform: scale(1.1); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); opacity: 0.7; }
  50% { transform: translateY(-10px); opacity: 1; }
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero__art {
    max-width: 680px;
    margin: 0 auto;
  }

  .notes {
    grid-template-columns: 1fr;
  }

  .glyph-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .site-header {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .brand {
    flex: 1 1 auto;
  }

  .theme-toggle {
    flex: 0 0 auto;
  }

  .nav {
    order: 3;
    width: 100%;
    justify-content: space-between;
    overflow-x: auto;
  }

  .hero {
    padding-top: 3rem;
  }

  .story-grid,
  .glyph-grid {
    grid-template-columns: 1fr;
  }

  .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
