/* ==========================================================================
   Perspective — public stylesheet
   Type: Newsreader (headlines and article text), Instrument Sans (interface)
   Colour: brand blue for links and interface accents, brand green used sparingly,
   red only for "Breaking"
   ========================================================================== */

:root {
  --paper: #ffffff;
  --surface: #f1f4f3;
  --surface-2: #e4eae8;
  --ink: #14202b;
  --ink-2: #46525e;
  --ink-3: #647079;
  --rule: #d8dedd;
  --field-border: #7c8a87;
  --brand: #0c63b5;
  --brand-hover: #094a87;
  --on-brand: #ffffff;
  --focus: #0c63b5;
  --chrome: #14202b;
  --chrome-ink: #e9eef0;
  --alert: #ff5a5f;
  --ok-bg: #e3f4ec;
  --ok-ink: #0a4530;
  --err-bg: #fbe9ea;
  --err-ink: #8a1c22;

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r: 4px;
  --gutter: 1rem;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #0f1720;
  --surface: #17212c;
  --surface-2: #202c39;
  --ink: #e9eef0;
  --ink-2: #b1bcc5;
  --ink-3: #8f9ba6;
  --rule: #2a3642;
  --field-border: #6b7b88;
  --brand: #4db3f2;
  --brand-hover: #82c8f5;
  --on-brand: #06131f;
  --focus: #82c8f5;
  --chrome: #0a1017;
  --ok-bg: #12301f;
  --ok-ink: #a9e8c8;
  --err-bg: #3a1a1d;
  --err-ink: #ffb3b6;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1720;
    --surface: #17212c;
    --surface-2: #202c39;
    --ink: #e9eef0;
    --ink-2: #b1bcc5;
    --ink-3: #8f9ba6;
    --rule: #2a3642;
    --field-border: #6b7b88;
    --brand: #4db3f2;
    --brand-hover: #82c8f5;
    --on-brand: #06131f;
    --focus: #82c8f5;
    --chrome: #0a1017;
    --ok-bg: #12301f;
    --ok-ink: #a9e8c8;
    --err-bg: #3a1a1d;
    --err-ink: #ffb3b6;
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 4rem; }
body {
  margin: 0;
  font: 400 1rem/1.55 var(--sans);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
img { height: auto; }
a { color: inherit; }
h1, h2, h3, p, ul, ol, figure { margin-block: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.container { width: min(100% - 2 * var(--gutter), 76rem); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.muted { color: var(--ink-2); }
.skip-link { position: absolute; left: .5rem; top: -4rem; z-index: 100; background: var(--ink); color: var(--paper); padding: .6rem 1rem; border-radius: var(--r); }
.skip-link:focus { top: .5rem; }
@media (min-width: 40rem) { :root { --gutter: 1.5rem; } }

/* ---------- Breaking bar ---------- */
.ticker { background: var(--chrome); color: var(--chrome-ink); font: 500 .875rem/1.3 var(--sans); }
.ticker-row { display: flex; align-items: center; gap: .9rem; padding-block: .55rem; min-width: 0; }
.ticker-flag { display: inline-flex; align-items: center; gap: .45rem; flex: none; font-weight: 600; padding-right: .9rem; border-right: 1px solid rgba(255,255,255,.25); }
.ticker-flag:not(.ticker-flag--live) .dot { background: var(--brand); animation: none; }
.ticker-viewport { flex: 1 1 auto; min-width: 0; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent); mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent); }
.ticker-track { display: flex; width: max-content; animation: ticker-scroll 32s linear infinite; }
.ticker-row:hover .ticker-track, .ticker-row:focus-within .ticker-track { animation-play-state: paused; }
.ticker-list { display: flex; align-items: center; list-style: none; margin: 0; padding: 0; }
.ticker-list li { flex: none; white-space: nowrap; }
.ticker-list li::after { content: '\2022'; margin: 0 1.25rem; opacity: .5; }
.ticker-list a { color: inherit; text-decoration: none; }
.ticker-list a:hover { text-decoration: underline; }
@keyframes ticker-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .ticker-track { animation: none; } .ticker-viewport { overflow-x: auto; } }
.dot { width: .55rem; height: .55rem; border-radius: 50%; background: var(--alert); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------- Masthead ---------- */
.site-header { position: sticky; top: 0; z-index: 40; }
.masthead { background: var(--paper); border-top: 4px solid var(--ink); }
.masthead-row { display: grid; grid-template-columns: 1fr auto; align-items: center; padding-block: .9rem .8rem; gap: 1rem; }
.masthead-date { display: none; margin: 0; gap: .75rem; font: 500 .8125rem var(--sans); color: var(--ink-2); }
.masthead-date span { color: var(--ink-3); }
.brand { margin: 0; font: inherit; }
.wordmark {
  display: inline-flex; align-items: center; gap: .55rem;
  font: 600 clamp(1.9rem, 1.2rem + 2.6vw, 3.4rem)/1 var(--serif);
  letter-spacing: -.025em; color: var(--ink); text-decoration: none;
}
.wordmark .mark { height: .85em; width: auto; flex: none; }
.tools { display: flex; gap: .15rem; justify-self: end; }
.icon-btn {
  display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border: 0; border-radius: 50%;
  background: transparent; color: var(--ink); cursor: pointer;
}
.icon-btn:hover { background: var(--surface); }
@media (min-width: 40rem) {
  .masthead-row { grid-template-columns: 1fr auto 1fr; padding-block: 1.4rem 1.2rem; }
  .masthead-date { display: flex; }
  .brand { justify-self: center; }
}

/* ---------- Section navigation ---------- */
.nav { background: var(--paper); border-block: 1px solid var(--rule); }
.nav-list { display: flex; gap: 1.6rem; margin: 0; padding: 0; list-style: none; overflow-x: auto; scrollbar-width: none; }
.nav-list::-webkit-scrollbar { display: none; }
.nav-list a {
  display: block; padding: .8rem 0 .7rem; font: 500 .95rem var(--sans); white-space: nowrap;
  color: var(--ink); text-decoration: none; border-bottom: 3px solid transparent;
}
.nav-list a:hover { border-color: var(--ink-3); }
.nav-list a.is-active { color: var(--brand); border-color: var(--brand); }
@media (min-width: 64rem) { .nav-list { justify-content: center; gap: 2.2rem; } }

.search-panel { border-top: 1px solid var(--rule); background: var(--surface); }
.search-panel[hidden] { display: none; }
.search-panel .container { display: flex; gap: .5rem; padding-block: .8rem; }
.search-panel input { flex: 1; min-width: 0; }

/* ---------- Forms and buttons ---------- */
input[type="text"], input[type="email"], input[type="search"], input[type="password"], textarea {
  width: 100%; padding: .7rem .85rem; border: 1px solid var(--field-border); border-radius: var(--r);
  background: var(--paper); color: var(--ink); font: 400 1rem/1.4 var(--sans);
}
textarea { resize: vertical; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .7rem 1.15rem; border: 1px solid var(--brand); border-radius: var(--r);
  background: var(--brand); color: var(--on-brand); font: 600 .95rem/1.2 var(--sans);
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn--lg { padding: .85rem 1.5rem; font-size: 1rem; }
.btn--ghost { background: transparent; color: var(--brand); }
.btn--ghost:hover { background: var(--surface); color: var(--brand-hover); }
.form { max-width: 34rem; margin-top: 1.5rem; }
.field { display: grid; gap: .4rem; margin-bottom: 1.1rem; }
.field label { font: 500 .9rem var(--sans); }
.search-inline { display: flex; gap: .5rem; max-width: 32rem; margin: 1.25rem 0 .5rem; }
.search-inline input { flex: 1; min-width: 0; }

.notice { font: 500 .95rem/1.4 var(--sans); padding-block: .8rem; }
.notice--ok { background: var(--ok-bg); color: var(--ok-ink); }
.notice--err { background: var(--err-bg); color: var(--err-ink); }
.notice.inline { border-radius: var(--r); padding: 1rem 1.25rem; margin-block: 1.25rem; }
.notice ul { margin: 0; padding-left: 1.1rem; }

/* ---------- Media ---------- */
.media { display: block; position: relative; overflow: hidden; border-radius: var(--r); background: var(--surface); }
.media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.r-3x2 { aspect-ratio: 3 / 2; }
.r-16x10 { aspect-ratio: 16 / 10; }
.ph { display: grid; place-items: center; width: 100%; height: 100%; background: var(--surface-2); color: var(--ink-3); }
.ph-mark { width: 22%; max-width: 4rem; height: auto; opacity: .55; }

/* ---------- Stories ---------- */
.story-title { font: 600 1.25rem/1.22 var(--serif); letter-spacing: -.005em; text-wrap: balance; }
.story-title a { color: var(--ink); text-decoration: none; }
.story-title a:hover, .lead-title a:hover, .ranked a:hover, .voice-title:hover {
  text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: .18em;
}
.story-dek { font: 400 1.02rem/1.5 var(--serif); color: var(--ink-2); margin-top: .4rem; text-wrap: pretty; }
.meta { display: flex; flex-wrap: wrap; gap: .2rem .9rem; margin-top: .55rem; font: 400 .8125rem/1.4 var(--sans); color: var(--ink-3); }
.meta-cat { color: var(--brand); font-weight: 600; text-decoration: none; }
.meta-cat:hover { text-decoration: underline; }
.meta-by { color: var(--ink-2); font-weight: 500; }
.kicker { font: 600 .95rem var(--sans); color: var(--brand); text-decoration: none; }
.kicker:hover { text-decoration: underline; }

.story { display: grid; gap: .7rem; align-content: start; }
.story--row { grid-template-columns: minmax(0, 1fr) 7rem; gap: 1rem; padding-block: 1.2rem; border-top: 1px solid var(--rule); align-items: start; }
.story--row .story-dek { display: none; }
.story--row .media { order: 2; }
@media (min-width: 40rem) {
  .story--row { grid-template-columns: minmax(0, 1fr) 14rem; gap: 1.75rem; padding-block: 1.5rem; }
  .story--row .story-dek { display: block; }
  .story--row .story-title { font-size: 1.45rem; }
}

/* ---------- Home: lead + top stories ---------- */
.hero { padding-top: 1.5rem; }
.lead { display: grid; gap: 1.1rem; }
.lead-title { margin: .35rem 0 .8rem; font: 600 clamp(2rem, 1.3rem + 2.7vw, 3.3rem)/1.06 var(--serif); letter-spacing: -.02em; text-wrap: balance; }
.lead-title a { color: var(--ink); text-decoration: none; }
.lead-dek { font: 400 1.2rem/1.45 var(--serif); color: var(--ink-2); text-wrap: pretty; }
.lead .meta { margin-top: 1rem; font-size: .875rem; }
@media (min-width: 64rem) {
  .lead { grid-template-columns: 5fr 7fr; gap: 2.75rem; align-items: center; }
  .lead .media { order: 2; }
  .lead-body { order: 1; }
  .lead-dek { font-size: 1.3rem; }
}

.secondary { margin-top: 1.5rem; border-top: 1px solid var(--rule); display: grid; }
.story--brief { grid-template-columns: minmax(0, 1fr) 6.5rem; gap: 1rem; padding-block: 1.1rem; border-bottom: 1px solid var(--rule); align-items: start; }
.story--brief .media { order: 2; }
.story--brief .story-title { font-size: 1.15rem; }
@media (min-width: 40rem) {
  .secondary { grid-template-columns: 1fr 1fr; column-gap: 2rem; }
}
@media (min-width: 64rem) {
  .secondary { grid-template-columns: repeat(4, 1fr); column-gap: 3rem; margin-top: 2.25rem; }
  .story--brief { position: relative; grid-template-columns: 1fr; gap: .8rem; padding: 1.4rem 0 0; border-bottom: 0; }
  .story--brief .media { order: -1; }
  .story--brief + .story--brief::before { content: ""; position: absolute; left: -1.5rem; top: 1.4rem; bottom: 0; border-left: 1px solid var(--rule); }
}

/* ---------- Home: feed + rail ---------- */
.layout { display: grid; gap: 2.5rem; padding-block: 2.5rem 1rem; }
@media (min-width: 64rem) { .layout { grid-template-columns: minmax(0, 1fr) 20rem; gap: 3.5rem; } }
.section-title { padding-top: .7rem; margin-bottom: .35rem; border-top: 3px solid var(--ink); font: 600 1.75rem/1.1 var(--serif); letter-spacing: -.01em; }
.section-title a { text-decoration: none; }
.section-title a:hover { color: var(--brand); }
.section-title--small { font-size: 1.3rem; border-top-width: 2px; margin-bottom: .5rem; }
.rail-block { margin-bottom: 2.5rem; }
.ranked { margin: 0; padding: 0; list-style: none; }
.ranked li { display: grid; grid-template-columns: 2.2rem 1fr; gap: .5rem; padding-block: .9rem; border-bottom: 1px solid var(--rule); align-items: baseline; }
.rank { font: 600 1.9rem/1 var(--serif); color: var(--brand); }
.ranked a { font: 600 1.05rem/1.3 var(--serif); color: var(--ink); text-decoration: none; text-wrap: balance; }
.voices { margin: 0; padding: 0; list-style: none; }
.voices li { padding-block: .9rem; border-bottom: 1px solid var(--rule); }
.voice-name { font: italic 500 1rem/1.2 var(--serif); color: var(--brand); margin-bottom: .2rem; }
.voice-title { font: 600 1.05rem/1.3 var(--serif); color: var(--ink); text-decoration: none; text-wrap: balance; }
.panel { background: var(--surface); padding: 1.35rem; border-radius: var(--r); }
.panel-title { font: 600 1.4rem/1.15 var(--serif); margin-bottom: .4rem; }
.panel p { font-size: .95rem; color: var(--ink-2); margin-bottom: .9rem; }
.newsletter-row { display: flex; gap: .5rem; }
.newsletter-row input { flex: 1; min-width: 0; }
.rail .newsletter-row { flex-direction: column; }

/* ---------- Category strips ---------- */
.strip { padding-block: 2.25rem 0.5rem; }
.strip-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding-top: .7rem; margin-bottom: 1.4rem; border-top: 3px solid var(--ink); }
.strip-head .section-title { padding: 0; margin: 0; border: 0; }
.strip-more { font: 500 .9rem var(--sans); color: var(--brand); white-space: nowrap; }
.strip-grid { display: grid; gap: 2rem 1.75rem; }
.strip-grid .story-title { font-size: 1.3rem; }
@media (min-width: 40rem) { .strip-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 64rem) { .strip-grid { grid-template-columns: repeat(3, 1fr); gap: 2rem 2.25rem; } }

/* ---------- Listing pages ---------- */
.listing { padding-bottom: 1rem; }
.listing-head { padding-block: 2.5rem 1.25rem; border-bottom: 3px solid var(--ink); }
.listing-title { font: 600 clamp(2rem, 1.4rem + 2.2vw, 3rem)/1.08 var(--serif); letter-spacing: -.02em; text-wrap: balance; }
.listing-intro { margin-top: .6rem; font: 400 1.15rem/1.5 var(--serif); color: var(--ink-2); max-width: 40rem; }
.feed-list--wide { max-width: 52rem; }
.listing .search-inline { margin-top: 1.5rem; }
.listing > .muted, .listing .feed-list { margin-top: .75rem; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); font: 500 .95rem var(--sans); }
.pager a, .pager-pages > span { display: grid; place-items: center; min-width: 2.25rem; height: 2.25rem; padding-inline: .4rem; border-radius: var(--r); color: var(--ink); text-decoration: none; }
.pager a:hover { background: var(--surface); }
.pager-pages { display: flex; gap: .15rem; }
.pager .is-current { background: var(--ink); color: var(--paper); }
.pager-step { padding-inline: .75rem !important; color: var(--brand) !important; }
.pager-step.is-off { color: var(--ink-3) !important; }
@media (max-width: 39.99rem) { .pager-pages a, .pager-pages .gap { display: none; } }

