/* =========================================================================
   Pipocket — Obsidian & Bullion
   A flat-file XAUUSD desk. Dark-first, gold-accented, mobile-first layout.
   ========================================================================= */

/* ---------- 1. Tokens -------------------------------------------------- */
:root {
  --gold: #e8b53a;
  --gold-bright: #f7d774;
  --gold-deep: #b9801f;

  --accent-news: #f2a63b;
  --accent-signals: #2fd39a;
  --accent-ea: #9b8cff;

  --bg: #0a0c10;
  --bg-alt: #0d1017;
  --panel: #12161e;
  --panel-2: #171c26;
  --line: #232a36;
  --line-soft: #1a212c;

  --ink: #e9ecf3;
  --ink-soft: #b8c0cf;
  --ink-mute: #8b95a7;

  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 999px;

  --shadow: 0 18px 40px -24px rgba(0, 0, 0, .9);
  --shadow-lift: 0 28px 60px -28px rgba(0, 0, 0, .95);

  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --wrap: 1180px;
  --gutter: clamp(1rem, 4vw, 2.5rem);

  --ease: cubic-bezier(.22, .61, .36, 1);
}

html[data-theme="light"] {
  --gold: #a8710d;
  --gold-bright: #c9871a;
  --gold-deep: #7d5309;
  --accent-news: #b9700c;
  --accent-signals: #0f8f68;
  --accent-ea: #5a49d6;

  --bg: #fbf8f2;
  --bg-alt: #f5f0e6;
  --panel: #ffffff;
  --panel-2: #faf6ee;
  --line: #e2d9c8;
  --line-soft: #ece4d6;

  --ink: #14161a;
  --ink-soft: #454b57;
  --ink-mute: #6d7480;

  --shadow: 0 18px 40px -30px rgba(60, 45, 15, .45);
  --shadow-lift: 0 28px 55px -32px rgba(60, 45, 15, .5);
}

/* ---------- 2. Base ---------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Guard against a stray wide element, but never put this on body: a scroll
     container there swallows window scrolling (progress bar, TOC spy, anchors). */
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: clamp(15.5px, 1.6vw, 17px);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px 520px at 12% -8%, rgba(232, 181, 58, .10), transparent 60%),
    radial-gradient(760px 460px at 92% 4%, rgba(155, 140, 255, .07), transparent 62%),
    repeating-linear-gradient(to right, var(--line-soft) 0 1px, transparent 1px 96px),
    repeating-linear-gradient(to bottom, var(--line-soft) 0 1px, transparent 1px 96px);
  opacity: .55;
  mask-image: linear-gradient(to bottom, #000 0, transparent 62%);
}

html[data-theme="light"] body::before { opacity: .8; }

img, svg { max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--gold-bright); }
button { font: inherit; color: inherit; }

h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.15; letter-spacing: -.022em; font-weight: 800; }
p { margin: 0 0 1em; }

code, kbd { font-family: var(--font-mono); font-size: .9em; }

kbd {
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: .05em .4em;
  background: var(--panel-2);
}

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); position: relative; z-index: 1; }
.section { margin: clamp(2.5rem, 6vw, 4.5rem) auto 0; }
.section--related { margin-top: clamp(2rem, 5vw, 3.5rem); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--gold); color: #17140c; padding: .6rem 1rem; border-radius: 0 0 10px 0; font-weight: 700;
}
.skip-link:focus { left: 0; }
:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 3px; border-radius: 4px; }

