/* ==========================================================================
   CryptoAI Signal — public content pages (Phase 9)
   Used by article.php, learning.php, market-analysis.php, 404.php.

   index.html is a static file and is NOT modified; these pages are separate
   documents and carry their own copy of the site's design tokens. The token
   VALUES below are copied verbatim from index.html so both themes match.

   ORDERING IS LOAD-BEARING: :root must stay ABOVE the [data-theme] blocks.
   They have identical specificity, so a :root placed after them wins and
   silently breaks the light theme. That exact bug already happened once in
   index.html. Do not reorder.
   ========================================================================== */

:root{
  --bg-deep:#050816;
  --bg-card:#0B1020;
  --blue:#00C8FF;
  --blue2:#009DFF;
  --green:#00FF66;
  --warn:#F5A623;
  --danger:#FF4D4D;
  --text:#FFFFFF;
  --text-muted:#B8C1D1;
  --border:rgba(0,200,255,0.12);
  --radius:9px;
  --radius-sm:10px;
  --content-max:1550px;   /* matches index.html exactly */

  /* These four were referenced by .pub-theme-btn and .pub-icon-btn but never
     defined, so those declarations were invalid and the buttons rendered with
     no background, no accent colour and no hover glow. Values are the ones the
     homepage already uses for the same controls. */
  --bg-glass: rgba(11,16,32,0.7);
  --glow-blue: 0 0 30px rgba(0,200,255,0.15);
}

[data-theme="dark"]{
  --bg-deep:#050816;--bg-card:#0B1020;--bg-nav:rgba(5,8,22,0.88);
  --bg-input:rgba(255,255,255,0.04);--bg-hover:rgba(0,200,255,0.03);
  --border:rgba(0,200,255,0.12);--text:#FFFFFF;--text-muted:#B8C1D1;
  --text-sub:rgba(184,193,209,0.55);--divider:rgba(0,200,255,0.08);
  --shadow:0 8px 32px rgba(0,0,0,0.4);--blue:#00C8FF;--warn:#F5A623;

  /* These four were referenced by .pub-theme-btn and .pub-icon-btn but never
     defined, so those declarations were invalid and the buttons rendered with
     no background, no accent colour and no hover glow. Values are the ones the
     homepage already uses for the same controls. */
  --toggle-bg: rgba(0,200,255,0.12);
  --toggle-ico: #00C8FF;
  --bg-glass: rgba(11,16,32,0.75);
  --glow-blue: 0 0 32px rgba(0,200,255,0.14);
}

[data-theme="light"]{
  --bg-deep:#EEF0F4;--bg-card:#FFFFFF;--bg-nav:rgba(255,255,255,0.94);
  --bg-input:#F1F2F5;--bg-hover:#F4F6F9;--border:#DFE2E8;--text:#0B0E14;
  --text-muted:#6B7280;--text-sub:#98A1AD;--divider:#ECEEF2;
  --shadow:0 1px 2px rgba(16,20,28,0.05),0 8px 24px rgba(16,20,28,0.08);
  --blue:#0B72E7;--warn:#D97A16;

  /* These four were referenced by .pub-theme-btn and .pub-icon-btn but never
     defined, so those declarations were invalid and the buttons rendered with
     no background, no accent colour and no hover glow. Values are the ones the
     homepage already uses for the same controls. */
  --toggle-bg: #FBEEDD;
  --toggle-ico: #D97A16;
  --bg-glass: #FFFFFF;
  --glow-blue: 0 2px 10px rgba(11,114,231,0.16);
}

*{box-sizing:border-box;}
html{scroll-behavior:smooth;overflow-x:hidden;}
body{
  margin:0;background:var(--bg-deep);color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  line-height:1.6;-webkit-font-smoothing:antialiased;
  overflow-x:hidden;   /* matches index.html — prevents any stray-wide child from creating a horizontal scrollbar */
}
a{color:var(--blue);text-decoration:none;}
a:hover{text-decoration:underline;}
img{max-width:100%;display:block;}

/* ── Nav ───────────────────────────────────────────────────────────────── */
.pub-nav{position:sticky;top:0;z-index:50;background:var(--bg-nav);
  backdrop-filter:blur(12px);border-bottom:1px solid var(--border);}
/* index.html's <nav> has NO max-width and NO auto margins: it is
   position:fixed;left:0;right:0 with padding:11px 60px, so the logo sits 60px
   from the left edge and the CTA 60px from the right. The previous
   max-width + margin:0 auto turned this into a narrow centred container,
   which is what pushed the whole header into the middle of the screen. */
.pub-nav-inner{width:100%;padding:11px 60px;
  display:flex;align-items:center;justify-content:space-between;}
.pub-brand{display:flex;align-items:center;gap:14px;color:var(--text);font-weight:700;
  text-decoration:none;font-size:20px;letter-spacing:-0.3px;}
.pub-brand:hover{text-decoration:none;}
/* Logo mark. Sized 36px so the brand block keeps the SAME total height it
   had as a text glyph — the header height, nav padding and alignment are
   therefore unchanged. Gradient + colours copied from the homepage logo. */
