/* Ruben's Markets Log — shared stylesheet
   Every page in this site links to this one file, so the look
   never drifts no matter how a page's content was generated. */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Source+Serif+4:ital,wght@0,400;0,500;0,600;1,400&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root{
  --paper:#EEF0E7;
  --paper-alt:#E3E6D9;
  --ink:#1C201C;
  --ink-soft:#4E5548;
  --rule:#C7CBBB;
  --rate:#A23B2C;
  --oil:#B9832A;
  --trade:#3C6E64;
}
*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{
  background:var(--paper);
  color:var(--ink);
  font-family:'Source Serif 4', serif;
  -webkit-font-smoothing:antialiased;
}
a{color:inherit;}

/* ---------- Top bar (every page) ---------- */
.topbar{
  border-bottom:1px solid var(--rule);
  background:var(--paper-alt);
  padding:16px 24px;
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  flex-wrap:wrap;
  gap:8px;
}
.topbar .site-title{
  font-family:'Fraunces', serif;
  font-weight:600;
  font-size:17px;
  text-decoration:none;
}
.topbar .back-link{
  font-family:'IBM Plex Mono', monospace;
  font-size:12px;
  color:var(--ink-soft);
  text-decoration:none;
}
.topbar .back-link:hover{ color:var(--ink); }

/* ---------- Page wrapper ---------- */
.page{
  max-width:660px;
  margin:0 auto;
  padding:44px 24px 100px;
}

/* ---------- Index page ---------- */
.index-intro{
  margin-bottom:36px;
}
.index-intro h1{
  font-family:'Fraunces', serif;
  font-weight:600;
  font-size:30px;
  line-height:1.2;
  margin:0 0 12px;
}
.index-intro p{
  font-size:15.5px;
  color:var(--ink-soft);
  line-height:1.55;
  margin:0;
  max-width:60ch;
}
.index-group-label{
  font-family:'IBM Plex Mono', monospace;
  font-size:11px;
  letter-spacing:0.02em;
  color:var(--ink-soft);
  margin:32px 0 10px;
}
.index-list{
  list-style:none;
  margin:0;
  padding:0;
  border-top:1px solid var(--rule);
}
.index-list li{ border-bottom:1px solid var(--rule); }
.index-list a{
  display:flex;
  justify-content:space-between;
  align-items:baseline;
  gap:16px;
  padding:14px 4px;
  text-decoration:none;
}
.index-list a:hover{ background:rgba(28,32,28,0.05); }
.index-list .idx-date{
  font-family:'IBM Plex Mono', monospace;
  font-size:12px;
  color:var(--ink-soft);
  white-space:nowrap;
}
.index-list .idx-teaser{
  font-size:15.5px;
  flex:1;
}
.index-list.weekly li{ border-left:3px solid var(--rate); }
.index-list.weekly a{ padding-left:13px; }

/* ---------- Briefing entry content ---------- */
.entry-kicker{
  font-family:'IBM Plex Mono', monospace;
  font-size:12px;
  color:var(--ink-soft);
  margin-bottom:10px;
  display:flex;
  gap:10px;
  align-items:center;
}
.tag{
  display:inline-block;
  padding:2px 8px;
  border-radius:2px;
  font-size:10.5px;
  letter-spacing:0.03em;
}
.tag.daily{ background:var(--paper-alt); border:1px solid var(--rule); }
.tag.weekly{ background:var(--rate); color:var(--paper); }