/* ---------- Article ---------- */
.article-head { padding-top: 2rem; }
.preview-flag { margin-bottom: 1rem; padding: .6rem .9rem; border-radius: var(--r); background: var(--err-bg); color: var(--err-ink); font: 500 .9rem var(--sans); }
.article-title { margin: .4rem 0 .9rem; font: 600 clamp(2.15rem, 1.35rem + 3.3vw, 3.6rem)/1.05 var(--serif); letter-spacing: -.02em; text-wrap: balance; }
.article-dek { font: 400 clamp(1.2rem, 1.1rem + .5vw, 1.4rem)/1.42 var(--serif); color: var(--ink-2); text-wrap: pretty; }
.byline { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; margin-block: 1.4rem 1rem; padding-block: .85rem; border-block: 1px solid var(--rule); font: 400 .9rem/1.5 var(--sans); color: var(--ink-2); }
.byline-name a { color: var(--ink); font-weight: 600; text-decoration: none; }
.byline-name a:hover { text-decoration: underline; }
.byline-time span { margin-left: .9rem; }
.share { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin-bottom: 1.75rem; }
.share-label { margin-right: .3rem; font: 500 .85rem var(--sans); color: var(--ink-3); }
.share a, .share button {
  padding: .38rem .85rem; border: 1px solid var(--field-border); border-radius: 999px; background: transparent;
  font: 500 .85rem/1.2 var(--sans); color: var(--ink); text-decoration: none; cursor: pointer;
}
.share a:hover, .share button:hover { background: var(--surface); }
.article-hero { margin-bottom: 2rem; }
.article-hero img { width: 100%; border-radius: var(--r); }
.article-hero figcaption { margin-top: .6rem; font: 400 .85rem/1.45 var(--sans); color: var(--ink-3); }
.article-foot { margin-block: 3rem 0; }
.author-box { padding-top: 1.25rem; border-top: 3px solid var(--ink); }
.author-name { font: 600 1.2rem var(--serif); }
.author-name a { text-decoration: none; }
.author-name a:hover { color: var(--brand); }
.author-bio { margin-top: .4rem; color: var(--ink-2); }