/* ---------- 3. Header -------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line-soft);
}
.header-inner { display: flex; align-items: center; gap: clamp(.7rem, 2vw, 1.6rem); min-height: 68px; }

.brand { display: flex; align-items: center; gap: .65rem; flex: 0 0 auto; }
.brand-mark { display: grid; place-items: center; filter: drop-shadow(0 6px 14px rgba(232, 181, 58, .28)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 1.06rem; letter-spacing: .01em; }
.brand-text small { font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-mute); }

.nav { display: flex; align-items: center; gap: .3rem; margin-inline-start: auto; }
.nav a {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem .7rem; border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 600; color: var(--ink-soft);
  transition: background .18s var(--ease), color .18s var(--ease);
}
.nav a:hover { background: var(--panel); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--panel); box-shadow: inset 0 -2px 0 var(--gold); }
.nav-count {
  font-family: var(--font-mono); font-size: .7rem; color: var(--ink-mute);
  background: var(--bg-alt); border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 0 .35rem;
}

.header-tools { display: flex; align-items: center; gap: .35rem; }
.icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px;
  background: transparent; border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--ink-soft); cursor: pointer; transition: all .18s var(--ease);
}
.icon-btn:hover { color: var(--gold-bright); border-color: var(--gold-deep); background: var(--panel); }
.hamburger { display: none; }

/* Status tape */
.tape { border-top: 1px solid var(--line-soft); background: linear-gradient(90deg, rgba(232, 181, 58, .09), transparent 42%); }
.tape-inner {
  display: flex; align-items: center; gap: 1.2rem; padding-block: .5rem;
  font-family: var(--font-mono); font-size: .74rem; color: var(--ink-mute);
  overflow-x: auto; scrollbar-width: none; white-space: nowrap;
}
.tape-inner::-webkit-scrollbar { display: none; }
.tape-item { display: inline-flex; align-items: center; gap: .45rem; flex: 0 0 auto; }
.tape-item code { color: var(--gold-bright); background: transparent; }
.tape-item--gold { color: var(--gold); margin-inline-start: auto; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-signals); box-shadow: 0 0 0 4px rgba(47, 211, 154, .14); }

