/*
Theme Name: Perivis
Theme URI: https://perivis.com
Author: Perivis
Description: A typographic, newspaper-style theme for high-volume wires (filings, notifications, data releases) organised by source, with room for longer analysis later. Categories = sources, tags = subjects.
Version: 1.1.0
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: perivis
*/

:root {
  --ground: #F7F6F2;
  --paper: #FFFFFF;
  --ink: #16181D;
  --ink-2: #3B3F47;
  --muted: #5A5F69;
  --faint: #9A9890;
  --rule: #D9D7D0;
  --rule-soft: #E3E0D8;
  --accent: #A33D17;
  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --sans: 'IBM Plex Sans', -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
  --wide: 1200px;
  --narrow: 820px;
  --read: 720px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
#content { flex: 1 0 auto; }
a { color: var(--ink); text-decoration: none; }
a:hover, a:focus-visible { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
img { max-width: 100%; height: auto; }

.screen-reader-text {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px); white-space: nowrap;
}
.skip-link:focus {
  clip: auto; width: auto; height: auto; z-index: 1000; top: 8px; left: 8px;
  background: var(--ink); color: #fff; padding: 10px 14px;
}

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

/* ---------- Type helpers ---------- */
.kicker {
  font-family: var(--mono); font-size: 11px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--accent);
}
.kicker-muted { color: var(--muted); }
.meta { font-size: 13px; color: var(--muted); }
.meta a { color: var(--ink); font-weight: 600; }
.serif { font-family: var(--serif); }
.section-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  border-top: 1px solid var(--ink); padding-top: 12px; margin: 0 0 6px;
  font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
}
.section-head a { font-weight: 500; letter-spacing: .04em; color: var(--muted); }
.section-head a:hover { color: var(--accent); }

/* ---------- Header ---------- */
.topline { padding: 14px 0; border-bottom: 1px solid var(--rule); }
.topline .wrap { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }

.masthead { text-align: center; padding: 30px 0 24px; }
.masthead .site-name {
  font-family: var(--serif); font-size: clamp(40px, 7vw, 60px); font-weight: 600;
  letter-spacing: -0.015em; line-height: 1;
}
.masthead .site-tagline {
  margin-top: 10px; font-family: var(--serif); font-style: italic; font-size: 16px; color: var(--muted);
}

.site-nav { border-top: 1px solid var(--ink); border-bottom: 3px double var(--ink); }
.nav-list {
  list-style: none; margin: 0; padding: 12px 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 30px;
}
.nav-list > li { position: relative; }
.nav-list a { font-size: 13px; font-weight: 500; letter-spacing: .04em; display: inline-block; padding: 4px 0; }
.nav-list .current-menu-item > a,
.nav-list .current-menu-ancestor > a,
.nav-list .current-category-ancestor > a { font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.nav-list .sub-menu {
  list-style: none; margin: 0; padding: 8px 0; position: absolute; top: 100%; left: -14px; z-index: 50;
  min-width: 220px; background: var(--paper); border: 1px solid var(--rule);
  box-shadow: 0 8px 24px rgba(22,24,29,.08); display: none;
}
.nav-list li:hover > .sub-menu,
.nav-list li:focus-within > .sub-menu { display: block; }
.nav-list .sub-menu a { display: block; padding: 7px 14px; letter-spacing: 0; }

/* compact header for inner pages */
.site-header-compact { border-bottom: 3px double var(--ink); }
.site-header-compact .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 32px; padding-block: 18px; }
.site-header-compact .site-name { font-family: var(--serif); font-size: 26px; font-weight: 600; letter-spacing: -0.01em; }
.site-header-compact .site-nav { border: 0; flex: 1 1 auto; }
.site-header-compact .nav-list { justify-content: flex-start; gap: 4px 24px; padding: 0; }

.search-inline { display: flex; gap: 8px; align-items: center; }
.search-inline input[type="search"] {
  font: 400 14px var(--sans); padding: 7px 10px; width: 180px;
  border: 1px solid #CFCCC3; background: var(--paper); color: var(--ink); border-radius: 3px;
}

/* ---------- Big search (home) ---------- */
.search-big { width: 100%; max-width: 720px; margin: 0 auto; display: flex; }
.search-big input[type="search"] {
  flex: 1; min-width: 0; font: 400 17px var(--sans); padding: 15px 18px;
  border: 1px solid var(--ink); border-right: 0; background: var(--paper); color: var(--ink);
  border-radius: 4px 0 0 4px;
}
.search-big button {
  font: 500 15px var(--sans); padding: 0 24px; min-height: 52px; cursor: pointer;
  background: var(--ink); color: #fff; border: 1px solid var(--ink); border-radius: 0 4px 4px 0;
}
.search-big button:hover { background: var(--accent); border-color: var(--accent); }

