/* ============================================================
   BEORA · BRAND KIT · SHARED STYLESHEET
   Lives at /brand/brand.css — every page imports this.
   Tokens are pulled from the V4 design system (colors_and_type.css)
   and scoped here for a static, vendor-free deploy.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=JetBrains+Mono:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;0,6..72,600;1,6..72,400&family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,500;0,9..144,600;1,9..144,300;1,9..144,400&display=swap');

@font-face {
  font-family: "Gambarino";
  src: url("/brand/assets/fonts/Gambarino-Regular.woff2") format("woff2"),
       url("/brand/assets/fonts/Gambarino-Regular.woff") format("woff"),
       url("/brand/assets/fonts/Gambarino-Regular.ttf") format("truetype");
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  /* ── Type ─────────────────────────────────────────────── */
  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-brand:   "Gambarino", "Fraunces", ui-serif, serif;
  --font-ui:      "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;
  --font-wiki:    "Newsreader", Georgia, serif;
  --font-serif:   "Fraunces", "Newsreader", Georgia, serif;

  /* ── Palette ──────────────────────────────────────────── */
  --ink:        #0B0B0F;
  --ink-2:      #1E1E24;
  --ink-3:      #5A5A64;
  --ink-4:      #A3A3AC;
  --ink-5:      #D4D4D8;
  --bone:       #FAFAF7;
  --bone-2:     #F2F2EE;
  --bone-3:     #E8E8E3;
  --paper:      #FFFFFF;
  --coral:      #E06148;
  --coral-deep: #B84830;
  --coral-tint: #FCE9E3;
  --iodine-50:  #F4F6D2;
  --iodine-200: #E4EC5C;
  --iodine-500: #C8D900;
  --iodine-700: #7A8A00;
  --iodine-900: #1F2600;
  --iodine-ink: #D8E820;

  --signal-ok:   #0B7A3B;
  --signal-warn: #C67A00;
  --signal-crit: #B3261E;

  --line: var(--ink);
  --hair: var(--ink-5);

  /* ── Accent role assignments ─────────────────────────── */
  /* IODINE leads — the agent, the system, the live signal. */
  /* CORAL supports — human, warmth, mascot only.           */
  --accent:        var(--iodine-700);   /* readable iodine on bone */
  --accent-bright: var(--iodine-200);   /* glow on dark surfaces */
  --accent-fill:   var(--iodine-500);   /* solid blocks */
  --accent-tint:   var(--iodine-50);    /* tint backgrounds */
  --support:       var(--coral-deep);   /* coral, demoted */
}

/* ── Reset ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bone);
  color: var(--ink);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
  font-size: 15px;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }

/* ── Layout shell ─────────────────────────────────────── */
.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* ── Side nav (sticky) ────────────────────────────────── */
.sidenav {
  border-right: 1px solid var(--ink);
  background: var(--bone);
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
/* Back-to-site link above the brand mark */
.sidenav .back-home {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-decoration: none;
  margin-bottom: 18px;
  transition: color 0.15s;
}
.sidenav .back-home:hover { color: var(--ink); }
.sidenav .back-home svg { flex-shrink: 0; }

.sidenav .brand-mark {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--ink);
}
.sidenav .brand-mark .b {
  font-family: var(--font-brand);
  font-style: italic;
  font-size: 28px;
  letter-spacing: -0.02em;
  font-weight: 400;
  color: var(--ink);
  line-height: 1;
}
.sidenav .brand-mark .label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.sidenav nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidenav nav .group-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin: 16px 0 6px;
  padding: 0 4px;
}
.sidenav nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--ink-2);
  padding: 7px 4px;
  border-bottom: 1px solid transparent;
  transition: color 0.12s;
}
.sidenav nav a:hover { color: var(--ink); }
.sidenav nav a.active {
  color: var(--ink);
  font-weight: 500;
}
.sidenav nav a.active::before {
  content: "";
  width: 6px; height: 6px;
  background: var(--accent-fill);
  margin-right: 8px;
  box-shadow: 0 0 0 2px var(--iodine-50);
}
.sidenav nav a .num {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-4);
  letter-spacing: 0.1em;
}

