/**
 * brief-page.css
 * Shared stylesheet for the eToro Competition Brief view format.
 * Per-brand overrides: set CSS custom properties on <body>.
 *
 * Required per-brand vars (set on <body style="...">):
 *   --brand-primary:   #00D54B    Primary brand color
 *   --brand-dark:      #111111    Dark variant (or #000)
 *   --brand-bg:        #f5f5f5    Card background when no image
 *   --brand-name:      "Cash App" Used in generated content
 *
 * Usage: <link rel="stylesheet" href="../assets/brief-page.css">
 * Then: <link rel="stylesheet" href="brief-overrides.css"> (optional per-brand)
 */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }

/* ---- Design tokens -------------------------------------- */
:root {
  --font-display: 'Larken', Georgia, 'Times New Roman', serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;

  --black:  #0c0c0c;
  --white:  #ffffff;
  --bg:     #f2f2f2;
  --grey:   #555;
  --light:  #999;
  --border: #e4e4e4;
  --red:    #CC0000;
  --pad:    16px;
  --max-w:  1320px;

  /* Brand tokens — override per brand */
  --brand-primary: #CC0000;
  --brand-dark:    #111111;
  --brand-bg:      #f5f5f5;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--black);
  -webkit-font-smoothing: antialiased;
}

/* ---- Scroll progress ------------------------------------ */
.scroll-bar {
  position: fixed; top: 0; left: 0; height: 2px;
  background: var(--brand-primary); z-index: 400; width: 0;
  transition: width 0.05s linear;
}