.pub-brand-mark{
  width:44px;height:44px;flex:0 0 44px;border-radius:50%;
  background:linear-gradient(135deg,#009DFF,#00C8FF);
  display:flex;align-items:center;justify-content:center;
  box-shadow:0 0 20px rgba(0,200,255,0.4);overflow:hidden;
}
.pub-brand-mark svg{width:24px;height:24px;display:block;}
.pub-brand-text small{display:block;font-size:10px;letter-spacing:3px;
  color:var(--blue);font-weight:500;text-transform:uppercase;margin-top:-3px;}
.pub-brand-accent{color:var(--green);}   /* matches the homepage logo */
/* 25px — the value index.html uses. At 1366px the row has 772.6px available
   and the eight labels measure 536.8px, leaving 235.8px for seven gaps; 25px
   consumes 175px and leaves 60.8px of slack (34px even if every label renders
   5% wider than measured). Kept identical to the master so both render the
   same rhythm. */
.pub-nav-links{display:flex;gap:25px;list-style:none;}
.pub-nav-links a{color:var(--text-muted);font-size:14px;font-weight:500;letter-spacing:0.3px;text-decoration:none;transition:color 0.2s;}
.pub-nav-links a:hover,.pub-nav-links a.is-active{color:var(--blue);text-decoration:none;}
.pub-theme-btn{height:34px;padding:0 11px;border-radius:9px;background:var(--toggle-bg);border:1px solid var(--border);display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:16px;font-family:inherit;transition:all .3s;color:var(--toggle-ico);margin-right:2px;gap:4px;white-space:nowrap;}
.pub-theme-btn:hover{transform:scale(1.08);}

/* ── Layout ────────────────────────────────────────────────────────────── */
/* index.html's `section { padding:36px 60px }` is full-width too — the
   homepage applies .container-max INSIDE sections, never on them. Capping
   .pub-main itself is what compressed every page into a centre column. */
.pub-main{width:100%;padding:36px 60px 70px;}
.pub-crumb{display:flex;flex-wrap:wrap;align-items:center;gap:8px;
  font-size:12.5px;color:var(--text-muted);margin-bottom:26px;}
.pub-crumb a{transition:color .15s;}
.pub-crumb a{color:var(--text-muted);}
.pub-crumb a:hover{color:var(--blue);}
.pub-crumb-sep{opacity:0.45;}
.pub-crumb-current{color:var(--text);font-weight:600;}
.pub-dot{opacity:0.5;margin:0 7px;}

.pub-page-head{margin-bottom:60px;}
.pub-page-title{font-size:clamp(28px,3.5vw,44px);font-weight:700;line-height:1.15;margin:0 0 16px;letter-spacing:-1px;}
.pub-page-sub{color:var(--text-muted);margin:0;font-size:16px;line-height:1.7;max-width:520px;}

/* ── Article ───────────────────────────────────────────────────────────── */
.pub-article{background:var(--bg-card);border:1px solid var(--border);
  border-radius:var(--card-radius);padding:clamp(22px,4vw,48px);box-shadow:var(--shadow-1);}
.pub-article-cat{display:inline-block;font-size:11px;font-weight:800;letter-spacing:0.1em;
  text-transform:uppercase;color:var(--blue);margin-bottom:12px;}
.pub-article-title{font-size:clamp(28px,3.5vw,44px);font-weight:700;line-height:1.15;margin:0 0 16px;letter-spacing:-1px;
  color:var(--article-h1-color);font-family:Cambria,serif;}
.pub-article-lede{color:var(--text-muted);font-size:17.5px;line-height:1.65;margin:0 0 20px;max-width:70ch;}
.pub-article-meta{display:flex;flex-wrap:wrap;align-items:center;gap:2px;
  font-size:13px;color:var(--text-muted);padding-bottom:22px;border-bottom:1px solid var(--divider);}
.pub-author{color:var(--text);font-weight:600;}
.pub-article-hero{margin:28px 0 var(--flow-lg);border-radius:var(--card-radius);overflow:hidden;border:1px solid var(--border);}
.pub-article-hero img{width:100%;height:auto;}

/* Prose. Width is set by the single article container, not here. */
.pub-article-body{font-size:16.5px;line-height:1.78;font-family:Cambria,serif;}
.pub-article-body h1{color:var(--article-h1-color);}
.pub-article-body h2{font-size:26px;font-weight:700;margin:var(--flow-lg) 0 var(--flow-sm);
  letter-spacing:-0.02em;line-height:1.28;padding-top:6px;
  color:var(--article-heading-color);}
.pub-article-body h2:first-child{margin-top:0;padding-top:0;}
.pub-article-body h3{font-size:19.5px;font-weight:650;margin:30px 0 10px;
  letter-spacing:-0.01em;line-height:1.35;
  color:var(--article-heading-color);}
.pub-article-body h4{font-size:17px;font-weight:650;margin:24px 0 8px;
  color:var(--article-heading-color);}
.pub-article-body p{margin:0 0 var(--flow-md);}
.pub-article-body ul,.pub-article-body ol{margin:0 0 var(--flow-md);padding-left:22px;}
.pub-article-body li{margin-bottom:9px;padding-left:2px;}
.pub-article-body li::marker{color:var(--text-muted);}
.pub-article-body > *:last-child{margin-bottom:0;}
.pub-article-body img{border-radius:var(--card-radius);margin:var(--flow-md) 0;
  border:1px solid var(--border);box-shadow:var(--shadow-1);}
.pub-article-body figure{margin:var(--flow-md) 0;}
.pub-article-body figure img{margin:0;}
.pub-article-body figcaption{margin-top:10px;font-size:13px;color:var(--text-muted);
  text-align:center;line-height:1.55;}
.pub-article-body hr{border:0;border-top:1px solid var(--divider);margin:var(--flow-lg) 0;}
.pub-article-body blockquote{margin:var(--flow-md) 0;padding:18px 22px;border-left:3px solid var(--blue);
  background:var(--bg-hover);border-radius:0 var(--radius) var(--radius) 0;color:var(--text-muted);}
.pub-article-body pre{background:var(--bg-input);border:1px solid var(--border);
  border-radius:var(--card-radius);margin:var(--flow-md) 0;
  border-radius:var(--radius);padding:15px;overflow-x:auto;font-size:13.5px;}
.pub-article-body code{background:var(--bg-input);padding:2px 6px;border-radius:5px;font-size:14px;}
.pub-article-body pre code{background:none;padding:0;}
.pub-article-body table{width:100%;border-collapse:separate;border-spacing:0;
  margin:var(--flow-md) 0;font-size:14.5px;
  border:1px solid var(--border);border-radius:var(--card-radius);overflow:hidden;}
.pub-article-body th,.pub-article-body td{border-bottom:1px solid var(--divider);
  padding:12px 15px;text-align:left;}
.pub-article-body tr:last-child td{border-bottom:0;}
.pub-article-body th{background:var(--bg-input);font-weight:700;font-size:12.5px;
  letter-spacing:0.04em;text-transform:uppercase;color:var(--text-muted);}
.pub-article-body iframe{width:100%;aspect-ratio:16/9;height:auto;border:0;margin:var(--flow-md) 0;
  border-radius:var(--radius);margin:22px 0;}

/* ── Premium / Elite lock (no access control yet — content simply withheld) ─ */
.pub-lock{text-align:center;padding:clamp(30px,6vw,58px) 22px;margin:var(--flow-lg) 0;box-shadow:var(--shadow-1);
  background:var(--bg-hover);border:1px dashed var(--border);border-radius:var(--card-radius);}
.pub-lock-icon{font-size:38px;margin-bottom:12px;}
.pub-lock-tier{display:inline-block;font-size:10.5px;font-weight:800;letter-spacing:0.14em;
  text-transform:uppercase;color:var(--warn);border:1px solid var(--warn);
  padding:4px 11px;border-radius:999px;margin-bottom:14px;}
.pub-lock-title{font-size:21px;margin:0 0 10px;}
.pub-lock-text{color:var(--text-muted);max-width:52ch;margin:0 auto 22px;font-size:15px;}
.pub-lock-cta{display:inline-block;background:var(--blue);color:#04121F;font-weight:800;
  padding:12px 26px;border-radius:var(--radius);font-size:14.5px;}
.pub-lock-cta:hover{text-decoration:none;opacity:0.9;}
.pub-lock-badge{position:absolute;top:9px;right:9px;background:var(--warn);color:#1A1200;
  font-size:10px;font-weight:800;letter-spacing:0.07em;text-transform:uppercase;
  padding:3px 9px;border-radius:999px;}

/* ── Single-column reading layout ──────────────────────────────────────── */
/* The whole article is one centred column, so the surplus space is split
   evenly on both sides instead of collecting on one.

   --reading-measure is expressed in ch, which the browser resolves from the
   actual font metrics rather than a fixed pixel guess. At this font stack a
   'ch' holds ~0.78 characters of English prose, so 100ch renders ~78
   characters per line, inside the comfortable range. */
:root{
  --reading-measure:1000px;    /* the ONE content width */
  --nav-h:68px;                /* fallback; article-toc.js measures the real header */

  /* Shared surface system — every card-like block uses these so padding,
     radius, border and elevation stay identical across the page. */
  --card-radius:14px;
  --card-pad:24px;
  --shadow-1:0 1px 2px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.16);
  --shadow-2:0 2px 6px rgba(0,0,0,0.22), 0 12px 32px rgba(0,0,0,0.22);

  /* Vertical rhythm for long-form prose. */
  --flow-sm:28px;   /* h2 margin-bottom only */
  --flow-md:22px;
  --flow-lg:44px;

  /* Article heading colours — global brand tokens.
     Set here only, never per article, per category or inline. Authors have
     no control over these; the theme owns them. */
  --article-h1-color:var(--article-heading-color);
  --article-heading-color:#5EC9B1;
}
[data-theme="light"]{
  --shadow-1:0 1px 2px rgba(16,20,28,0.05), 0 4px 16px rgba(16,20,28,0.05);
  --shadow-2:0 2px 6px rgba(16,20,28,0.08), 0 12px 32px rgba(16,20,28,0.08);
  --article-heading-color:#029172;
}

