:root {
  --herald-accent: #ff6600;
  --herald-dark: #222;
  --herald-text: #333;
  --herald-muted: #888;
  --herald-line: #ddd;
  --herald-page: #eee;
  --herald-panel: #fff;
  --herald-width: 1380px;
  --font-serif: Georgia, "Times New Roman", serif;
  --font-sans: Arial, Helvetica, sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  background: var(--herald-page);
  color: var(--herald-text);
  font-family: var(--font-serif);
  font-size: 10px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  background: var(--herald-page);
  font-size: 1.6rem;
}

a { color: inherit; text-decoration: none; transition: color .2s ease; }
a:hover { color: var(--herald-accent); }
img { display: block; max-width: 100%; height: auto; }
button, input, textarea, select { font: inherit; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 10px;
  z-index: 9999;
  background: #fff;
  padding: 8px 12px;
}
.skip-link:focus { left: 10px; }

.container {
  width: min(var(--herald-width), calc(100% - 60px));
  margin: 0 auto;
}

.reading-progress {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000;
  height: 3px;
  background: var(--herald-accent);
}

/* Header */
.herald-site-header {
  background: var(--herald-panel);
  position: relative;
  z-index: 5;
}

.header-top {
  background: var(--herald-dark);
  color: #aaa;
  font-size: 1.3rem;
  line-height: 4rem;
}
.header-top-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
}
.secondary-navigation,
.herald-soc-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}
.secondary-navigation a,
.herald-soc-nav a { color: #aaa; }
.secondary-navigation a:hover,
.herald-soc-nav a:hover { color: #fff; }
.herald-calendar {
  color: #aaa;
  text-align: center;
  white-space: nowrap;
}
.header-top .herald-soc-nav { justify-content: flex-end; gap: 18px; text-transform: uppercase; font-family: var(--font-sans); font-size: 1.2rem; }

.header-middle {
  background: var(--herald-accent);
  min-height: 140px;
  position: relative;
}
.masthead-inner {
  min-height: 140px;
  display: flex;
  align-items: center;
  position: relative;
}
.site-logo {
  display: block;
  width: min(760px, 60vw);
  flex: 0 0 auto;
}
.site-logo img {
  width: 100%;
  height: auto;
}
.main-navigation {
  position: absolute;
  right: 42px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 0;
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #fff;
  white-space: nowrap;
}
.main-navigation a {
  color: #fff;
  padding: 0 15px;
  line-height: 4.2rem;
}
.main-navigation a[aria-current="page"],
.main-navigation a:hover {
  background: rgba(0, 0, 0, .13);
  color: #fff;
}
.search-toggle,
.herald-nav-toggle {
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
}
.search-toggle {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
  line-height: 1;
}
.herald-nav-toggle {
  display: none;
  font-size: 3rem;
  margin-right: 12px;
}
.header-search {
  padding: 0 0 18px;
}
.header-search input,
.search input,
.archive-search input {
  width: 100%;
  border: 1px solid var(--herald-line);
  border-radius: 0;
  padding: 11px 14px;
  font-size: 1.5rem;
  background: #fff;
}

.header-trending {
  background: #f6f6f6;
  border-bottom: 1px solid var(--herald-line);
}
.trending-list {
  min-height: 84px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 26px;
  align-items: center;
}
.trending-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  color: #666;
  font-size: 1.3rem;
  line-height: 1.35;
}
.trending-thumb {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  background: #ddd;
}
.trending-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Main layout */
.herald-site-content {
  width: min(var(--herald-width), calc(100% - 60px));
  margin: 0 auto;
  background: var(--herald-panel);
  min-height: 67vh;
  padding: 30px 30px 1px;
}
.herald-section {
  width: 100%;
  margin-bottom: 40px;
}
.herald-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 40px;
}
.herald-module-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  border-bottom: 2px solid #333;
  margin-bottom: 18px;
}
.herald-module-title h1,
.herald-module-title h2 {
  margin: 0;
  display: inline-block;
  background: #333;
  color: #fff;
  padding: 8px 14px;
  font-size: 1.7rem;
  line-height: 1.2;
  font-weight: 700;
}
.herald-module-title a {
  margin-bottom: 5px;
  border: 1px solid var(--herald-line);
  padding: 6px 18px;
  color: #777;
  font-family: var(--font-sans);
  font-size: 1.1rem;
  text-transform: uppercase;
}
.herald-module-title-dark h2 { background: #333; }

/* Featured mosaic */
.herald-fa-wrapper {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-height: 520px;
  background: #111;
  overflow: hidden;
}
.herald-fa-item {
  position: relative;
  min-height: 520px;
  overflow: hidden;
}
.fa-post-thumbnail {
  position: absolute;
  inset: 0;
  background: #444;
}
.fa-post-thumbnail::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .42);
}
.fa-post-thumbnail img,
.fa-post-thumbnail .image-fallback {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.herald-fa-item .entry-header {
  position: absolute;
  left: 30px;
  right: 24px;
  bottom: 30px;
  z-index: 1;
  color: #fff;
}
.meta-category {
  display: inline-block;
  color: var(--herald-accent);
  font-size: 1.3rem;
  line-height: 1.6rem;
  text-transform: uppercase;
  font-weight: 400;
  margin-bottom: 8px;
}
.herald-fa-item .meta-category {
  background: var(--herald-accent);
  color: #fff;
  padding: 7px 10px;
}
.entry-title {
  margin: 0;
  color: #333;
  font-weight: 700;
}
.herald-fa-item .entry-title {
  color: #fff;
  font-size: 2.1rem;
  line-height: 1.32;
  text-shadow: 0 1px 1px rgba(0,0,0,.3);
}
.entry-meta,
.entry-meta time,
.sidebar-story time {
  color: #999;
  font-size: 1.3rem;
  line-height: 1.6rem;
}
.herald-fa-item .entry-meta,
.herald-fa-item .entry-meta time {
  color: #fff;
}
.entry-meta time::before,
.sidebar-story time::before,
.meta-line time::before {
  content: "";
}

/* Story grid */
.herald-post-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 40px;
  row-gap: 36px;
}
.herald-lay-g {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  min-width: 0;
}
.herald-post-thumbnail {
  display: block;
  width: 130px;
  height: 86px;
  background: #ddd;
  overflow: hidden;
}
.herald-post-thumbnail img,
.herald-post-thumbnail .image-fallback {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.herald-lay-g .entry-title {
  font-size: 1.55rem;
  line-height: 1.32;
  margin-bottom: 8px;
}
.herald-lay-g .entry-header { margin: 0; }

.herald-sidebar {
  min-width: 0;
}
.sidebar-story {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 26px;
}
.sidebar-story:first-of-type {
  display: block;
}
.sidebar-story:first-of-type .sidebar-thumb { display: none; }
.sidebar-thumb {
  width: 74px;
  height: 55px;
  overflow: hidden;
  background: #ddd;
}
.sidebar-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.sidebar-story h3 {
  margin: 0 0 7px;
  font-size: 1.45rem;
  line-height: 1.32;
}

/* Archive and article pages */
.archive-head,
.article-detail {
  max-width: 1020px;
  margin: 0 auto 40px;
}
.archive-head {
  border-bottom: 1px solid var(--herald-line);
  padding-bottom: 24px;
}
.archive-head h1,
.article-hero h1 {
  margin: 0 0 14px;
  font-size: 4.2rem;
  line-height: 1.12;
  color: #222;
}
.archive-head p,
.lead-copy {
  color: #777;
  font-size: 1.8rem;
  line-height: 1.65;
}
.archive-search { margin-top: 18px; max-width: 520px; }
.article-hero {
  border-bottom: 1px solid var(--herald-line);
  margin-bottom: 34px;
  padding-bottom: 26px;
}
.article-hero-media {
  margin-top: 24px;
  background: #ddd;
}
.article-hero-media img {
  width: 100%;
  max-height: 560px;
  object-fit: cover;
}
.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: #999;
  font-size: 1.3rem;
}
.meta-line svg { display: none; }

