/*
  Mathematical Frontiers — daily briefing layout.
  Colour and type come from the host site's tokens (src/app/globals.css :root).
  app.js copies those tokens from the parent page at load, so the values below are
  fallbacks only (used when this page is opened outside the site frame).
*/
:root {
  --brand: #2e3a6b;
  --brand-deep: #1b2240;
  --brand-light: #3f4c85;
  --brand-pale: #eceef4;
  --gold: #8b6a2e;
  --gold-soft: #c9a96a;
  --sage: #9aa073;
  --surface: #f7f7f4;
  --white: #ffffff;
  --border: #dfe1e8;
  --text-primary: #1a1f33;
  --text-muted: #4a5068;
  --text-light: #6b7088;
  --serif: "Lora", Georgia, serif;
  --sans: "DM Sans", system-ui, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --wrap: 1080px;
  --on-dark: rgba(255, 255, 255, 0.86);
  --on-dark-muted: rgba(255, 255, 255, 0.62);
  --on-dark-line: rgba(255, 255, 255, 0.16);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--surface);
  color: var(--text-primary);
  font: 400 16px/1.65 var(--sans);
  font-variant-numeric: lining-nums tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; }
h1, h2, h3, h4, p { margin: 0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--white); padding: .7rem 1rem; z-index: 10; }
main:focus { outline: none; }
section, details, .masthead { scroll-margin-top: 88px; }
summary { list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 32px; }

/* Shared labels */
.eyebrow {
  font: 500 12px/1.4 var(--sans);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gold);
}
.chev {
  width: 9px; height: 9px; flex: none;
  border-right: 1.5px solid var(--text-light);
  border-bottom: 1.5px solid var(--text-light);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .2s ease;
}
details[open] > summary .chev { transform: rotate(-135deg) translate(-2px, -2px); }

/* Status markers */
.dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; margin: 0 10px 1px 0; vertical-align: middle; }
.dot-solved { background: var(--brand); }
.dot-verified { background: var(--gold); }
.dot-watch { border: 1.5px solid var(--gold); }
.dot-open { border: 1.5px solid var(--text-light); }
.dot-active { background: var(--sage); }
.status-text { display: inline-flex; align-items: baseline; font-size: 14px; line-height: 1.45; color: var(--text-muted); }
.status-text .dot { transform: translateY(-1px); }