/* ---------- Home ---------- */
.home-main { padding-block: 36px 72px; display: flex; flex-direction: column; gap: 56px; }
.notable-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 0 48px; }
.notable-item { display: flex; flex-direction: column; gap: 8px; padding: 20px 0; border-bottom: 1px solid var(--rule-soft); }
.notable-item .title { font-family: var(--serif); font-size: 23px; font-weight: 500; line-height: 1.2; }
.notable-item .dek { font-size: 15px; line-height: 1.5; color: var(--ink-2); }

.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 40px; }
.col-row { display: flex; flex-direction: column; gap: 3px; padding: 11px 0; border-bottom: 1px solid var(--rule-soft); }
.col-row .stamp { font-family: var(--mono); font-size: 11px; letter-spacing: .04em; color: var(--muted); }
.col-row .title { font-size: 15px; line-height: 1.4; }
.col-more { display: inline-block; margin-top: 12px; font-size: 13px; color: var(--accent); }

.long-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 40px; }

.sources-teaser {
  border-top: 1px solid var(--ink); padding-top: 28px;
  display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; align-items: center;
}
.sources-teaser h2 { font-family: var(--serif); font-weight: 500; font-size: 30px; margin: 0 0 8px; }
.sources-teaser p { margin: 0; max-width: 640px; color: var(--ink-2); }
.button-outline {
  display: inline-block; font-size: 15px; font-weight: 500; padding: 14px 24px;
  border: 1px solid var(--ink); border-radius: 4px;
}
.button-outline:hover { border-color: var(--accent); }