/* One rule centres the whole page: the article shell, the tags, prev/next,
   related articles and the CTA all share the same measure and the same
   left/right edges, so nothing drifts out of alignment.
   NOTE: .pub-crumb is intentionally NOT centred here. On article pages the
   breadcrumb lives inside .pub-read (see ".pub-read > .pub-crumb" below) and
   aligns with the article column there. On listing pages (learning.php /
   market-analysis.php) it is a direct .pub-main child and must share the same
   full-width left axis as .pub-page-head and .pub-grid — centring it to the
   article measure is what pushed it inward. */
.pub-main > .pub-article,
.pub-main > .pub-read > .pub-article,
.pub-main > .pub-read,
.pub-main > .pub-adjacent,
.pub-main > .pub-section,
.pub-main > .pub-cta{
  max-width:calc(var(--reading-measure) + 2 * clamp(22px, 4vw, 48px));
  margin-inline:auto;
}

/* ONE container. The shell above defines the single left and right edge, and
   every child — hero, contents, headings, paragraphs, lists, images, tables,
   code blocks and embeds — simply fills it. Nothing inside the article is
   given its own max-width or auto margin, so the page reads as one
   continuous document with a single content column. */


/* Sticky offset for in-page anchors must clear the already-sticky .pub-nav. */
.pub-article-body :is(h2,h3,h4){scroll-margin-top:calc(var(--nav-h) + 20px);}