/* ---------- 4. Hero ---------------------------------------------------- */
.hero { padding: clamp(2.5rem, 7vw, 5rem) 0 clamp(1.5rem, 4vw, 3rem); position: relative; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(1.4rem, 4vw, 2.6rem); align-items: center; }
.hero-inner { max-width: 940px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .55rem;
  font-family: var(--font-mono); font-size: .76rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink-mute); margin: 0 0 1.1rem;
}
.hero h1 { font-size: clamp(2.05rem, 6.4vw, 3.9rem); margin-bottom: .7rem; }
.grad {
  background: linear-gradient(100deg, var(--gold-bright), var(--gold) 40%, var(--gold-deep));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lede { color: var(--ink-soft); font-size: clamp(1rem, 1.9vw, 1.14rem); max-width: 62ch; }

.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .8rem 1.25rem; border-radius: var(--radius-pill); border: 1px solid transparent;
  font-weight: 700; font-size: .92rem; cursor: pointer; transition: all .2s var(--ease);
}
.btn--gold {
  background: linear-gradient(120deg, var(--gold-bright), var(--gold));
  color: #17140c; box-shadow: 0 12px 26px -14px rgba(232, 181, 58, .8);
}
.btn--gold:hover { color: #17140c; transform: translateY(-1px); box-shadow: 0 18px 34px -16px rgba(232, 181, 58, .95); }
.btn--ghost { border-color: var(--line); color: var(--ink-soft); background: var(--panel); }
.btn--ghost:hover { color: var(--ink); border-color: var(--gold-deep); }

.section-note { margin: 0; font-family: var(--font-mono); font-size: .74rem; color: var(--ink-mute); }

/* ---------- 5. Page head (category / search / 404) --------------------- */
.page-head { padding: clamp(2rem, 5vw, 3.4rem) 0 0; }
.page-head h1 { font-size: clamp(1.8rem, 4.6vw, 2.9rem); }
.page-head-meta { font-size: .85rem; color: var(--ink-mute); font-family: var(--font-mono); }
.crumbs { display: flex; gap: .5rem; align-items: center; font-size: .8rem; color: var(--ink-mute); margin-bottom: 1rem; font-family: var(--font-mono); }
.crumbs a { color: var(--ink-soft); }
.crumbs a:hover { color: var(--gold-bright); }

/* ---------- 6. Hero art panel ----------------------------------------- */
.hero-art {
  display: flex; flex-direction: column; justify-content: flex-end; gap: .8rem;
  border-radius: var(--radius-sm); border: 1px solid var(--line-soft);
  background:
    radial-gradient(120% 80% at 50% 120%, rgba(232, 181, 58, .16), transparent 60%),
    repeating-linear-gradient(to bottom, var(--line-soft) 0 1px, transparent 1px 34px),
    var(--panel);
  padding: 1.2rem; min-height: 210px;
}
.sep { color: var(--line); }

.tape-art { display: flex; align-items: flex-end; gap: 6px; height: 130px; }
.tape-art span {
  flex: 1 1 0; border-radius: 3px;
  background: linear-gradient(to top, var(--gold-deep), var(--gold-bright));
  animation: tape-fade .85s var(--ease) both;
}
.tape-art span:nth-child(1) { height: 34%; animation-delay: .02s; }
.tape-art span:nth-child(2) { height: 52%; animation-delay: .06s; }
.tape-art span:nth-child(3) { height: 41%; animation-delay: .10s; }
.tape-art span:nth-child(4) { height: 66%; animation-delay: .14s; }
.tape-art span:nth-child(5) { height: 58%; animation-delay: .18s; }
.tape-art span:nth-child(6) { height: 84%; animation-delay: .22s; }
.tape-art span:nth-child(7) { height: 74%; animation-delay: .26s; }
.tape-art span:nth-child(8) { height: 96%; animation-delay: .30s; }
.tape-art span:nth-child(9) { height: 88%; animation-delay: .34s; }
.tape-art span:nth-child(10) { height: 100%; animation-delay: .38s; }
.tape-art span:nth-child(11) { height: 92%; animation-delay: .42s; }
.tape-art span:nth-child(12) { height: 78%; animation-delay: .46s; opacity: .55; }
/* Fade-in only: the bars keep their full height from the first paint, so the
   graphic never renders as a row of stubs on slow loads or frozen captures. */
@keyframes tape-fade { from { opacity: .3; } to { opacity: 1; } }
.hero-art-label {
  margin: 0; font-family: var(--font-mono); font-size: .72rem; letter-spacing: .3em;
  text-transform: uppercase; color: var(--ink-mute); text-align: center;
}

/* ---------- 7. Badges, chips, levels ---------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: .3rem .6rem; border-radius: var(--radius-pill);
  border: 1px solid var(--line); background: var(--bg-alt); color: var(--ink-soft);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--news { color: var(--accent-news); border-color: color-mix(in srgb, var(--accent-news) 42%, transparent); background: color-mix(in srgb, var(--accent-news) 12%, transparent); }
.badge--signals { color: var(--accent-signals); border-color: color-mix(in srgb, var(--accent-signals) 42%, transparent); background: color-mix(in srgb, var(--accent-signals) 12%, transparent); }
.badge--ea-trading { color: var(--accent-ea); border-color: color-mix(in srgb, var(--accent-ea) 42%, transparent); background: color-mix(in srgb, var(--accent-ea) 12%, transparent); }
a.badge:hover { color: var(--gold-bright); }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; margin: .8rem 0; padding: 0; }
.chips li { margin: 0; }
.chips code {
  display: inline-block; padding: .2rem .5rem; border-radius: 7px;
  background: var(--bg-alt); border: 1px solid var(--line-soft);
  color: var(--gold); font-size: .78rem;
}

/* ---------- 8. Grid + cards ------------------------------------------- */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.section-title { font-size: clamp(1.3rem, 2.6vw, 1.8rem); margin: 0; }

.filter-bar { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .42rem .8rem; border-radius: var(--radius-pill);
  background: var(--panel); border: 1px solid var(--line); color: var(--ink-soft);
  font-size: .82rem; font-weight: 600; cursor: pointer; transition: all .18s var(--ease);
}
.chip span { font-family: var(--font-mono); font-size: .7rem; color: var(--ink-mute); }
.chip:hover { border-color: var(--gold-deep); color: var(--ink); }
.chip.is-active { background: linear-gradient(120deg, var(--gold-bright), var(--gold)); border-color: transparent; color: #17140c; }
.chip.is-active span { color: rgba(23, 20, 12, .65); }
.inline-search { display: block; min-width: min(260px, 60vw); }
.inline-search input {
  width: 100%; padding: .48rem .8rem; border-radius: var(--radius-pill);
  background: var(--panel); border: 1px solid var(--line); color: var(--ink); font-size: .85rem;
}

/* Article rows: a dense list, not a card grid. */
.articles {
  list-style: none; margin: 0; padding: 0; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.article-row {
  position: relative; display: grid; grid-template-columns: 104px minmax(0, 1fr) auto;
  gap: clamp(.7rem, 2vw, 1.2rem); align-items: start;
  padding: 1rem 1.15rem; border-bottom: 1px solid var(--line-soft);
  transition: background .18s var(--ease);
}
.article-row:last-child { border-bottom: 0; }
.article-row:hover { background: var(--panel-2); }
.article-row[hidden] { display: none; }
.article-row--latest { background: linear-gradient(90deg, color-mix(in srgb, var(--gold) 9%, transparent), transparent 45%); }
.article-hit { position: absolute; inset: 0; z-index: 1; border-radius: var(--radius); }
.article-hit:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: -3px; }
.article-tag {
  justify-self: start; display: inline-flex; align-items: center; gap: .35rem;
  font-size: .68rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  padding: .26rem .55rem; border-radius: var(--radius-pill);
  border: 1px solid var(--line); background: var(--bg-alt); color: var(--ink-soft);
}
.article-tag--news { color: var(--accent-news); border-color: color-mix(in srgb, var(--accent-news) 42%, transparent); background: color-mix(in srgb, var(--accent-news) 12%, transparent); }
.article-tag--signals { color: var(--accent-signals); border-color: color-mix(in srgb, var(--accent-signals) 42%, transparent); background: color-mix(in srgb, var(--accent-signals) 12%, transparent); }
.article-tag--ea-trading { color: var(--accent-ea); border-color: color-mix(in srgb, var(--accent-ea) 42%, transparent); background: color-mix(in srgb, var(--accent-ea) 12%, transparent); }
.article-body { min-width: 0; }
.article-title { font-size: 1.06rem; margin: 0 0 .3rem; }
.article-pin {
  display: inline-block; margin-left: .45rem; vertical-align: middle;
  font-size: .6rem; letter-spacing: .14em; text-transform: uppercase;
  color: #17140c; background: linear-gradient(120deg, var(--gold-bright), var(--gold));
  border-radius: var(--radius-pill); padding: .16rem .48rem;
}
.article-teaser { margin: 0 0 .5rem; color: var(--ink-soft); font-size: .9rem; }
.article-meta { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; font-family: var(--font-mono); font-size: .72rem; color: var(--ink-mute); }
.article-meta .chips { margin: 0; }
.article-cta { align-self: center; font-size: .8rem; font-weight: 700; color: var(--gold); white-space: nowrap; }
.article-row:hover .article-cta { color: var(--gold-bright); }

.empty-state { color: var(--ink-mute); font-size: .92rem; }

/* ---------- 9. Board index -------------------------------------------- */
.boards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: clamp(.9rem, 2vw, 1.2rem); }
.board {
  display: flex; flex-direction: column; gap: .6rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem; position: relative; overflow: hidden;
  transition: border-color .22s var(--ease);
}
.board::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; opacity: .8;
  background: linear-gradient(90deg, var(--ink-mute), transparent 70%);
}
.board--news::before { background: linear-gradient(90deg, var(--accent-news), transparent 70%); }
.board--signals::before { background: linear-gradient(90deg, var(--accent-signals), transparent 70%); }
.board--ea::before { background: linear-gradient(90deg, var(--accent-ea), transparent 70%); }
.board:hover { border-color: color-mix(in srgb, var(--gold) 40%, var(--line)); }
.board-head { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; flex-wrap: wrap; }
.board-title { font-size: 1.06rem; margin: 0; }
.board-title a:hover { color: var(--gold-bright); }
.board-tagline { margin: 0; font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-mute); }
.board-blurb { margin: 0; color: var(--ink-soft); font-size: .88rem; }
.board-stats {
  display: flex; gap: 1.4rem; margin: auto 0 0; padding: .7rem 0 0;
  border-top: 1px dashed var(--line-soft);
}
.board-stats dt { font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-mute); }
.board-stats dd { margin: .15rem 0 0; font-family: var(--font-mono); font-size: .92rem; color: var(--ink); }
.board-last { margin: 0; display: grid; gap: .15rem; font-size: .84rem; color: var(--ink-soft); }
.board-last span { font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.board-last a { color: var(--ink); }
.board-last a:hover { color: var(--gold-bright); }
.board-last--empty { color: var(--ink-mute); }

/* ---------- 10. Panels ------------------------------------------------- */
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(1.3rem, 3vw, 2rem);
}
.panel--method { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: clamp(1.2rem, 3vw, 2.4rem); align-items: center; }
.panel--method h2 { font-size: clamp(1.2rem, 2.4vw, 1.6rem); }
.method-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; }
.method-list li { padding-left: 1.4rem; position: relative; color: var(--ink-soft); font-size: .92rem; }
.method-list li::before { content: ""; position: absolute; left: 0; top: .55em; width: 8px; height: 8px; border-radius: 2px; background: var(--gold); }
.panel--empty, .panel--404 { text-align: center; }
.panel--404 { max-width: 620px; margin: 3rem auto; }

