/*
  RetenConcept — internal concept brief.
  Design tokens inherited 1:1 from the MediaMagic "Clay" design system
  (MediaMagicPlatform/DESIGN.md, MediaMagicWebsiteLanding/app/globals.css)
  so this brief reads as part of the same brand, not a one-off deck.
*/

:root {
  /* Surfaces — cream-tinted, never cool gray */
  --canvas: #fffaf0;
  --surface-soft: #faf5e8;
  --surface-card: #f5f0e0;
  --surface-strong: #ebe6d6;
  --surface-dark: #0a1a1a;
  --surface-dark-elevated: #1a2a2a;

  /* Text */
  --ink: #0a0a0a;
  --body: #3a3a3a;
  --body-strong: #1a1a1a;
  --muted: #6a6a6a;
  --muted-soft: #9a9a9a;
  --hairline: #e5e5e5;
  --hairline-soft: #f0f0f0;
  --on-dark: #ffffff;
  --on-dark-soft: #a0a0a0;

  /* Saturated brand rotation */
  --pink: #ff4d8b;
  --teal: #1a3a3a;
  --lavender: #b8a4ed;
  --peach: #ffb084;
  --ochre: #e8b94a;
  --mint: #a4d4c5;
  --coral: #ff6b5a;

  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;

  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;

  --content: 1180px;
  --section: 112px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--body);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--pink);
  color: #fff;
}

img { max-width: 100%; }

/* ─────────────────────────────  type  ───────────────────────────── */

.display {
  font-weight: 500;
  letter-spacing: -0.045em;
  color: var(--ink);
  line-height: 1.04;
  margin: 0;
}

.d-xl { font-size: clamp(38px, 6.2vw, 74px); letter-spacing: -0.055em; }
.d-lg { font-size: clamp(30px, 4.4vw, 54px); letter-spacing: -0.05em; }
.d-md { font-size: clamp(25px, 3.1vw, 38px); }
.d-sm { font-size: clamp(21px, 2.3vw, 29px); letter-spacing: -0.035em; }

h3 {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--body-strong);
  margin: 0;
}

p { margin: 0 0 1.05em; }
p:last-child { margin-bottom: 0; }