.prose { font: 400 clamp(1.125rem, 1.05rem + .32vw, 1.25rem)/1.72 var(--serif); color: var(--ink); overflow-wrap: break-word; }
.prose > * + * { margin-top: 1.2em; }
.prose h2 { margin-top: 2em; font: 600 1.6em/1.2 var(--serif); letter-spacing: -.01em; }
.prose h3 { margin-top: 1.7em; font: 600 1.3em/1.25 var(--serif); }
.prose h4 { margin-top: 1.5em; font: 600 1.1em/1.3 var(--serif); }
.prose a { color: var(--brand); text-underline-offset: .18em; }
.prose a:hover { color: var(--brand-hover); }
.prose blockquote { margin-inline: 0; padding-left: 1.25rem; border-left: 3px solid var(--brand); font-style: italic; font-size: 1.1em; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: .4em; }
.prose img { display: block; margin-inline: auto; border-radius: var(--r); }
.prose iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: var(--r); background: var(--surface); }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin-block: 2em; }
.prose pre { overflow-x: auto; padding: 1rem; border-radius: var(--r); background: var(--surface); font-size: .85em; line-height: 1.5; }
.prose code { font-size: .9em; }
.prose figcaption { font: 400 .85rem var(--sans); color: var(--ink-3); }

.page { max-width: 44rem; padding-block: 2.5rem 1rem; }
.page .listing-title { margin-bottom: 1.25rem; }
.page .listing-intro { margin-bottom: .5rem; }
.empty { padding-block: 5rem; text-align: center; }
.empty h2 { font: 600 2rem var(--serif); margin-bottom: .5rem; }
.notfound .btn { margin-top: 1rem; }