/* ---------- 11. Post page --------------------------------------------- */
.progress { position: fixed; inset: 0 0 auto 0; height: 3px; background: transparent; z-index: 60; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-bright), var(--gold), var(--gold-deep)); transition: width .1s linear; }

.post-head { padding: clamp(1.8rem, 4.5vw, 3rem) 0 clamp(1.2rem, 3vw, 2rem); border-bottom: 1px solid var(--line-soft); }
.post-tags { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin-bottom: .9rem; }
.post-tagline { font-size: .82rem; color: var(--ink-mute); }
.post-title { font-size: clamp(1.75rem, 4.6vw, 3rem); max-width: 26ch; }
.post-summary { color: var(--ink-soft); font-size: clamp(1rem, 2vw, 1.12rem); max-width: 72ch; }
.post-meta { display: flex; flex-wrap: wrap; gap: 1.2rem; font-family: var(--font-mono); font-size: .76rem; color: var(--ink-mute); }
.post-levels { margin-top: 1.2rem; display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.post-levels-label { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-mute); }
.post-levels .chips { margin: 0; }

.post-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(1.4rem, 3vw, 2.6rem); padding-top: clamp(1.6rem, 4vw, 2.6rem); }
.post-main { min-width: 0; }

.post-aside { display: grid; gap: 1rem; align-content: start; }
.toc { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .9rem 1rem; }
.toc summary { cursor: pointer; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-mute); }
.toc ol { list-style: none; margin: .8rem 0 0; padding: 0; display: grid; gap: .45rem; counter-reset: toc; }
.toc li a { font-size: .86rem; color: var(--ink-soft); display: block; padding-left: .7rem; border-left: 2px solid var(--line); }
.toc li.toc-l3 a { padding-left: 1.4rem; font-size: .82rem; color: var(--ink-mute); }
.toc li.toc-l4 a { padding-left: 1.4rem; font-size: .82rem; color: var(--ink-mute); }
.toc li a:hover, .toc li a.is-active { color: var(--gold-bright); border-left-color: var(--gold); }
.aside-share { display: flex; align-items: center; gap: .5rem; font-size: .8rem; color: var(--ink-mute); flex-wrap: wrap; }
.aside-share a, .aside-share button {
  border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius-pill);
  padding: .3rem .7rem; font-size: .78rem; cursor: pointer; color: var(--ink-soft);
}
.aside-share a:hover, .aside-share button:hover { color: var(--gold-bright); border-color: var(--gold-deep); }