.sidenav .footer {
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-4);
  line-height: 1.6;
}
.sidenav .footer a { color: var(--accent); }
.sidenav .footer .live-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-fill);
  box-shadow: 0 0 0 2px var(--iodine-50), 0 0 8px var(--iodine-200);
  margin-right: 6px;
  vertical-align: 1px;
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.55; transform: scale(1.18); }
}

/* ── Main column ──────────────────────────────────────── */
.main {
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 18px 56px;
  border-bottom: 1px solid var(--ink);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--bone);
  position: sticky; top: 0; z-index: 10;
}
.topbar .crumbs span.sep { color: var(--ink-4); margin: 0 6px; }
.topbar .crumbs .here { color: var(--accent); }
.topbar .meta { display: inline-flex; gap: 18px; }

.page-pad {
  padding: 64px 56px 120px;
  max-width: 1180px;
}
.page-pad-wide {
  padding: 64px 56px 120px;
  max-width: 1320px;
}

/* ── Page heads ───────────────────────────────────────── */
.page-head {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 24px;
  margin-bottom: 64px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--ink);
}
.page-head .num {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--accent);
  padding-top: 14px;
}
.page-head h1 {
  font-family: var(--font-display);
  font-size: 64px;
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 0.98;
  margin: 0 0 20px;
  color: var(--ink);
}
.page-head h1 em {
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 500;
  background: linear-gradient(180deg, transparent 62%, var(--accent-fill) 62%, var(--accent-fill) 92%, transparent 92%);
  padding: 0 0.05em;
}
.page-head .lede {
  font-family: var(--font-wiki);
  font-size: 21px;
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 720px;
  margin: 0 0 16px;
}
.page-head .lede em { color: var(--ink); font-weight: 500; font-style: normal; border-bottom: 2px solid var(--accent-fill); }
.page-head .meta-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  border: 1px solid var(--ink-5);
  padding: 4px 10px;
  margin-top: 8px;
}
.page-head .meta-tag .dot { width: 6px; height: 6px; background: var(--accent-fill); border-radius: 50%; box-shadow: 0 0 6px var(--iodine-200); }

/* ── Section heads ────────────────────────────────────── */
.section {
  margin-top: 96px;
}
.section:first-of-type { margin-top: 0; }
.section-head {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 24px;
  align-items: baseline;
  margin-bottom: 32px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--ink);
}
.section-head .num {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--accent);
}
.section-head h2 {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.015em;
  margin: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
}
.section-head h2 em {
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 500;
  color: var(--ink);
  background: linear-gradient(180deg, transparent 62%, var(--accent-fill) 62%, var(--accent-fill) 92%, transparent 92%);
  padding: 0 0.05em;
}
.section-head h2 .meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--ink-3);
  text-transform: uppercase;
  font-weight: 400;
}

/* ── Prose ────────────────────────────────────────────── */
.prose {
  max-width: 720px;
  font-family: var(--font-wiki);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink-2);
}
.prose p { margin: 0 0 12px; }
.prose strong { color: var(--ink); font-family: var(--font-display); font-weight: 600; font-size: 16px; }
.prose em { color: var(--ink); font-weight: 500; font-style: normal; background: linear-gradient(180deg, transparent 65%, var(--accent-fill) 65%, var(--accent-fill) 95%, transparent 95%); padding: 0 0.04em; }
.prose code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bone-3);
  padding: 1px 5px;
  border: 1px solid var(--ink-5);
}

/* ── Cards ────────────────────────────────────────────── */
.card {
  background: var(--paper);
  border: 1px solid var(--ink);
  display: flex;
  flex-direction: column;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ink-5);
  background: var(--bone);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.card-head .id { color: var(--accent); }
