/* ============================================================
   My Cows — pastoral storybook landing
   Light = high noon in the meadow · Dark = dusk pasture
   ============================================================ */

:root {
  /* sky + light */
  --sky-top: #aedcf0;
  --sky-bottom: #e9f6fb;
  --sun: #ffd763;
  --sun-halo: rgba(255, 224, 130, 0.45);
  --moon: #f4ecd7;
  --moon-crater: #ded1b2;
  --cloud: #ffffff;

  /* meadow */
  --hill-far: #a8d68a;
  --hill-mid: #7fbf68;
  --hill-near: #5da34e;
  --tree: #4c9346;
  --trunk: #8a6142;
  --fence: #a97e55;
  --fence-post: #8a6142;
  --grass-tuft: #3f7c38;
  --flower-a: #ffffff;
  --flower-b: #f7b6c8;
  --flower-heart: #f5c542;

  /* paper + ink */
  --paper: #fdf8ec;
  --paper-alt: #f6eeda;
  --ink: #3c3527;
  --ink-soft: #6b6250;
  --accent: #b9573f;        /* barn red */
  --accent-soft: #d8926f;

  /* cows */
  --cow-hide: #fdf6e3;
  --cow-spot: #4a443c;
  --cow2-hide: #e8c39a;     /* a jersey brown cow */
  --cow2-spot: #c68f5e;
  --cow-ear: #e8b08c;
  --cow-muzzle: #f2b8a0;
  --cow-nostril: #b97a5e;
  --cow-horn: #e9ddbf;
  --cow-udder: #f3b8ad;

  /* buildings */
  --church-wall: #fbf4e4;
  --church-roof: #b9573f;
  --church-door: #7c5236;
  --church-window: #f5c542;
  --hospital-wall: #f3ece0;
  --hospital-window: #a9d3e6;
  --hospital-cross-bg: #d66653;
  --grave: #9aa3a8;
  --grave-mark: #f0f2ef;

  --firefly: #ffe27a;

  --card-shadow: 0 6px 0 rgba(60, 53, 39, 0.08);
  --radius: 22px;
}

/* -------- dusk pasture -------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --sky-top: #232551;
    --sky-bottom: #5b4577;
    --cloud: #6f5f92;

    --hill-far: #3c5d55;
    --hill-mid: #2e4b40;
    --hill-near: #22392f;
    --tree: #2c4a3b;
    --trunk: #5d4433;
    --fence: #6e5138;
    --fence-post: #55402d;
    --grass-tuft: #35543f;
    --flower-a: #d8d3e8;
    --flower-b: #b98aa8;
    --flower-heart: #e0b64f;

    --paper: #201f2e;
    --paper-alt: #282639;
    --ink: #ece4d2;
    --ink-soft: #b0a894;
    --accent: #e78a68;
    --accent-soft: #b96a4d;

    --cow-hide: #e9e0ca;
    --cow-spot: #3b362f;
    --cow2-hide: #c7a37f;
    --cow2-spot: #a3764d;
    --cow-ear: #c79378;
    --cow-muzzle: #d59c88;
    --cow-nostril: #96604a;
    --cow-horn: #cbc0a4;
    --cow-udder: #cc978d;

    --church-wall: #d9d2c0;
    --church-roof: #a04f3c;
    --church-door: #5f3f2a;
    --church-window: #f0c968;
    --hospital-wall: #cfc8ba;
    --hospital-window: #7f9fb5;
    --hospital-cross-bg: #bf5a49;
    --grave: #7b848c;
    --grave-mark: #d7dcd8;

    --card-shadow: 0 6px 0 rgba(0, 0, 0, 0.25);
  }
}
:root[data-theme="dark"] {
  --sky-top: #232551;
  --sky-bottom: #5b4577;
  --cloud: #6f5f92;

  --hill-far: #3c5d55;
  --hill-mid: #2e4b40;
  --hill-near: #22392f;
  --tree: #2c4a3b;
  --trunk: #5d4433;
  --fence: #6e5138;
  --fence-post: #55402d;
  --grass-tuft: #35543f;
  --flower-a: #d8d3e8;
  --flower-b: #b98aa8;
  --flower-heart: #e0b64f;

  --paper: #201f2e;
  --paper-alt: #282639;
  --ink: #ece4d2;
  --ink-soft: #b0a894;
  --accent: #e78a68;
  --accent-soft: #b96a4d;

  --cow-hide: #e9e0ca;
  --cow-spot: #3b362f;
  --cow2-hide: #c7a37f;
  --cow2-spot: #a3764d;
  --cow-ear: #c79378;
  --cow-muzzle: #d59c88;
  --cow-nostril: #96604a;
  --cow-horn: #cbc0a4;
  --cow-udder: #cc978d;

  --church-wall: #d9d2c0;
  --church-roof: #a04f3c;
  --church-door: #5f3f2a;
  --church-window: #f0c968;
  --hospital-wall: #cfc8ba;
  --hospital-window: #7f9fb5;
  --hospital-cross-bg: #bf5a49;
  --grave: #7b848c;
  --grave-mark: #d7dcd8;

  --card-shadow: 0 6px 0 rgba(0, 0, 0, 0.25);
}

/* ============ base ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: "Nunito", "Avenir Next", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.65;
  overflow-x: hidden;
  transition: background-color 0.5s ease, color 0.5s ease;
}

h1, h2, h3, .wordmark {
  font-family: "Chewy", "Comic Sans MS", "Marker Felt", cursive;
  font-weight: 400;
  letter-spacing: 0.015em;
  line-height: 1.15;
}

a { color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { text-decoration-style: wavy; }

/* ============ header ============ */
.site-header {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem clamp(1.2rem, 4vw, 2.6rem);
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1.45rem;
  color: var(--ink);
}
.wordmark-cow { width: 2.1rem; height: 2.1rem; }