/* Trade plan card */
.trade-plan {
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-left: 3px solid var(--accent-signals);
  border-radius: var(--radius); padding: 1.2rem 1.3rem; margin-bottom: 1.8rem;
}
.trade-plan-title { font-size: 1rem; margin: 0 0 .9rem; display: flex; align-items: center; gap: .55rem; }
.trade-plan-grid { margin: 0; display: grid; gap: .55rem; }
.trade-plan-row { display: grid; grid-template-columns: minmax(96px, 130px) minmax(0, 1fr); gap: .8rem; align-items: baseline; padding-bottom: .5rem; border-bottom: 1px dashed var(--line-soft); }
.trade-plan-row:last-child { border-bottom: 0; padding-bottom: 0; }
.trade-plan-row dt { font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-mute); }
.trade-plan-row dd { margin: 0; font-family: var(--font-mono); font-size: .88rem; color: var(--ink); }
.trade-plan-row--entry dd { color: var(--accent-signals); font-weight: 600; }
.trade-plan-row--stop-loss dd { color: #ff7a70; font-weight: 600; }
.trade-plan-row[class*="take-profit"] dd { color: var(--gold-bright); }
.trade-plan-row--risk-reward dd { color: var(--gold); }
.trade-plan-note { margin: .9rem 0 0; font-size: .78rem; color: var(--ink-mute); }

/* Prose */
.prose { color: var(--ink-soft); font-size: 1.02rem; }
.prose > * + * { margin-top: 1.15em; }
.prose h2, .prose h3, .prose h4 { color: var(--ink); scroll-margin-top: 90px; }
.prose h2, .prose h3 { font-size: clamp(1.3rem, 2.7vw, 1.65rem); margin-top: 2.2em; padding-left: .7rem; border-left: 3px solid var(--gold); }
/* Markdown "##" renders as h3 (the post title owns h1/h2 space), so h3 is the
   section level that carries the gold rule. */
.prose h3 { font-size: clamp(1.24rem, 2.5vw, 1.52rem); }
.prose h4 { font-size: clamp(1.02rem, 2vw, 1.18rem); margin-top: 1.9em; }
.prose p { margin: 0; }
.prose strong { color: var(--ink); }
.prose a { color: var(--gold); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--gold) 45%, transparent); text-underline-offset: 3px; }
.prose a:hover { color: var(--gold-bright); text-decoration-color: currentColor; }
.prose ul, .prose ol { padding-left: 1.25rem; display: grid; gap: .5rem; }
.prose ul { list-style: none; padding-left: 1.1rem; }
.prose ul > li { position: relative; }
.prose ul > li::before { content: ""; position: absolute; left: -1rem; top: .62em; width: 7px; height: 7px; border-radius: 2px; background: var(--gold); }
.prose ol { padding-left: 1.5rem; }
.prose ol > li::marker { color: var(--gold); font-family: var(--font-mono); }
.prose blockquote {
  margin: 0; padding: .9rem 1.1rem; border-left: 3px solid var(--accent-ea);
  background: var(--panel); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic; color: var(--ink-soft);
}
.prose blockquote p { margin: 0; }
.prose hr { border: 0; height: 1px; background: linear-gradient(90deg, var(--line), transparent); margin: 2.2em 0; }
.prose :not(pre) > code {
  background: var(--bg-alt); border: 1px solid var(--line-soft); border-radius: 6px;
  padding: .12em .38em; color: var(--gold); font-size: .88em;
}
.prose em { color: var(--ink-soft); }