.article-body {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  line-height: 1.78;
  color: #444;
  max-width: 720px;
  margin: 0 auto;
  overflow-wrap: break-word;
}
.article-body p { margin: 0 0 1.2em; }
.article-body > p:first-of-type {
  color: #333;
  font-size: 1.06em;
}
.article-body h2,
.article-body h3 {
  color: #222;
  margin: 1.55em 0 .65em;
  line-height: 1.2;
}
.article-body h2 { font-size: 2.8rem; }
.article-body h3 { font-size: 2.2rem; }
.article-body a {
  color: var(--herald-accent);
  border-bottom: 1px solid currentColor;
}
.article-body img {
  margin: 1.6em 0;
  width: 100%;
}
.article-body figure { margin: 1.8em 0; }
.article-body figcaption {
  color: #999;
  font-family: var(--font-sans);
  font-size: 1.3rem;
  line-height: 1.45;
  margin-top: 8px;
}
.article-body blockquote {
  border-left: 4px solid var(--herald-accent);
  margin: 1.4em 0;
  padding: 5px 0 5px 20px;
  font-style: italic;
}
.article-body ul,
.article-body ol {
  margin: 0 0 1.2em;
  padding-left: 1.4em;
}
.article-image-missing,
.image-fallback {
  display: grid;
  place-items: center;
  background: #ddd;
  color: #777;
  font-family: var(--font-sans);
  font-size: 1.2rem;
  min-height: 74px;
}
.image-fallback::after {
  content: attr(data-fallback-label);
}