/* ---- Header --------------------------------------------- */
.hdr {
  position: sticky; top: 2px; z-index: 300;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
}
.hdr-back { font-size: 11px; color: var(--light); transition: color .15s; }
.hdr-back:hover { color: var(--black); }
.hdr-center { display: flex; align-items: center; gap: 10px; }
.hdr-name {
  font-family: var(--font-display);
  font-size: 17px; font-weight: 400; letter-spacing: -0.02em;
}
.threat {
  font-size: 9px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; padding: 3px 7px; border-radius: 2px;
}
.threat-high    { background: #fee2e2; color: #991b1b; }
.threat-medium  { background: #fef3c7; color: #92400e; }
.threat-low     { background: #dcfce7; color: #166534; }
.threat-monitor { background: #f3f4f6; color: #374151; }

.hdr-toggle { display: flex; gap: 2px; }
.hdr-btn {
  font-size: 11px; font-weight: 500; padding: 5px 11px;
  border-radius: 2px; color: var(--light); cursor: pointer;
  border: 1px solid transparent; transition: all .15s;
}
.hdr-btn.on { background: var(--black); color: var(--white); }
.hdr-btn:not(.on):hover { background: #f0f0f0; color: var(--black); }

/* ---- Split Hero ----------------------------------------- */
.hero-split {
  display: flex;
  height: 48vh; min-height: 320px;
  overflow: hidden;
}
.hero-brand {
  flex: 0 0 42%;
  background: var(--brand-dark);
  display: flex; flex-direction: column;
  justify-content: flex-end;
  padding: 28px 32px;
  position: relative;
  overflow: hidden;
}
.hero-brand::before {
  /* Large translucent brand initial — decorative */
  content: attr(data-initial);
  position: absolute;
  top: -20px; right: -10px;
  font-family: var(--font-display);
  font-size: 220px; font-weight: 700;
  color: rgba(255,255,255,0.04);
  letter-spacing: -0.05em;
  line-height: 1;
  pointer-events: none;
}
.hero-brand-accent {
  width: 32px; height: 2px;
  background: var(--brand-primary);
  margin-bottom: 16px;
}
.hero-eye {
  font-size: 9px; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: rgba(255,255,255,0.3);
  margin-bottom: 8px;
}
.hero-name {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 52px);
  font-weight: 400; letter-spacing: -0.03em;
  color: var(--white); line-height: 1; margin-bottom: 12px;
}
.hero-sub {
  font-size: 12px; color: rgba(255,255,255,0.5);
  line-height: 1.55; max-width: 300px;
}
.hero-stats {
  display: flex; gap: 20px; margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.hero-stat-val {
  font-family: var(--font-display);
  font-size: 17px; font-weight: 400;
  letter-spacing: -0.02em; color: var(--white); margin-bottom: 2px;
}
.hero-stat-key {
  font-size: 9px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: rgba(255,255,255,0.3);
}
.hero-photo {
  flex: 1;
  overflow: hidden; background: #111;
  position: relative;
}
.hero-photo img {
  width: 100%; height: 100%; object-fit: cover;
}
/* Hero photo fallback: brand color gradient */
.hero-photo.no-photo {
  background: linear-gradient(
    135deg,
    var(--brand-primary) 0%,
    color-mix(in srgb, var(--brand-primary) 30%, #000) 100%
  );
}

/* ---- TL;DR strip ---------------------------------------- */
.tldr {
  background: var(--black); color: var(--white);
  padding: 0 24px;
}
.tldr-inner {
  max-width: var(--max-w); margin: 0 auto;
  display: flex; align-items: stretch;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.tldr-stats { display: flex; flex: 1; overflow-x: auto; }
.tldr-stat {
  padding: 16px 22px; flex-shrink: 0;
  border-right: 1px solid rgba(255,255,255,0.08);
}
.tldr-stat:first-child { padding-left: 0; }
.tldr-val {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 400;
  letter-spacing: -0.02em; line-height: 1; margin-bottom: 3px;
}
.tldr-key {
  font-size: 9px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: rgba(255,255,255,0.35);
}
.tldr-verdict {
  padding: 16px 0 16px 24px;
  max-width: 320px; flex-shrink: 0;
}
.tldr-vlabel {
  font-size: 9px; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--brand-primary); margin-bottom: 5px;
}
.tldr-vtext {
  font-family: var(--font-display);
  font-size: 13px; color: rgba(255,255,255,0.75);
  line-height: 1.55; letter-spacing: -0.01em;
}

/* ---- Gallery label -------------------------------------- */
.gallery-hdr {
  max-width: var(--max-w); margin: 0 auto;
  padding: 18px 24px 10px;
  font-size: 9px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--light);
}

/* ---- Mosaic layout -------------------------------------- */
.mosaic-wrap {
  max-width: var(--max-w); margin: 0 auto;
  padding: 0 24px 40px;
}
.mosaic { display: flex; gap: var(--pad); align-items: flex-start; }
.mosaic-col { flex: 1; display: flex; flex-direction: column; gap: var(--pad); }
.mosaic-full { margin-bottom: var(--pad); }

/* ---- Card ----------------------------------------------- */
.m-card {
  background: var(--white);
  border: 1px solid var(--border);
  overflow: hidden; cursor: pointer;
}
.m-card:hover .m-img img { transform: scale(1.025); }
.m-card.open:hover .m-img img { transform: none; }

/* Image area */
.m-img { overflow: hidden; background: #111; position: relative; border-radius: 0; }
.m-img img {
  width: 100%; display: block; object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 0;
}
/* Explicitly kill any rounded corners everywhere */
.m-card, .m-card *, .hero-split, .hero-split *, .practice-card { border-radius: 0 !important; }

/* Natural ratio — for agency/system images; no forced crop */
.m-img.natural { background: #f5f5f5; }
.m-img.natural img { height: auto !important; object-fit: unset; }
.m-img.natural.dark { background: #111; }

/* ---- Fallback card: no image available ---------------- */
/*
 * Four tiers — always pick the highest tier available:
 *   Tier 1: Real agency/brand photography        → .m-img (standard)
 *   Tier 2: Product screenshots                   → .m-img (standard)
 *   Tier 3: Brand color fill + label              → .m-img.fallback.color
 *   Tier 4: Dark fill + ghost number              → .m-img.fallback (default)
 *
 * Rule: a confident color field always beats a mediocre crop.
 * Never show a bad image just because you have one.
 *
 * Usage:
 *   <div class="m-img fallback color" data-num="§01" data-section="Quick Facts">
 *     <span class="fallback-label">Quick Facts</span>
 *   </div>
 */
.m-img.fallback {
  min-height: 180px;
  background: var(--brand-dark, #111);
  display: flex;
  align-items: flex-end;
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}
/* Tier 4: ghost number on dark */
.m-img.fallback::before {
  content: attr(data-num);
  position: absolute;
  bottom: -16px; right: 8px;
  font-family: var(--font-display);
  font-size: 96px; font-weight: 700;
  letter-spacing: -0.05em; line-height: 1;
  color: rgba(255,255,255,0.06);
  pointer-events: none;
}
.m-img.fallback::after {
  content: '';
  position: absolute; top: 0; left: 0;
  width: 3px; height: 100%;
  background: var(--brand-primary, #CC0000);
}

/* Tier 3: brand primary color fill */
.m-img.fallback.color {
  background: var(--brand-primary, #CC0000);
}
.m-img.fallback.color::before {
  color: rgba(0,0,0,0.08);
}
.m-img.fallback.color::after {
  background: rgba(0,0,0,0.2);
}
.m-img.fallback.color .fallback-label {
  color: rgba(0,0,0,0.4);
}

.m-img.fallback .fallback-label {
  position: relative; z-index: 1;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: rgba(255,255,255,0.35);
}

/* Caption below image */
.m-caption {
  padding: 10px 14px 12px;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}
.m-card.open .m-caption { border-bottom-color: var(--border); }
.m-caption-row {
  display: flex; align-items: baseline;
  justify-content: space-between; gap: 8px;
}
.m-num {
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--brand-primary); flex-shrink: 0;
}
.m-name { font-size: 13px; font-weight: 600; color: var(--black); flex: 1; }
.m-expand {
  font-size: 16px; font-weight: 300; color: var(--light); line-height: 1;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1); flex-shrink: 0;
}
.m-card.open .m-expand { transform: rotate(45deg); color: var(--black); }
.m-sub { font-size: 11px; color: var(--light); margin-top: 2px; line-height: 1.4; }

/* Expand body — CSS grid collapse animation */
.m-body {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
.m-card.open .m-body { grid-template-rows: 1fr; }
.m-body-inner { overflow: hidden; }

/* Content inside expanded card */
.m-content { padding: 20px; border-top: 1px solid var(--border); }
.m-content p {
  font-size: 13px; color: var(--grey);
  line-height: 1.7; max-width: 620px; margin-bottom: 12px;
}
.m-content p:last-child { margin-bottom: 0; }
.m-content h4 {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--light); margin-bottom: 10px; margin-top: 16px;
}
.m-content h4:first-child { margin-top: 0; }

/* Content components */
.callout {
  border-left: 2px solid var(--brand-primary);
  padding: 10px 14px; margin: 14px 0;
  background: color-mix(in srgb, var(--brand-primary) 6%, white);
  font-size: 12px; font-style: italic; color: var(--grey); line-height: 1.6;
}
.fact-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 1px; background: var(--border);
  border: 1px solid var(--border); margin-bottom: 14px;
}
.f-cell { background: var(--white); padding: 12px; }
.f-val {
  font-family: var(--font-display);
  font-size: 18px; font-weight: 400;
  letter-spacing: -0.02em; margin-bottom: 2px;
}
.f-key { font-size: 9px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.07em; color: var(--light); }
.timeline { padding-left: 18px; border-left: 2px solid var(--border); }
.t-item { position: relative; padding-left: 16px; padding-bottom: 20px; }
.t-item:last-child { padding-bottom: 0; }
.t-item::before {
  content: ''; position: absolute; left: -24px; top: 4px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--black); border: 2px solid var(--bg); box-shadow: 0 0 0 1.5px var(--black);
}
.t-item.now::before { background: var(--brand-primary); box-shadow: 0 0 0 1.5px var(--brand-primary); }
.t-yr { font-family: var(--font-mono); font-size: 10px; color: var(--brand-primary); margin-bottom: 2px; }
.t-hd { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.t-bd { font-size: 12px; color: var(--grey); line-height: 1.55; max-width: 520px; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.sw { width: 88px; }
.sw-block { height: 48px; border-radius: 2px; margin-bottom: 5px; border: 1px solid rgba(0,0,0,0.06); }
.sw-name { font-size: 11px; font-weight: 500; margin-bottom: 1px; }
.sw-hex { font-family: var(--font-mono); font-size: 10px; color: var(--light); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.two-col ul { list-style: none; }
.two-col li { font-size: 12px; color: var(--grey); padding: 6px 0; border-bottom: 1px solid var(--border); line-height: 1.45; }
.two-col li:last-child { border-bottom: none; }
.verdict-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); }
.v-col { background: var(--white); padding: 16px; }
.v-label { font-size: 9px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; padding-bottom: 8px; margin-bottom: 10px; border-bottom: 2px solid var(--border); }
.v-col.borrow .v-label { color: #16a34a; border-color: #16a34a; }
.v-col.watch  .v-label { color: #d97706; border-color: #d97706; }
.v-col.reject .v-label { color: var(--red); border-color: var(--red); }
.v-col ul { list-style: none; }
.v-col li { font-size: 12px; color: var(--grey); padding: 5px 0; border-bottom: 1px solid var(--border); line-height: 1.4; }
.v-col li:last-child { border-bottom: none; }
.social-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.soc-item { padding: 12px; background: #f9f9f9; border: 1px solid var(--border); }
.soc-plat { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 5px; }
.soc-body { font-size: 12px; color: var(--grey); line-height: 1.55; }
.campaign { margin-bottom: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.campaign:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.campaign-img { overflow: hidden; margin-bottom: 12px; }
.campaign-img img { width: 100%; height: auto; display: block; }
.c-meta { display: flex; gap: 14px; margin-bottom: 5px; font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.07em; color: var(--light); }
.c-name { font-family: var(--font-display); font-size: 18px; font-weight: 400; letter-spacing: -0.01em; margin-bottom: 7px; }
.c-desc { font-size: 12px; color: var(--grey); line-height: 1.65; max-width: 580px; }
.c-sub { display: grid; grid-template-columns: repeat(3,1fr); gap: 2px; margin-top: 10px; }
.c-sub div { aspect-ratio: 16/9; overflow: hidden; }
.c-sub div img { width: 100%; height: 100%; object-fit: cover; }
.vs-tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.vs-tbl th { text-align: left; font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--light); padding: 8px 10px; background: #f5f5f5; border-bottom: 1px solid var(--border); }
.vs-tbl td { padding: 10px; border-bottom: 1px solid var(--border); color: var(--grey); vertical-align: top; line-height: 1.45; }
.vs-tbl tr:last-child td { border-bottom: none; }
.wc { color: #15803d; font-weight: 500; }
.we { color: #1d4ed8; font-weight: 500; }
.img2 { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; margin: 12px 0; }
.img2 div { aspect-ratio: 16/9; overflow: hidden; }
.img2 div img { width: 100%; height: 100%; object-fit: cover; }
.full-link { display: inline-flex; align-items: center; gap: 5px; margin-top: 20px; font-size: 11px; font-weight: 500; border-bottom: 1px solid var(--black); padding-bottom: 1px; transition: opacity .15s; }
.full-link:hover { opacity: 0.5; }

/* Brand in Practice (full-width expandable grid) */
.practice-card { background: var(--white); border: 1px solid var(--border); overflow: hidden; cursor: pointer; }
.practice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.practice-grid div { aspect-ratio: 4/3; overflow: hidden; background: #111; }
.practice-grid div img { width: 100%; height: 100%; object-fit: cover; }
.practice-caption { padding: 10px 14px 12px; display: flex; align-items: center; justify-content: space-between; }
.practice-caption-left { display: flex; align-items: baseline; gap: 8px; }
.practice-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.45s cubic-bezier(0.16, 1, 0.3, 1); }
.practice-card.open .practice-body { grid-template-rows: 1fr; }
.practice-body-inner { overflow: hidden; }
.practice-expand { font-size: 16px; font-weight: 300; color: var(--light); transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1); }
.practice-card.open .practice-expand { transform: rotate(45deg); color: var(--black); }

/* Footer */
.page-footer { padding: 24px; border-top: 1px solid var(--border); margin-top: 16px; }

/* JS helper — expand toggle */
/* function tog(id) { document.getElementById(id).classList.toggle('open'); } */

/* ---- Responsive ----------------------------------------- */
@media (max-width: 768px) {
  :root { --pad: 10px; }
  .mosaic { flex-direction: column; }
  .hero-split { flex-direction: column; height: auto; }
  .hero-brand { flex: none; padding: 24px 20px; min-height: 200px; }
  .hero-photo { height: 40vw; min-height: 180px; }
  .tldr-inner { flex-direction: column; }
  .tldr-stats { flex-wrap: wrap; }
  .tldr-stat { padding: 10px 14px; }
  .tldr-verdict { padding: 12px 0; max-width: 100%; border-top: 1px solid rgba(255,255,255,0.07); }
  .two-col, .verdict-row, .social-grid { grid-template-columns: 1fr; }
  .practice-grid { grid-template-columns: repeat(2,1fr); }
}
