/* ============================================================
   Insurtech Daily — editorial news wire
   A print-inspired system: warm paper, serif headlines, hairline
   rules instead of cards, one deep ink-red accent. No glow, no
   pulse, no monospace-everywhere.
   ============================================================ */

:root {
  /* Paper + ink */
  --paper: #f7f4ee;
  --paper-2: #efeae0;        /* recessed fields, hover wash */
  --ink: #1c1a15;            /* headline / primary text */
  --ink-2: #45413a;          /* body / secondary */
  --ink-3: #837d70;          /* meta / muted */
  --ink-4: #a8a293;          /* faint */

  --rule: rgba(28, 26, 21, 0.16);
  --rule-soft: rgba(28, 26, 21, 0.09);

  /* One editorial accent — a deep, warm masthead red */
  --accent: #9a2b1e;
  --accent-deep: #7c2016;

  --maxw: 860px;
  --gutter: clamp(20px, 5vw, 48px);

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Libre Franklin", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  font-feature-settings: "kern" 1, "liga" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent); color: var(--paper); }
a { color: inherit; text-decoration: none; }

/* Numbers should align like a table wherever they carry data */
.statline b, .meta, .cnt, .result-count { font-feature-settings: "tnum" 1; }

/* ============================================================
   Masthead bar (sticky, understated)
   ============================================================ */

.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: baseline; gap: 24px;
  padding: 14px var(--gutter);
  background: rgba(247, 244, 238, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rule);
}
.brand { display: inline-flex; align-items: baseline; gap: 10px; }

/* Section nav */
.nav { display: inline-flex; align-items: baseline; gap: 20px; }
.nav a {
  font-size: 0.74rem; font-weight: 600; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.09em; white-space: nowrap;
  padding-bottom: 2px; border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.nav a:hover { color: var(--ink); }
.nav a.active { color: var(--ink); border-bottom-color: var(--accent); }
/* red masthead rule instead of the old glowing tick */
.brand-tick {
  align-self: center;
  width: 3px; height: 17px; border-radius: 0;
  background: var(--accent);
}
.brand-name {
  font-family: var(--serif); font-weight: 600; font-size: 1.28rem;
  letter-spacing: -0.01em; color: var(--ink);
}
.status {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.72rem; font-weight: 500; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
}

/* ============================================================
   Layout + masthead standfirst
   ============================================================ */

main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter) 56px;
}

.intro { padding: 46px 0 24px; }
.tagline {
  margin: 0;
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(2.3rem, 5.2vw, 3.4rem); line-height: 1.04;
  letter-spacing: -0.02em; color: var(--ink);
}
.dek {
  margin: 15px 0 0; max-width: 52ch;
  font-size: 1.02rem; line-height: 1.45; color: var(--ink-2);
}
.statline {
  margin: 20px 0 0;
  font-size: 0.74rem; font-weight: 500; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.09em;
}
.statline b { color: var(--ink); font-weight: 600; }
.statline .sep { color: var(--ink-4); margin: 0 6px; }

/* ============================================================
   Editorial brief — "what's happening / why it matters"
   ============================================================ */

.brief {
  margin: 14px 0 40px;
  border: 1px solid var(--rule);
  border-top: 3px solid var(--ink);
  border-radius: 2px;
  /* A faint warm wash over paper — clearly a featured panel, not the
     recessed grey search field that follows it. */
  background: linear-gradient(rgba(154, 43, 30, 0.035), rgba(154, 43, 30, 0.035)), var(--paper);
}

.brief-head {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 18px;
  padding: 18px 22px;
  background: none; border: 0; cursor: pointer;
  color: inherit; font: inherit; text-align: left;
  transition: background 0.15s ease;
}
.brief-head:hover { background: rgba(154, 43, 30, 0.05); }

/* explicit "expandable" affordance */
.brief-cue {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent);
}
.brief-cue-label { display: none; }
@media (min-width: 720px) { .brief-cue-label { display: inline; } }

.brief-kicker {
  display: inline-flex; align-items: baseline; gap: 8px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--accent); white-space: nowrap;
  align-self: center;
}
.brief-spark { width: 7px; height: 7px; background: var(--accent); align-self: center; }

.brief-lede { min-width: 0; display: flex; align-items: baseline; gap: 12px; }
.brief-headline {
  font-family: var(--serif); font-size: 1.24rem; font-weight: 600; color: var(--ink);
  letter-spacing: -0.01em; line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto;
}
.brief-teaser {
  display: none;
  color: var(--ink-3); font-size: 0.92rem; font-style: italic; font-family: var(--serif);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto;
}

.brief-actions { display: inline-flex; align-items: center; gap: 10px; align-self: center; }