.card-body { padding: 24px; }
.card.dark { background: var(--ink); color: var(--bone); border-color: var(--ink); }
.card.dark .card-head { background: #14141a; color: var(--ink-4); border-color: var(--ink-3); }
.card.dark .card-head .id { color: var(--accent-bright); }

/* ── Wordmark renders (HTML/CSS) ──────────────────────── */
.wm-beora {
  font-family: var(--font-brand);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1;
  display: inline-block;
}
.wm-carewiki {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.025em;
  color: var(--ink);
  display: inline-flex;
  align-items: baseline;
  line-height: 1;
}
.wm-carewiki .care { color: inherit; }
.wm-carewiki .wiki { color: var(--ink-3); font-weight: 400; }

/* CareWiki "by Beora" lockup — L·01 stacked, canon */
.lockup-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.lockup-stack .attribution {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.lockup-stack .attribution::before {
  content: "";
  width: 14px;
  height: 1px;
  background: var(--ink-4);
}
.lockup-stack .attribution .b {
  font-family: var(--font-brand);
  font-style: italic;
  font-size: 12px;
  text-transform: none;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-left: 2px;
}
.dark .lockup-stack .attribution { color: var(--ink-4); }
.dark .lockup-stack .attribution::before { background: var(--ink-3); }
.dark .lockup-stack .attribution .b { color: var(--bone); }
.dark .wm-beora { color: var(--bone); }
.dark .wm-carewiki { color: var(--bone); }
.dark .wm-carewiki .wiki { color: var(--ink-4); }

/* ── Stage frames (corner crops, V4 chrome) ───────────── */
.stage {
  position: relative;
  padding: 56px 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  background:
    repeating-linear-gradient(
      to right,
      transparent 0 calc(50% - 0.5px),
      rgba(11,11,15,0.04) calc(50% - 0.5px) calc(50% + 0.5px),
      transparent calc(50% + 0.5px) 100%
    );
}
.stage.dark {
  background: var(--ink);
  color: var(--bone);
}
.stage .corner { position: absolute; width: 12px; height: 12px; }
.stage .corner.tl { top: 0; left: 0; border-top: 1px solid var(--ink); border-left: 1px solid var(--ink); }
.stage .corner.tr { top: 0; right: 0; border-top: 1px solid var(--ink); border-right: 1px solid var(--ink); }
.stage .corner.bl { bottom: 0; left: 0; border-bottom: 1px solid var(--ink); border-left: 1px solid var(--ink); }
.stage .corner.br { bottom: 0; right: 0; border-bottom: 1px solid var(--ink); border-right: 1px solid var(--ink); }
.stage.dark .corner { border-color: var(--ink-3); }

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 16px;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  letter-spacing: 0;
  cursor: pointer;
  transition: background 0.12s;
}
.btn:hover { background: var(--bone-3); }
.btn-primary { background: var(--ink); color: var(--bone); }
.btn-primary:hover { background: var(--coral); border-color: var(--coral); }
.btn .arrow { font-family: var(--font-mono); }

/* ── Tag / label / pill ───────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  border: 1px solid var(--ink-5);
  padding: 3px 8px;
  background: var(--bone);
}
.tag.coral { color: var(--coral-deep); border-color: var(--coral-deep); background: var(--coral-tint); }
.tag.iodine { color: var(--iodine-700); border-color: var(--iodine-500); background: var(--iodine-50); }
.tag .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent-fill); }

/* ── Footer ───────────────────────────────────────────── */
.page-foot {
  margin: 96px 0 0;
  padding: 24px 0 0;
  border-top: 1px solid var(--ink);
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.page-foot a { color: var(--accent); }
.page-foot a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ── Utilities ────────────────────────────────────────── */
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.row-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.label-mono {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }

  /* Sidenav becomes a compact sticky top bar */
  .sidenav {
    position: sticky;
    top: 0;
    z-index: 100;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--ink);
    background: var(--bone);
    padding: 0;
    flex-direction: row;
    align-items: center;
    gap: 0;
  }

  /* Brand mark stays left, compact */
  .sidenav .brand-mark {
    flex-shrink: 0;
    border-bottom: none;
    padding: 12px 16px;
    border-right: 1px solid var(--ink);
    gap: 7px;
  }
  .sidenav .brand-mark .b { font-size: 20px; }
  .sidenav .brand-mark .label { display: none; }

  /* Nav links become a horizontal scrollable strip */
  .sidenav nav {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0;
    padding: 0 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .sidenav nav::-webkit-scrollbar { display: none; }

  .sidenav nav .group-label { display: none; }

  .sidenav nav a {
    flex-shrink: 0;
    padding: 14px 12px;
    border-bottom: 2px solid transparent;
    font-size: 13px;
    white-space: nowrap;
  }
  .sidenav nav a.active {
    border-bottom-color: var(--accent-fill);
  }
  .sidenav nav a.active::before { display: none; }
  .sidenav nav a .num { display: none; }

  /* Footer hidden on mobile */
  .sidenav .footer { display: none; }

  .topbar, .page-pad, .page-pad-wide { padding-left: 24px; padding-right: 24px; }
  .row-2, .row-3, .row-4 { grid-template-columns: 1fr; }
  .page-head { grid-template-columns: 1fr; }
  .page-head .num { padding-top: 0; }
  .page-head h1 { font-size: 44px; }
  .section-head { grid-template-columns: 1fr; }
  .section-head h2 { font-size: 26px; flex-direction: column; align-items: flex-start; gap: 4px; }
}

/* ─────────────────────────────────────────────────────────────────────────
   LOADING & THINKING  (brand.css shared styles)
   These are intentional exceptions to the "no rounded corners beyond 2px" rule.
   The parrot bubble (rx=20) is the mascot speech bubble — its silhouette is
   the brand shape, not a generic UI chrome element.
   ──────────────────────────────────────────────────────────────────────── */

/* Parrot thinking bubble — matches iOS ParrotThinkingView exactly.
   The canonical mascot PNG (tufts + wing + body + tail + 3 dots) does the
   talking; this wrapper just bobs the artwork. */
@keyframes parrot-bob {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-5px); }
}
.parrot-thinking {
  position: relative;
  display: inline-block;
  animation: parrot-bob 1.6s ease-in-out infinite;
}
.parrot-thinking img.bubble {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Plain typing bubble — coral = human, iodine = agent */
@keyframes dot-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
  30%            { transform: translateY(-5px); opacity: 1; }
}
.typing-bubble {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--iodine-50); border: 1px solid var(--iodine-500);
  padding: 10px 14px; border-radius: 0 10px 10px 10px;
}
.typing-bubble.dark { background: var(--ink-2); border-color: var(--ink-3); }
.typing-dot {
  display: block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--iodine-700);
  animation: dot-bounce 1.1s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.18s; }
.typing-dot:nth-child(3) { animation-delay: 0.36s; }
.typing-bubble.dark .typing-dot { background: var(--iodine-200); }
.typing-bubble.coral-bubble {
  background: var(--coral-tint);
  border-color: var(--coral);
  border-radius: 0 10px 10px 10px;
}
.coral-dot { background: var(--coral-deep) !important; }

/* Skeleton shimmer */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton-block {
  background: linear-gradient(90deg, var(--bone-3) 25%, var(--bone-2) 50%, var(--bone-3) 75%);
  background-size: 800px 100%; animation: shimmer 1.6s infinite linear;
}
.skel-coral {
  background: linear-gradient(90deg, var(--coral-tint) 25%, #fce9e380 50%, var(--coral-tint) 75%);
  background-size: 800px 100%; animation: shimmer 1.6s infinite linear;
}
.skel-iodine {
  background: linear-gradient(90deg, #c8d90018 25%, #c8d90038 50%, #c8d90018 75%);
  background-size: 800px 100%; animation: shimmer 1.8s infinite linear;
}
