/* ──────────────────────────────────────────────────────────
   site.css — single source of truth for everything that
   appears on more than one page of kartaa.pages.dev.
   Page-specific component styles stay in each page's inline
   <style> block. Tokens, reset, nav, footer signoff, and
   benediction live here.
   ────────────────────────────────────────────────────────── */

/* ─── Design tokens ─────────────────────────────────────── */
:root {
  /* Core neutrals — near-black with a faint blue undertone. */
  --bg:      #0a0d14;
  --bg-2:    #11151f;        /* surfaces */
  --bg-3:    #1a1f2e;        /* elevated */
  --line:    rgba(255, 255, 255, 0.08);
  --line-2:  rgba(255, 255, 255, 0.14);
  --ink:     #e9ecf2;        /* body text */
  --ink-2:   #b9bfcc;        /* secondary */
  --ink-3:   #6f7587;        /* muted */
  --ink-4:   #4a4f5d;        /* faint */

  /* Default accent = Midnight blue. Pages opt into other accents
     by setting [data-accent="ember|moss"] on <html>. */
  --accent:        #4f8cff;
  --accent-soft:   rgba(79, 140, 255, 0.14);
  --accent-line:   rgba(79, 140, 255, 0.32);
  --accent-glow:   rgba(79, 140, 255, 0.45);

  /* Status accents. */
  --success:       #5fb87a;
  --warn:          #f0b76b;

  /* Typography. */
  --f-mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --f-display: "Newsreader", ui-serif, Georgia, serif;
  --f-body:    "Geist", ui-sans-serif, system-ui, -apple-system, sans-serif;

  --t-1: clamp(2.6rem, 7vw, 5.6rem); /* hero */
  --t-2: clamp(1.7rem, 3.4vw, 2.6rem);
  --t-3: clamp(1.2rem, 2.2vw, 1.55rem);
  --t-4: 1.0625rem;
  --t-5: 0.9375rem;
  --t-6: 0.78125rem;
  --lh-tight: 1.05;
  --lh-snug:  1.25;
  --lh:       1.55;

  /* Spacing rhythm — single source of truth for both pages. */
  --gutter:      clamp(1.25rem, 3vw, 2.5rem);
  --section-gap: clamp(4rem, 9vw, 7.5rem);
  --max-w:       72rem;   /* outer container width — nav, footer, page wrap */
  --copy-w:      36rem;   /* prose column width */
}

/* Live-swappable accents. Both pages use [data-accent="ember"] today;
   moss is reserved for future use. */
[data-accent="ember"] {
  --accent:        #ff8c4f;
  --accent-soft:   rgba(255, 140, 79, 0.16);
  --accent-line:   rgba(255, 140, 79, 0.32);
  --accent-glow:   rgba(255, 140, 79, 0.45);
}
[data-accent="moss"] {
  --accent:        #5fb87a;
  --accent-soft:   rgba(95, 184, 122, 0.14);
  --accent-line:   rgba(95, 184, 122, 0.32);
  --accent-glow:   rgba(95, 184, 122, 0.45);
}

/* ─── Reset + base ──────────────────────────────────────── */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); }

body {
  font-family: var(--f-body);
  font-size: var(--t-5);
  line-height: var(--lh);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; transition: color .12s ease; }
a:hover { color: var(--ink); }

/* Faint grain overlay — same SVG on every page, identical opacity +
   blend mode, so the perceived bg warmth stays consistent. */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.035;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='128' height='128'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
}

::selection { background: var(--accent); color: var(--bg); }

/* ─── Top nav (shared across every page) ────────────────── */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: rgba(10, 13, 20, 0.72);
  border-bottom: 1px solid var(--line);
}
.nav__inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1rem var(--gutter);
  display: flex;
  align-items: center;
  gap: 2rem;
}
.nav__brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  font-family: var(--f-display);
  font-style: italic;
  font-weight: 500;
  font-size: 1.25rem;
  color: var(--ink);
  letter-spacing: -.01em;
  text-decoration: none;
}
.nav__brand:hover { color: var(--ink); }
.nav__brand img { width: 26px; height: 26px; }
.nav__links {
  margin-left: auto;
  display: flex;
  gap: 1.5rem;
  font-family: var(--f-mono);
  font-size: var(--t-6);
  color: var(--ink-3);
  text-transform: lowercase;
  letter-spacing: .01em;
}
.nav__links a {
  color: var(--ink-3);
  border-bottom: 1px dashed transparent;
  padding-bottom: 1px;
  transition: color .12s, border-color .12s;
}
.nav__links a:hover { color: var(--ink); border-color: var(--accent-line); }
.nav__links a.is-cta { color: var(--accent); }
.nav__links a.is-cta:hover { color: var(--ink); }
@media (max-width: 720px) {
  .nav__links { gap: 1rem; }
  .nav__links a:not(.is-cta) { display: none; }
}

