/* ============================================================================
   Equity & Markets Insight — shared analysis-page theme
   ----------------------------------------------------------------------------
   Carries the front-page design system (front-page.html) across every
   *-blog-page.html company analysis. Loaded AFTER each article's own inline
   <style>, so equal-specificity rules win.

   DESIGN ONLY. This file never changes content, figures or wording.

   House identity: paper #FBF9F4 · navy #1B2A4A · gold #D4A853 / #A9812E ·
   red #E8453C (negatives only) · Playfair Display / DM Sans / DM Mono.

   Created 2026-07-27. Companion script: em-analysis-embed.js
   ========================================================================== */

/* --- 1. Re-point the articles' own tokens at the house palette ------------ */
:root{
  /* the article stylesheets are built on these; redefining them re-skins
     everything downstream without touching a single article's markup */
  --vanquis-deep:#1B2A4A;
  --vanquis-mid:#2D4A7A;
  --vanquis-accent:#E8453C;          /* red — negatives and alerts ONLY */
  --vanquis-gold:#D4A853;
  --vanquis-light:#F4F0E7;           /* was bluish #F0F4F8 → house cream-2 */
  --text-primary:#141C2B;
  --text-secondary:#4E5567;
  --text-muted:#8A8574;              /* warm stone, not blue-grey */
  --bg-white:#FFFFFF;
  --border-light:rgba(27,42,74,.15);
  --positive:#3FA66A;
  --negative:#E8453C;

  /* front-page tokens, added */
  --ink:#0E1626;
  --paper:#FBF9F4;
  --paper-2:#F4F0E7;
  --gold-soft:#E4C583;
  --gold-deep:#A9812E;
  --stone:#8C8375;
  --accent:var(--gold-deep);
  --line:rgba(27,42,74,.15);
  --line-strong:rgba(27,42,74,.28);
  --hair:rgba(27,42,74,.07);
  --shadow:0 26px 50px -30px rgba(27,42,74,.40);
}

/* --- 2. Page shell ------------------------------------------------------- */
html{-webkit-text-size-adjust:100%;scroll-behavior:smooth}
body{
  background:var(--paper);
  color:var(--text-primary);
  font-family:"DM Sans",system-ui,-apple-system,sans-serif;
  line-height:1.7;
  overflow-x:hidden;
}
::selection{background:var(--vanquis-gold);color:var(--ink)}
.em-mono{font-family:"DM Mono",ui-monospace,monospace}

/* --- 3. Injected site chrome (em-analysis-embed.js) ---------------------- */
.em-nav{
  border-bottom:1px solid var(--hair);
  background:color-mix(in srgb,var(--paper) 84%,transparent);
  backdrop-filter:blur(10px);
  position:sticky;top:0;z-index:60;
}
.em-nav-inner{
  max-width:1280px;margin:0 auto;padding:0 clamp(16px,4vw,44px);
  display:flex;align-items:center;gap:26px;height:60px;
}
.em-brand{display:flex;align-items:center;gap:12px;flex-shrink:0;text-decoration:none}
.em-brand img{height:34px;width:auto;display:block}
.em-brand-name{
  font-family:"Playfair Display",serif;font-weight:800;font-size:18px;
  letter-spacing:-.01em;line-height:1;color:var(--text-primary);white-space:nowrap;
}
.em-brand-name b{font-style:italic;font-weight:600;color:var(--accent)}
.em-nav-links{display:flex;gap:26px;margin-left:auto;align-items:center}
.em-nav-links a{
  font-size:14px;font-weight:500;color:var(--text-secondary);text-decoration:none;
  position:relative;padding:4px 0;transition:color .2s;white-space:nowrap;
}
.em-nav-links a::after{
  content:"";position:absolute;left:0;right:100%;bottom:-2px;height:2px;
  background:var(--accent);transition:right .25s ease;
}
.em-nav-links a:hover{color:var(--text-primary)}
.em-nav-links a:hover::after{right:0}