/* ── Left sticky TOC rail (desktop layout enhancement) ─────────────────────
   The rail lives inside .pub-article but is pulled entirely into the LEFT
   margin with a negative offset, so it occupies space that was empty and the
   article column keeps its exact width, padding, alignment and centring. The
   article box is never given a grid, never shrinks and never moves; removing
   this whole block returns the page to its previous production layout with no
   other change.

   Hidden by default (mobile-first). Only the wide-desktop media query below
   turns it on, and article-toc.js only moves the TOC node into it at the same
   breakpoint, so the two can never disagree. */
/* ── Desktop two-column read layout (TOC rail + locked article) ───────────
   Mobile-first: the rail is hidden and .pub-read is a plain block, so the
   article renders exactly as it always has. The desktop rules below turn
   .pub-read into a real CSS grid — no absolute positioning, no fragile
   offset math. This is why the rail now visibly uses the left gutter where
   every previous absolute-position attempt failed. */
.pub-toc-rail{display:none;}

@media (min-width: 1280px){
  :root{
    --toc-rail-gap:32px;     /* space between the rail and the article */
    --toc-rail-safe:24px;    /* safe margin from the .pub-main content edge */
  }

  /* THE LAYOUT.
     Two columns: a flexible TOC column (1fr) that soaks up available left
     space, and the article column pinned to its EXISTING width via a fixed
     track. The article never resizes (fixed track); the rail widens with the
     viewport (1fr eats the remainder). */
  .pub-main > .pub-read{
    display:grid;
    grid-template-columns:
      minmax(auto, calc(var(--reading-measure) + 2 * clamp(22px, 4vw, 48px)))
      minmax(0, 1fr);
    column-gap:var(--toc-rail-gap);
    align-items:start;
    /* Cap the whole grid so the article column sits at the same centre it does
       today; the left 1fr only grows into space that was already empty. */
    --toc-rail-max-fill:520px;
    max-width:calc(
      (var(--reading-measure) + 2 * clamp(22px, 4vw, 48px))
      + var(--toc-rail-gap) + var(--toc-rail-max-fill)
    );
    margin-inline:auto;
  }

  /* The article column: fill its track at exactly the width it had standalone.
     width:100% + the fixed track = its original max-width, so it never moves
     or resizes. */
  .pub-read > .pub-article{
    max-width:none;
    width:100%;
    margin-inline:0;
    grid-column:1;
    min-width:0;
  }

  /* The rail column. */
  .pub-read > .pub-toc-rail{
    display:block;
    grid-column:2;
    align-self:stretch;
    min-width:0;
  }

  /* Breadcrumb lives in the article column (column 2), on its own row above
     the article, so it aligns with the article card instead of stretching
     across the TOC rail. It gets the full article width, and single-line
     since that width is ample for the trail. */
  .pub-read > .pub-crumb{
    grid-column:1;
    grid-row:1;
    max-width:none;
    margin:0 0 4px;
    flex-wrap:nowrap;
    min-width:0;
    justify-self:stretch;
  }

  /* The article sits on the second grid row, under the breadcrumb, still in
     column 2. The rail spans both rows so it stays full height. */
  .pub-read > .pub-article{
    grid-row:2;
  }
  .pub-read > .pub-toc-rail{
    grid-row:1 / 3;
  }

  /* The inner wrapper sticks while reading. It fills the whole rail column, so
     long labels wrap far less. overflow-y:auto shows a scrollbar ONLY when the
     TOC is genuinely taller than the viewport — a fitting TOC shows none. */
  .pub-toc-rail-inner{
    /* Non-sticky: the rail (Contents + Latest Articles) scrolls with the page,
       like the reference sidebar. Keeps the two blocks from overlapping, which
       a sticky Contents block would cause on long articles. */
    overflow-x:hidden;
    padding-right:4px;
    margin-bottom:28px;
  }

  /* Compact "CONTENTS" label instead of the large authored heading. */
  .pub-toc-rail-label{
    font-size:11px;font-weight:700;letter-spacing:0.12em;
    text-transform:uppercase;color:var(--text-muted);margin:0 0 16px;
  }

  /* The authored "Contents" heading still moves into the rail (to keep its
     anchor id) but is hidden there so only the compact label shows. */
  .pub-toc-rail-inner > h2,
  .pub-toc-rail-inner > h3,
  .pub-toc-rail-inner > h4,
  .pub-toc-rail-inner .pub-contents-title{
    position:absolute;width:1px;height:1px;padding:0;margin:-1px;
    overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;
  }

  /* Rules that framed the authored block add nothing in the rail. */
  .pub-toc-rail-inner > hr{display:none;}
  .pub-toc-rail-inner .pub-contents{margin:0;}

  /* The list fills the full rail width; single column so numbering stays clean
     and long labels use the horizontal space instead of wrapping. */
  .pub-toc-rail-inner ol,
  .pub-toc-rail-inner ul,
  .pub-toc-rail-inner .pub-contents-list{
    columns:1;font-size:14px;line-height:1.55;margin:0;padding-left:22px;
    width:100%;box-sizing:border-box;
  }
  .pub-toc-rail-inner li{margin-bottom:12px;}

  /* Related Articles — move the whole section to the page's left content edge
     and stop the cards stretching. Two independent defects, two fixes:

     1) POSITION. The base rule (line ~260) centres .pub-section with
        margin-inline:auto, so on wide screens it floats to the middle. The
        desired left boundary (user's green line) is .pub-main's own content
        edge — its padding-left:60px. margin-inline:0 makes the section hug
        that edge; the base max-width cap is kept so exactly 3 card columns
        fit and leftover space falls on the right.

     2) CARD STRETCH. The base .pub-grid uses repeat(auto-fill,
        minmax(280px,1fr)); the 1fr max lets columns grow to fill the row, so
        a single card stretches edge-to-edge. Fixed 280px tracks (the design's
        own minmax floor — no new width invented) + justify-content:start keep
        every card 280px, packed left, with the existing 24px gap.

     SCOPED to article pages only: `.pub-read ~ .pub-*` matches a sibling
     that follows a .pub-read under the same parent. Only article.php emits
     .pub-read, so listing pages (learning.php / market-analysis.php) can
     never match this. .pub-adjacent (Prev/Next) gets the same left-edge
     treatment so it lines up with Related Articles at the green line; its
     internal two-column prev/next layout and width are unchanged, the block
     just stops centring and hugs the left edge. */
  .pub-main > .pub-read ~ .pub-adjacent,
  .pub-main > .pub-read ~ .pub-section{
    margin-inline:0;
  }
  .pub-main > .pub-read ~ .pub-section > .pub-grid{
    grid-template-columns:repeat(auto-fill, 280px);
    justify-content:start;
  }
}