.entry h2{
  font-family:'Fraunces', serif;
  font-weight:600;
  font-size:32px;
  line-height:1.22;
  margin:0 0 28px;
  max-width:20ch;
}
.entry h3{
  font-family:'Fraunces', serif;
  font-weight:600;
  font-size:18px;
  margin:36px 0 10px;
  padding-top:20px;
  border-top:1px solid var(--rule);
}
.entry h3:first-of-type{ margin-top:0; }
.entry p{
  font-size:16px;
  line-height:1.62;
  margin:0 0 16px;
  max-width:68ch;
}
.entry ul{
  margin:0 0 16px;
  padding-left:0;
  list-style:none;
}
.entry li{
  font-size:15.5px;
  line-height:1.55;
  margin:0 0 12px;
  padding-left:16px;
  position:relative;
  max-width:68ch;
}
.entry li::before{
  content:"–";
  position:absolute;
  left:0;
  color:var(--ink-soft);
}
.entry strong{ font-weight:600; }

.callout{
  background:var(--paper-alt);
  border-left:3px solid var(--trade);
  padding:16px 20px;
  margin:0 0 16px;
  font-size:15px;
  line-height:1.6;
}
.callout p:last-child{ margin-bottom:0; }

.levels{
  font-family:'IBM Plex Mono', monospace;
  font-size:13px;
  line-height:1.9;
  background:var(--paper-alt);
  border:1px solid var(--rule);
  padding:16px 20px;
  margin:0 0 20px;
  max-width:68ch;
}

.sources{
  margin-top:44px;
  padding-top:16px;
  border-top:1px solid var(--rule);
  font-size:12.5px;
  color:var(--ink-soft);
  font-style:italic;
  max-width:68ch;
}

.page-nav{
  display:flex;
  justify-content:space-between;
  margin-top:48px;
  padding-top:20px;
  border-top:1px solid var(--rule);
  font-family:'IBM Plex Mono', monospace;
  font-size:12.5px;
}
.page-nav a{ text-decoration:none; }
.page-nav a:hover{ color:var(--ink-soft); }
.page-nav .disabled{ color:var(--rule); pointer-events:none; }

@media (max-width: 700px){
  .entry h2{ font-size:26px; }
  .page{ padding:32px 18px 80px; }
}

/* ============================================================
   INDEX / DASHBOARD
   The landing page is the only wide page on the site: a calendar
   of briefings on the left, a portfolio performance card on the
   right. Everything below re-uses the same paper palette as the
   article pages so the two never feel like different sites.
   ============================================================ */

:root{
  --up:#3C6E64;
  --down:#A23B2C;
  --card:#F5F6EF;
}

.page-wide{
  max-width:1000px;
  margin:0 auto;
  padding:44px 24px 100px;
}

/* ---------- Masthead ---------- */
.masthead{
  border-bottom:2px solid var(--ink);
  padding-bottom:18px;
  margin-bottom:6px;
}
.masthead h1{
  font-family:'Fraunces', serif;
  font-weight:600;
  font-size:38px;
  line-height:1.1;
  margin:0 0 12px;
  letter-spacing:-0.01em;
}
.masthead p{
  font-size:15.5px;
  color:var(--ink-soft);
  line-height:1.55;
  margin:0;
  max-width:64ch;
}
.masthead-meta{
  font-family:'IBM Plex Mono', monospace;
  font-size:11px;
  letter-spacing:0.06em;
  text-transform:uppercase;
  color:var(--ink-soft);
  display:flex;
  justify-content:space-between;
  gap:16px;
  flex-wrap:wrap;
  padding:8px 0 30px;
  border-bottom:1px solid var(--rule);
  margin-bottom:34px;
}

/* ---------- Two-column dashboard ---------- */
.dash{
  display:grid;
  grid-template-columns:minmax(0,1.35fr) minmax(0,1fr);
  gap:38px;
  align-items:start;
}
.panel-label{
  font-family:'IBM Plex Mono', monospace;
  font-size:11px;
  letter-spacing:0.08em;
  text-transform:uppercase;
  color:var(--ink-soft);
  margin:0 0 12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

/* ---------- Calendar ---------- */
.cal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  border-bottom:1px solid var(--rule);
  padding-bottom:10px;
  margin-bottom:4px;
}
.cal-month{
  font-family:'Fraunces', serif;
  font-weight:600;
  font-size:20px;
}
.cal-nav{ display:flex; gap:6px; }
.cal-nav button{
  font-family:'IBM Plex Mono', monospace;
  font-size:13px;
  line-height:1;
  width:28px;
  height:28px;
  background:transparent;
  color:var(--ink);
  border:1px solid var(--rule);
  border-radius:2px;
  cursor:pointer;
}
.cal-nav button:hover:not(:disabled){ background:var(--paper-alt); }
.cal-nav button:disabled{ color:var(--rule); cursor:default; }