/* Code blocks */
.code { margin: 1.6em 0; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-alt); }
.code figcaption {
  display: flex; align-items: center; justify-content: space-between;
  padding: .45rem .8rem; background: var(--panel-2); border-bottom: 1px solid var(--line-soft);
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-mute);
}
.code-copy { background: transparent; border: 1px solid var(--line); border-radius: 6px; padding: .15rem .5rem; font-size: .68rem; cursor: pointer; color: var(--ink-soft); }
.code-copy:hover { color: var(--gold-bright); border-color: var(--gold-deep); }
.code pre { margin: 0; padding: 1rem; overflow-x: auto; }
.code code { font-family: var(--font-mono); font-size: .82rem; line-height: 1.6; color: color-mix(in srgb, var(--ink) 88%, var(--gold)); }

/* Post footer */
.post-foot { margin-top: clamp(2rem, 5vw, 3rem); padding-top: 1.6rem; border-top: 1px solid var(--line-soft); display: grid; gap: 1.3rem; }
.post-foot-tags { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.post-foot-label { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-mute); }
.post-foot-tags .chips { margin: 0; }
.post-nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .8rem; }
.post-nav-item {
  display: grid; gap: .3rem; padding: .9rem 1rem; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--panel); transition: border-color .2s var(--ease), transform .2s var(--ease);
}
.post-nav-item:hover { border-color: var(--gold-deep); transform: translateY(-2px); }
.post-nav-item--right { text-align: right; }
.post-nav-label { font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-mute); }
.post-nav-title { font-weight: 700; font-size: .95rem; color: var(--ink); }
.post-foot-more { margin: 0; font-size: .86rem; color: var(--ink-mute); }
.post-foot-note {
  margin: 0; padding: .9rem 1rem; font-size: .82rem; color: var(--ink-mute);
  background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius-sm);
}