.em-foot{
  margin-top:clamp(40px,4vw,68px);border-top:1px solid var(--line);
  padding:40px 0 60px;background:var(--paper);
}
.em-foot-inner{max-width:1280px;margin:0 auto;padding:0 clamp(16px,4vw,44px)}
.em-foot-grid{display:flex;justify-content:space-between;gap:30px;flex-wrap:wrap;align-items:flex-start}
.em-foot-brand{display:flex;align-items:center;gap:11px}
.em-foot-brand img{height:30px}
.em-foot-brand span{font-family:"Playfair Display",serif;font-weight:800;font-size:20px;color:var(--text-primary)}
.em-foot-brand span b{font-style:italic;color:var(--accent)}
.em-foot p.em-blurb{margin-top:14px;max-width:34ch;color:var(--text-secondary);font-size:13.5px}
.em-foot-cols{display:flex;gap:clamp(28px,5vw,64px);flex-wrap:wrap}
.em-foot-col h6{
  font-family:"DM Mono",monospace;font-size:10.5px;letter-spacing:.16em;
  text-transform:uppercase;color:var(--text-muted);margin-bottom:12px;
}
.em-foot-col a{display:block;color:var(--text-secondary);font-size:13.5px;padding:4px 0;text-decoration:none;transition:color .2s}
.em-foot-col a:hover{color:var(--accent)}
.em-foot-note{
  margin-top:30px;padding-top:20px;border-top:1px solid var(--hair);
  font-family:"DM Mono",monospace;font-size:11px;color:var(--text-muted);
  line-height:1.7;max-width:92ch;
}

