/* ============================================================
   CirFin — shared stylesheet
   ============================================================ */

/* Smooth cross-fade between pages (e.g. Times card -> article) in
   browsers that support cross-document view transitions. No-op
   (plain navigation) everywhere else — purely progressive. */
@view-transition{
  navigation: auto;
}
/* Slower, gentler easing than the browser default (which is a snappy
   0.25s linear-ish fade and reads as flaky/abrupt) — a single relaxed
   ease-out on both the whole-page crossfade and the cover-photo morph. */
::view-transition-group(*){
  animation-duration: 0.5s;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}
::view-transition-old(root),
::view-transition-new(root){
  animation-duration: 0.35s;
  animation-timing-function: ease;
}

:root{
  --bg: #0A0A09;
  --bg-rgb: 10,10,9;
  --bg-soft: #121210;
  --surface: #17171490;
  --line: rgba(243,239,231,0.10);
  --line-strong: rgba(243,239,231,0.22);
  --text: #F3EFE7;
  --text-dim: #ABA69C;
  --text-faint: #726D64;
  --accent: #2FBE73;
  --accent-rgb: 47,190,115;
  --accent-soft: rgba(47,190,115,0.14);
  --accent-2: #E3B341;
  --initial-rgb: 243,239,231;
  --cover-grad-1: #10241a;
  --cover-grad-2: #0A0A09;
  --tooltip-bg: #17171F;
  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --serif-news: "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: "Playfair Display", Georgia, "Times New Roman", serif;
  --mono: "Playfair Display", Georgia, "Times New Roman", serif;
  --maxw: 1180px;
}

/* ---------- Light mode ---------- */
:root[data-theme="light"]{
  --bg: #FAF7F0;
  --bg-rgb: 250,247,240;
  --bg-soft: #F1ECE1;
  --surface: #FFFFFFCC;
  --line: rgba(26,23,18,0.12);
  --line-strong: rgba(26,23,18,0.24);
  --text: #1A1712;
  --text-dim: #4B4438;
  --text-faint: #857C6B;
  --accent-soft: rgba(47,190,115,0.12);
  --initial-rgb: 26,23,18;
  --cover-grad-1: #E8F3EC;
  --cover-grad-2: #F1ECE1;
  --tooltip-bg: #FFFFFF;
}

*{ box-sizing:border-box; }
html{ scroll-behavior:smooth; }
html{ -webkit-text-size-adjust:100%; text-size-adjust:100%; }
body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:var(--sans);
  font-size:16px;
  line-height:1.6;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
  transition:background .25s ease, color .25s ease;
}
img{ max-width:100%; display:block; }
a{ color:inherit; text-decoration:none; }
.wrap{ max-width:var(--maxw); margin:0 auto; padding:0 28px; }

/* ---------- Kicker / eyebrow ---------- */
.kicker{
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-family:var(--mono);
  font-size:12px;
  letter-spacing:0.14em;
  text-transform:uppercase;
  color:var(--accent);
}
.kicker::before{
  content:"";
  width:6px; height:6px;
  border-radius:50%;
  background:var(--accent);
}