/* Masthead */
.masthead { text-align: center; padding: 64px 0 0; }
.masthead h1 {
  font: 500 clamp(38px, 5.4vw, 60px)/1.1 var(--serif);
  letter-spacing: -.015em;
  color: var(--brand-deep);
  margin: 18px 0 16px;
}
.standfirst { max-width: none; text-wrap: balance; margin: 0 auto; font-size: 17px; color: var(--text-muted); }
.thesis { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px 0; list-style: none; padding: 0; margin: 26px 0 36px; }
.thesis li { white-space: nowrap; font: 500 13px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--brand); }
.thesis li + li::before { content: "→"; color: var(--gold); margin: 0 14px; letter-spacing: 0; }
.edition-bar {
  display: flex; justify-content: space-between; gap: 16px;
  border-top: 2px solid var(--brand-deep);
  border-bottom: 1px solid var(--border);
  padding: 11px 0;
  font-size: 13px; color: var(--text-muted);
}
.section-index { display: flex; justify-content: center; gap: 36px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.section-index a { font-size: 14px; color: var(--text-muted); text-decoration: none; }
.section-index a:hover, .section-index a.current { color: var(--brand); }

/* Lead: today's signal */
.lead {
  margin-top: 40px;
  display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 28px 48px;
  background: var(--brand-deep); color: var(--white);
  border-radius: 6px;
  padding: 48px 48px 52px;
}
.lead .eyebrow, .lead .aside-label { color: var(--gold-soft); }
.lead-head { grid-column: 1 / -1; }
.lead h2 { font: 500 clamp(26px, 3vw, 34px)/1.2 var(--serif); letter-spacing: -.01em; margin: 14px 0 0; text-wrap: balance; }
.lead-summary { font-size: 18px; line-height: 1.6; color: var(--on-dark); }
.lead-status {
  display: flex; align-items: baseline;
  margin-top: 28px; padding-top: 18px;
  border-top: 1px solid var(--on-dark-line);
  font-size: 14px; color: var(--on-dark-muted);
}
.lead .dot-watch { border-color: var(--gold-soft); }
.lead-aside { border-left: 1px solid var(--on-dark-line); padding-left: 36px; align-self: stretch; }
.aside-label { font: 500 12px/1.4 var(--sans); letter-spacing: .14em; text-transform: uppercase; }
.lead-aside ul { list-style: none; margin: 18px 0 0; padding: 0; }
.lead-aside li { padding: 16px 0; border-top: 1px solid var(--on-dark-line); }
.lead-aside li:first-child { border-top: 0; padding-top: 0; }
.aside-figure { display: block; font: 400 18px/1.45 var(--serif); color: var(--white); }
.lead-aside a { display: inline-block; margin-top: 8px; font-size: 13px; color: var(--on-dark-muted); text-decoration: none; border-bottom: 1px solid var(--on-dark-line); }
.lead-aside a:hover { color: var(--white); border-color: var(--gold-soft); }

/* Sections */
.section { padding: 80px 0 0; }
.section-head { text-align: center; max-width: none; margin: 0 auto 40px; }
.section-head h2, .section-head p, .case-body h3, .masthead h1 { text-wrap: balance; }
.section-head h2 { font: 500 clamp(28px, 3.2vw, 38px)/1.2 var(--serif); letter-spacing: -.01em; color: var(--brand-deep); margin-top: 12px; }
.section-head p { margin-top: 14px; font-size: 16px; color: var(--text-muted); }
.section-meta { margin-top: 12px; font-size: 13px; color: var(--text-light); }

/* Daily watch feed */
.feed { border-top: 2px solid var(--brand-deep); }
.brief-item { border-bottom: 1px solid var(--border); }
.brief-summary { display: grid; grid-template-columns: 56px minmax(0, 1fr) 84px; gap: 0 8px; padding: 26px 0; }
.brief-num { font: 500 22px/1.3 var(--serif); color: var(--gold); }
.brief-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-light); }
.brief-cat { color: var(--brand); font-weight: 500; }
.brief-main strong { display: block; margin: 8px 0 10px; font: 500 22px/1.32 var(--serif); color: var(--brand-deep); transition: color .15s; }
.brief-summary:hover strong { color: var(--brand); }
.brief-signal { display: block; max-width: 760px; font-size: 15.5px; line-height: 1.6; color: var(--text-muted); }
.brief-signal b, .fact-row dt, .brief-detail h4, .source-label, .table-label, .case-limit b {
  font: 500 11px/1.5 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--gold);
}
.brief-signal b { margin-right: 10px; }
.brief-side { display: flex; flex-direction: column; align-items: flex-end; gap: 14px; font-size: 13px; color: var(--text-light); padding-top: 2px; }
.brief-detail { padding: 0 0 32px 64px; }
.brief-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; padding: 22px 0 6px; border-top: 1px dashed var(--border); }
.brief-detail h4 { margin-bottom: 6px; }
.brief-columns p { font-size: 15px; color: var(--text-primary); }

.fact-list { margin: 18px 0 0; }
.fact-row { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 16px; padding: 10px 0; border-top: 1px solid var(--border); }
.fact-row dt { padding-top: 3px; }
.fact-row dd { margin: 0; font-size: 15px; color: var(--text-primary); }
.fact-row.emphasis dd { color: var(--brand-deep); font-weight: 500; }
.fact-row a { color: var(--brand); text-decoration: none; border-bottom: 1px solid var(--border); }
.fact-row a:hover { border-color: var(--brand); }

.source-links { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; margin-top: 18px; }
.source-links a { font-size: 13.5px; color: var(--brand); text-decoration: none; border-bottom: 1px solid var(--border); }
.source-links a:hover { border-color: var(--brand); }
.source-links a::after { content: " ↗"; font-size: 11px; color: var(--text-light); }
.empty { padding: 32px 0; text-align: center; color: var(--text-muted); }

/* Problem status board */
.board-head, .problem-row > summary { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.35fr) minmax(0, 1fr) 20px; gap: 24px; align-items: baseline; }
.board-head { padding: 0 0 10px; border-bottom: 2px solid var(--brand-deep); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-light); }
.problem-row { border-bottom: 1px solid var(--border); }
.problem-row > summary { padding: 18px 0; }
.problem-name { font: 500 19px/1.35 var(--serif); color: var(--brand-deep); }
.problem-row > summary:hover .problem-name { color: var(--brand); }
.problem-field { font-size: 14px; color: var(--text-light); }
.problem-expanded { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 48px; padding: 6px 0 36px; }
.problem-statement p { font-size: 15px; color: var(--text-muted); margin-top: 14px; }
.problem-statement .problem-ask { font: 400 19px/1.5 var(--serif); color: var(--brand-deep); margin-top: 8px; }
.problem-statement code { display: block; margin-top: 16px; padding: 12px 16px; background: var(--brand-pale); border-left: 2px solid var(--brand); font: 14px/1.6 var(--mono); color: var(--brand-deep); overflow-x: auto; white-space: pre-wrap; }
.problem-history { font-size: 14px; }
.problem-expanded .fact-list { margin: 0; }
.problem-expanded .fact-row:first-child { border-top: 0; padding-top: 0; }