.cal-grid{
  display:grid;
  grid-template-columns:repeat(7, 1fr) 34px;
  gap:3px;
}
.cal-dow{
  font-family:'IBM Plex Mono', monospace;
  font-size:10px;
  letter-spacing:0.06em;
  color:var(--ink-soft);
  text-align:center;
  padding:10px 0 6px;
}

/* A day cell is a link when a brief exists that day, a plain div when not. */
.cal-day{
  position:relative;
  aspect-ratio:1/1;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:5px;
  border:1px solid transparent;
  border-radius:3px;
  font-family:'IBM Plex Mono', monospace;
  font-size:12.5px;
  color:var(--ink-soft);
  text-decoration:none;
}
.cal-day.pad{ visibility:hidden; }
.cal-day.empty{ color:var(--rule); }
.cal-day.has{
  background:var(--card);
  border-color:var(--rule);
  color:var(--ink);
  font-weight:500;
}
.cal-day.has:hover{
  background:var(--ink);
  color:var(--paper);
  border-color:var(--ink);
}
.cal-day.has:hover .cal-dot{ background:var(--paper); }
.cal-day.today{ border-color:var(--ink); border-style:dashed; }
.cal-dot{
  width:4px;
  height:4px;
  border-radius:50%;
  background:var(--trade);
}
/* 8th column: the weekly report covering that Mon–Sun row. */
.cal-week{
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:3px;
  font-family:'IBM Plex Mono', monospace;
  font-size:10px;
  letter-spacing:0.04em;
  text-decoration:none;
  color:var(--rule);
}
.cal-week.has{
  background:var(--rate);
  color:var(--paper);
  font-weight:500;
}
.cal-week.has:hover{ background:var(--ink); }

.cal-legend{
  display:flex;
  gap:18px;
  flex-wrap:wrap;
  font-family:'IBM Plex Mono', monospace;
  font-size:10.5px;
  color:var(--ink-soft);
  margin-top:14px;
  padding-top:12px;
  border-top:1px solid var(--rule);
}
.cal-legend span{ display:flex; align-items:center; gap:6px; }
.swatch{ width:9px; height:9px; border-radius:2px; display:inline-block; }
.swatch.daily{ background:var(--card); border:1px solid var(--rule); }
.swatch.weekly{ background:var(--rate); }

/* Preview of the hovered / selected day, under the grid. */
.cal-preview{
  margin-top:16px;
  padding:14px 16px;
  background:var(--paper-alt);
  border-left:3px solid var(--rule);
  min-height:78px;
}
.cal-preview .cp-kicker{
  font-family:'IBM Plex Mono', monospace;
  font-size:10.5px;
  letter-spacing:0.06em;
  text-transform:uppercase;
  color:var(--ink-soft);
  margin:0 0 6px;
}
.cal-preview .cp-title{
  font-size:15px;
  line-height:1.45;
  margin:0;
}
.cal-preview a{ text-decoration:none; border-bottom:1px solid var(--rule); }
.cal-preview a:hover{ border-bottom-color:var(--ink); }
.cal-preview.is-empty .cp-title{ color:var(--ink-soft); font-style:italic; }