/* ── Latest Articles widget (article sidebar rail — desktop only) ─────────
   Lives in .pub-toc-rail. article-toc.js places the Contents block above it
   when the article has one; otherwise this is the rail's only content. The
   rail itself is display:none below 1280px, so these rules only take visible
   effect on desktop. */
.pub-latest-title{
  font-size:11px;font-weight:700;letter-spacing:0.12em;text-transform:uppercase;
  color:var(--text-muted);margin:0 0 4px;padding-bottom:12px;
  border-bottom:2px solid var(--border);
}
.pub-latest-list{list-style:none;margin:0;padding:0;}
.pub-latest-item{border-bottom:1px solid var(--divider);}
.pub-latest-item:last-child{border-bottom:0;}
.pub-latest-link{
  display:grid;grid-template-columns:64px 1fr;gap:12px;align-items:start;
  padding:14px 0;text-decoration:none;
}
.pub-latest-thumb{
  width:64px;height:64px;border-radius:3px;overflow:hidden;
  background:var(--bg-input);
}
.pub-latest-thumb img{width:100%;height:100%;object-fit:cover;display:block;}
.pub-latest-meta{min-width:0;display:flex;flex-direction:column;gap:6px;}
.pub-latest-headline{
  font-size:14px;font-weight:600;line-height:1.35;color:var(--text);
  display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;
}
.pub-latest-link:hover .pub-latest-headline{color:var(--blue);}
.pub-latest-date{font-size:12px;color:var(--text-muted);}

/* ── Contents (inside the article, never a sidebar) ────────────────────── */
.pub-contents{margin:0 0 var(--flow-lg);}
.pub-contents-title{font-size:11px;font-weight:700;letter-spacing:0.1em;
  text-transform:uppercase;color:var(--text-muted);margin:0 0 18px;}
.pub-contents-list{list-style:none;margin:0;padding:0;
  font-size:15px;line-height:1.5;
  columns:2;column-gap:44px;}
.pub-contents-list li{margin:0 0 13px;break-inside:avoid;}
.pub-contents-list a{position:relative;display:inline-block;padding-left:19px;
  color:var(--text-muted);transition:color .16s ease;}
/* Chevron drawn in CSS so it inherits currentColor and stays crisp in both
   themes — no icon font, no extra markup. */
.pub-contents-list a::before{content:"";position:absolute;left:2px;top:0.5em;
  width:5px;height:5px;
  border-right:1.5px solid currentColor;border-bottom:1.5px solid currentColor;
  transform:rotate(-45deg);opacity:.4;
  transition:opacity .16s ease,transform .16s ease;}
.pub-contents-list a:hover{color:var(--blue);text-decoration:none;}
.pub-contents-list a:hover::before{opacity:1;transform:rotate(-45deg) translate(1.5px,1.5px);}
/* Three-level hierarchy: H2 flush, H3 one step in, H4 two steps in. The
   indent is applied to the <li> (not the <a>) so the chevron keeps its
   fixed offset inside the link and stays aligned at every level. */
.pub-contents-list .pub-contents-h3{padding-left:19px;}
.pub-contents-list .pub-contents-h3 a{font-size:14px;}
.pub-contents-list .pub-contents-h4{padding-left:38px;}
.pub-contents-list .pub-contents-h4 a{font-size:13.5px;opacity:.9;}

@media (max-width:640px){
  .pub-contents-list{columns:1;}
  /* Tighter steps on narrow screens so deep items do not wrap awkwardly. */
  .pub-contents-list .pub-contents-h3{padding-left:14px;}
  .pub-contents-list .pub-contents-h4{padding-left:28px;}
}

/* ── Premium CTA (after the article body) ──────────────────────────────── */
.pub-cta{margin-top:28px;padding:clamp(28px,4vw,44px);text-align:center;
  background:var(--bg-card);border:1px solid var(--border);border-radius:var(--card-radius);
  box-shadow:var(--shadow-1);}
.pub-cta-eyebrow{font-size:11px;font-weight:800;letter-spacing:0.1em;text-transform:uppercase;
  color:var(--blue);margin:0 0 10px;}
.pub-cta-title{font-size:clamp(20px,2.4vw,27px);font-weight:700;line-height:1.25;margin:0 0 12px;
  letter-spacing:-0.5px;}
.pub-cta-text{color:var(--text-muted);font-size:15.5px;line-height:1.7;max-width:60ch;
  margin:0 auto 22px;}
.pub-cta-btn{display:inline-block;}

/* ── Tags ──────────────────────────────────────────────────────────────── */
.pub-tags{display:flex;flex-wrap:wrap;gap:9px;margin-top:var(--flow-lg);
  padding-top:26px;border-top:1px solid var(--divider);}
.pub-tag{font-size:12.5px;color:var(--text-muted);background:var(--bg-input);
  border:1px solid var(--border);padding:6px 14px;border-radius:999px;
  transition:color .16s,border-color .16s,background .16s;}