/* ---------- Archives ---------- */
.archive-main { padding-block: 56px 80px; }
.archive-head { padding-bottom: 28px; margin-bottom: 8px; border-bottom: 1px solid var(--ink); display: flex; flex-direction: column; gap: 12px; }
.archive-head h1 { font-family: var(--serif); font-size: clamp(36px, 6vw, 56px); font-weight: 600; line-height: 1.1; margin: 0; }
.archive-head .desc { font-family: var(--serif); font-size: 19px; line-height: 1.5; color: var(--ink-2); }
.archive-head .desc p { margin: 0; }
.crumbs { font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.feed-link { font-size: 13px; color: var(--accent); }
.children-list { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; }
.children-list a { border-bottom: 1px solid var(--rule); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters a {
  font-size: 13px; font-weight: 500; padding: 7px 14px; border: 1px solid #CFCCC3;
  border-radius: 999px; background: var(--paper);
}
.filters a.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }

.wire-row {
  display: flex; gap: 18px; align-items: baseline;
  padding: 14px 0; border-bottom: 1px solid var(--rule-soft);
}
.wire-row .stamp { font-family: var(--mono); font-size: 12px; color: var(--muted); min-width: 64px; flex: none; }
.wire-row .src {
  font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); min-width: 140px; max-width: 160px; flex: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wire-row .title { font-size: 15px; line-height: 1.45; }

.long-item { padding: 28px 0; border-bottom: 1px solid var(--rule-soft); display: flex; flex-direction: column; gap: 10px; }
.long-item h2 { font-family: var(--serif); font-weight: 500; font-size: 28px; line-height: 1.18; margin: 0; }
.long-item .excerpt { font-size: 16px; line-height: 1.55; color: var(--ink-2); }
.long-item .excerpt p { margin: 0; }

.pager { display: flex; justify-content: space-between; align-items: center; padding-top: 32px; font-size: 13px; color: var(--muted); }
.pager a { font-weight: 600; color: var(--ink); }
.pager .disabled { color: var(--faint); }
.empty { padding: 40px 0; color: var(--muted); font-family: var(--serif); font-size: 19px; }

/* ---------- Single ---------- */
.single-main { padding-block: 64px 80px; }
.entry-title { font-family: var(--serif); font-size: clamp(32px, 5vw, 48px); font-weight: 500; line-height: 1.15; letter-spacing: -0.01em; margin: 16px 0 0; }
.entry-dek { font-family: var(--serif); font-style: italic; font-size: 21px; line-height: 1.5; color: var(--ink-2); margin: 18px 0 0; }
.entry-meta {
  margin: 28px 0 36px; padding: 14px 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule);
  display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; font-size: 13px; color: var(--muted);
}
.entry-meta a { color: var(--ink); font-weight: 600; }
.source-link { color: var(--accent) !important; }
.entry-content { font-family: var(--serif); font-size: 20px; line-height: 1.65; color: #22252B; }
.entry-content p, .entry-content ul, .entry-content ol, .entry-content table, .entry-content blockquote { margin: 0 0 22px; }
.entry-content h2, .entry-content h3 {
  font-family: var(--sans); font-size: 15px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  margin: 36px 0 14px; color: var(--ink);
}
.entry-content h4 { font-family: var(--sans); font-size: 16px; margin: 28px 0 10px; }
.entry-content a { color: var(--accent); border-bottom: 1px solid #E3C9BD; }
.entry-content li { margin-bottom: 8px; }
.entry-content blockquote { border-left: 2px solid var(--ink); padding-left: 18px; font-style: italic; color: var(--ink-2); }
.entry-content table { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: 15px; display: block; overflow-x: auto; }
.entry-content th, .entry-content td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--rule); }
.entry-content th { font-weight: 600; border-bottom-color: var(--ink); }
.entry-content figure { margin: 8px 0 30px; }
.entry-content figcaption { font-family: var(--sans); font-size: 13px; color: var(--muted); margin-top: 8px; }
.entry-content img { display: block; }
.wire-note {
  margin-top: 36px; padding: 14px 16px; background: var(--paper); border: 1px solid var(--rule);
  font-size: 13px; color: var(--muted);
}
.filed { margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--ink); display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: baseline; }
.filed .label { font-size: 13px; font-weight: 600; }
.filed a { font-size: 14px; font-weight: 500; color: var(--accent); border-bottom: 1px solid #E3C9BD; }
.related { margin-top: 64px; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 40px; }
.related .col-row .title { font-family: var(--serif); font-size: 17px; }

/* ---------- Sources directory ---------- */
.source-region { display: flex; flex-wrap: wrap; gap: 24px 48px; padding: 36px 0; border-bottom: 1px solid var(--rule); }
.source-region .region-name { flex: 1 1 220px; display: flex; flex-direction: column; gap: 6px; }
.source-region .region-name a.name { font-family: var(--serif); font-size: 32px; font-weight: 500; line-height: 1.2; }
.source-groups { flex: 999 1 560px; min-width: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 28px 40px; }
.source-group { display: flex; flex-direction: column; }
.source-group .kicker { margin-bottom: 8px; color: var(--muted); }
.source-group .src { font-size: 15px; line-height: 1.4; padding: 6px 0; border-bottom: 1px solid var(--rule-soft); }

/* ---------- Page ---------- */
.page-main { padding-block: 56px 80px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: #CFCCC3; }
.site-footer .wrap { padding-block: 36px; display: flex; flex-wrap: wrap; gap: 24px 32px; justify-content: space-between; font-size: 13px; line-height: 1.7; }
.site-footer .site-name { font-family: var(--serif); font-size: 22px; font-weight: 600; color: #fff; }
.site-footer a { color: #fff; }
.site-footer a:hover { color: #F0B79E; }
.footer-menu { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 28px; }

/* ---------- Logo & author label ---------- */
.site-name.has-logo { display: inline-block; line-height: 0; }
.site-logo { width: auto; max-width: 100%; display: block; }
.site-logo-mast { height: var(--logo-h-mast, 64px); margin: 0 auto; }
.site-logo-bar { height: var(--logo-h-bar, 30px); }
.author-label {
  display: inline-block; margin-left: 6px; padding: 1px 7px; vertical-align: 1px;
  font-family: var(--mono); font-size: 10px; font-weight: 400; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); border: 1px solid #CFCCC3; border-radius: 3px; white-space: nowrap;
}

/* ---------- Small screens ---------- */
@media (max-width: 720px) {
  .wrap, .wrap-narrow, .wrap-read { padding-inline: 20px; }
  .nav-list { justify-content: flex-start; gap: 4px 18px; }
  .nav-list .sub-menu { position: static; display: block; border: 0; box-shadow: none; background: transparent; padding: 0 0 0 12px; }
  .search-inline input[type="search"] { width: 100%; }
  .search-inline { width: 100%; }
  .wire-row { flex-wrap: wrap; gap: 4px 12px; }
  .wire-row .src { min-width: 0; max-width: none; }
  .wire-row .title { flex-basis: 100%; }
  .notable-grid { grid-template-columns: 1fr; }
  .entry-content { font-size: 18px; }
}