/* Embeds */
.article-body iframe,
.article-body table,
.article-body figure { max-width: 100%; }
.article-embed {
  clear: both;
  margin: 1.8em auto;
  width: 100%;
}
.article-embed-frame {
  background: #000;
  overflow: hidden;
}
.article-embed-video,
.article-embed-frame.article-embed-video {
  aspect-ratio: 16 / 9;
}
.article-embed-wide {
  background: #f6f6f6;
  min-height: 152px;
}
.article-embed iframe,
.article-embed video {
  display: block;
  width: 100%;
  border: 0;
}
.article-embed-frame iframe {
  height: 100%;
  min-height: 360px;
}
.article-embed-wide iframe { min-height: 152px; }
.article-embed-video video {
  height: 100%;
  background: #000;
}
.article-embed-social {
  display: flex;
  justify-content: center;
  padding: 8px 0;
}
.article-embed-social blockquote {
  max-width: min(100%, 560px);
  width: 100%;
}
.article-embed-tiktok blockquote { max-width: min(100%, 605px); }
.article-body table {
  display: block;
  overflow-x: auto;
}
.article-body code {
  background: #f5f5f5;
  border: 1px solid var(--herald-line);
  padding: 1px 6px;
}

.share-rail {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  max-width: 720px;
  margin: 36px auto 8px;
  padding-top: 24px;
  border-top: 1px solid var(--herald-line);
}
.share-rail span {
  color: #999;
  font-family: var(--font-sans);
  font-size: 1.2rem;
  text-transform: uppercase;
}
.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--herald-line);
  background: #fff;
  color: #555;
  cursor: pointer;
}
.icon-btn svg { width: 18px; height: 18px; }
.related {
  max-width: 1020px;
  margin: 44px auto;
}
.related .section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #333;
  margin-bottom: 18px;
}
.related .section-head h2 {
  margin: 0;
  background: #333;
  color: #fff;
  padding: 8px 14px;
  font-size: 1.7rem;
}
.btn {
  border: 1px solid var(--herald-line);
  padding: 6px 12px;
  color: #777;
  font-family: var(--font-sans);
  font-size: 1.2rem;
}

/* Footer */
.herald-site-footer {
  width: min(var(--herald-width), calc(100% - 60px));
  margin: 0 auto;
}
.footer-bottom {
  background: #222;
  color: #aaa;
  font-size: 1.3rem;
  line-height: 4.8rem;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.footer-bottom .herald-soc-nav { gap: 18px; }

/* Mobile drawer */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
}
.drawer[aria-hidden="true"] { display: none; }
.drawer[aria-hidden="false"] { pointer-events: auto; }
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
}
.drawer-panel {
  position: absolute;
  inset: 0 auto 0 0;
  width: min(330px, 86vw);
  background: #fff;
  padding: 18px;
  overflow-y: auto;
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.drawer-head img { width: 210px; }
.drawer-head button {
  border: 0;
  background: transparent;
  font-size: 3rem;
  cursor: pointer;
}
.drawer nav {
  display: grid;
  gap: 0;
  margin-top: 16px;
}
.drawer nav a {
  border-bottom: 1px solid var(--herald-line);
  padding: 13px 0;
  text-transform: uppercase;
  font-weight: 700;
}

.empty-state {
  border: 1px dashed var(--herald-line);
  padding: 28px;
  color: #777;
}

.htmx-indicator {
  opacity: 0;
  transition: opacity .2s ease;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { opacity: 1; }

@media (max-width: 1180px) {
  .main-navigation a { padding: 0 9px; font-size: 1.25rem; }
  .site-logo { width: min(620px, 52vw); }
  .herald-post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trending-list { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 14px 0; }
}

@media (max-width: 900px) {
  .container,
  .herald-site-content,
  .herald-site-footer {
    width: min(100%, calc(100% - 24px));
  }
  .header-top { display: none; }
  .header-middle { min-height: 78px; }
  .masthead-inner { min-height: 78px; }
  .herald-nav-toggle { display: block; }
  .site-logo { width: min(280px, 68vw); }
  .main-navigation { display: none; }
  .header-trending { display: none; }
  .herald-site-content { padding: 18px 12px 1px; }
  .herald-fa-wrapper { grid-template-columns: 1fr; min-height: 0; }
  .herald-fa-item { min-height: 330px; }
  .herald-layout { grid-template-columns: 1fr; gap: 32px; }
  .herald-post-grid { grid-template-columns: 1fr; }
  .herald-lay-g { grid-template-columns: 110px minmax(0, 1fr); gap: 14px; }
  .herald-post-thumbnail { width: 110px; height: 83px; }
  .archive-head h1,
  .article-hero h1 { font-size: 3rem; }
  .article-body { font-size: 1.65rem; }
  .footer-inner { display: block; line-height: 2.2rem; padding: 14px 0; }
  .footer-bottom .herald-soc-nav { margin-top: 8px; flex-wrap: wrap; }
}

@media (max-width: 520px) {
  .search-toggle { margin-left: auto; }
  .herald-fa-item { min-height: 290px; }
  .herald-fa-item .entry-header { left: 18px; right: 18px; bottom: 20px; }
  .herald-fa-item .entry-title { font-size: 1.9rem; }
  .herald-lay-g .entry-title { font-size: 1.45rem; }
  .sidebar-story { grid-template-columns: 70px minmax(0, 1fr); }
}
