/*
 * Ported from the nikkers.cc deep-dive style guide so both sites read as one
 * system. Those rules live inline in the nikke repo (src/pages/updates.ts and
 * src/lib/content-blocks.ts), not in @whykusanagi/corrupted-theme, so they have
 * to be copied rather than imported.
 *
 * ponytail: only the blocks a yap post actually uses — header, prose, quote,
 * index cards. Tables, grids, columns, figures, callouts and the
 * --nikke-element-* palette are deep-dive machinery for data articles. Copy one
 * over when a post needs it; do not port the whole system on spec.
 *
 * Core tokens (--accent, --text, --border, --glass, --radius-*) come from the
 * vendored theme. These four are defined by nikke locally, so they come too.
 */
:root {
  --upd-mono: ui-monospace, 'JetBrains Mono', Menlo, monospace;
  --upd-pink: #e86ca8;
  --upd-radius-card: 16px;
  --mono: ui-monospace, 'JetBrains Mono', Menlo, monospace;
}

/* ── page frame ─────────────────────────────────────────────────────────── */

.upd-wrap { padding: 2.5rem 0 5rem; }

.upd-header {
  text-align: center;
  padding: 1.5rem 0 2.5rem;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
  position: relative;
  background: transparent;
}
.upd-header::after {
  content: ''; position: absolute; bottom: -1px; left: 50%; transform: translateX(-50%);
  width: 200px; height: 3px;
  background: linear-gradient(135deg, var(--accent), #b61b70);
  box-shadow: 0 0 20px rgba(217, 79, 144, .55);
}

.upd-kicker {
  display: inline-flex; align-items: center; gap: .6rem;
  font-family: var(--upd-mono); font-size: .78rem; letter-spacing: 3px;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 1rem;
}
.upd-kicker .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 10px var(--accent);
  animation: updpulse 2s ease-in-out infinite;
}
@keyframes updpulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .4; transform: scale(.8); }
}

.upd-h1 {
  font-family: var(--upd-mono);
  font-size: clamp(2.2rem, 5vw, 4rem); font-weight: 800;
  letter-spacing: -1px; line-height: 1.05; margin: 0 0 .75rem;
  background: linear-gradient(135deg, #f5f1f8 0%, var(--upd-pink) 50%, var(--accent) 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  text-shadow: 0 0 60px rgba(217, 79, 144, .25);
}

.upd-sub {
  color: var(--text-secondary); font-style: italic; font-size: 1.05rem;
  max-width: 760px; margin: 0 auto;
}

.upd-datestamp {
  display: inline-block; margin-top: 1.25rem; padding: .4rem 1rem;
  font-family: var(--upd-mono); font-size: .8rem; letter-spacing: 2px;
  color: var(--upd-pink); background: rgba(217, 79, 144, .08);
  border: 1px solid rgba(217, 79, 144, .3); border-radius: 4px;
}

/* ── article body ───────────────────────────────────────────────────────── */

.ct-body > * { max-width: 47rem; margin-inline: auto; }
.ct-body > .ct-section-h { max-width: none; }

.ct-body .ct-p { line-height: 1.75; color: var(--text-secondary); margin: 0 auto 1.15em; }
.ct-body .ct-p strong { color: var(--text); }
.ct-body a { color: var(--accent-light); }
.ct-hi { color: var(--accent-light); font-weight: 600; }

.ct-list { color: var(--text-secondary); line-height: 1.75; margin: 0 auto 1.15em; padding-left: 1.4em; }
.ct-list li { margin: .35em 0; }

.ct-section-h {
  display: flex; align-items: baseline; gap: 1.25rem; padding-bottom: .9rem;
  margin: 2.4rem 0 1.75rem; border-bottom: 1px solid var(--border);
}
.ct-section-n {
  font-family: var(--mono); font-size: .82rem; font-weight: 700; letter-spacing: 2px;
  color: var(--accent); padding: .25rem .65rem; background: rgba(217, 79, 144, .1);
  border: 1px solid rgba(217, 79, 144, .3); border-radius: 4px;
}
.ct-section-t { font-size: 1.7rem; font-weight: 700; letter-spacing: -.5px; color: var(--text); margin: 0; }

.ct-quote {
  margin: 1.8em auto; padding: 1.2rem 1.4rem 1.2rem 2.6rem; position: relative;
  background: var(--glass); border: 1px solid var(--border); border-radius: var(--radius-md);
}

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

.dd-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--spacing-lg, 1.5rem); }
.dd-card {
  background: var(--glass); border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; text-decoration: none; display: block; transition: border-color .2s;
}
.dd-card:hover { border-color: var(--accent); }
.dd-card img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }
.dd-card-body { padding: 1.1rem 1.25rem; }
.dd-card-date { font-family: var(--mono); font-size: .72rem; letter-spacing: 1.5px; color: var(--accent); margin-bottom: .5rem; }
.dd-card-body h3 { margin: 0 0 .45rem; font-size: 1.05rem; color: var(--text); }
.dd-card-body p { margin: 0; color: var(--text-secondary); font-size: .88rem; line-height: 1.6; }