.eyebrow {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.eyebrow::before {
  content: "";
  width: 22px;
  height: 1.5px;
  background: var(--ink);
  opacity: 0.35;
  flex: none;
}

.lede {
  font-size: clamp(17px, 1.65vw, 21px);
  line-height: 1.5;
  color: var(--body-strong);
  letter-spacing: -0.012em;
  max-width: 62ch;
}

.mono { font-family: var(--mono); }
strong, b { color: var(--body-strong); font-weight: 600; }
em { font-style: normal; box-shadow: inset 0 -0.5em 0 rgba(232, 185, 74, 0.32); }

/* ────────────────────────────  layout  ──────────────────────────── */

.wrap {
  width: 100%;
  max-width: var(--content);
  margin: 0 auto;
  padding: 0 28px;
}

section.band { padding: var(--section) 0; }
section.band + section.band { padding-top: 0; }

.band-dark {
  background: var(--surface-dark);
  color: var(--on-dark-soft);
  padding: var(--section) 0;
}

/* A preceding .band already contributes its bottom padding as the gap;
   adding margin here would double the cream space before the dark block. */
section.band + .band-dark { margin-top: 0; }
.band-dark .display,
.band-dark h3 { color: var(--on-dark); }
.band-dark .eyebrow { color: var(--on-dark-soft); }
.band-dark .eyebrow::before { background: var(--on-dark); opacity: 0.4; }
.band-dark .lede { color: rgba(255, 255, 255, 0.82); }
/* `b` also has to be reset here: the global rule paints it near-black, which is
   invisible on the dark band. */
.band-dark strong,
.band-dark b { color: #fff; }

.sec-head { margin-bottom: 48px; max-width: 78ch; }
.sec-head .lede { margin-top: 20px; }

.grid { display: grid; gap: 20px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ─────────────────────────────  cards  ──────────────────────────── */

.card {
  background: var(--surface-soft);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 26px;
}

.card-plain {
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 26px;
}

.card h3 + p { margin-top: 10px; }
.card p { font-size: 15px; }

.card-num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted-soft);
  display: block;
  margin-bottom: 14px;
}

/* Saturated feature cards — the Clay "brand rotation" */
.c-pink { background: var(--pink); border-color: var(--pink); color: rgba(255,255,255,0.9); }
.c-teal { background: var(--teal); border-color: var(--teal); color: rgba(255,255,255,0.78); }
.c-lav { background: var(--lavender); border-color: var(--lavender); color: rgba(10,10,10,0.72); }
.c-peach { background: var(--peach); border-color: var(--peach); color: rgba(10,10,10,0.72); }
.c-ochre { background: var(--ochre); border-color: var(--ochre); color: rgba(10,10,10,0.72); }
.c-mint { background: var(--mint); border-color: var(--mint); color: rgba(10,10,10,0.72); }
.c-coral { background: var(--coral); border-color: var(--coral); color: rgba(255,255,255,0.88); }

.c-pink h3, .c-coral h3, .c-teal h3 { color: #fff; }
.c-lav h3, .c-peach h3, .c-ochre h3, .c-mint h3 { color: var(--ink); }
.c-pink .card-num, .c-coral .card-num, .c-teal .card-num { color: rgba(255,255,255,0.65); }
.c-lav .card-num, .c-peach .card-num, .c-ochre .card-num, .c-mint .card-num { color: rgba(10,10,10,0.5); }

/* ─────────────────────────────  chips  ──────────────────────────── */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.02em;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--canvas);
  color: var(--muted);
  white-space: nowrap;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip.on { border-color: var(--ink); color: var(--ink); }
.band-dark .chip { background: transparent; border-color: rgba(255,255,255,0.2); color: rgba(255,255,255,0.72); }

.tag-sev {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: var(--r-xs);
  font-weight: 500;
}
.sev-fatal { background: rgba(239,68,68,0.12); color: #b91c1c; }
.sev-serious { background: rgba(245,158,11,0.16); color: #a16207; }
.sev-manageable { background: rgba(34,197,94,0.14); color: #15803d; }

/* ─────────────────────────────  quote  ──────────────────────────── */

.quote {
  border-left: 2px solid var(--ink);
  padding: 4px 0 4px 22px;
  margin: 0;
  font-size: clamp(17px, 1.9vw, 22px);
  line-height: 1.42;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-weight: 500;
}
.quote cite {
  display: block;
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.band-dark .quote { border-left-color: var(--ochre); color: #fff; }
.band-dark .quote cite { color: var(--on-dark-soft); }

/* ────────────────────────────  topbar  ──────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 250, 240, 0.86);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--hairline);
}
.topbar-in {
  max-width: var(--content);
  margin: 0 auto;
  padding: 13px 28px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.brand {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.02em;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
}
.brand-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--pink);
  flex: none;
}
.topbar nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.topbar nav::-webkit-scrollbar { display: none; }
.topbar nav a {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}
.topbar nav a:hover { color: var(--ink); background: var(--surface-card); }

.btn {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
  padding: 9px 15px;
  border-radius: var(--r-sm);
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s, transform 0.08s;
  white-space: nowrap;
}
.btn:hover { background: #1f1f1f; }
.btn:active { transform: translateY(1px); }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--hairline);
}
.btn-ghost:hover { background: var(--surface-card); border-color: var(--muted-soft); }
.btn-sm { font-size: 12px; padding: 7px 12px; }

.lang {
  display: inline-flex;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  overflow: hidden;
  flex: none;
}
.lang button {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 7px 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.lang button.on { background: var(--ink); color: #fff; }

/* ─────────────────────────────  hero  ───────────────────────────── */

.hero { padding: 92px 0 var(--section); }
.hero .d-xl { max-width: 17ch; }
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  margin-top: 44px;
  padding-top: 26px;
  border-top: 1px solid var(--hairline);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
.hero-meta b { color: var(--ink); font-weight: 500; }

.thesis {
  margin-top: 44px;
  background: var(--teal);
  border-radius: var(--r-xl);
  padding: 40px;
  color: rgba(255,255,255,0.8);
}
.thesis .d-sm { color: #fff; max-width: 26ch; }
.thesis p { margin-top: 16px; max-width: 58ch; font-size: 15.5px; }

/* ───────────────────────────  diagrams  ─────────────────────────── */

.fig {
  margin: 0;
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  background: var(--surface-soft);
  padding: 34px;
  overflow: hidden;
}
.band-dark .fig {
  background: var(--surface-dark-elevated);
  border-color: rgba(255,255,255,0.1);
}
.fig figcaption {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--hairline);
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.03em;
  color: var(--muted);
  line-height: 1.5;
}
.band-dark .fig figcaption { border-top-color: rgba(255,255,255,0.12); color: var(--on-dark-soft); }

.fig-scroll { overflow-x: auto; }
.fig-scroll > svg { display: block; min-width: 720px; width: 100%; height: auto; }

/* node primitives used inside HTML diagrams */
.node {
  border: 1px solid var(--hairline);
  background: var(--canvas);
  border-radius: var(--r-md);
  padding: 16px 18px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--body-strong);
}
.node b { display: block; font-size: 14.5px; font-weight: 600; margin-bottom: 6px; letter-spacing: -0.01em; }
.node span { display: block; font-size: 13px; line-height: 1.5; color: var(--muted); }
.band-dark .node {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.9);
}
.band-dark .node span { color: rgba(255, 255, 255, 0.7); }

.node-accent { border-color: var(--ink); box-shadow: 0 2px 0 var(--ink); }
.band-dark .node-accent { border-color: var(--ochre); box-shadow: 0 2px 0 var(--ochre); }

.stack { display: flex; flex-direction: column; gap: 10px; }

/* ─────────────────────────  compare table  ──────────────────────── */

.tbl-scroll { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--hairline); }
table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--canvas);
}
th, td {
  text-align: left;
  padding: 15px 18px;
  border-bottom: 1px solid var(--hairline-soft);
  vertical-align: top;
}
thead th {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr.is-us { background: rgba(255, 77, 139, 0.055); }
tbody tr.is-us td:first-child { font-weight: 600; color: var(--ink); }
td b { color: var(--body-strong); }

/* ─────────────────────────────  steps  ──────────────────────────── */

.steps { counter-reset: step; display: grid; gap: 0; }
.step {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 22px;
  padding: 26px 0;
  border-top: 1px solid var(--hairline);
  align-items: start;
}
.step:last-child { border-bottom: 1px solid var(--hairline); }
.step-n {
  counter-increment: step;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted-soft);
  padding-top: 3px;
}
.step-n::before { content: "0" counter(step); }
.step h3 { margin-bottom: 8px; }
.step p { font-size: 15px; }
.step-meta {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ──────────────────────────  questions  ─────────────────────────── */

.q {
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 24px 26px;
  background: var(--canvas);
  transition: border-color 0.15s;
}
.q:hover { border-color: var(--muted-soft); }
.q-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.q-id {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted-soft);
}
.q h3 { font-size: 17px; letter-spacing: -0.015em; }
.q-why { font-size: 14.5px; margin-top: 9px; }
.q-test {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--surface-card);
  border-radius: var(--r-sm);
  font-size: 13.5px;
}
.q-test b {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
}