.theme-toggle {
  border: 2.5px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  border-radius: 999px;
  width: 3.6rem;
  height: 2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-around;
  font-size: 0.95rem;
  line-height: 1;
  box-shadow: 0 3px 0 rgba(60, 53, 39, 0.15);
  transition: transform 0.15s ease;
}
.theme-toggle:hover { transform: translateY(-1px); }
.theme-toggle:active { transform: translateY(1px); box-shadow: none; }

/* ============ hero ============ */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bottom) 78%, var(--hill-near) 100%);
  overflow: hidden;
  transition: background 0.5s ease;
}

.hero-copy {
  position: relative;
  z-index: 5;
  text-align: center;
  padding: clamp(5.5rem, 12vh, 8rem) 1.4rem 0;
  max-width: 46rem;
  margin: 0 auto;
}

.hero-kicker {
  font-weight: 800;
  text-transform: lowercase;
  letter-spacing: 0.12em;
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin-bottom: 0.4rem;
}

.hero h1 {
  font-size: clamp(3.6rem, 11vw, 6.8rem);
  color: var(--ink);
  text-shadow: 0 4px 0 rgba(60, 53, 39, 0.12);
  margin-bottom: 0.6rem;
}

.hero-sub {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  font-weight: 600;
  max-width: 38rem;
  margin: 0 auto 0.9rem;
}

.hero-note {
  font-style: italic;
  color: var(--ink-soft);
  font-size: 0.98rem;
}

/* the scene sits at the bottom of the hero */
.scene {
  width: 100%;
  height: clamp(300px, 52vh, 620px);
  margin-top: auto;
  display: block;
}

.hill-far  { fill: var(--hill-far); }
.hill-mid  { fill: var(--hill-mid); }
.hill-near { fill: var(--hill-near); }

/* sun/moon + stars swap */
.moon { opacity: 0; }
.sun  { opacity: 1; }
.stars { opacity: 0; }
.stars circle { fill: #ffe9a8; }
.fireflies { opacity: 0; }
.ff { fill: var(--firefly); }

.celestial .sun, .celestial .moon, .stars, .fireflies {
  transition: opacity 0.8s ease;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sun { opacity: 0; }
  :root:not([data-theme="light"]) .moon { opacity: 1; }
  :root:not([data-theme="light"]) .stars { opacity: 1; }
  :root:not([data-theme="light"]) .fireflies { opacity: 1; }
}
:root[data-theme="dark"] .sun { opacity: 0; }
:root[data-theme="dark"] .moon { opacity: 1; }
:root[data-theme="dark"] .stars { opacity: 1; }
:root[data-theme="dark"] .fireflies { opacity: 1; }

/* ============ animations ============ */

/* clouds drift gently and loop */
.cloud { will-change: transform; }
.cloud-1 { animation: drift 85s linear infinite; }
.cloud-2 { animation: drift 65s linear infinite; animation-delay: -22s; }
.cloud-3 { animation: drift 105s linear infinite; animation-delay: -48s; }

@keyframes drift {
  from { transform: translateX(-420px); }
  to   { transform: translateX(1560px); }
}

/* cows breathe (CSS transform overrides the SVG attribute transform,
   so each keyframe restates the full placement transform) */
.cow-hero { animation: breathe-hero 4.2s ease-in-out infinite; }
.cow-calf { animation: breathe-calf 3.1s ease-in-out infinite 0.8s; }
@keyframes breathe-hero {
  0%, 100% { transform: translate(280px, 452px); }
  50%      { transform: translate(280px, 449px); }
}
@keyframes breathe-calf {
  0%, 100% { transform: translate(420px, 330px) scale(0.45); }
  50%      { transform: translate(420px, 328px) scale(0.45); }
}

/* grazing head bobs down to the grass and back */
.head-graze {
  transform-origin: 30px -10px;
  animation: graze 7s ease-in-out infinite;
}
@keyframes graze {
  0%, 18%       { transform: translate(26px, 66px) rotate(0deg); }
  30%, 55%      { transform: translate(26px, 82px) rotate(14deg); }
  68%, 100%     { transform: translate(26px, 66px) rotate(0deg); }
}

/* tails swish */
.tail-swish {
  transform-origin: 188px 52px;
  animation: swish 5.5s ease-in-out infinite;
}
@keyframes swish {
  0%, 70%, 100% { transform: rotate(0deg); }
  78%           { transform: rotate(14deg); }
  86%           { transform: rotate(-6deg); }
  92%           { transform: rotate(8deg); }
}

/* blink now and then */
.eye { animation: blink 6s infinite; transform-origin: center; transform-box: fill-box; }
@keyframes blink {
  0%, 92%, 100% { transform: scaleY(1); }
  95%, 97%      { transform: scaleY(0.08); }
}

/* fireflies wander and pulse */
.ff-1 { animation: firefly 7s ease-in-out infinite; }
.ff-2 { animation: firefly 9s ease-in-out infinite 1.4s; }
.ff-3 { animation: firefly 8s ease-in-out infinite 3s; }
.ff-4 { animation: firefly 10s ease-in-out infinite 2s; }
@keyframes firefly {
  0%, 100% { opacity: 0.1; transform: translate(0, 0); }
  25%      { opacity: 1;   transform: translate(14px, -16px); }
  50%      { opacity: 0.25; transform: translate(30px, -4px); }
  75%      { opacity: 1;   transform: translate(12px, 12px); }
}

@media (prefers-reduced-motion: reduce) {
  .cloud, .cow-hero, .cow-calf, .head-graze, .tail-swish, .eye, .ff {
    animation: none !important;
  }
}

/* ============ sections ============ */
.section { padding: clamp(3rem, 7vw, 5.5rem) 1.4rem; }
.section-inner { max-width: 62rem; margin: 0 auto; }

.section h2 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 1.2rem;
  color: var(--ink);
}