/* ---------- Header ---------- */
header.site{
  position:sticky; top:0; z-index:50;
  background:rgba(var(--bg-rgb),0.82);
  backdrop-filter:blur(10px);
  border-bottom:1px solid var(--line);
}
header.site .bar{
  display:flex; align-items:center; justify-content:space-between;
  padding:20px 28px;
  max-width:var(--maxw); margin:0 auto;
}
.logo{
  font-family:var(--serif-news);
  font-weight:400;
  font-size:22px;
  letter-spacing:0.01em;
  display:flex; align-items:baseline; gap:8px;
}
.logo .tag{
  font-family:var(--mono);
  font-size:10px;
  letter-spacing:0.14em;
  text-transform:uppercase;
  color:var(--text-faint);
  font-weight:500;
}
nav.main{ display:flex; align-items:center; gap:34px; }
nav.main a{
  font-size:14px; color:var(--text-dim);
  transition:color .2s ease;
  position:relative;
}
nav.main a:hover{ color:var(--text); }
nav.main a.active{ color:var(--text); }
nav.main a.active::after{
  content:""; position:absolute; left:0; right:0; bottom:-6px;
  height:2px; background:var(--accent);
}
.btn{
  display:inline-flex; align-items:center; gap:8px;
  padding:11px 20px;
  border-radius:999px;
  font-size:13px; font-weight:600;
  letter-spacing:0.01em;
  border:1px solid var(--line-strong);
  transition:all .2s ease;
  white-space:nowrap;
}
.btn.primary{ background:var(--accent); color:#0A0A09; border-color:var(--accent); }
.btn.primary:hover{ background:#49D98A; }
.btn.ghost{ background:transparent; color:var(--text); }
.btn.ghost:hover{ border-color:var(--text-dim); }
.navmenu-toggle{ display:none; }

.bar-actions{ display:flex; align-items:center; gap:10px; }
.theme-toggle{
  display:inline-flex; align-items:center; justify-content:center;
  width:38px; height:38px;
  border-radius:999px;
  border:1px solid var(--line-strong);
  background:transparent;
  color:var(--text);
  font-size:16px;
  line-height:1;
  cursor:pointer;
  transition:all .2s ease;
}
.theme-toggle:hover{ border-color:var(--accent); color:var(--accent); }

/* ---------- Footer ---------- */
footer.site{
  border-top:1px solid var(--line);
  padding:56px 0 32px;
  margin-top:100px;
}
footer.site .foot-grid{
  display:flex; justify-content:space-between; gap:40px; flex-wrap:wrap;
  margin-bottom:40px;
}
footer.site .foot-col h4{
  font-family:var(--mono); font-size:11px; letter-spacing:0.12em;
  text-transform:uppercase; color:var(--text-faint); margin:0 0 14px;
}
footer.site .foot-col a{
  display:block; color:var(--text-dim); font-size:14px; margin-bottom:10px;
  transition:color .2s ease;
}
footer.site .foot-col a:hover{ color:var(--text); }
footer.site .foot-bottom{
  display:flex; justify-content:space-between; align-items:center;
  padding-top:24px; border-top:1px solid var(--line);
  font-size:12px; color:var(--text-faint); flex-wrap:wrap; gap:12px;
}

/* ---------- Sections ---------- */
section{ padding:96px 0; }
.section-head{ margin-bottom:48px; max-width:640px; }
.section-head h2{
  font-family:var(--serif);
  font-size:clamp(28px,3.4vw,42px);
  font-weight:500;
  margin:14px 0 0;
  line-height:1.15;
}
.section-head p{ color:var(--text-dim); font-size:16px; margin-top:14px; max-width:520px; }

/* ---------- Buttons row ---------- */
.cta-row{ display:flex; gap:14px; flex-wrap:wrap; align-items:center; }

/* ---------- Episode / Article cards ---------- */
.grid{ display:grid; gap:22px; }
.grid.cols-3{ grid-template-columns:repeat(3,1fr); }
.grid.cols-2{ grid-template-columns:repeat(2,1fr); }

.card{
  border:1px solid var(--line);
  border-radius:14px;
  overflow:hidden;
  background:linear-gradient(180deg, rgba(255,255,255,0.02), transparent);
  padding:24px;
  transition:border-color .2s ease, transform .2s ease;
  display:flex; flex-direction:column; height:100%;
}
.card:hover{ border-color:var(--line-strong); transform:translateY(-2px); }
.card .ep-num{
  font-family:var(--mono); font-size:12px; color:var(--accent);
  letter-spacing:0.08em;
}
.card h3{
  font-family:var(--serif); font-weight:500; font-size:20px;
  line-height:1.3; margin:12px 0 10px;
}
/* Podcast episode titles — dense, high-contrast newspaper serif (WSJ-style) */
.card h3.ep-title{
  font-family:var(--serif-news);
  font-weight:700;
  font-size:20px;
  line-height:1.3;
  letter-spacing:-0.005em;
  margin:12px 0 10px;
}
.card .meta{
  display:flex; flex-wrap:wrap; gap:8px;
  font-size:12px; color:var(--text-faint); margin-bottom:14px;
}
.tag{
  border:1px solid var(--line-strong);
  border-radius:999px; padding:4px 10px;
  font-family:var(--mono); text-transform:uppercase; letter-spacing:0.06em;
  font-size:10px; color:var(--text-dim);
}
.card p.desc{ color:var(--text-dim); font-size:14px; margin:0 0 18px; flex-grow:1; }
.card .card-foot{
  display:flex; justify-content:space-between; align-items:center;
  padding-top:14px; border-top:1px solid var(--line);
  font-size:13px;
}
.card .card-foot .card-link{ color:var(--text); font-weight:600; }
.card:hover .card-foot .card-link{ color:var(--accent); }

/* Arrow glyph as an SVG mask instead of a Unicode character — the "→" character
   falls outside the serif type stack and Chrome substitutes a mismatched fallback
   glyph for it, so we draw it ourselves instead. */
.arrow-right{
  display:inline-block; width:0.8em; height:0.8em;
  margin-left:6px; vertical-align:-0.08em;
  background-color:currentColor;
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 5l7 7-7 7'/%3E%3C/svg%3E") center / contain no-repeat;
  mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 5l7 7-7 7'/%3E%3C/svg%3E") center / contain no-repeat;
  transition:transform .18s ease;
}
a:hover .arrow-right{ transform:translateX(3px); }

/* ---------- CirFin Times — magazine grid ---------- */
.times-grid{
  display:grid; grid-template-columns:repeat(3, 1fr); gap:26px;
}
.times-feature{
  grid-column:1 / -1;
  display:grid; grid-template-columns:0.9fr 1.1fr;
  border:1px solid var(--line); border-radius:14px; overflow:hidden;
  text-decoration:none; color:inherit;
  transition:border-color .2s ease;
  margin-bottom:4px;
}
.times-feature:hover{ border-color:var(--line-strong); }
.times-feature .cover{ min-height:190px; }
.times-feature .body{ padding:22px 26px; display:flex; flex-direction:column; justify-content:center; }
.times-feature .body h3{
  font-family:var(--serif-news); font-weight:700; font-size:clamp(18px,2vw,24px);
  line-height:1.22; margin:10px 0 10px; letter-spacing:-0.005em;
}
.times-feature .body p.desc{ color:var(--text-dim); font-size:13.5px; margin:0 0 14px; }

.times-card{
  border:1px solid var(--line); border-radius:14px; overflow:hidden;
  display:flex; flex-direction:column;
  text-decoration:none; color:inherit;
  transition:border-color .2s ease, transform .2s ease;
}
.times-card:hover{ border-color:var(--line-strong); transform:translateY(-2px); }
.times-card .cover{ aspect-ratio:16/10; }
.times-card .body{ padding:20px; display:flex; flex-direction:column; flex-grow:1; }
.times-card .body h3{
  font-family:var(--serif-news); font-weight:700; font-size:18px;
  line-height:1.32; margin:10px 0 8px; letter-spacing:-0.005em;
}
.times-card .body p.desc{ color:var(--text-dim); font-size:13.5px; margin:0 0 14px; flex-grow:1; }

.cover{ position:relative; overflow:hidden; background:var(--bg-soft); }
.cover img{ width:100%; height:100%; object-fit:cover; display:block; }
.cover.placeholder{
  display:flex; align-items:center; justify-content:center;
  background:
    radial-gradient(circle at 30% 20%, rgba(47,190,115,0.16), transparent 55%),
    linear-gradient(160deg, var(--cover-grad-1), var(--cover-grad-2) 70%);
}
.cover.placeholder .initial{
  font-family:var(--serif-news); font-weight:800; font-size:120px; line-height:1;
  color:rgba(var(--initial-rgb),0.10);
}
.cover .date-chip{
  position:absolute; top:14px; left:14px; z-index:2;
  font-family:var(--mono); font-size:10px; letter-spacing:.08em; text-transform:uppercase;
  background:#0A0A09; border:1px solid rgba(243,239,231,0.35);
  color:#F3EFE7; padding:5px 10px; border-radius:999px;
}
.times-feature .cover .date-chip, .times-card .cover .date-chip{ z-index:2; }

@media (max-width: 900px){
  .times-grid{ grid-template-columns:repeat(2, 1fr); }
  .times-feature{ grid-template-columns:1fr; }
  .times-feature .cover{ min-height:180px; }
}
@media (max-width: 620px){
  .times-grid{ grid-template-columns:1fr; }
}

/* ---------- Article page (CirFin Times single post) ---------- */
.article-hero{ padding:52px 0 0; }
.article-hero .back-link{
  display:inline-flex; align-items:center; gap:6px;
  font-family:var(--mono); font-size:12px; letter-spacing:.06em; text-transform:uppercase;
  color:var(--text-dim); margin-bottom:28px;
}
.article-hero .back-link:hover{ color:var(--accent); }
.article-hero h1{
  font-family:var(--serif-news); font-weight:700; font-size:clamp(30px,4.6vw,50px);
  line-height:1.15; margin:0 0 20px; max-width:840px; letter-spacing:-0.005em;
}
.article-byline{
  display:flex; gap:16px; align-items:center; flex-wrap:wrap;
  color:var(--text-dim); font-size:14px; margin-bottom:36px;
  font-family:var(--mono); font-size:12px; letter-spacing:.04em; text-transform:uppercase;
}
.article-byline .dot{ width:3px; height:3px; border-radius:50%; background:var(--text-faint); }
.article-cover{ border-radius:16px; overflow:hidden; margin-bottom:44px; max-height:520px; }
.article-cover img{ width:100%; height:100%; max-height:520px; object-fit:cover; display:block; }
.article-cover.placeholder{ height:320px; }
.article-cover.placeholder .initial{ font-family:var(--serif-news); font-weight:800; font-size:160px; }

.article-body{ max-width:700px; }
.article-body p{ color:var(--text); font-size:17px; line-height:1.75; margin:0 0 22px; }
.article-body h3{
  font-family:var(--serif); font-weight:700; color:var(--text); font-size:23px;
  margin:40px 0 16px; line-height:1.3;
}
.article-body ul{ margin:0 0 22px; padding-left:22px; color:var(--text); font-size:17px; line-height:1.75; }
.article-body ul li{ margin-bottom:6px; }
.article-foot{
  max-width:700px; margin-top:56px; padding-top:28px; border-top:1px solid var(--line);
  display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:16px;
}
.more-row{ margin-top:80px; }
.more-row .section-head{ margin-bottom:32px; }

/* ---------- Stats ---------- */
.stats{
  display:flex; gap:0; border:1px solid var(--line); border-radius:14px; overflow:hidden;
}
.stats .stat{
  flex:1; padding:28px 24px; border-right:1px solid var(--line);
}
.stats .stat:last-child{ border-right:none; }
.stats .stat .num{
  font-family:var(--serif); font-size:clamp(28px,3vw,38px); color:var(--accent);
}
.stats .stat .label{ font-size:12px; color:var(--text-dim); margin-top:6px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px){
  .grid.cols-3{ grid-template-columns:repeat(2,1fr); }
  .stats{ flex-wrap:wrap; }
  .stats .stat{ flex:1 1 50%; border-bottom:1px solid var(--line); }
  nav.main{ display:none; }
}
@media (max-width: 620px){
  .grid.cols-3, .grid.cols-2{ grid-template-columns:1fr; }
  section{ padding:64px 0; }
}

/* ---------- Reveal on scroll ---------- */
[data-reveal]{
  opacity:0; transform:translateY(18px);
  transition:opacity .7s ease, transform .7s ease;
}
[data-reveal].in{ opacity:1; transform:none; }

/* ---------- Mobile nav ---------- */
.navmenu-toggle{
  display:none;
  width:38px; height:38px;
  border-radius:8px;
  border:1px solid var(--line-strong);
  background:transparent;
  color:var(--text);
  align-items:center; justify-content:center;
  cursor:pointer;
}
@media (max-width: 900px){
  .navmenu-toggle{ display:flex; }
  nav.main{
    display:flex; flex-direction:column; align-items:flex-start; gap:0;
    position:fixed; top:73px; left:0; right:0;
    background:var(--bg);
    border-bottom:1px solid var(--line);
    max-height:0; overflow:hidden;
    transition:max-height .3s ease;
    padding:0 28px;
  }
  nav.main.open{ max-height:420px; padding:14px 28px 24px; }
  nav.main a{ padding:12px 0; width:100%; border-bottom:1px solid var(--line); font-size:15px; }
  nav.main .btn{ margin-top:14px; }
}

.story-caption{
  margin-top:10px;
  font-style:italic;
  font-size:14px;
  color:var(--text-dim);
  text-align:center;
}