/* Network figure */
.problem-network { margin: 64px 0 0; }
.network-title { text-align: center; font: 500 22px/1.3 var(--serif); color: var(--brand-deep); }
.network-scroll { overflow-x: auto; margin-top: 12px; }
.network-scroll svg { display: block; width: 100%; min-width: 680px; height: auto; }
.edge { fill: none; stroke: var(--text-light); stroke-width: 1.2; opacity: .7; }
.edge.dashed { stroke-dasharray: 4 5; }
.edge-label { font: 500 12px var(--sans); fill: var(--text-muted); paint-order: stroke; stroke: var(--surface); stroke-width: 6px; stroke-linejoin: round; }
.network-nodes rect { fill: var(--white); stroke: var(--border); stroke-width: 1; transition: stroke .15s; }
.network-nodes a:hover rect, .network-nodes a:focus rect { stroke: var(--brand); }
.network-nodes a:focus { outline: none; }
.node-title { font: 500 15px var(--serif); fill: var(--brand-deep); }
.node-subtitle { font: 12px var(--sans); fill: var(--text-light); }
.node-dot-solved { fill: var(--brand); }
.node-dot-verified { fill: var(--gold); }
.node-dot-watch { fill: none; stroke: var(--gold); stroke-width: 1.5; }
.node-dot-open { fill: none; stroke: var(--text-light); stroke-width: 1.5; }
.network-note { max-width: 640px; margin: 12px auto 0; text-align: center; font-size: 13px; color: var(--text-light); }

/* Field map */
.map-controls { display: flex; justify-content: center; gap: 10px; margin-top: 22px; }
.map-control { padding: 7px 16px; border: 1px solid var(--border); border-radius: 100px; background: transparent; font-size: 13px; color: var(--text-muted); cursor: pointer; }
.map-control:hover { border-color: var(--brand); color: var(--brand); }
.field-directory { border-top: 2px solid var(--brand-deep); }
.field-accordion { border-bottom: 1px solid var(--border); }
.field-accordion > summary { display: grid; grid-template-columns: minmax(0, 1fr) auto 20px; gap: 32px; align-items: center; padding: 22px 0; }
.field-title { display: block; }
.field-short { display: block; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.field-title strong { display: block; margin: 4px 0 4px; font: 500 20px/1.35 var(--serif); color: var(--brand-deep); }
.field-accordion > summary:hover strong { color: var(--brand); }
.field-description { display: block; font-size: 14.5px; color: var(--text-muted); max-width: 720px; }
.field-count { font-size: 13px; color: var(--text-light); white-space: nowrap; }
.field-count b { font: 500 20px var(--serif); color: var(--brand-deep); margin-right: 4px; }
.table-scroll { overflow-x: auto; padding-bottom: 28px; }
.frontier-table { width: 100%; border-collapse: collapse; min-width: 560px; }
.frontier-table th { text-align: left; font-weight: 500; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-light); padding: 8px 16px 8px 0; border-bottom: 1px solid var(--text-light); }
.frontier-table td { vertical-align: top; padding: 12px 16px 12px 0; border-bottom: 1px solid var(--border); font-size: 14.5px; }
.frontier-table td:first-child { width: 48%; }
.subfield-detail summary { font-weight: 500; color: var(--brand-deep); }
.subfield-detail summary::before { content: "+"; display: inline-block; width: 16px; color: var(--gold); }
.subfield-detail[open] summary::before { content: "−"; }
.subfield-expanded { padding: 8px 0 4px 16px; }
.subfield-expanded p { font-size: 14px; color: var(--text-muted); margin-bottom: 10px; }
.topic-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { font-size: 12px; padding: 2px 10px; border: 1px solid var(--border); border-radius: 100px; color: var(--text-muted); background: var(--white); }
.impact-marker { font-size: 14px; color: var(--text-muted); }