/* ---------- 12. Footer ------------------------------------------------ */
.site-footer { margin-top: clamp(3rem, 8vw, 5rem); border-top: 1px solid var(--line-soft); background: var(--bg-alt); }
.footer-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(2, minmax(0, 1fr)); gap: clamp(1.4rem, 4vw, 3rem); padding-block: clamp(2rem, 5vw, 3rem); }
.footer-logo { font-size: 1.3rem; font-weight: 800; margin: 0 0 .6rem; display: flex; align-items: center; gap: .5rem; }
.footer-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.footer-blurb { color: var(--ink-soft); font-size: .92rem; max-width: 48ch; }
.footer-meta { font-family: var(--font-mono); font-size: .76rem; color: var(--ink-mute); }
.footer-col h2 { font-size: .74rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-mute); margin-bottom: .9rem; }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.footer-col li { display: flex; align-items: center; justify-content: space-between; gap: .8rem; font-size: .9rem; }
.footer-col a { color: var(--ink-soft); }
.footer-col a:hover { color: var(--gold-bright); }
.footer-col span { font-family: var(--font-mono); font-size: .74rem; color: var(--ink-mute); }
.footer-risk { padding-bottom: 2.2rem; }
.footer-risk p { font-size: .78rem; color: var(--ink-mute); max-width: 92ch; }
.footer-copy { font-family: var(--font-mono); }

.to-top {
  position: fixed; right: clamp(.8rem, 2vw, 1.6rem); bottom: clamp(.8rem, 2vw, 1.6rem);
  width: 44px; height: 44px; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--gold-deep); background: var(--panel);
  color: var(--gold); cursor: pointer; z-index: 45; box-shadow: var(--shadow);
}
.to-top:hover { color: var(--gold-bright); transform: translateY(-2px); }

/* ---------- 13. Responsive -------------------------------------------- */
@media (max-width: 1024px) {
  .hero-art { min-height: 140px; }
  .tape-art { height: 90px; }
  .panel--method { grid-template-columns: minmax(0, 1fr); }
}

@media (min-width: 1080px) {
  .post-layout { grid-template-columns: minmax(0, 1fr) 268px; }
  .post-aside { grid-column: 2; grid-row: 1; position: sticky; top: 96px; }
  .post-main { grid-column: 1; grid-row: 1; }
  .post-layout--about { grid-template-columns: minmax(0, 1fr) 268px; }
  .hero-grid { grid-template-columns: minmax(0, 1.35fr) minmax(0, .65fr); }
}

@media (max-width: 900px) {
  .hamburger { display: grid; }
  .nav {
    position: absolute; inset: 100% 0 auto 0; flex-direction: column; align-items: stretch;
    gap: .2rem; padding: .8rem var(--gutter) 1.1rem;
    background: var(--bg-alt); border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-lift);
  }
  .nav[hidden] { display: none; }
  .nav a { justify-content: space-between; padding: .7rem .8rem; font-size: .98rem; }
  .nav a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--gold); }
  .nav-count { order: 2; }
  .header-inner { position: relative; }
  .article-row { grid-template-columns: 92px minmax(0, 1fr); }
  .article-cta { display: none; }
  .footer-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .article-row { grid-template-columns: minmax(0, 1fr); gap: .55rem; padding: .9rem 1rem; }
  .article-teaser { font-size: .86rem; }
  .post-meta { gap: .8rem; }
  .trade-plan-row { grid-template-columns: minmax(0, 1fr); gap: .15rem; }
  .trade-plan-row dt { font-size: .7rem; }
  .footer-grid { grid-template-columns: minmax(0, 1fr); }
  .filter-bar { width: 100%; }
  .inline-search { min-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .tape-art span { animation: none; }
}

@media print {
  .site-header, .site-footer, .progress, .to-top, .aside-share, .post-nav, .section--related, .filter-bar { display: none !important; }
  body { background: #fff; color: #000; }
  body::before { display: none; }
  .prose a { color: #000; text-decoration: underline; }
}
