@import url('https://fonts.googleapis.com/css2?family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&family=Source+Serif+4:ital,opsz,wght@0,8..60,300;0,8..60,400;0,8..60,600;1,8..60,400&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --navy:           #0D2B55;
  --navy-dark:      #071B38;
  --navy-mid:       #163859;
  --navy-light:     #1E4D7B;
  --gold:           #C9A84C;
  --gold-light:     #DFC07A;
  --gold-muted:     #8B6E2A;
  --gold-rule:      #C9A84C44;
  --white:          #FFFFFF;
  --off-white:      #FAF8F4;
  --parchment:      #F3EFE6;
  --text:           #1A1A1A;
  --text-secondary: #4A4A4A;
  --text-muted:     #767676;
  --border:         #E2DDD4;
  --border-dark:    #C8C0B0;
  --sidebar-width:  300px;
  --header-height:  56px;
  --section-domestic:  #1B5E20;
  --section-companies: #0D47A1;
  --section-banking:   #4A148C;
  --section-funds:     #BF360C;
  --section-indexes:   #004D40;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  font-family: 'Source Serif 4', Georgia, serif;
  background: var(--off-white);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.site-header {
  height: var(--header-height);
  background: var(--navy-dark);
  border-bottom: 2px solid var(--gold);
  display: flex;
  align-items: center;
  padding: 0 24px;
  flex-shrink: 0;
  position: relative;
  z-index: 100;
}
.site-header__logo {
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  flex: 1;
}
.site-header__brand {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.01em;
}
.site-header__brand span { color: var(--gold); }
.site-header__tagline {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 0.7rem;
  font-weight: 300;
  color: #8BA7C4;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-left: 1px solid #2A4A6B;
  padding-left: 10px;
  margin-left: 2px;
}
.site-header__meta { display: flex; align-items: center; gap: 20px; }
.site-header__date { font-size: 0.72rem; color: #8BA7C4; letter-spacing: 0.05em; }
.site-header__smp-link {
  font-size: 0.72rem;
  color: var(--gold);
  text-decoration: none;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.85;
  transition: opacity 0.15s;
}
.site-header__smp-link:hover { opacity: 1; }

.site-body { display: flex; flex: 1; overflow: hidden; }

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid #1A3F6B;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar.collapsed { width: 0; border-right: none; }

.sidebar__streams { padding: 18px 0 12px; border-bottom: 1px solid var(--gold-rule); flex-shrink: 0; max-height: 50vh; overflow-y: auto; }
.sidebar__section-label {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--gold-muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0 18px 8px;
}
.stream-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 18px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 0.875rem;
  color: #A8C0D8;
  text-align: left;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
  overflow: hidden;
}
.stream-btn:hover { background: rgba(201,168,76,0.08); color: var(--white); }
.stream-btn.active { background: rgba(201,168,76,0.14); color: var(--white); font-weight: 600; }
.stream-btn.active .stream-dot { opacity: 1; }
.stream-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; opacity: 0.5; transition: opacity 0.12s; }
.stream-count { margin-left: auto; font-size: 0.68rem; color: var(--gold-muted); font-family: 'JetBrains Mono', monospace; }

