/* ─────────────────────────────────────────────────────────────
   decimal-scaled — MkDocs Material overrides
   Mootable design system, dusk theme.
   Sampled from mootable-cow-dusk.svg (#3F4A6E + #C68A2E + #7A6A8E).
   ───────────────────────────────────────────────────────────── */

@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Manrope:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap");

:root {
  /* Mootable brand tokens (referenced by the overrides below). */
  --moo-blue:     #374E94;
  --moo-teal:     #367594;
  --moo-purple:   #563794;
  --moo-silver:   #787A79;
  --moo-charcoal: #2B2D2C;
  --moo-ink:      #1A1A1A;
  --moo-paper:    #F4F4F2;

  /* Dusk accents (per-library, this project) */
  --dusk-primary:        #3F4A6E;
  --dusk-primary-strong: #2D3656;
  --dusk-accent:         #C68A2E;
  --dusk-purple:         #7A6A8E;
}

/* ── Background "paper grid" motif ─────────────────────────── */
/* The Mootable design system uses a faint blueprint grid on the
   off-white "paper" background to evoke drafting tables. Apply to
   the main content surface in both themes; tint per-scheme so it
   stays visible without competing with text. */
.md-main {
  background-image:
    linear-gradient(var(--grid-line-color, rgba(0, 0, 0, 0.04)) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line-color, rgba(0, 0, 0, 0.04)) 1px, transparent 1px);
  background-size: 64px 64px;
  background-position: -1px -1px;
}

[data-md-color-scheme="default"] {
  --grid-line-color: rgba(63, 74, 110, 0.04);   /* dusk-blue at 4% on paper */
}
[data-md-color-scheme="slate"] {
  --grid-line-color: rgba(183, 192, 229, 0.03); /* dusk-tint at 3% on slate */
}

/* ── Light scheme: paper background, dusk primary ──────────── */
[data-md-color-scheme="default"] {
  --md-primary-fg-color:        var(--dusk-primary);
  --md-primary-fg-color--light: #5A6595;
  --md-primary-fg-color--dark:  var(--dusk-primary-strong);
  --md-primary-bg-color:        #FFFFFF;
  --md-primary-bg-color--light: rgba(255, 255, 255, 0.7);

  --md-accent-fg-color:         var(--dusk-accent);
  --md-accent-fg-color--transparent: rgba(198, 138, 46, 0.1);

  --md-default-bg-color:        var(--moo-paper);
  --md-typeset-a-color:         var(--dusk-primary);
}

/* ── Dark scheme: slightly-lifted dusk for legibility ──────── */
[data-md-color-scheme="slate"] {
  --md-primary-fg-color:        #5A6595;
  --md-primary-fg-color--light: #7480B0;
  --md-primary-fg-color--dark:  var(--dusk-primary);

  --md-accent-fg-color:         #D4A35E;
  --md-accent-fg-color--transparent: rgba(212, 163, 94, 0.12);

  --md-default-bg-color:        #1F2128;
  --md-default-bg-color--light: #262932;
  --md-typeset-a-color:         #B7C0E5;
}