/* ───────────────────────  comment affordance  ───────────────────── */

.commentable { position: relative; }

.cbtn {
  position: absolute;
  top: 0;
  right: -13px;
  transform: translateX(100%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--canvas);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11.5px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.16s, border-color 0.16s, color 0.16s, background 0.16s;
  white-space: nowrap;
  z-index: 5;
}
.commentable:hover .cbtn,
.cbtn:focus-visible,
.cbtn.has { opacity: 1; }
.cbtn:hover { border-color: var(--ink); color: var(--ink); }
.cbtn.has { border-color: var(--pink); color: var(--pink); background: rgba(255,77,139,0.07); }
.cbtn svg { width: 13px; height: 13px; flex: none; }
.band-dark .cbtn { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.18); color: rgba(255,255,255,0.7); }
.band-dark .cbtn:hover { border-color: #fff; color: #fff; }

/*
  Below 1420px there is no gutter to float the pin into, and overlaying it on
  the block would cover the heading. Let it flow as the block's last element
  instead — always visible, never on top of content, touch-friendly.
*/
@media (max-width: 1420px) {
  .cbtn {
    position: static;
    transform: none;
    opacity: 1;
    display: inline-flex;
    margin-top: 18px;
  }
  .quote .cbtn { margin-top: 14px; }
}

/* ───────────────────────────  drawer  ───────────────────────────── */

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.38);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s;
  z-index: 60;
}
.scrim.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100vw);
  background: var(--canvas);
  border-left: 1px solid var(--hairline);
  transform: translateX(100%);
  transition: transform 0.26s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 70;
  display: flex;
  flex-direction: column;
  box-shadow: -20px 0 60px -30px rgba(0, 0, 0, 0.4);
}
.drawer.open { transform: none; }