/* ─── Shared footer container + scaffold ──────────────────
   Both pages use the same outer footer treatment (border,
   padding, mono small text), the same .footer__row width,
   and the same .footer__nav row of inline links. Spacings
   are intentionally tight: the benediction above the
   footer already supplies vertical breathing room. */
footer {
  border-top: 1px solid var(--line);
  margin-top: 1rem;
  padding: 2rem var(--gutter) 1.25rem;
  background: var(--bg);
  color: var(--ink-3);
  font-size: var(--t-6);
}
footer a { color: var(--ink-2); }
footer a:hover { color: var(--accent); }
footer .footer__row { max-width: var(--max-w); margin: 0 auto; }
footer .footer__nav {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  font-family: var(--f-mono);
  font-size: var(--t-6);
}
footer .footer__nav a {
  color: var(--ink-3);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  padding-bottom: 1px;
  transition: color .12s, border-color .12s;
}
footer .footer__nav a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent-line);
}

/* ─── Shared footer signoff (heart + by + handle) ─────────
   Both pages render the same signoff block — identical
   spacing, dashed top rule, dashed-on-hover anchor.
   Page-level wrapper variations are fine; the inner
   .footer__signoff class is the cohesive unit. */
.footer__signoff {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .85rem;
  flex-wrap: wrap;
  font-family: var(--f-display);
  font-style: italic;
  font-size: 1rem;
  color: var(--ink-2);
  letter-spacing: 0;
  border-top: 1px dashed var(--line);
  padding: 1.1rem 0 0;
  margin: 0;
}
.footer__signoff a {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: var(--ink-2);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  padding-bottom: 1px;
  transition: color .12s, border-color .12s;
}
.footer__signoff a:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.footer__signoff svg.heart  { color: var(--accent); }
.footer__signoff svg.coffee { color: var(--accent); }
.footer__signoff .sep { color: var(--ink-4); }

@keyframes heart-beat {
  0%, 100% { transform: scale(1); }
  18% { transform: scale(1.18); }
  36% { transform: scale(1); }
  54% { transform: scale(1.10); }
  72% { transform: scale(1); }
}
.footer__signoff svg.heart {
  transform-origin: center;
  animation: heart-beat 2.4s ease-in-out infinite;
}

@keyframes coffee-steam {
  0%   { opacity: 0; transform: translateY(2px); }
  20%  { opacity: 0.85; }
  100% { opacity: 0; transform: translateY(-7px); }
}
.footer__signoff svg.coffee .steam-1 { animation: coffee-steam 2.6s ease-out infinite; }
.footer__signoff svg.coffee .steam-2 { animation: coffee-steam 2.6s ease-out infinite .9s; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ─── Click-to-copy on every <pre> ────────────────────────
   /scripts/copy-buttons.js wraps each <pre> in .code-block
   and injects a .copy-btn in the top-right. Subtle by
   default, full-opacity on hover/focus, always-on for touch. */
.code-block {
  position: relative;
  margin: 1rem 0;
}
.code-block > pre {
  margin: 0;
  padding-right: 5rem; /* reserve space for the absolute-positioned button */
}
.copy-btn {
  position: absolute;
  top: .55rem;
  right: .55rem;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .6rem;
  font-family: var(--f-mono);
  font-size: var(--t-6);
  letter-spacing: .04em;
  text-transform: lowercase;
  color: var(--ink-3);
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  opacity: .55;
  transition: opacity .12s, color .12s, border-color .12s, background .12s;
}
.code-block:hover .copy-btn,
.copy-btn:focus-visible { opacity: 1; outline: none; }
.copy-btn:hover {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--bg-2);
}
.copy-btn.is-copied {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  opacity: 1;
}
.copy-btn__icon { display: block; }
@media (max-width: 480px) {
  .copy-btn { opacity: 1; }
}

/* ─── Closing benediction (Sanskrit phrase + chrome) ───── */
/* Drop the last section's bottom padding so the benediction
   sits a measured distance below it, not adrift in dead air. */
main > .section:last-of-type,
main > section:last-of-type { padding-bottom: 1.5rem; }
.benediction {
  margin: 2.25rem auto 1.5rem;
  max-width: 38rem;
  text-align: center;
  padding: 0 1rem;
}
.benediction__phrase {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .9rem;
  font-family: var(--f-display);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--accent);
  letter-spacing: .005em;
  margin: 0;
}
.benediction__rule {
  flex: 1 1 auto;
  height: 1px;
  max-width: 6.5rem;
  background: linear-gradient(90deg, transparent 0%, var(--accent-line) 50%, transparent 100%);
}
.benediction__translation {
  font-family: var(--f-display);
  font-style: italic;
  font-size: .92rem;
  color: var(--ink-3);
  margin: .5rem 0 0;
  letter-spacing: .005em;
}
@media (max-width: 480px) {
  .benediction__phrase { font-size: 1rem; gap: .65rem; }
  .benediction__rule  { max-width: 3.5rem; }
}