/* ── yap-specific: X embeds and the recap stat row ──────────────────────── */

/* widgets.js swaps the blockquote for an iframe it sizes itself, so this styles
   the pre-swap fallback — which is what survives a deleted tweet. */
.twitter-tweet {
  border-left: 2px solid var(--accent); color: var(--text-secondary);
  margin: 2rem auto; padding-left: 1rem; max-width: 47rem;
}

.yap-stats { display: flex; gap: 1.5rem; list-style: none; margin: 1.5rem auto; padding: 0; max-width: 47rem; }
.yap-stats strong { color: var(--accent); display: block; font-size: 1.5rem; font-family: var(--upd-mono); }
.yap-stats li { color: var(--text-muted); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; }

@media (max-width: 640px) {
  .upd-wrap { padding: 1.5rem 0 3rem; }
  .yap-stats { gap: 1rem; }
  .ct-cols { grid-template-columns: 1fr; }
}


/* ---------------------------------------------------------------------------
   Remaining deep-dive content blocks, ported from
   nikke/src/lib/content-blocks.ts so a yap post can use the same markup a deep
   dive does: tables, grids, callouts, figures, stat rows, badges.
   Skipped: .ct-entity, .ct-attrs, .ct-media — those are NIKKE unit cards.
   Tracked for promotion into the theme in corrupted-theme#76.
   --------------------------------------------------------------------------- */
:root { --cyan: var(--corrupted-cyan); }

.ct-body > .ct-figure { max-width: none; }
.ct-body > .ct-table { max-width: 62rem; }
.ct-h3 { font-size: 1.15rem; font-weight: 700; margin: 1.6em auto .6em; color: var(--accent-light); }
.ct-figure, .ct-table { margin: 1.9em auto; }
.ct-figure img { width: 100%; height: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); display: block; }
.ct-figure figcaption, .ct-table figcaption { color: var(--text-muted); font-size: .82rem;
      margin: .6em auto 0; text-align: center; max-width: 47rem; }