.pub-tag:hover,.pub-tag.is-on{color:var(--blue);border-color:var(--blue);text-decoration:none;}

/* ── Prev / Next ───────────────────────────────────────────────────────── */
.pub-adjacent{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-top:28px;}
.pub-adj{background:var(--bg-card);border:1px solid var(--border);border-radius:var(--card-radius);
  padding:18px 20px;display:block;box-shadow:var(--shadow-1);
  transition:border-color .18s ease,transform .18s ease,box-shadow .18s ease;}
.pub-adj:hover{border-color:var(--blue);transform:translateY(-2px);
  box-shadow:var(--shadow-2);text-decoration:none;}
.pub-adj-next{text-align:right;}
.pub-adj-label{display:block;font-size:11px;font-weight:800;letter-spacing:0.09em;
  text-transform:uppercase;color:var(--blue);margin-bottom:6px;}
.pub-adj-title{display:block;color:var(--text);font-weight:600;font-size:14.5px;line-height:1.4;}

/* ── Sections + cards ──────────────────────────────────────────────────── */
.pub-section{margin-top:56px;}
.pub-section-title{font-size:22px;font-weight:700;margin:0 0 20px;letter-spacing:-0.02em;
  padding-bottom:14px;border-bottom:1px solid var(--divider);}
.pub-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:24px;}
.pub-card{background:var(--bg-card);border:1px solid var(--border);border-radius:var(--card-radius);
  overflow:hidden;display:flex;flex-direction:column;box-shadow:var(--shadow-1);
  transition:border-color .18s ease,transform .18s ease,box-shadow .18s ease;}
.pub-card:hover{border-color:var(--blue);transform:translateY(-3px);box-shadow:var(--shadow-2);}
.pub-card-media{display:block;position:relative;aspect-ratio:16/9;overflow:hidden;background:var(--bg-input);}
.pub-card-media img{width:100%;height:100%;object-fit:cover;}
.pub-card-body{padding:18px 20px 20px;display:flex;flex-direction:column;flex:1;}
/* Category label: plain coloured text (no filled blue bar), everywhere a
   card renders it — Related Articles, listing pages (learning / market-
   analysis) and homepage-featured cards all use .pub-card-cat via
   renderArticleCard, so this one base rule covers them all. padding:0 makes
   it left-align with the card title; margin-bottom keeps the gap before it.
   uppercase / size / weight / tracking are unchanged. */
.pub-card-cat{display:block;font-size:11px;font-weight:800;letter-spacing:0.08em;text-transform:uppercase;
  color:var(--blue);background:none;padding:0;margin-bottom:8px;text-decoration:none;}
.pub-card-cat:hover{color:var(--blue2);text-decoration:none;background:none;}
.pub-card-title{font-size:16.5px;font-weight:650;line-height:1.35;margin:0 0 10px;letter-spacing:-0.01em;}
.pub-card-title a{color:var(--text);}
.pub-card-title a:hover{color:var(--blue);text-decoration:none;}
.pub-card-excerpt{color:var(--text-muted);font-size:13.5px;margin:0 0 13px;flex:1;
  display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;}
.pub-card-meta{font-size:12px;color:var(--text-sub);display:flex;align-items:center;flex-wrap:wrap;}
.pub-card-author{font-weight:700;text-transform:uppercase;letter-spacing:0.02em;}

/* ── Filters / pagination ──────────────────────────────────────────────── */
.pub-filters{display:flex;flex-wrap:wrap;gap:10px;margin-bottom:16px;}
.pub-search,.pub-select{background:var(--bg-input);border:1px solid var(--border);
  color:var(--text);border-radius:var(--radius);padding:10px 13px;font-size:14px;font-family:inherit;}
.pub-search{flex:1;min-width:200px;}
.pub-btn{display:inline-block;background:var(--blue);color:#04121F;font-weight:600;
  border:1px solid var(--blue);border-radius:8px;padding:10px 22px;
  font-size:14px;cursor:pointer;font-family:inherit;}
.pub-btn:hover{text-decoration:none;opacity:0.9;}
.pub-btn-ghost{background:transparent;color:var(--text-muted);border-color:var(--border);}
.pub-btn-ghost:hover{color:var(--blue);border-color:var(--blue);}
.pub-tagbar{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:20px;}
.pub-result-count{font-size:12.5px;color:var(--text-muted);margin-bottom:14px;}
.pub-pager{display:flex;flex-wrap:wrap;gap:7px;justify-content:center;margin-top:34px;}
.pub-page-btn{background:var(--bg-card);border:1px solid var(--border);color:var(--text-muted);
  border-radius:var(--radius);padding:8px 14px;font-size:13.5px;font-weight:600;min-width:40px;text-align:center;}