/* ---------- Footer ---------- */
.footer { margin-top: 4rem; padding-top: 3rem; background: var(--chrome); color: var(--chrome-ink); font-size: .95rem; }
.footer a { color: inherit; text-decoration: none; }
.footer a:hover { text-decoration: underline; }
.footer-grid { display: grid; gap: 2.25rem; }
@media (min-width: 40rem) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 64rem) { .footer-grid { grid-template-columns: 1.5fr 1fr 1fr 1.5fr; gap: 3rem; } }
.wordmark--footer { color: var(--chrome-ink); font-size: 2rem; }
.footer-about p { margin-top: 1rem; max-width: 24rem; opacity: .8; }
.footer-title { margin-bottom: .8rem; font: 600 1.15rem var(--serif); }
.footer-links, .social { margin: 0; padding: 0; list-style: none; display: grid; gap: .5rem; }
.footer-links a, .social a { opacity: .8; }
.footer-links a:hover, .social a:hover { opacity: 1; }
.social { grid-auto-flow: column; justify-content: start; gap: 1.1rem; margin-top: 1.1rem; }
.footer-news p { margin-bottom: .9rem; opacity: .8; }
.footer .newsletter input { background: transparent; border-color: rgba(255, 255, 255, .45); color: var(--chrome-ink); }
.footer .newsletter input::placeholder { color: rgba(233, 238, 240, .6); }
.footer .btn { background: #4db3f2; border-color: #4db3f2; color: #06170f; }
.footer .btn:hover { background: #82c8f5; }
.footer-base { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-block: 1.25rem 1.75rem; border-top: 1px solid rgba(255, 255, 255, .15); font-size: .85rem; opacity: .75; }
.footer-base p { margin: 0; }

@media (prefers-reduced-motion: reduce) { .dot { animation: none; } }
@media print {
  .ticker, .masthead-date, .tools, .nav, .share, .footer, .strip, .skip-link { display: none !important; }
  .prose { font-size: 12pt; }
  a { text-decoration: none; }
}