.sidebar__filters {
  overflow: hidden;
  padding: 14px 18px;
  border-bottom: 1px solid var(--gold-rule);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.filter-input {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(201,168,76,0.2);
  border-radius: 3px;
  padding: 7px 10px;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 0.8rem;
  color: var(--white);
  outline: none;
  transition: border-color 0.15s;
}
.filter-input::placeholder { color: #5A7A99; }
.filter-input:focus { border-color: var(--gold); }
.filter-row { display: flex; gap: 6px; align-items: center; }
.filter-label {
  font-size: 0.65rem;
  color: var(--gold-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  width: 34px;
  flex-shrink: 0;
}
.filter-date {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(201,168,76,0.2);
  border-radius: 3px;
  padding: 6px 8px;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 0.75rem;
  color: var(--white);
  outline: none;
  transition: border-color 0.15s;
  color-scheme: dark;
}
.filter-date:focus { border-color: var(--gold); }

.sidebar__list { flex: 1; overflow-y: auto; padding: 8px 0 24px; }
.sidebar__list::-webkit-scrollbar { width: 4px; }
.sidebar__list::-webkit-scrollbar-track { background: transparent; }
.sidebar__list::-webkit-scrollbar-thumb { background: #1E3F6B; border-radius: 2px; }

.article-item {
  display: block;
  padding: 12px 18px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.1s;
}
.article-item:hover { background: rgba(255,255,255,0.04); }
.article-item.active { background: rgba(201,168,76,0.12); border-left: 2px solid var(--gold); padding-left: 16px; }
.article-item__section {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 4px;
  font-family: 'Source Serif 4', Georgia, serif;
}
.article-item__title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: #C8DCF0;
  line-height: 1.35;
  margin-bottom: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.article-item.active .article-item__title { color: var(--white); }
.article-item__date { font-size: 0.67rem; color: #5A7A99; font-family: 'JetBrains Mono', monospace; }
.sidebar__empty { padding: 24px 18px; font-size: 0.8rem; color: #5A7A99; text-align: center; font-style: italic; }

.article-panel { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--off-white); }

.panel-toolbar {
  height: 44px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  flex-shrink: 0;
}
.panel-toolbar__breadcrumb {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: 'Source Serif 4', Georgia, serif;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.panel-toolbar__breadcrumb span { color: var(--navy); font-weight: 600; }
.toolbar-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 5px 10px;
  font-size: 0.72rem;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: 'Source Serif 4', Georgia, serif;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
  white-space: nowrap;
}
.toolbar-btn:hover { border-color: var(--navy); color: var(--navy); background: var(--parchment); }
.toolbar-btn--active { background: var(--navy); color: var(--white); border-color: var(--navy); }

.panel-scroll { flex: 1; overflow-y: auto; }
.panel-scroll::-webkit-scrollbar { width: 6px; }
.panel-scroll::-webkit-scrollbar-track { background: var(--off-white); }
.panel-scroll::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 3px; }

.panel-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 48px;
  text-align: center;
}
.panel-welcome__logo { font-family: 'Libre Baskerville', Georgia, serif; font-size: 2.5rem; font-weight: 700; color: var(--navy); margin-bottom: 8px; }
.panel-welcome__logo span { color: var(--gold); }
.panel-welcome__rule { width: 48px; height: 2px; background: var(--gold); margin: 16px auto; }
.panel-welcome__text { font-size: 0.95rem; color: var(--text-muted); max-width: 380px; line-height: 1.7; font-style: italic; }
.panel-welcome__streams { margin-top: 32px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.welcome-stream-tag { padding: 6px 14px; border: 1px solid var(--border); border-radius: 2px; font-size: 0.75rem; color: var(--text-secondary); }

.article-content { max-width: 760px; margin: 0 auto; padding: 40px 48px 80px; }
.fullscreen .article-content { max-width: 860px; padding: 48px 64px 80px; }

.article-section-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-family: 'Source Serif 4', Georgia, serif;
  margin-bottom: 16px;
  padding: 4px 10px 4px 8px;
  border-radius: 2px;
  background: var(--parchment);
  border: 1px solid var(--border);
}
.section-pip { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

.article-headline {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 1.95rem;
  font-weight: 700;
  color: var(--navy-dark);
  line-height: 1.22;
  letter-spacing: -0.01em;
  margin-bottom: 12px;
}
.fullscreen .article-headline { font-size: 2.4rem; }

.article-deck {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 300;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.article-byline { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; font-size: 0.78rem; color: var(--text-muted); }
.article-byline__author { font-weight: 600; color: var(--text-secondary); }
.article-byline__sep { width: 3px; height: 3px; background: var(--border-dark); border-radius: 50%; }
.article-byline__date { font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; }
.article-byline__editor { font-style: italic; color: var(--text-muted); }

.article-summary-card {
  background: var(--navy);
  border-left: 3px solid var(--gold);
  padding: 16px 20px;
  margin-bottom: 28px;
  border-radius: 0 2px 2px 0;
}
.article-summary-card__label { font-size: 0.6rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); margin-bottom: 8px; font-family: 'Source Serif 4', Georgia, serif; }
.article-summary-card__text { font-size: 0.88rem; color: #C8DCF0; line-height: 1.6; font-family: 'Source Serif 4', Georgia, serif; }

.article-body { font-family: 'Source Serif 4', Georgia, serif; font-size: 1rem; line-height: 1.75; color: var(--text); overflow-wrap: anywhere; word-break: break-word; }
.article-body p { margin-bottom: 1.2em; }
.article-body h2 { font-family: 'Libre Baskerville', Georgia, serif; font-size: 1.15rem; font-weight: 700; color: var(--navy); margin: 2em 0 0.6em; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.article-body h3 { font-family: 'Libre Baskerville', Georgia, serif; font-size: 1rem; font-weight: 700; color: var(--navy-mid); margin: 1.5em 0 0.5em; }
.article-body strong { font-weight: 600; color: var(--navy-dark); }
.article-body ul, .article-body ol { padding-left: 1.5em; margin-bottom: 1.2em; }
.article-body li { margin-bottom: 0.4em; }
.article-body a { color: var(--navy-light); text-decoration: underline; text-underline-offset: 2px; }
.article-body a:hover { color: var(--gold-muted); }

.correction-notice { background: #FFF8E1; border: 1px solid #FFD54F; border-left: 3px solid #F9A825; padding: 12px 16px; margin-bottom: 20px; border-radius: 0 2px 2px 0; font-size: 0.85rem; }

.article-sources { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--border); }
.article-sources__heading { font-size: 0.65rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px; font-family: 'Source Serif 4', Georgia, serif; }
.article-sources__list { list-style: none; padding: 0; }
.article-sources__list li { font-size: 0.8rem; margin-bottom: 5px; padding-left: 12px; position: relative; }
.article-sources__list li::before { content: '→'; position: absolute; left: 0; color: var(--gold-muted); font-size: 0.7rem; }
.article-sources__list a { color: var(--navy-light); text-decoration: none; word-break: break-all; }
.article-sources__list a:hover { text-decoration: underline; }

.article-legal { margin-top: 24px; padding: 14px 16px; background: var(--parchment); border: 1px solid var(--border); border-radius: 2px; font-size: 0.75rem; color: var(--text-muted); line-height: 1.6; font-style: italic; }

[data-section="Domestic-IE"]    { color: var(--section-domestic); }
[data-section="Companies"]      { color: var(--section-companies); }
[data-section="Central Banking"]{ color: var(--section-banking); }
[data-section="Funds"]          { color: var(--section-funds); }
[data-section="Indexes"]        { color: var(--section-indexes); }
.section-pip[data-section="Domestic-IE"]    { background: var(--section-domestic); }
.section-pip[data-section="Companies"]      { background: var(--section-companies); }
.section-pip[data-section="Central Banking"]{ background: var(--section-banking); }
.section-pip[data-section="Funds"]          { background: var(--section-funds); }
.section-pip[data-section="Indexes"]        { background: var(--section-indexes); }
.stream-dot[data-section="Domestic-IE"]    { background: var(--section-domestic); }
.stream-dot[data-section="Companies"]      { background: var(--section-companies); }
.stream-dot[data-section="Central Banking"]{ background: var(--section-banking); }
.stream-dot[data-section="Funds"]          { background: var(--section-funds); }
.stream-dot[data-section="Indexes"]        { background: var(--section-indexes); }
.article-item__section[data-section="Domestic-IE"]    { color: var(--section-domestic); }
.article-item__section[data-section="Companies"]      { color: var(--section-companies); }
.article-item__section[data-section="Central Banking"]{ color: var(--section-banking); }
.article-item__section[data-section="Funds"]          { color: var(--section-funds); }
.article-item__section[data-section="Indexes"]        { color: var(--section-indexes); }

.results-count { padding: 8px 18px 4px; font-size: 0.65rem; color: var(--gold-muted); font-family: 'JetBrains Mono', monospace; letter-spacing: 0.05em; flex-shrink: 0; }
.loading-spinner { display: flex; align-items: center; justify-content: center; height: 200px; color: var(--text-muted); font-size: 0.85rem; }

body.article-page { overflow: auto; display: block; }
body.article-page .standalone-header { background: var(--navy-dark); border-bottom: 2px solid var(--gold); padding: 14px 32px; display: flex; align-items: center; justify-content: space-between; }
body.article-page .standalone-header a { font-family: 'Libre Baskerville', Georgia, serif; font-size: 1.1rem; font-weight: 700; color: var(--white); text-decoration: none; }
body.article-page .standalone-header a span { color: var(--gold); }
body.article-page .standalone-header .back-link { font-family: 'Source Serif 4', Georgia, serif; font-size: 0.78rem; color: var(--gold); text-decoration: none; opacity: 0.8; font-weight: 400; }
body.article-page .standalone-header .back-link:hover { opacity: 1; }
body.article-page main { max-width: 760px; margin: 40px auto 80px; padding: 0 32px; }

@media (max-width: 768px) {
  :root { --sidebar-width: 260px; }
  .site-header__tagline { display: none; }
  .article-content { padding: 24px 20px 60px; }
  .article-headline { font-size: 1.5rem; }
}

/* Article page byline (build_site.py rendered articles) */
.byline { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; font-size: 0.78rem; color: var(--text-muted); flex-wrap: wrap; }
.byline .author { font-weight: 600; color: var(--text-secondary); }
.byline time { font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; }
.byline .edited-by { font-style: italic; color: var(--text-muted); }

/* ── Collapsible stream/source tree ─────────────────────────────── */
.source-search-input {
  width: calc(100% - 36px);
  margin: 0 18px 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(201,168,76,0.2);
  border-radius: 3px;
  padding: 6px 9px;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 0.78rem;
  color: var(--white);
  outline: none;
  transition: border-color 0.15s;
}
.source-search-input::placeholder { color: #5A7A99; }
.source-search-input:focus { border-color: var(--gold); }

.stream-row { display: flex; flex-direction: column; }

.stream-caret {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  flex-shrink: 0;
  color: var(--gold-muted);
  font-size: 0.95rem;
  line-height: 1;
  transition: transform 0.15s;
}
.stream-caret.open { transform: rotate(90deg); }
.stream-caret--empty { visibility: hidden; }

.stream-btn .stream-label { flex: 0 1 auto; }

.source-sublist {
  display: flex;
  flex-direction: column;
  padding: 2px 0 6px;
}
.source-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 18px 5px 40px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 0.78rem;
  color: #8FA8C2;
  text-align: left;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
  overflow: hidden;
}
.source-btn:hover { background: rgba(201,168,76,0.07); color: var(--white); }
.source-btn.active { background: rgba(201,168,76,0.12); color: var(--white); font-weight: 600; }
.source-label { overflow: hidden; text-overflow: ellipsis; }
.source-count {
  margin-left: auto;
  font-size: 0.62rem;
  color: var(--gold-muted);
  font-family: 'JetBrains Mono', monospace;
}

/* ── Resize handle ──────────────────────────────────────────────── */
.resize-handle {
  width: 5px;
  flex-shrink: 0;
  background: transparent;
  cursor: col-resize;
  transition: background 0.15s;
  z-index: 10;
  position: relative;
}
.resize-handle:hover,
.resize-handle.dragging { background: var(--gold-rule); }

/* ── Internal sidebar resize handles ───────────────────────────── */
.sidebar-inner-handle {
  height: 5px;
  flex-shrink: 0;
  background: transparent;
  cursor: row-resize;
  transition: background 0.15s;
  z-index: 10;
  position: relative;
}
.sidebar-inner-handle:hover,
.sidebar-inner-handle.dragging { background: var(--gold-rule); }