.pub-page-btn:hover{border-color:var(--blue);color:var(--blue);text-decoration:none;}
.pub-page-btn.is-current{background:var(--blue);border-color:var(--blue);color:#04121F;}

/* ── Empty + 404 ───────────────────────────────────────────────────────── */
.pub-empty{text-align:center;padding:64px 20px;background:var(--bg-card);
  border:1px solid var(--border);border-radius:var(--radius-sm);}
.pub-empty-icon{font-size:40px;margin-bottom:12px;}
.pub-empty h2{margin:0 0 8px;font-size:20px;}
.pub-empty p{color:var(--text-muted);margin:0;}
.pub-404{text-align:center;padding:clamp(50px,10vw,110px) 20px;}
.pub-404-code{font-size:clamp(66px,15vw,140px);font-weight:900;line-height:1;color:var(--blue);
  letter-spacing:-0.04em;opacity:0.9;}
.pub-404-title{font-size:clamp(21px,3.4vw,30px);margin:14px 0 12px;}
.pub-404-text{color:var(--text-muted);max-width:48ch;margin:0 auto 28px;}
.pub-404-actions{display:flex;flex-wrap:wrap;gap:11px;justify-content:center;}

/* ── Footer ────────────────────────────────────────────────────────────── */
/* Mirrors index.html footer rhythm. */
.pub-footer{padding:36px 60px 24px;border-top:1px solid var(--border);}
.pub-footer-inner{max-width:var(--content-max);margin:0 auto;width:100%;}
.pub-footer-links{display:flex;gap:60px;}

/* Responsive side padding — mirrors index.html's own breakpoints so the
   container gutters shrink at exactly the same widths the homepage does.
   Required: without these, the new 60px desktop gutter would crush content
   on tablet/mobile. Values copied from the homepage (24px, then 12px). */
@media (max-width:1024px){
  .pub-nav-inner{padding:16px 24px;}
  .pub-main{padding:28px 24px 70px;}
  .pub-footer-inner{padding:40px 24px 28px;}
}
@media (max-width:1023px){
  /* Single column below the grid breakpoint: tighten the long-form rhythm so
     the page does not feel airy on a narrow screen. */
  :root{--flow-lg:34px;--flow-md:19px;}
  .pub-article-body h2{font-size:23px;}
  .pub-article-body h3{font-size:18.5px;}
  .pub-adjacent{grid-template-columns:1fr;}
  .pub-section{margin-top:44px;}
}
@media (max-width:767px){
  .pub-nav-inner{padding:14px 12px;}
  .pub-main{padding:20px 12px 48px;overflow-x:hidden;}
  .pub-footer-inner{padding:32px 12px 24px;}
  /* Listing grids: on mobile force a single column so the minmax(280px,...)
     track can never exceed the (narrow) viewport and trigger horizontal
     overflow / the browser zoom-to-fit bar. min-width:0 lets cards and their
     media shrink with the column instead of pushing past the screen edge. */
  .pub-grid{grid-template-columns:1fr;gap:18px;}
  .pub-grid,.pub-card,.pub-card-media,.pub-card-body{min-width:0;}

  /* ── Mobile reading polish (Education / Technical Analysis listing pages) ──
     Tighter vertical rhythm and full-width stacked filter controls so these
     pages read as cleanly on a phone as the rest of the site. Scoped to
     .pub-* only — desktop and the homepage are untouched. */
  .pub-page-head{margin-bottom:28px;}                 /* was 60px — too airy on phones */
  .pub-page-title{font-size:clamp(26px,7vw,34px);letter-spacing:-0.5px;overflow-wrap:anywhere;}
  .pub-page-sub{font-size:15px;}
  .pub-filters .pub-search,
  .pub-filters .pub-select,
  .pub-filters .pub-btn,
  .pub-filters .pub-btn-ghost{width:100%;flex:1 1 100%;min-width:0;text-align:center;}
  .pub-tagbar{gap:7px;margin-bottom:18px;}
}

/* index.html hides .nav-links at <=1024px because it has a mobile header and
   a mobile bottom nav to fall back on. These pages have neither, so hiding
   them would leave no navigation at all — the links wrap onto their own row
   instead. This is the one place the public header is allowed to differ from
   the homepage, and only below 1024px. */
@media (max-width:1024px){
  .pub-nav-inner{flex-wrap:wrap;gap:12px;}
  .pub-nav-links{order:3;width:100%;margin-left:0;gap:14px;justify-content:center;}
}

@media (max-width:700px){
  .pub-adjacent{grid-template-columns:1fr;}
  .pub-adj-next{text-align:left;}
}

/* ==========================================================================
   Homepage Featured Articles (Task 9) — used ONLY by the optional
   assets/homepage-featured.js drop-in. Every selector is scoped to
   .cai-fa-* so nothing here can collide with index.html's existing styles
   or with the frozen Historical Results module (.hr-*, .sd-*, .lc-*).
   Tokens are read from index.html's own :root, so this inherits the
   homepage theme automatically when loaded there.
   ========================================================================== */
#caiFeaturedArticles{max-width:var(--content-max,1550px);margin:0 auto;padding:40px 20px;}
.cai-fa-head{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:20px;}
.cai-fa-heading{font-size:24px;margin:0;color:var(--text);letter-spacing:-0.01em;}
.cai-fa-all{font-size:13.5px;font-weight:700;color:var(--blue);text-decoration:none;}
.cai-fa-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:18px;}
.cai-fa-card{background:var(--bg-card);border:1px solid var(--border);border-radius:var(--card-radius);box-shadow:var(--shadow-1);
  overflow:hidden;display:flex;flex-direction:column;transition:border-color .18s,transform .18s;}
.cai-fa-card:hover{border-color:var(--blue);transform:translateY(-2px);}
.cai-fa-media{display:block;position:relative;aspect-ratio:16/9;overflow:hidden;background:var(--bg-input);}
.cai-fa-media img{width:100%;height:100%;object-fit:cover;display:block;}
.cai-fa-lock{position:absolute;top:9px;right:9px;background:var(--warn);color:#1A1200;font-size:10px;
  font-weight:800;letter-spacing:0.07em;text-transform:uppercase;padding:3px 9px;border-radius:999px;}
.cai-fa-body{padding:15px 17px 17px;display:flex;flex-direction:column;flex:1;}
.cai-fa-cat{font-size:10.5px;font-weight:800;letter-spacing:0.1em;text-transform:uppercase;
  color:var(--blue);margin-bottom:8px;}