.brief-chevron { display: inline-flex; color: inherit; transition: transform 0.25s ease; }
.brief-head:hover .brief-cue { color: var(--accent-deep); }
.brief[data-open="true"] .brief-chevron { transform: rotate(180deg); }
.brief[data-open="true"] .brief-headline { white-space: normal; overflow: visible; }

/* Animated open/close via grid rows */
.brief-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.3s ease; }
.brief[data-open="true"] .brief-body { grid-template-rows: 1fr; }
.brief-body-inner {
  min-height: 0; overflow: hidden;
  opacity: 0; transition: opacity 0.22s ease, padding 0.3s ease;
  padding: 0 22px;
}
.brief[data-open="true"] .brief-body-inner { opacity: 1; padding: 4px 22px 24px; }

.brief-block + .brief-block { margin-top: 18px; }
.brief-label {
  margin: 0 0 6px;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.11em;
  text-transform: uppercase; color: var(--accent);
}
.brief-text {
  margin: 0; max-width: 64ch;
  font-family: var(--serif); font-size: 1.12rem; line-height: 1.6; color: var(--ink-2);
}
.brief-foot {
  margin: 20px 0 0; padding-top: 12px;
  border-top: 1px solid var(--rule-soft);
  font-size: 0.7rem; font-weight: 500; color: var(--ink-4);
  text-transform: uppercase; letter-spacing: 0.06em;
}

/* ---- Brief archive pages (/brief/ and /brief/<date>/) ---- */
.brief-lede-text {
  margin: 14px 0 0; max-width: 60ch;
  font-family: var(--serif); font-size: 1.22rem; line-height: 1.5;
  font-style: italic; color: var(--ink-2);
}
.brief-article { margin: 26px 0 0; }
.brief-article .brief-block + .brief-block { margin-top: 26px; }
.brief-archive .summary { max-width: 68ch; }

.brief-nav {
  display: grid; gap: 12px; margin: 34px 0 0;
  padding-top: 20px; border-top: 1px solid var(--rule-soft);
}
@media (min-width: 720px) { .brief-nav { grid-template-columns: 1fr 1fr; } }
.brief-nav-link {
  display: flex; flex-direction: column; gap: 5px;
  padding: 13px 15px; border: 1px solid var(--rule-soft);
  text-decoration: none; color: inherit; background: var(--paper);
}
.brief-nav-link:hover { border-color: var(--accent); background: rgba(154, 43, 30, 0.04); }
/* The "later" link sits right-aligned so the pair reads as a timeline. */
.brief-nav-link.next { text-align: right; }
.brief-nav-dir {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--accent);
}
.brief-nav-title {
  font-family: var(--serif); font-size: 1rem; line-height: 1.35; color: var(--ink);
}
.brief-provenance {
  margin: 30px 0 0; padding-top: 14px;
  border-top: 1px solid var(--rule-soft);
  max-width: 64ch; font-size: 0.82rem; line-height: 1.55; color: var(--ink-3);
}
.brief-provenance a { color: var(--accent); }

/* ============================================================
   Toolbar — search + section filters
   ============================================================ */

.controls {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 4px 0 0;
}
.search-wrap {
  display: inline-flex; align-items: center; gap: 9px; flex: 1 1 260px;
  padding: 9px 13px;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 2px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.search-wrap:focus-within { border-color: var(--accent); background: var(--paper); }
.search-wrap:focus-within svg { color: var(--accent); }
.search-wrap svg { color: var(--ink-3); flex: none; transition: color 0.15s ease; }
#search, #coSearch {
  flex: 1; min-width: 0;
  background: none; border: 0; outline: none;
  color: var(--ink); font-family: var(--sans); font-size: 0.92rem;
}
#search::placeholder, #coSearch::placeholder { color: var(--ink-3); }
.result-count {
  font-size: 0.72rem; font-weight: 500; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-left: auto; white-space: nowrap;
}

/* Companies index — fresher search field + sort segmented control */
.co-search-wrap { flex: 1 1 240px; padding: 11px 15px; background: var(--paper); }
.co-search-wrap #coSearch { font-size: 0.96rem; }