/* ---------- Portfolio card ---------- */
.perf{
  background:var(--card);
  border:1px solid var(--rule);
  border-radius:3px;
  padding:18px 18px 14px;
}
.perf-switch{
  display:inline-flex;
  border:1px solid var(--rule);
  border-radius:3px;
  overflow:hidden;
  background:var(--paper);
}
.perf-switch button{
  font-family:'IBM Plex Mono', monospace;
  font-size:10.5px;
  letter-spacing:0.05em;
  padding:5px 10px;
  background:transparent;
  color:var(--ink-soft);
  border:0;
  border-right:1px solid var(--rule);
  cursor:pointer;
}
.perf-switch button:last-child{ border-right:0; }
.perf-switch button:hover{ color:var(--ink); }
.perf-switch button[aria-pressed="true"]{
  background:var(--ink);
  color:var(--paper);
}

.perf-window{
  font-family:'IBM Plex Mono', monospace;
  font-size:10.5px;
  color:var(--ink-soft);
  margin:12px 0 4px;
}
.perf-row{
  display:grid;
  grid-template-columns:46px minmax(0,1fr) 62px 60px;
  align-items:center;
  gap:10px;
  padding:11px 0;
  border-top:1px solid var(--rule);
}
.perf-row:first-of-type{ border-top:0; }
.perf-tkr{
  font-family:'IBM Plex Mono', monospace;
  font-size:12px;
  font-weight:600;
}
.perf-name{
  font-size:13px;
  color:var(--ink-soft);
  line-height:1.3;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.perf-spark{ display:block; width:62px; height:22px; }
.perf-chg{
  font-family:'IBM Plex Mono', monospace;
  font-size:13px;
  font-weight:600;
  text-align:right;
}
.perf-chg.up{ color:var(--up); }
.perf-chg.down{ color:var(--down); }
.perf-chg.flat{ color:var(--ink-soft); }

.perf-foot{
  border-top:1px solid var(--rule);
  margin-top:4px;
  padding-top:10px;
  font-family:'IBM Plex Mono', monospace;
  font-size:10px;
  color:var(--ink-soft);
  line-height:1.5;
}
.perf-warn{
  background:var(--rate);
  color:var(--paper);
  font-family:'IBM Plex Mono', monospace;
  font-size:10px;
  letter-spacing:0.04em;
  padding:7px 10px;
  border-radius:2px;
  margin:0 0 14px;
  line-height:1.5;
}

/* ---------- Latest strip + archive ---------- */
.latest{ margin-top:34px; }
.latest ol{ list-style:none; margin:0; padding:0; border-top:1px solid var(--rule); }
.latest li{ border-bottom:1px solid var(--rule); }
.latest a{
  display:block;
  padding:11px 2px;
  text-decoration:none;
  font-size:14px;
  line-height:1.45;
}
.latest a:hover{ background:rgba(28,32,28,0.05); }
.latest .l-date{
  font-family:'IBM Plex Mono', monospace;
  font-size:10.5px;
  letter-spacing:0.05em;
  color:var(--ink-soft);
  display:block;
  margin-bottom:3px;
}

.archive{ margin-top:46px; border-top:1px solid var(--rule); padding-top:18px; }
.archive summary{
  font-family:'IBM Plex Mono', monospace;
  font-size:11px;
  letter-spacing:0.08em;
  text-transform:uppercase;
  color:var(--ink-soft);
  cursor:pointer;
}
.archive summary:hover{ color:var(--ink); }
.archive .index-list{ margin-top:16px; }

@media (max-width: 860px){
  .dash{ grid-template-columns:1fr; gap:34px; }
  .masthead h1{ font-size:30px; }
  .page-wide{ padding:32px 18px 80px; }
  .cal-day{ font-size:11.5px; }
}

/* ============================================================
   BRIEFING ARTICLE PAGES
   A sticky section rail on the left, the article in a fixed
   measure beside it. Below 1040px the rail becomes a horizontal
   chip strip above the article.
   ============================================================ */

.progress{
  position:fixed;
  top:0; left:0; right:0;
  height:2px;
  z-index:20;
  background:transparent;
}
.progress span{
  display:block;
  height:100%;
  width:0;
  background:var(--ink);
}

.article-shell{
  display:grid;
  grid-template-columns:190px minmax(0,690px);
  gap:54px;
  justify-content:center;
  padding:48px 24px 110px;
}
.article-col{ min-width:0; }

/* ---------- Section rail ---------- */
.rail-sticky{ position:sticky; top:36px; }
.rail-label{
  font-family:'IBM Plex Mono', monospace;
  font-size:10.5px;
  letter-spacing:0.08em;
  text-transform:uppercase;
  color:var(--ink-soft);
  margin:0 0 12px;
}
.toc{ list-style:none; margin:0; padding:0; }
.toc li{ margin:0 0 2px; }
.toc a{
  display:flex;
  gap:9px;
  align-items:baseline;
  padding:6px 8px 6px 0;
  font-size:13px;
  line-height:1.35;
  color:var(--ink-soft);
  text-decoration:none;
  border-left:2px solid transparent;
  padding-left:10px;
}
.toc a:hover{ color:var(--ink); }
.toc a.is-active{
  color:var(--ink);
  border-left-color:var(--ink);
  font-weight:500;
}
.toc-num{
  font-family:'IBM Plex Mono', monospace;
  font-size:10px;
  color:var(--rule);
  flex:none;
}
.toc a.is-active .toc-num{ color:var(--ink-soft); }

/* ---------- Article header ---------- */
.entry-head{
  border-bottom:2px solid var(--ink);
  padding-bottom:22px;
  margin-bottom:30px;
}
.entry-kicker{ margin-bottom:14px; }
.kicker-sep{ color:var(--rule); }
.entry-head h2{
  font-size:36px;
  line-height:1.18;
  max-width:24ch;
  margin:0;
  letter-spacing:-0.008em;
}

/* Lead paragraphs sit right under the headline with no heading of their own. */
.entry-lead p:first-child{
  font-size:18px;
  line-height:1.58;
  color:var(--ink);
}
.entry-lead p:first-child::first-letter{
  font-family:'Fraunces', serif;
  font-weight:600;
  font-size:52px;
  float:left;
  line-height:0.84;
  padding:6px 9px 0 0;
}

/* ---------- Numbered sections ---------- */
.sec{ margin-top:40px; }
.entry h3{
  display:flex;
  align-items:baseline;
  gap:12px;
  flex-wrap:wrap;
  font-size:19px;
  margin:0 0 14px;
  padding-top:18px;
  border-top:1px solid var(--rule);
}
.sec-num{
  font-family:'IBM Plex Mono', monospace;
  font-size:11px;
  font-weight:500;
  color:var(--rate);
  letter-spacing:0.04em;
}
.sec-note{
  font-family:'IBM Plex Mono', monospace;
  font-size:10.5px;
  font-weight:400;
  letter-spacing:0.03em;
  color:var(--ink-soft);
  text-transform:uppercase;
}

/* ---------- Key levels table ---------- */
.levels{
  font-family:'IBM Plex Mono', monospace;
  font-size:12.5px;
  line-height:1.5;
  background:var(--card);
  border:1px solid var(--rule);
  padding:6px 16px;
  margin:0 0 20px;
}
.lv-group{ padding:9px 0; border-top:1px solid var(--rule); }
.lv-group:first-child{ border-top:0; }
.lv-row{
  display:grid;
  grid-template-columns:104px minmax(0,1fr);
  gap:12px;
  padding:2.5px 0;
}
.lv-label{
  font-weight:600;
  color:var(--ink);
  overflow:hidden;
  text-overflow:ellipsis;
}
.lv-val{ color:var(--ink-soft); }
.entry .lv-note{
  margin:7px 0 0;
  padding-left:116px;
  font-size:11.5px;
  color:var(--ink-soft);
  line-height:1.6;
}
.pct{ font-weight:600; }
.pct.up{ color:var(--up); }
.pct.down{ color:var(--down); }

/* ---------- Off the beaten path ---------- */
.callout{
  background:var(--paper-alt);
  border:1px solid var(--rule);
  border-left:3px solid var(--trade);
  padding:20px 24px 6px;
  margin:0;
}
.entry .callout-sub{
  font-family:'Fraunces', serif;
  font-weight:600;
  font-size:16px;
  line-height:1.35;
  margin:0 0 14px;
  color:var(--ink);
}

/* ---------- Watch next week / portfolio implications ---------- */
.sec-watch li::before{ content:"\25A1"; font-size:11px; top:1px; }
.sec-portfolio li::before{ content:"\2192"; }
.sec-portfolio li{ padding-left:22px; }
.sec-watch li{ padding-left:22px; }

/* ---------- Related ---------- */
.related{
  margin-top:52px;
  padding-top:18px;
  border-top:1px solid var(--rule);
}
.related ul{ list-style:none; margin:0; padding:0; }
.related li{ border-bottom:1px solid var(--rule); }
.related li:first-child{ border-top:1px solid var(--rule); }
.related a{
  display:grid;
  grid-template-columns:88px minmax(0,1fr);
  gap:14px;
  align-items:baseline;
  padding:11px 2px;
  text-decoration:none;
}
.related a:hover{ background:rgba(28,32,28,0.05); }
.rel-tag{
  font-family:'IBM Plex Mono', monospace;
  font-size:10px;
  letter-spacing:0.05em;
  text-transform:uppercase;
  color:var(--ink-soft);
}
.rel-title{ font-size:14.5px; line-height:1.45; }

/* ---------- Prev / next ---------- */
.entry-nav{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:16px;
  margin-top:44px;
}
.nav-card{
  display:flex;
  flex-direction:column;
  gap:7px;
  padding:14px 16px;
  border:1px solid var(--rule);
  border-radius:3px;
  text-decoration:none;
  background:var(--card);
}
.nav-card:hover{ border-color:var(--ink); }
.nav-next{ text-align:right; }
.nav-dir{
  font-family:'IBM Plex Mono', monospace;
  font-size:10px;
  letter-spacing:0.06em;
  text-transform:uppercase;
  color:var(--ink-soft);
}
.nav-title{
  font-size:14px;
  line-height:1.4;
  display:-webkit-box;
  -webkit-line-clamp:3;
  -webkit-box-orient:vertical;
  overflow:hidden;
}
.nav-card.disabled{
  color:var(--rule);
  background:transparent;
  border-style:dashed;
  font-family:'IBM Plex Mono', monospace;
  font-size:10px;
  letter-spacing:0.06em;
  text-transform:uppercase;
  align-items:center;
  justify-content:center;
  pointer-events:none;
}

@media (max-width: 1040px){
  /* Rail turns into a scrollable chip strip above the article. */
  .article-shell{ grid-template-columns:minmax(0,690px); gap:26px; padding:32px 18px 80px; }
  .rail-sticky{ position:static; }
  .rail-label{ margin-bottom:8px; }
  .toc{
    display:flex;
    gap:6px;
    overflow-x:auto;
    padding-bottom:4px;
    -webkit-overflow-scrolling:touch;
  }
  .toc li{ margin:0; flex:none; }
  .toc a{
    border:1px solid var(--rule);
    border-radius:99px;
    padding:5px 12px;
    white-space:nowrap;
    font-size:12px;
  }
  .toc a.is-active{ background:var(--ink); color:var(--paper); border-color:var(--ink); }
  .toc a.is-active .toc-num{ color:var(--paper); }
}

@media (max-width: 700px){
  .entry-head h2{ font-size:27px; max-width:none; }
  .entry-nav{ grid-template-columns:1fr; }
  .nav-next{ text-align:left; }
  .lv-row{ grid-template-columns:1fr; gap:0; }
  .entry .lv-note{ padding-left:0; }
  .related a{ grid-template-columns:1fr; gap:4px; }
}