/* --- 4. Hero banner ------------------------------------------------------ */
.hero-banner{
  background:linear-gradient(135deg,var(--vanquis-deep) 0%,var(--vanquis-mid) 60%,#3A5C8A 100%);
  padding:clamp(1.6rem,4vw,2.6rem) clamp(1.1rem,4vw,2rem) clamp(1.4rem,3vw,2rem);
  position:relative;overflow:hidden;
}
.hero-banner::before{
  content:'';position:absolute;top:-40%;right:-10%;width:520px;height:520px;
  background:radial-gradient(circle,rgba(212,168,83,.16) 0%,transparent 70%);border-radius:50%;
}
/* the house navy-touching-gold double-line motif replaces the old red stripe */
.hero-banner::after{
  content:'';position:absolute;bottom:0;left:0;right:0;height:5px;
  background:linear-gradient(180deg,var(--vanquis-gold) 0 3px,rgba(255,255,255,.28) 3px 4px,var(--vanquis-gold) 4px 5px);
}
.hero-inner{max-width:900px;margin:0 auto;position:relative;z-index:1}

.em-hero-kicker{
  display:flex;align-items:center;gap:12px;margin-bottom:16px;
  font-family:"DM Mono",monospace;font-size:10.5px;letter-spacing:.22em;
  text-transform:uppercase;color:var(--gold-soft);
}
.em-hero-kicker .em-rule{height:1px;flex:1;max-width:90px;background:rgba(212,168,83,.45)}
.em-hero-kicker .em-date{color:rgba(255,255,255,.55);letter-spacing:.14em}

.stat-box{
  background:rgba(255,255,255,.08);
  border:1px solid rgba(212,168,83,.22);
  padding:.9rem 1.2rem;backdrop-filter:blur(4px);
}
.stat-label{
  font-family:"DM Mono",monospace;font-size:.66rem;color:rgba(255,255,255,.55);
  text-transform:uppercase;letter-spacing:.18em;margin-bottom:.35rem;font-weight:400;
}
.stat-value{font-family:"Playfair Display",serif;font-size:1.2rem;color:#fff;font-weight:700;letter-spacing:-.01em}
.stat-value.positive{color:#81C995}

/* --- 5. Article body ----------------------------------------------------- */
.article-container{
  max-width:900px;margin:0 auto;
  padding:0 clamp(1.15rem,4vw,2.4rem) clamp(2.6rem,5vw,4rem);
  background:var(--bg-white);
  border:1px solid var(--line);border-top:none;
  border-radius:0 0 10px 10px;
  box-shadow:var(--shadow);
}
.meta-bar{
  display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;
  padding:1.15rem 0;border-bottom:1px solid var(--line);margin-bottom:1.9rem;
}
.meta-date{font-family:"DM Mono",monospace;font-size:.76rem;letter-spacing:.05em;color:var(--text-muted)}
.grade-badge{
  background:var(--vanquis-deep);color:#fff;font-family:"DM Mono",monospace;
  font-size:.7rem;font-weight:500;padding:.3rem .7rem;border-radius:3px;letter-spacing:.12em;
}
.grade-label{font-family:"DM Mono",monospace;font-size:.68rem;letter-spacing:.16em;text-transform:uppercase;color:var(--text-muted)}

.article-title{
  font-family:"Playfair Display",serif;font-size:clamp(1.75rem,4.4vw,2.45rem);
  font-weight:800;color:var(--text-primary);line-height:1.14;
  margin-bottom:.75rem;letter-spacing:-.018em;text-wrap:balance;
}
.article-subtitle{
  font-size:.9rem;line-height:1.65;color:var(--text-muted);
  margin-bottom:2rem;font-style:italic;max-width:74ch;
}

h2{
  font-family:"Playfair Display",serif;font-size:clamp(1.3rem,2.6vw,1.6rem);
  font-weight:700;color:var(--vanquis-deep);
  margin:2.6rem 0 1rem;padding-bottom:.42rem;
  /* gold double-line: red is reserved for negatives */
  border-bottom:3px solid var(--vanquis-gold);
  display:inline-block;letter-spacing:-.01em;
}
h3{
  font-family:"DM Sans",sans-serif;font-size:1.08rem;font-weight:700;
  color:var(--vanquis-deep);margin:1.9rem 0 .8rem;letter-spacing:-.005em;
}
p{margin-bottom:1.05rem;font-size:1.02rem;line-height:1.78;color:var(--text-secondary);max-width:74ch}
strong,b{color:var(--text-primary);font-weight:600}
a{color:var(--gold-deep)}

ul li{font-size:.98rem;line-height:1.7;color:var(--text-secondary);margin-bottom:.72rem}
ul li::before{background:var(--vanquis-gold)}

.summary-box{
  background:var(--vanquis-light);
  border:1px solid var(--line);border-left:4px solid var(--vanquis-gold);
  border-radius:0 8px 8px 0;padding:1.5rem 1.7rem;margin-bottom:2rem;
}
.summary-box ul li::before{background:var(--vanquis-deep)}
.summary-box p:first-child{font-family:"DM Mono",monospace;font-size:.72rem !important;letter-spacing:.2em;text-transform:uppercase}

.disclosure-box{
  background:#FDF4F3;border:1px solid rgba(232,69,60,.4);border-left:4px solid var(--vanquis-accent);
  border-radius:0 8px 8px 0;padding:1rem 1.3rem;margin-bottom:2rem;font-size:.88rem;color:#7A2020;
}

.table-label{
  font-family:"DM Mono",monospace;font-size:.7rem;font-weight:500;
  color:var(--gold-deep);text-transform:uppercase;letter-spacing:.2em;margin-bottom:.6rem;
}

/* --- 6. Tables ----------------------------------------------------------- */
table{width:100%;border-collapse:collapse;margin-bottom:1.5rem;font-size:.88rem}
thead th{
  background:var(--vanquis-deep);color:#fff;padding:.7rem .9rem;text-align:left;
  font-family:"DM Mono",monospace;font-weight:500;font-size:.72rem;letter-spacing:.1em;text-transform:uppercase;
}
tbody td{
  padding:.6rem .9rem;border-bottom:1px solid var(--line);
  font-family:"DM Mono",monospace;font-size:.82rem;color:var(--text-secondary);
}
/* row labels stay in the reading typeface */
tbody td:first-child{font-family:"DM Sans",sans-serif;font-size:.88rem;color:var(--text-primary)}
tbody tr:nth-child(even){background:var(--paper-2)}
tbody tr:hover td{background:rgba(212,168,83,.09)}
td.positive{color:var(--positive);font-weight:600}
td.negative{color:var(--negative);font-weight:600}
td.bold{font-weight:700;color:var(--text-primary)}

/* horizontal scroll shell added by em-analysis-embed.js for naked tables */
.em-table-scroll{overflow-x:auto;-webkit-overflow-scrolling:touch;margin-bottom:1.5rem}
.em-table-scroll table{margin-bottom:0}

/* --- 7. Callouts, verdict, figures --------------------------------------- */
.callout{
  border-left:4px solid;border-radius:0 8px 8px 0;padding:1.05rem 1.35rem;
  margin:1.6rem 0;font-size:.9rem;line-height:1.7;font-style:italic;
}
.callout-beginner{background:#F4F0E7;border-color:var(--vanquis-gold);color:#4A3F22}
.callout-title{
  font-family:"DM Mono",monospace;font-weight:500;font-style:normal;display:block;
  margin-bottom:.4rem;font-size:.7rem;letter-spacing:.2em;text-transform:uppercase;color:var(--gold-deep);
}

.verdict-box{
  background:radial-gradient(90% 140% at 100% 0%,rgba(212,168,83,.20),transparent 55%),
             linear-gradient(135deg,var(--vanquis-deep),var(--vanquis-mid));
  color:#F3ECDD;border:1px solid var(--line-strong);border-radius:8px;
  padding:1.9rem 2rem;margin:2.2rem 0;
}
.verdict-box h3{
  font-family:"Playfair Display",serif;font-size:1.45rem;font-weight:700;
  margin-bottom:.85rem;color:var(--vanquis-gold);letter-spacing:-.01em;
}
.verdict-box p{color:rgba(243,236,221,.92);margin-bottom:.7rem;max-width:none}
.verdict-box strong{color:#fff}

figure img{border-radius:8px;border:1px solid var(--line)}
figcaption{font-family:"DM Mono",monospace;font-size:.7rem;letter-spacing:.04em;color:var(--text-muted);margin-top:.6rem;font-style:normal}

/* chart panels are inline-styled #f8fafc in every article — warm them up */
div[style*="f8fafc" i]{
  background:var(--paper-2) !important;
  border:1px solid var(--line) !important;
  border-radius:8px !important;
}

.disclaimer,.sources{border-top:1px solid var(--line)}
.disclaimer{font-size:.76rem;line-height:1.7;color:var(--text-muted)}
.sources h3{font-family:"DM Mono",monospace;font-size:.72rem;letter-spacing:.2em;text-transform:uppercase;color:var(--text-muted)}
.sources ul li{font-size:.8rem;color:var(--text-muted)}
.sources ul li::before{background:var(--text-muted)}

/* --- 8. Reading aids (em-analysis-embed.js) ------------------------------ */
.em-progress{
  position:fixed;top:0;left:0;height:3px;width:0;z-index:90;
  background:linear-gradient(90deg,var(--vanquis-gold),var(--gold-deep));
  transition:width .08s linear;pointer-events:none;
}
body.em-embedded .em-progress{display:none}

.em-toc{
  border:1px solid var(--line);border-radius:8px;background:var(--paper);
  margin:0 0 2rem;overflow:hidden;
}
.em-toc>summary{
  cursor:pointer;list-style:none;padding:.85rem 1.1rem;
  font-family:"DM Mono",monospace;font-size:.7rem;letter-spacing:.2em;
  text-transform:uppercase;color:var(--gold-deep);
  display:flex;align-items:center;justify-content:space-between;gap:10px;
}
.em-toc>summary::-webkit-details-marker{display:none}
.em-toc>summary::after{content:"+";font-size:1rem;color:var(--text-muted);line-height:1}
.em-toc[open]>summary::after{content:"–"}
.em-toc>summary:hover{background:var(--paper-2)}
.em-toc-list{padding:.2rem .6rem .9rem;display:grid;gap:1px}
.em-toc-list a{
  display:block;padding:.5rem .7rem;border-radius:5px;text-decoration:none;
  font-size:.88rem;color:var(--text-secondary);border-left:2px solid transparent;
}
.em-toc-list a:hover{background:var(--paper-2);color:var(--vanquis-deep);border-left-color:var(--vanquis-gold)}

.em-top{
  position:fixed;right:18px;bottom:18px;z-index:80;
  width:42px;height:42px;border-radius:50%;
  border:1px solid var(--line-strong);background:var(--bg-white);color:var(--vanquis-deep);
  font-size:16px;line-height:1;cursor:pointer;box-shadow:0 10px 24px -14px rgba(27,42,74,.55);
  opacity:0;pointer-events:none;transition:opacity .25s,transform .25s;
}
.em-top.show{opacity:1;pointer-events:auto}
.em-top:hover{transform:translateY(-2px);border-color:var(--gold-deep);color:var(--gold-deep)}

/* --- 9. Embed mode ------------------------------------------------------- */
/* When framed by the Base44 app (?embed=1) the app shell supplies nav, footer
   and page background, and the article sits flush inside it — no card border,
   no inner scrollbar, no "box in a box". */
body.em-embedded{background:transparent}
body.em-embedded .em-nav,
body.em-embedded .em-foot,
body.em-embedded .em-top{display:none !important}
body.em-embedded .article-container{
  box-shadow:none;border:none;border-radius:0;
  max-width:920px;padding-bottom:1.5rem;
}
body.em-embedded .hero-banner{border-radius:0}

/* --- 10. Responsive ------------------------------------------------------ */
@media (max-width:900px){
  .em-nav-links{display:none}
}
@media (max-width:700px){
  .stat-box{padding:.75rem .9rem}
  .stat-value{font-size:1.05rem}
  .article-title{font-size:1.62rem}
  p{font-size:1rem;line-height:1.75}
  ul li{font-size:.96rem}
  table{font-size:.8rem}
  thead th{padding:.55rem .6rem;font-size:.66rem}
  tbody td{padding:.5rem .6rem;font-size:.78rem}
  tbody td:first-child{font-size:.82rem}
  .verdict-box{padding:1.4rem 1.3rem}
  .em-foot-grid{flex-direction:column}
}
@media (prefers-reduced-motion:reduce){
  html{scroll-behavior:auto}
  *{transition-duration:.001ms !important;animation-duration:.001ms !important}
}
@media print{
  .em-nav,.em-foot,.em-progress,.em-top,.em-toc{display:none !important}
  .article-container{box-shadow:none;border:none}
}