.ct-table-scroll { overflow-x: auto; border-radius: var(--radius-lg); }
.ct-table table { width: 100%; border-collapse: collapse; background: var(--glass);
      border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.ct-table th, .ct-table td { padding: .6em .9em; border-bottom: 1px solid var(--border-light); font-size: .9rem; }
.ct-table tbody tr:last-child td { border-bottom: 0; }
.ct-table td { color: var(--text-secondary); }
.ct-table th { background: rgba(217,79,144,.08); color: var(--accent-light);
      font-family: var(--mono, ui-monospace, monospace); font-size: .78rem; letter-spacing: 1px;
      text-transform: uppercase; white-space: nowrap; }
.ct-callout { position: relative; margin: 1.8em auto; padding: 1.15rem 1.35rem;
      background: var(--glass); border: 1px solid var(--border); border-radius: var(--radius-md); }
.ct-callout::before { content: ""; position: absolute; inset: 5px; pointer-events: none; z-index: 2;
      opacity: .6;
      background:
        linear-gradient(var(--accent, #d94f90), var(--accent, #d94f90)) left top / 13px 1px no-repeat,
        linear-gradient(var(--accent, #d94f90), var(--accent, #d94f90)) left top / 1px 13px no-repeat,
        linear-gradient(var(--ct-tone, #d94f90), var(--ct-tone, #d94f90)) right bottom / 13px 1px no-repeat,
        linear-gradient(var(--ct-tone, #d94f90), var(--ct-tone, #d94f90)) right bottom / 1px 13px no-repeat; }
.ct-callout::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
      border-radius: inherit;
      background: repeating-linear-gradient(0deg, transparent 0 2px,
        color-mix(in srgb, var(--ct-tone, #d94f90) 4%, transparent) 2px 3px); }
.ct-callout > * { position: relative; z-index: 3; }
.ct-callout p { margin: 0 0 .5em; color: var(--text-secondary); line-height: 1.7; }
.ct-callout p:last-child { margin: 0; }
.ct-callout strong { color: var(--text); }
.ct-callout-title { font-family: var(--mono, ui-monospace, monospace); font-weight: 700;
      color: var(--ct-tone, var(--accent)); margin-bottom: .6em; text-transform: uppercase;
      font-size: .76rem; letter-spacing: 2.5px; }
.ct-slash { opacity: .55; }
.ct-key { --ct-tone: var(--accent, #d94f90); }
.ct-warn { --ct-tone: #e0a106; }
.ct-info { --ct-tone: var(--cyan, #00ffff); }
.ct-quote::before { content: "“"; position: absolute; left: .7rem; top: .2rem;
      font-family: var(--mono, ui-monospace, monospace); font-size: 2.4rem; line-height: 1;
      color: var(--accent); opacity: .5; }
.ct-quote::after { content: ""; position: absolute; inset: 5px; pointer-events: none;
      opacity: .5;
      background:
        linear-gradient(var(--accent, #d94f90), var(--accent, #d94f90)) right bottom / 13px 1px no-repeat,
        linear-gradient(var(--accent, #d94f90), var(--accent, #d94f90)) right bottom / 1px 13px no-repeat; }
.ct-quote-text { color: var(--text); line-height: 1.7; font-size: 1.05rem; }
.ct-quote-attr { margin-top: .8rem; font-family: var(--mono, ui-monospace, monospace);
      font-size: .74rem; letter-spacing: 1.5px; text-transform: uppercase;
      color: var(--text-muted); text-align: right; }
.ct-cols { display: grid; grid-template-columns: repeat(var(--ct-cols, 2), minmax(0, 1fr));
      gap: 1.4rem; margin: 1.8em auto; }
.ct-col > *:first-child { margin-top: 0; }
.ct-col > .ct-p:last-child { margin-bottom: 0; }
.ct-badges { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .4rem; }
.ct-badge { font-family: var(--mono, ui-monospace, monospace); font-size: .62rem; letter-spacing: 1.5px;
      text-transform: uppercase; padding: .15rem .45rem; border-radius: 3px;
      border: 1px solid var(--accent); color: var(--accent); }
.ct-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(var(--ct-grid-min, 260px), 1fr));
      gap: 1rem; margin: 1.8em auto; }
.ct-cell { position: relative; padding: 1.05rem 1.2rem; background: var(--glass);
      border: 1px solid var(--border); border-radius: var(--radius-md); }
.ct-cell::before { content: ""; position: absolute; inset: 5px; pointer-events: none; opacity: .45;
      background:
        linear-gradient(var(--accent, #d94f90), var(--accent, #d94f90)) left top / 11px 1px no-repeat,
        linear-gradient(var(--accent, #d94f90), var(--accent, #d94f90)) left top / 1px 11px no-repeat; }
.ct-cell > * { position: relative; }
.ct-cell-eyebrow { font-family: var(--mono, ui-monospace, monospace); font-size: .68rem;
      letter-spacing: 2px; text-transform: uppercase; color: var(--accent); margin-bottom: .45rem; }
.ct-cell-title { margin: 0 0 .5rem; font-size: 1rem; font-weight: 700; color: var(--text); }
.ct-cell .ct-p { font-size: .9rem; margin-bottom: .6em; }
.ct-cell .ct-p:last-child { margin-bottom: 0; }
.ct-stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
      gap: .9rem; margin: 1.7em auto; }
.ct-stat { padding: .95rem 1.15rem; background: var(--glass); border: 1px solid var(--border);
      border-radius: var(--radius-lg); }
.ct-stat-value { font-size: 1.7rem; font-weight: 800; color: var(--accent-light); line-height: 1.1;
      font-variant-numeric: tabular-nums; }
.ct-stat-label { color: var(--text-muted); font-size: .8rem; margin-top: .3rem; }
.ct-stat-sub { color: var(--text-muted); font-size: .72rem; margin-top: .2em; }
.ct-col > .ct-callout { margin: 0; height: 100%; }

/* ---------------------------------------------------------------------------
   Data display, ported from nikke-analysis/recap/recap.css (the CORELUST
   season recap). That page ships its own palette; these alias onto the
   corrupted theme's equivalents instead, so light/dark keeps working without a
   second set of colours to maintain. Tracked in corrupted-theme#76.
   --------------------------------------------------------------------------- */
:root {
  --surface-2: var(--surface-elevated);
  --line: var(--border);
  --faint: var(--text-muted);
  --muted: var(--text-secondary);
  --up: var(--corrupted-green);
}

/* Stat tiles — label, big number, one line of context. */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 22px auto; }
.tile { background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; padding: 14px; }
.tile .k { font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.tile .v { font-family: var(--mono); font-size: 1.5rem; font-weight: 700; margin-top: 4px; line-height: 1; }
.tile .d { font-family: var(--mono); font-size: .76rem; color: var(--up); margin-top: 5px; }
.tile .d.mut { color: var(--muted); }

/* Bar chart. Heights are inline percentages computed by scripts/stream-recap.mjs;
   the last bar is the current/most recent one and stays full accent. */
.spark { display: flex; align-items: flex-end; gap: 3px; height: 72px; padding-top: 2px; }
.spark .b { flex: 1; border-radius: 2px 2px 0 0; background: var(--accent); min-height: 2px; }
.spark .b.empty { background: var(--line); opacity: .5; }
.spark .b:not(:last-child) { background: color-mix(in srgb, var(--accent) 42%, var(--surface-2)); }
.spark.flat .b { background: color-mix(in srgb, var(--accent) 42%, var(--surface-2)); }
.spark-x { display: flex; justify-content: space-between; font-family: var(--mono);
  font-size: .6rem; color: var(--faint); margin-top: 5px; }
.spark-wrap { margin: 20px auto; }
.spark-cap { font-family: var(--mono); font-size: .64rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--faint); margin-bottom: 8px; }

/* Award rows — small category, enormous winner. This is the part that reads as
   a graphic on stream instead of a paragraph to be read aloud. */
.awards-list { display: grid; border-top: 1px solid var(--line); margin: 20px auto 14px; }
.award-row { display: grid; grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto auto; padding: 18px 0; border-bottom: 1px solid var(--line); }
.award-cat { grid-column: 1; grid-row: 1; font-family: var(--mono); font-size: .64rem;
  letter-spacing: .18em; text-transform: uppercase; color: var(--accent); }
.award-winner { grid-column: 1; grid-row: 2; font-size: clamp(1.9rem, 4.6vw, 2.9rem);
  font-weight: 800; line-height: 1.05; margin-top: 6px; overflow-wrap: anywhere; }
.award-detail { grid-column: 1; grid-row: 3; color: var(--muted); font-size: .9rem;
  max-width: 58ch; margin-top: 9px; line-height: 1.5; }
.award-stat { grid-column: 2; grid-row: 2 / 4; align-self: center; justify-self: end;
  text-align: right; white-space: nowrap; font-family: var(--mono); font-size: 1.6rem;
  font-weight: 700; color: var(--accent); padding-left: 16px; }
@media (max-width: 560px) {
  .tiles { grid-template-columns: 1fr; }
  .award-row { grid-template-columns: 1fr; gap: 5px; }
  .award-stat { grid-column: 1; grid-row: auto; justify-self: start;
    text-align: left; margin-top: 4px; font-size: 1.4rem; padding-left: 0; }
}

/* Back to the index. Was lost in the deep-dive restyle; without it the only
   way out of a post is the browser's back button, which is useless when the
   page is being scrolled on a capture source rather than driven by a mouse. */
.yap-nav { display: flex; justify-content: space-between; align-items: baseline;
  max-width: 47rem; margin: 0 auto 18px; font-family: var(--mono); font-size: .72rem;
  letter-spacing: .12em; text-transform: uppercase; }
.yap-nav a { color: var(--text-muted); text-decoration: none; border-bottom: 1px solid transparent; }
.yap-nav a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.yap-foot { max-width: 47rem; margin: 38px auto 0; padding-top: 18px;
  border-top: 1px solid var(--border); font-family: var(--mono); font-size: .72rem;
  letter-spacing: .12em; text-transform: uppercase; }
.yap-foot a { color: var(--text-muted); text-decoration: none; }
.yap-foot a:hover { color: var(--accent); }

/* YouTube embed. youtube-nocookie.com so a reader who never presses play does
   not get a tracking cookie. Aspect-ratio keeps it responsive without the
   padding-top wrapper hack. */
.yap-video { margin: 22px auto; max-width: 47rem; }
.yap-video iframe { width: 100%; aspect-ratio: 16 / 9; height: auto;
  border: 1px solid var(--border); border-radius: var(--radius-lg); display: block; }
.yap-video figcaption { font-family: var(--mono); font-size: .72rem; color: var(--text-muted);
  margin-top: 8px; letter-spacing: .06em; }

/* ---------- Celeste aside -------------------------------------------------
   The two-hander. His prose stays plain; she gets the boxes. Flex, so the
   chibi is optional — drop the <img> and the text just takes the full width.
   Use as: <div class="ct-callout ct-key ct-celeste"><img …><div>…</div></div>
   Art: /assets/celeste/{mocking,cheek,wow}.png — all 220px tall, alpha.    */
.ct-celeste { display: flex; gap: 1.1rem; align-items: center; }
.ct-celeste > img { flex: 0 0 auto; height: 120px; width: auto;
  filter: drop-shadow(0 2px 7px rgba(0, 0, 0, .5)); }
.ct-celeste > div { flex: 1 1 auto; min-width: 0; }
@media (max-width: 560px) {
  .ct-celeste { gap: .75rem; }
  .ct-celeste > img { height: 78px; }
}

/* Celeste's voiced take: native player under the callout text.
   Generated by scripts/celeste-voice.mjs from the callout's data-voice. */
.ct-celeste audio.ct-voice { display: block; width: 100%; max-width: 320px; height: 32px;
  margin-top: .6rem; color-scheme: dark; }

/* Code blocks in a post: the theme styles <pre>; undo its inline-code chip inside one. */
.ct-body pre { white-space: pre; font-size: .82rem; }
.ct-body pre code { display: block; border: 0; padding: 0; background: none; }