.drawer-head {
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--hairline);
  flex: none;
}
.drawer-head .eyebrow { margin-bottom: 10px; }
.drawer-head h3 { font-size: 16px; letter-spacing: -0.02em; padding-right: 34px; }
.drawer-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  border: 1px solid var(--hairline);
  background: var(--canvas);
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.drawer-close:hover { color: var(--ink); border-color: var(--muted-soft); }

.thread {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.thread-empty {
  color: var(--muted-soft);
  font-size: 14px;
  text-align: center;
  padding: 34px 10px;
  line-height: 1.5;
}

.cmt { border-bottom: 1px solid var(--hairline-soft); padding-bottom: 16px; }
.cmt:last-child { border-bottom: 0; padding-bottom: 0; }
.cmt-top {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-bottom: 6px;
}
.cmt-who { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.cmt-when { font-family: var(--mono); font-size: 11px; color: var(--muted-soft); }
.cmt-del {
  margin-left: auto;
  border: 0;
  background: none;
  color: var(--muted-soft);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 4px;
  font-family: var(--mono);
}
.cmt-del:hover { color: var(--error); }
.cmt-body { font-size: 14.5px; line-height: 1.5; color: var(--body); white-space: pre-wrap; word-break: break-word; }

.composer {
  flex: none;
  border-top: 1px solid var(--hairline);
  padding: 16px 22px 20px;
  background: var(--surface-soft);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.composer input,
.composer textarea {
  width: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  resize: vertical;
}
.composer textarea { min-height: 88px; line-height: 1.5; }
.composer input:focus,
.composer textarea:focus { outline: none; border-color: var(--ink); }
.composer-row { display: flex; align-items: center; gap: 10px; }
.composer-row .btn { margin-left: auto; }
.composer-hint { font-family: var(--mono); font-size: 10.5px; color: var(--muted-soft); }
.composer-err { font-size: 12.5px; color: var(--error); }

/* floating total */
.fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 12px 17px;
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.5);
}
.fab:hover { background: #1f1f1f; }
.fab svg { width: 15px; height: 15px; }

/* ────────────────────────────  footer  ──────────────────────────── */

footer {
  border-top: 1px solid var(--hairline);
  margin-top: var(--section);
  padding: 40px 0 60px;
}
.foot-in {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 30px;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
}
.foot-in a { color: var(--muted); }

/* ─────────────────────────  responsive  ─────────────────────────── */

@media (max-width: 900px) {
  :root { --section: 76px; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: 1fr; }
  .thesis { padding: 28px; }
  .fig { padding: 22px; }
  .topbar nav { display: none; }
}

@media (max-width: 620px) {
  .g2, .g4 { grid-template-columns: 1fr; }
  .wrap { padding: 0 18px; }
  .step { grid-template-columns: 1fr; gap: 10px; }
  .hero { padding: 56px 0 var(--section); }
  .fab { right: 14px; bottom: 14px; }
}

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