.sort-group { display: inline-flex; align-items: center; gap: 7px; flex: none; }
.sort-label {
  font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--ink-4); margin-right: 1px;
}
.sort-btn {
  font-family: var(--sans); font-size: 0.76rem; font-weight: 500; line-height: 1;
  color: var(--ink-2); background: none;
  border: 1px solid var(--rule); border-radius: 2px;
  padding: 7px 11px; cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.sort-btn:hover { color: var(--ink); border-color: var(--ink-3); }
.sort-btn.active {
  color: var(--paper); background: var(--ink); border-color: var(--ink); font-weight: 600;
}

.filter-bar {
  display: flex; flex-wrap: wrap; gap: 7px;
  padding: 16px 0 0;
}
.chip {
  display: inline-flex; align-items: baseline; gap: 7px;
  font-family: var(--sans); font-size: 0.76rem; font-weight: 500; line-height: 1;
  color: var(--ink-2);
  background: none;
  border: 1px solid var(--rule); border-radius: 2px;
  padding: 7px 11px; cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.chip:hover { color: var(--ink); border-color: var(--ink-3); }
.chip.active {
  color: var(--paper); background: var(--ink); border-color: var(--ink);
  font-weight: 600;
}
.chip .cnt { color: var(--ink-4); font-size: 0.7rem; }
.chip:hover .cnt { color: var(--ink-3); }
.chip.active .cnt { color: rgba(247, 244, 238, 0.6); }

/* ============================================================
   Lead story
   ============================================================ */

.lead:empty { display: none; }
.lead-card {
  display: block;
  padding: 22px 0 26px;
  margin: 26px 0 0;
  border-top: 3px solid var(--ink);
}
.lead-badge-row { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.lead-badge {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--accent);
}
.lead-note {
  font-size: 0.68rem; font-weight: 500; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.lead-main { display: block; }
.lead-card h2 {
  margin: 0;
  font-family: var(--serif); font-size: clamp(1.85rem, 4.2vw, 2.7rem); font-weight: 600;
  line-height: 1.08; letter-spacing: -0.02em; color: var(--ink);
}
.lead-main:hover h2 { color: var(--accent-deep); }
.lead-card .summary {
  margin: 14px 0 0; max-width: 60ch;
  font-family: var(--serif); color: var(--ink-2); font-size: 1.14rem; line-height: 1.55;
}
.lead-card .meta { margin-bottom: 12px; }

/* ---- Shared meta line (source · time · outlets) ---- */
.meta {
  font-size: 0.71rem; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-3); line-height: 1.4;
}
.meta .src { color: var(--ink-2); }
.meta .time { color: var(--ink-3); }
.meta .dot { color: var(--ink-4); margin: 0 2px; }
.meta .outlets { color: var(--accent); }

/* ============================================================
   Headline wire
   ============================================================ */

.feed { list-style: none; margin: 14px 0 0; padding: 0; }
.story {
  display: block;
  padding: 21px 0;
  border-top: 1px solid var(--rule);
}
.story-main { display: block; }
.story .meta { margin-bottom: 9px; }
.story-main:hover h3 { color: var(--accent-deep); }
.story h3 {
  margin: 0; max-width: 58ch;
  font-family: var(--serif); font-size: 1.32rem; font-weight: 500; line-height: 1.26;
  letter-spacing: -0.005em; color: var(--ink);
  transition: color 0.15s ease;
}
.story .summary {
  margin: 8px 0 0; max-width: 62ch;
  color: var(--ink-3); font-size: 0.96rem; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ---- Threads: folded repeat coverage of one story ---- */
.thread { margin-top: 10px; }
.lead-card .thread { margin-top: 16px; }

.thread-toggle {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 3px 0; margin: 0;
  background: none; border: 0; cursor: pointer;
  font-family: var(--sans); font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-3);
  transition: color 0.15s ease;
}
.thread-toggle:hover { color: var(--accent-deep); }
/* Caret drawn with borders rather than a glyph — renders identically
   whatever the font stack resolves to. */
.thread-toggle .thread-chevron {
  width: 0; height: 0; flex: none;
  border-left: 5px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.15s ease;
}
.thread-toggle[aria-expanded="true"] { color: var(--accent); }
.thread-toggle[aria-expanded="true"] .thread-chevron { transform: rotate(90deg); }

.thread-list {
  list-style: none; margin: 8px 0 0; padding: 0 0 0 13px;
  border-left: 2px solid var(--rule);
}
.thread-item + .thread-item { margin-top: 8px; }
.thread-link { display: block; }
.thread-src {
  font-size: 0.66rem; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-2);
}
.thread-dot { color: var(--ink-4); }
.thread-time {
  font-size: 0.66rem; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-3);
}
.thread-title {
  display: block; margin-top: 2px; max-width: 58ch;
  font-family: var(--serif); font-size: 0.98rem; line-height: 1.34;
  color: var(--ink-2);
  transition: color 0.15s ease;
}
.thread-link:hover .thread-title { color: var(--accent-deep); }
.thread-more {
  margin-top: 8px;
  font-size: 0.68rem; font-weight: 500; letter-spacing: 0.04em;
  color: var(--ink-4);
}

@media (prefers-reduced-motion: reduce) {
  .thread-toggle .thread-chevron { transition: none; }
}

/* ---- Card footer: company badges + category tags ---- */
.card-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.story .card-tags { margin-top: 11px; }
.lead-card .card-tags { margin-top: 18px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* Taxonomy tags — quiet, uppercase, neutral outline. */
.tag-pill {
  font-family: var(--sans); font-size: 0.64rem; font-weight: 600; line-height: 1.5;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-3);
  background: none;
  border: 1px solid var(--rule); border-radius: 2px;
  padding: 2px 7px; white-space: nowrap;
}