/* ── Display type uses Outfit for headings ─────────────────── */
.md-typeset h1,
.md-typeset h2,
.md-typeset h3,
.md-typeset h4,
.md-typeset h5 {
  font-family: "Outfit", "Manrope", system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.md-typeset h1 { color: var(--md-primary-fg-color); }
.md-typeset h2 {
  color: var(--md-primary-fg-color);
  border-bottom: 1px solid var(--md-default-fg-color--lightest);
  padding-bottom: 0.3em;
}

/* ── Header autohide: leave a 4px sliver so hover can reveal ── */
/* Material's `header.autohide` hides the header on scroll-down
   via `transform: translateY(-100%)`. Override to keep a 4px
   strip visible — enough to act as a hover hotzone — and slide
   the full bar back into view when the user mouses over it.
   Restores the scroll-up reveal behaviour as well. */
.md-header[data-md-state="hidden"] {
  transform: translateY(calc(-100% + 4px));
  transition: transform 200ms ease-out;
}
.md-header[data-md-state="hidden"]:hover {
  transform: translateY(0);
}

/* ── Site header: lift the brand mark a touch ──────────────── */
.md-header__button.md-logo img,
.md-header__button.md-logo svg {
  height: 1.6rem;
  width: auto;
}

/* ── Code blocks tone-match the paper background ───────────── */
[data-md-color-scheme="default"] .md-typeset code {
  background: #ECECE8;
  color: #1F2128;
}

/* ── Tables: tighten + brand-tint header row ───────────────── */
.md-typeset table:not([class]) {
  font-size: 0.78rem;
}
.md-typeset table:not([class]) th {
  background: var(--md-accent-fg-color--transparent);
  font-family: "Outfit", sans-serif;
  font-weight: 600;
  color: var(--md-primary-fg-color);
}

/* ── Hero / landing page motifs ────────────────────────────── */
.md-typeset .hero-row {
  display: grid;
  grid-template-columns: 67.5% 32.5%;     /* cow lifted from 25% → 32.5% (+30%) */
  gap: 2rem;
  align-items: center;
  margin: 1.5rem 0 2rem;
}
.md-typeset .hero-copy { min-width: 0; }
.md-typeset .hero-mark {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  justify-self: end;
}
.md-typeset .hero-mark svg {
  width: 100%;
  height: auto;
  display: block;
}

/* Fluorescent flicker: each coloured panel runs an independent
   short-cycle brightness blip + glow so the cow gently shimmers
   like a strip light. Prime-second cycles keep panels from
   drifting back into sync. Adapted from the moocad splash
   `post-flicker` animation, lifted further (brightness(2) +
   drop-shadow glow) so the effect is visible without staring.
   First delays kept under 2s so the user sees a flicker within
   a couple of seconds of landing on the page. */
@keyframes hero-flicker {
  /* Peak window 1% of cycle. With cycles tuned to 30-60s
     (see per-cpath rules below), flash duration lands in the
     300-600ms target band: 30s × 1% = 300ms, 60s × 1% = 600ms. */
  0%, 49.5%      { filter: brightness(1); }
  50%            { filter: brightness(2) drop-shadow(0 0 8px rgba(255,255,255,0.7)); }
  50.5%, 100%    { filter: brightness(1); }
}

/* One-shot reveal — fade opacity 0 -> 1 over the first
   flicker, then hold. fill-mode: forwards locks the panel
   visible after this fires once. */
@keyframes hero-reveal {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}

/* All coloured panels AND their matching white-stroke halos
   start invisible; each panel's reveal plays only when its
   first flicker hits, so the cow appears to build itself up
   in the same rhythm as the flicker. */
.md-typeset .hero-mark [class^="cpath-"],
.md-typeset .hero-mark [class^="hpath-"] {
  opacity: 0;
}
/* Cycle = how long between repeats for the SAME panel. We use
   prime-second cycles in the 30-100s range so a given panel
   blips only every minute or so, but pair each with a NEGATIVE
   delay so the panel's first peak (at 50% of cycle) lands in
   the opening 1-18 seconds — front-loading the show without
   making panels chatter at each other afterwards.
   Formula:  animation-delay = T_first_peak - (cycle / 2)        */
/* Cycles 1-3 minutes per panel. First-peak times follow a
   sine-wave clustering instead of a perfectly even 1-per-second
   ramp, so the opening reveal feels more organic - bursts of
   2-3 panels separated by brief lulls instead of a metronome.
   Formula:  T(n) = n + 2·sin(n·2π/5),  rounded to 0.1s.
   Clusters land near 0-3s, 5-8s, 10-13s, 15-18s.            */
/* Each cpath: TWO animations. hero-flicker (infinite brightness
   blip) + hero-reveal (one-shot fade-in, fill-mode forwards).
   reveal delay = first-peak-time - 0.2s so the 0.4s opacity
   ramp centres on the flicker peak — panel "lights up" at the
   exact moment the flash hits. After reveal completes, opacity
   stays at 1 (forwards) and only the flicker keeps running.
   The matching white-stroke halo (hpath-N) gets the same
   reveal animation — see the .hpath-N rules below. */
/* Reveal-time distribution: ease-in-out across the 4s window
   instead of sine clustering. Curve T(n) = 2·(1-cos(π·n/17))
   gives slow start, fast middle, slow finish — a couple of
   panels at first, then a quick crescendo, then a soft tail. */
.md-typeset .hero-mark .cpath-0  { animation: hero-flicker 30.0s linear -15.0s infinite, hero-reveal 0.4s ease-out -0.2s forwards; } /* peak 0.0s, flash 300ms */
.md-typeset .hero-mark .cpath-1  { animation: hero-flicker 31.5s linear -15.8s infinite, hero-reveal 0.4s ease-out -0.2s forwards; } /* peak 0.0s, flash 315ms */
.md-typeset .hero-mark .cpath-2  { animation: hero-flicker 33.0s linear -16.4s infinite, hero-reveal 0.4s ease-out -0.1s forwards; } /* peak 0.1s, flash 330ms */
.md-typeset .hero-mark .cpath-3  { animation: hero-flicker 34.5s linear -17.0s infinite, hero-reveal 0.4s ease-out  0.1s forwards; } /* peak 0.3s, flash 345ms */
.md-typeset .hero-mark .cpath-4  { animation: hero-flicker 36.0s linear -17.5s infinite, hero-reveal 0.4s ease-out  0.3s forwards; } /* peak 0.5s, flash 360ms */
.md-typeset .hero-mark .cpath-5  { animation: hero-flicker 37.5s linear -18.0s infinite, hero-reveal 0.4s ease-out  0.6s forwards; } /* peak 0.8s, flash 375ms */
.md-typeset .hero-mark .cpath-6  { animation: hero-flicker 39.0s linear -18.4s infinite, hero-reveal 0.4s ease-out  0.9s forwards; } /* peak 1.1s, flash 390ms */
.md-typeset .hero-mark .cpath-7  { animation: hero-flicker 40.5s linear -18.8s infinite, hero-reveal 0.4s ease-out  1.3s forwards; } /* peak 1.5s, flash 405ms */
.md-typeset .hero-mark .cpath-8  { animation: hero-flicker 42.0s linear -19.2s infinite, hero-reveal 0.4s ease-out  1.6s forwards; } /* peak 1.8s, flash 420ms */
.md-typeset .hero-mark .cpath-9  { animation: hero-flicker 43.5s linear -19.6s infinite, hero-reveal 0.4s ease-out  2.0s forwards; } /* peak 2.2s, flash 435ms */
.md-typeset .hero-mark .cpath-10 { animation: hero-flicker 45.0s linear -19.9s infinite, hero-reveal 0.4s ease-out  2.4s forwards; } /* peak 2.6s, flash 450ms */
.md-typeset .hero-mark .cpath-11 { animation: hero-flicker 46.5s linear -20.4s infinite, hero-reveal 0.4s ease-out  2.7s forwards; } /* peak 2.9s, flash 465ms */
.md-typeset .hero-mark .cpath-12 { animation: hero-flicker 48.0s linear -20.8s infinite, hero-reveal 0.4s ease-out  3.0s forwards; } /* peak 3.2s, flash 480ms */
.md-typeset .hero-mark .cpath-13 { animation: hero-flicker 49.5s linear -21.3s infinite, hero-reveal 0.4s ease-out  3.3s forwards; } /* peak 3.5s, flash 495ms */
.md-typeset .hero-mark .cpath-14 { animation: hero-flicker 51.0s linear -21.8s infinite, hero-reveal 0.4s ease-out  3.5s forwards; } /* peak 3.7s, flash 510ms */
.md-typeset .hero-mark .cpath-15 { animation: hero-flicker 52.5s linear -22.4s infinite, hero-reveal 0.4s ease-out  3.7s forwards; } /* peak 3.9s, flash 525ms */
.md-typeset .hero-mark .cpath-16 { animation: hero-flicker 55.0s linear -23.5s infinite, hero-reveal 0.4s ease-out  3.8s forwards; } /* peak 4.0s, flash 550ms */
.md-typeset .hero-mark .cpath-17 { animation: hero-flicker 60.0s linear -26.0s infinite, hero-reveal 0.4s ease-out  3.8s forwards; } /* peak 4.0s, flash 600ms */

/* All halos reveal together AFTER the last coloured panel has
   lit up (last cpath peak is 18.2s). Until then, revealed
   panels butt up against each other with no white-grout
   separator — the cow assembles as a single coloured silhouette
   and the white-mosaic grout pops in as a final beat. */
.md-typeset .hero-mark [class^="hpath-"] {
  /* Last cpath finishes at T = 3.8 + 0.4 = 4.2s, so the halo
     reveal kicks off then — no perceptible pause between the
     final coloured panel and the white-grout pop. */
  animation: hero-reveal 0.6s ease-out 4.2s forwards;
}

/* Respect users who've opted out of motion: hold the cow steady,
   fully visible from the start (skip the reveal AND the
   flicker). */
@media (prefers-reduced-motion: reduce) {
  .md-typeset .hero-mark [class^="cpath-"] {
    animation: none;
    opacity: 1;
  }
}

@media (max-width: 60em) {
  .md-typeset .hero-row {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .md-typeset .hero-mark {
    display: none;        /* mobile: hide the cow entirely */
  }
}

.md-typeset .hero-tagline {
  font-family: "Outfit", sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--md-default-fg-color--light);
  margin-bottom: 0.6rem;
}
.md-typeset .hero-wordmark {
  font-family: "Outfit", sans-serif;
  font-weight: 800;
  font-size: 3rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 0.8rem;
}
.md-typeset .hero-wordmark .a { color: var(--dusk-primary); }
.md-typeset .hero-wordmark .b { color: var(--dusk-accent); }
.md-typeset .hero-lede {
  font-size: 1.1rem;
  line-height: 1.5;
  max-width: 38em;
  color: var(--md-default-fg-color);
}

/* Hero action button row */
.md-typeset .hero-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.4rem;
  flex-wrap: wrap;
}
.md-typeset .hero-actions .md-button {
  margin: 0;
}