.section-lede {
  font-size: 1.12rem;
  color: var(--ink-soft);
  font-weight: 600;
  margin: -0.6rem 0 2rem;
}

/* story */
.story { background: var(--paper); }
.story-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  font-size: 1.08rem;
}
.story-cols em { font-style: italic; font-weight: 700; }

/* wave dividers */
.divider { line-height: 0; background: var(--paper); }
.divider svg { width: 100%; height: 44px; display: block; }
.divider-flip { background: var(--paper-alt); }
.divider-flip svg { transform: rotate(180deg); }
.divider-flip svg path { fill: var(--paper); }

/* rules */
.rules { background: var(--paper-alt); }

.rule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.4rem;
}

.rule-card {
  background: var(--paper);
  border: 2.5px solid color-mix(in srgb, var(--ink) 14%, transparent);
  border-radius: var(--radius);
  padding: 1.6rem 1.4rem 1.4rem;
  box-shadow: var(--card-shadow);
  text-align: center;
  transition: transform 0.18s ease;
}
.rule-card:hover { transform: translateY(-4px) rotate(-0.4deg); }
.rule-card:nth-child(even):hover { transform: translateY(-4px) rotate(0.4deg); }

.rule-icon { width: 74px; height: 74px; margin-bottom: 0.6rem; }

.rule-card h3 { font-size: 1.5rem; }

.rule-tag {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.rule-card > p:last-child { font-size: 0.98rem; }

/* barn */
.barn { background: var(--paper); }

.barn-list {
  list-style: none;
  display: grid;
  gap: 0.9rem;
  max-width: 46rem;
}
.barn-list li {
  padding-left: 2rem;
  position: relative;
  font-size: 1.05rem;
}
.barn-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.44em;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50% 50% 46% 54%;
  background: var(--hill-mid);
  border: 2px solid color-mix(in srgb, var(--ink) 20%, transparent);
}

/* outro */
.outro {
  background: var(--paper);
  text-align: center;
  padding-bottom: clamp(3rem, 6vw, 4.5rem);
}
.outro-inner { max-width: 36rem; }
.outro-cow { width: 74px; height: 74px; margin-bottom: 0.8rem; }
.outro-line { font-size: 1.1rem; margin-bottom: 1.1rem; }
.outro-cta {
  font-family: "Chewy", cursive;
  font-size: clamp(1.4rem, 3.4vw, 1.9rem);
}

/* footer */
.site-footer {
  background: var(--hill-near);
  color: #f4f8ee;
  text-align: center;
  padding: 1.5rem 1.4rem 1.7rem;
  font-size: 0.92rem;
}
.site-footer a { color: #ffe9a8; }
.footer-fine { opacity: 0.85; font-style: italic; }
.footer-pajami { margin-top: 0.5rem; font-size: 0.78rem; opacity: 0.6; }
.footer-pajami a { color: inherit; text-decoration: none; }
.footer-pajami a:hover { text-decoration: underline; }

/* small screens: tighten hero */
@media (max-width: 560px) {
  .hero-copy { padding-top: 4.6rem; }
  .scene { height: min(46svh, 420px); }
}