/* Company badges — proper case, accent-red, filled: clearly a link. */
.company-badge {
  font-family: var(--sans); font-size: 0.74rem; font-weight: 600; line-height: 1.5;
  color: var(--accent-deep);
  background: rgba(154, 43, 30, 0.07);
  border: 1px solid rgba(154, 43, 30, 0.22); border-radius: 2px;
  padding: 2px 9px; white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.company-badge:hover { background: var(--accent); border-color: var(--accent); color: var(--paper); }
/* A hair of separation before the neutral tags that follow. */
.company-badge + .tag-pill { margin-left: 4px; }

/* ============================================================
   States
   ============================================================ */

.loading, .empty {
  text-align: center; color: var(--ink-3);
  font-size: 0.9rem; padding: 52px 0;
}
.retry-btn {
  margin-left: 8px;
  font-family: var(--sans); font-size: 0.82rem; font-weight: 600;
  color: var(--accent); background: none;
  border: 1px solid var(--rule); border-radius: 2px;
  padding: 5px 12px; cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.retry-btn:hover { border-color: var(--accent); background: rgba(154, 43, 30, 0.06); }

/* ============================================================
   Footer
   ============================================================ */

.site-footer {
  max-width: var(--maxw); margin: 48px auto 0;
  padding: 28px var(--gutter) 52px;
  border-top: 2px solid var(--ink);
}
.foot-desc { margin: 0; max-width: 62ch; color: var(--ink-3); font-size: 0.86rem; line-height: 1.55; }
.foot-desc b { color: var(--ink-2); font-weight: 600; }
.foot-meta {
  margin: 14px 0 0; font-size: 0.7rem; font-weight: 500; color: var(--ink-4);
  text-transform: uppercase; letter-spacing: 0.06em;
}

/* ============================================================
   Companies — index list
   ============================================================ */

.co-list { list-style: none; margin: 18px 0 0; padding: 0; }
.co-row { border-top: 1px solid var(--rule-soft); }
.co-row:first-child { border-top: 1px solid var(--rule); }
.co-link {
  display: flex; align-items: baseline; justify-content: space-between; gap: 18px;
  padding: 15px 0;
}
.co-name {
  font-family: var(--serif); font-size: 1.24rem; font-weight: 500;
  letter-spacing: -0.005em; color: var(--ink); transition: color 0.15s ease;
}
.co-link:hover .co-name { color: var(--accent-deep); }
.co-meta {
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--ink-3); white-space: nowrap; font-feature-settings: "tnum" 1;
}
.co-meta .co-count { color: var(--ink-2); }
.co-meta .co-latest { color: var(--ink-4); }
.co-meta .dot { color: var(--ink-4); margin: 0 2px; }

/* ============================================================
   Company — detail page
   ============================================================ */

.crumb { margin: 26px 0 0; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.crumb a { color: var(--ink-3); }
.crumb a:hover { color: var(--accent); }

.co-head { padding: 18px 0 20px; }
.co-kicker { margin: 0 0 10px; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.13em; color: var(--accent); }

.co-facts {
  display: flex; flex-wrap: wrap; gap: 26px 44px;
  padding: 22px 0 6px; border-top: 1px solid var(--rule);
}
.co-fact { min-width: 0; }
.fact-label { margin: 0 0 9px; font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.co-sources { margin: 0; max-width: 42ch; font-size: 0.88rem; color: var(--ink-2); line-height: 1.5; }

.section-label {
  margin: 36px 0 0; padding-bottom: 9px; border-bottom: 2px solid var(--ink);
  font-family: var(--sans); font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink);
}

/* ============================================================
   Responsive
   ============================================================ */

@media (min-width: 720px) {
  .brief-teaser { display: inline; }
  .brief[data-open="true"] .brief-teaser { display: none; }
}

@media (max-width: 620px) {
  .result-count { display: none; }
  .status { display: none; }
  /* Three nav items no longer fit beside the masthead on a phone —
     tighten the gaps and let the nav scroll rather than pushing the
     sticky topbar wider than the viewport. */
  .topbar { gap: 14px; }
  .nav {
    gap: 15px; min-width: 0; overflow-x: auto;
    scrollbar-width: none; -ms-overflow-style: none;
    /* Fade the trailing edge so a clipped item reads as "scroll me"
       rather than as a broken layout. */
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
  }
  .nav::-webkit-scrollbar { width: 0; height: 0; }
  .co-link { flex-direction: column; gap: 5px; }
  .sort-group { flex: 1 1 100%; flex-wrap: wrap; }
  .sort-btn { flex: 1 1 auto; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