.cai-fa-title{font-size:16.5px;line-height:1.35;margin:0 0 9px;}
.cai-fa-title a{color:var(--text);text-decoration:none;}
.cai-fa-title a:hover{color:var(--blue);}
.cai-fa-excerpt{color:var(--text-muted);font-size:13.5px;margin:0 0 13px;flex:1;
  display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;}
.cai-fa-meta{font-size:12px;color:var(--text-sub,var(--text-muted));}


/* ==========================================================================
   Header CTA cluster + footer columns.
   Values copied from index.html's .nav-cta / .btn / .btn-outline /
   .nav-profile-btn / .nav-bell-badge / .footer-* rules so these render
   identically to the homepage in both themes.
   ========================================================================== */

/* index.html .nav-cta */
/* Mirrors index.html: nav controls sized against the 14px nav text, not the
   44px logo. Navbar height is unaffected — the logo is still tallest. */
.pub-nav-cta{display:flex;gap:10px;align-items:center;}

/* index.html .btn + .btn-outline */
.pub-btn-outline{
  padding:8px 18px;border-radius:8px;font-family:inherit;font-size:14px;font-weight:600;
  cursor:pointer;text-decoration:none;transition:all 0.2s;border:1px solid rgba(0,200,255,0.35);
  display:inline-flex;align-items:center;gap:8px;background:transparent;color:var(--blue);
  white-space:nowrap;
}
.pub-btn-outline:hover{text-decoration:none;background:rgba(0,200,255,0.08);}

/* index.html .nav-profile-btn / .nav-bell-btn */
.pub-icon-btn{
  width:34px;height:34px;border-radius:50%;flex:0 0 auto;position:relative;
  background:var(--bg-glass);border:1px solid var(--border);color:var(--text-muted);
  display:flex;align-items:center;justify-content:center;cursor:pointer;transition:all 0.2s;
  text-decoration:none;
}
.pub-icon-btn:hover{border-color:var(--blue);color:var(--blue);box-shadow:var(--glow-blue);text-decoration:none;}
.pub-icon-btn svg{width:17px;height:17px;}

/* index.html .nav-bell-badge */
.pub-bell-badge{
  position:absolute;top:-4px;right:-4px;min-width:15px;height:15px;padding:0 3px;
  border-radius:8px;background:var(--danger);color:#fff;font-size:10px;font-weight:800;
  display:flex;align-items:center;justify-content:center;
}

/* index.html .footer-top / .footer-col */
.pub-footer-top{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:28px;}
.pub-footer-col h4{
  font-size:12px;font-weight:700;color:var(--text-muted);text-transform:uppercase;
  letter-spacing:2px;margin-bottom:16px;
}
.pub-footer-col a{
  display:block;font-size:13px;color:rgba(184,193,209,0.7);text-decoration:none;
  margin-bottom:10px;transition:color 0.2s;
}
.pub-footer-col a:hover{color:var(--blue);}

/* index.html .footer-bottom */
.pub-footer-bottom{
  display:flex;justify-content:center;align-items:center;padding-top:18px;
  border-top:1px solid var(--border);font-size:12px;color:rgba(184,193,209,0.4);
}
/* index.html: footer .logo-crypto, footer .logo-ai { font-size:18px } */
.pub-footer .pub-brand{font-size:18px;}

/* index.html light-theme overrides for the same components */
[data-theme="light"] .pub-nav{background:#FFFFFF;border-bottom:1px solid #DFE2E8;
  box-shadow:0 1px 3px rgba(16,20,28,0.05),0 4px 12px rgba(16,20,28,0.04);}
[data-theme="light"] .pub-brand{color:#0F172A;}
[data-theme="light"] .pub-brand-accent{color:#09944F;}
[data-theme="light"] .pub-brand-text small{color:#0B72E7;}
[data-theme="light"] .pub-nav-links a{color:#1E293B;}
[data-theme="light"] .pub-nav-links a:hover,
[data-theme="light"] .pub-nav-links a.is-active{color:#0B72E7;}
[data-theme="light"] .pub-theme-btn,
[data-theme="light"] .pub-icon-btn{background:#F3F4F6;border-color:#D1D5DB;color:#111827;}
[data-theme="light"] .pub-btn-outline{color:#0B72E7;border-color:#E7F1FD;background:transparent;}
[data-theme="light"] .pub-btn-outline:hover{background:#F4F6F9;}
[data-theme="light"] .pub-footer{background:#FFFFFF;border-top:1px solid #DFE2E8;}
[data-theme="light"] .pub-footer-col h4{color:#374151;}
[data-theme="light"] .pub-footer-col a{color:#4B5563;}
[data-theme="light"] .pub-footer-col a:hover{color:#0B72E7;}
[data-theme="light"] .pub-footer-bottom{color:#4B5563;border-top:1px solid #E2E8F0;}

/* index.html collapses the footer columns at <=1024px */
@media (max-width:1024px){
  .pub-footer-top{flex-direction:column;gap:32px;}
  .pub-footer-links{flex-wrap:wrap;gap:32px;}
}

/* ── Card corner-radius overrides (scoped, additive) ─────────────────────────
   Listing pages (/learning.php, /market-analysis.php) carry .pub-list on <body>;
   the article-detail page (article.php) carries .pub-article-page. These keep
   the changes isolated so the shared --card-radius token (14px) and every other
   component using it (homepage cards, hero/article images) stay untouched.
   Radius only — no size/spacing/shadow/colour change. */
.pub-list .pub-card{border-radius:8px;}                 /* listing article cards */
.pub-article-page .pub-section .pub-card{border-radius:8px;}  /* Related Articles cards */
.pub-article-page .pub-adj{border-radius:8px;}          /* Previous / Next cards */