/* Hero install snippet */
.md-typeset .hero-install {
  display: inline-block;
  margin-top: 1.4rem;
  padding: 0.75rem 1.1rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.95rem;
  background: var(--md-code-bg-color);
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 8px;
}
.md-typeset .hero-install .prompt {
  color: var(--md-default-fg-color--light);
  user-select: none;
}

/* Grid of cards (Material's grid-cards class extended) */
.md-typeset .grid.cards > :is(ul, ol) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
  margin: 1.2rem 0;
  padding: 0;
  list-style: none;
}
.md-typeset .grid.cards > :is(ul, ol) > li {
  border: 2px solid var(--md-default-fg-color--lightest);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  background: var(--md-default-bg-color);
  box-shadow:
    4px 6px 14px var(--card-shadow-rest, rgba(26, 26, 26, 0.12)),
    2px 3px 6px var(--card-shadow-rest-tight, rgba(26, 26, 26, 0.06));
  transition: border-color 200ms, box-shadow 200ms, transform 200ms;
}
.md-typeset .grid.cards > :is(ul, ol) > li:hover {
  border-color: var(--md-primary-fg-color);
  box-shadow:
    8px 10px 22px var(--card-shadow-hover, rgba(26, 26, 26, 0.18)),
    3px 5px 8px var(--card-shadow-hover-tight, rgba(26, 26, 26, 0.08));
}

/* Dark mode: shadows lift via light-coloured glow instead of darkening. */
[data-md-color-scheme="slate"] {
  --card-shadow-rest:        rgba(183, 192, 229, 0.08);
  --card-shadow-rest-tight:  rgba(183, 192, 229, 0.04);
  --card-shadow-hover:       rgba(212, 163, 94, 0.18);
  --card-shadow-hover-tight: rgba(212, 163, 94, 0.10);
}

/* Footer: keep brand attribution */
.md-footer-meta {
  background: var(--md-primary-fg-color--dark);
}