/* History timeline */
.timeline { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--brand-deep); }
.case { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 40px; padding: 34px 0; border-bottom: 1px solid var(--border); }
.case-year { display: block; font: 500 34px/1.1 var(--serif); color: var(--gold); }
.case-arena { display: block; margin-top: 8px; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-light); }
.case-body h3 { font: 500 22px/1.32 var(--serif); color: var(--brand-deep); }
.case-method { margin: 8px 0 14px; font-size: 13px; color: var(--brand); }
.case-body > p { font-size: 15.5px; color: var(--text-primary); max-width: 720px; }
.case-limit { margin-top: 16px; padding-left: 16px; border-left: 2px solid var(--gold); font-size: 15px; color: var(--text-muted) !important; }
.case-limit b { display: block; margin-bottom: 2px; }

/* Philosophy */
.thesis-small { margin: -12px 0 32px; }
.thesis-small li { font-size: 12px; }
.philosophy-section .case { grid-template-columns: 180px minmax(0, 1fr); gap: 32px; }
.case-year-small { font-size: 17px; line-height: 1.3; white-space: nowrap; }
.key-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1px; margin: 4px 0 22px; background: var(--border); border: 1px solid var(--border); }
.key-figure { background: var(--white); padding: 14px 16px; }
.key-figure b { display: block; font: 500 24px/1.2 var(--serif); color: var(--brand-deep); }
.key-figure span { display: block; margin-top: 6px; font-size: 13px; line-height: 1.45; color: var(--text-muted); }
.philosophy-section .fact-list { margin-top: 0; }
.philosophy-section .fact-row:first-child { border-top: 0; }

/* Footer */
.footer { max-width: var(--wrap); margin: 64px auto 0; padding: 24px 32px 56px; }
.footer p { border-top: 1px solid var(--border); padding-top: 20px; text-align: center; font-size: 13px; color: var(--text-light); }

/* Responsive */
@media (max-width: 860px) {
  .lead { grid-template-columns: 1fr; gap: 32px; padding: 40px 32px; }
  .lead-aside { border-left: 0; padding-left: 0; border-top: 1px solid var(--on-dark-line); padding-top: 24px; }
  .problem-expanded { grid-template-columns: 1fr; gap: 28px; }
  .case { grid-template-columns: 1fr; gap: 10px; }
  .philosophy-section .case { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .masthead { padding-top: 40px; }
  .thesis { margin: 20px 0 28px; }
  .thesis li { font-size: 12px; }
  .thesis li + li::before { margin: 0 8px; }
  .thesis-small li { font-size: 11px; letter-spacing: .06em; }
  .thesis-small li + li::before { margin: 0 6px; }
  .edition-bar { flex-direction: column; align-items: center; gap: 2px; }
  .section-index { gap: 20px; flex-wrap: wrap; }
  .lead { margin-top: 28px; padding: 32px 22px; border-radius: 4px; }
  .lead-summary { font-size: 16.5px; }
  .section { padding-top: 60px; }
  .section-head { margin-bottom: 28px; }
  .brief-summary { grid-template-columns: 34px minmax(0, 1fr); padding: 22px 0; }
  .brief-num { font-size: 18px; }
  .brief-side { grid-column: 2; flex-direction: row; justify-content: space-between; align-items: center; padding-top: 12px; }
  .brief-main strong { font-size: 19px; }
  .brief-detail { padding-left: 0; }
  .brief-columns { grid-template-columns: 1fr; gap: 18px; }
  .fact-row { grid-template-columns: 1fr; gap: 2px; }
  .board-head { display: none; }
  .problem-network { display: none; }
  .problem-board { border-top: 2px solid var(--brand-deep); }
  .problem-row > summary { grid-template-columns: minmax(0, 1fr) 20px; gap: 6px 12px; }
  .problem-row > summary .status-text, .problem-row > summary .problem-field { grid-column: 1; }
  .problem-row > summary .chev { grid-column: 2; grid-row: 1; }
  .field-accordion > summary { grid-template-columns: minmax(0, 1fr) 20px; gap: 6px 12px; }
  .field-count { grid-column: 1; }
  .field-accordion > summary .chev { grid-column: 2; grid-row: 1; }
  .case-year { font-size: 28px; }
  .footer { padding: 20px 16px 40px; margin-top: 64px; }
}

/* Editorial summaries: an executive scan line for each research section. */
.section-summary {
  max-width: 760px;
  margin: 14px auto 0;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.7;
  text-wrap: balance;
}
.section-summary strong,
.standfirst strong {
  color: var(--brand);
  font-weight: 700;
}
@media (max-width: 640px) {
  .section-summary { font-size: 14px; line-height: 1.65; }
}
