:root {
  color-scheme: light;
  --accent: #bb2727;
  --accent-dark: #bb2727;
  --ink: #171717;
  --muted: #686868;
  --line: #dedede;
  --paper: #ffffff;
  --surface: #f4f5f2;
  --focus: #0d6b7a;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--surface);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background: var(--surface);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.app-shell {
  min-height: 100vh;
  background: var(--paper);
  overflow-x: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  min-height: 64px;
  padding: max(12px, env(safe-area-inset-top)) 18px 12px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  flex: 1 1 auto;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.brand-logo {
  display: block;
  width: min(250px, calc(100vw - 210px));
  height: auto;
  max-height: 46px;
  object-fit: contain;
  object-position: left center;
}

.topbar-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.connection-banner {
  padding: 8px 18px;
  color: #fff;
  background: #3f4548;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
}

.connection-banner[hidden] {
  display: none;
}

.ad-slot-header {
  width: 100vw;
  max-width: 100vw;
  min-height: 0;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  background: #fff;
  overflow: hidden;
  text-align: center;
}

.ad-slot[hidden] {
  display: none;
}

.ad-label {
  padding-top: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}

.ad-content {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  overflow: hidden;
}

.ad-content > *,
.ad-content img,
.ad-content iframe {
  max-width: 100%;
}

.ad-slot-header .ad-content,
.ad-slot-header .ad-content > *,
.ad-slot-header .ad-content a,
.ad-slot-header .ad-content img,
.ad-slot-header .ad-content iframe {
  max-width: 100vw;
}

.ad-content ins.adsbygoogle {
  display: block;
  width: 100%;
  min-height: 90px;
}

.ad-content img {
  display: block;
  height: auto;
}

.ad-slot-inline,
.ad-slot-home,
.ad-slot-after-article {
  clear: both;
  margin: 26px 0;
  padding: 8px 0;
  background: #fff;
  border-top: 1px solid var(--line);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-align: center;
}

.ad-slot-home {
  margin: 28px 0 6px;
}

.ad-stack {
  display: grid;
  gap: 14px;
  margin: 28px 0;
}

.ad-stack .ad-slot-inline {
  margin: 0;
}

.ad-slot-after-article {
  margin-top: 34px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
}

.section-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}

.section-tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-weight: 750;
  white-space: nowrap;
}

.tab.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.tab-home {
  display: inline-grid;
  width: 40px;
  padding: 0;
  place-items: center;
}

.tab-icon {
  display: block;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.searchbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 14px 18px 0;
  background: #fff;
}

.searchbar input {
  min-width: 0;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
}

.searchbar button,
.back-button,
.story-save {
  min-height: 42px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 0 13px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.content {
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 18px 48px;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 18px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 18px calc(28px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.site-footer a,
.footer-link {
  color: inherit;
  text-decoration: none;
}

.footer-link {
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font: inherit;
}

.site-footer a:hover,
.footer-link:hover {
  color: var(--accent);
  background: transparent;
  text-decoration: underline;
}

body.share-bar-visible .app-shell {
  padding-bottom: calc(68px + env(safe-area-inset-bottom));
}

body.app-notice-visible .app-shell {
  padding-bottom: calc(126px + env(safe-area-inset-bottom));
}

body.share-bar-visible.app-notice-visible .app-shell {
  padding-bottom: calc(194px + env(safe-area-inset-bottom));
}

.share-bar {
  position: fixed;
  z-index: 40;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(16px);
}

.share-bar[hidden] {
  display: none;
}

.share-bar-inner {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  width: min(100%, 760px);
  margin: 0 auto;
}

.share-action {
  display: flex;
  min-width: 0;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 6px;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.share-action:hover {
  color: #fff;
  background: var(--accent);
}

.share-icon {
  flex: 0 0 auto;
  font-size: 17px;
  font-weight: 900;
}

.share-monogram {
  font-size: 12px;
}

.share-brand-icon {
  display: block;
  width: 18px;
  height: 18px;
}

.app-notices {
  position: fixed;
  z-index: 45;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  left: 12px;
  display: grid;
  gap: 8px;
  max-width: 640px;
  margin: 0 auto;
  pointer-events: none;
}

body.share-bar-visible .app-notices {
  bottom: calc(80px + env(safe-area-inset-bottom));
}

.system-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.16);
  pointer-events: auto;
}

.system-notice[hidden] {
  display: none;
}

.system-notice > div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.system-notice strong {
  font-size: 15px;
}

.system-notice span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.system-notice button {
  min-height: 40px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 0 12px;
  color: #fff;
  background: var(--accent);
  font-size: 13px;
  font-weight: 850;
}

.notice-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.system-notice .quiet-button {
  color: var(--accent);
  background: #fff;
}

.install-dialog {
  position: fixed;
  z-index: 70;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.52);
}

.install-dialog[hidden] {
  display: none;
}

.install-dialog-panel {
  position: relative;
  width: min(100%, 460px);
  border-radius: 8px;
  padding: 26px 24px 22px;
  color: var(--ink);
  background: #fff;
  box-shadow: var(--shadow);
}

.install-dialog-panel h2 {
  max-width: calc(100% - 36px);
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: 0;
}

.install-dialog-panel ol {
  display: grid;
  gap: 12px;
  margin: 20px 0 0;
  padding-left: 24px;
  line-height: 1.45;
}

.dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface);
  font-size: 26px;
  line-height: 1;
}

.feed-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 0 18px;
  border-bottom: 3px solid var(--ink);
}

.feed-header h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 56px);
  line-height: 0.98;
  letter-spacing: 0;
}

.feed-header p {
  max-width: 360px;
  margin: 0;
  color: var(--muted);
  font-weight: 650;
  line-height: 1.35;
}

.lead-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.85fr);
  gap: 22px;
  margin-top: 22px;
}

.story-card {
  position: relative;
  min-width: 0;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.story-card.lead {
  border: 0;
}

.story-link {
  color: inherit;
  text-decoration: none;
}

.story-media {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #ddd;
}

.lead .story-media {
  aspect-ratio: 1.62 / 1;
}

.story-kicker,
.article-kicker {
  margin-top: 12px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.story-title {
  margin: 8px 0 0;
  font-size: 22px;
  line-height: 1.08;
  letter-spacing: 0;
}

.lead .story-title {
  font-size: clamp(30px, 4.5vw, 50px);
}

.story-excerpt {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.story-meta,
.article-meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.story-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  margin-top: 26px;
}

.home-section {
  margin-top: 28px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 10px;
}

.section-heading h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.1;
  letter-spacing: 0;
  text-transform: uppercase;
}

.section-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.compact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.story-card.compact {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.story-card.compact .story-media {
  aspect-ratio: 4 / 3;
}

.story-card.compact .story-kicker {
  margin-top: 9px;
  font-size: 11px;
}

.story-card.compact .story-title {
  font-size: clamp(17px, 2.4vw, 22px);
  line-height: 1.12;
}

.story-card.compact .story-meta {
  font-size: 11px;
}

.story-card.compact .story-actions {
  margin-top: 8px;
}

.story-card.compact .story-save {
  min-width: 36px;
  min-height: 36px;
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.story-card.featured-card {
  border-bottom: 3px solid var(--ink);
  padding-bottom: 22px;
}

.story-card.featured-card .story-title {
  font-size: clamp(30px, 4vw, 46px);
}

.story-card.featured-card .story-media {
  aspect-ratio: 1.62 / 1;
}

.more-panel {
  margin-top: 30px;
  border-top: 3px solid var(--ink);
  padding-top: 14px;
}

.more-panel summary {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: var(--accent);
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}

.more-panel summary::-webkit-details-marker {
  display: none;
}

.more-panel[open] summary {
  background: var(--accent);
  color: #fff;
}

.more-list {
  margin-top: 22px;
}

.story-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.story-save {
  min-width: 42px;
  padding: 0 10px;
  background: #fff;
  color: var(--accent);
}

.story-save.is-saved {
  background: var(--accent);
  color: #fff;
}

.article-view {
  max-width: 760px;
  margin: 0 auto;
}

.back-button {
  margin: 8px 0 24px;
  background: #fff;
  color: var(--accent);
}

.article-view h1 {
  margin: 8px 0 0;
  font-size: clamp(34px, 6vw, 62px);
  line-height: 1;
  letter-spacing: 0;
}

.article-image {
  display: block;
  width: 100%;
  max-height: 560px;
  margin-top: 24px;
  object-fit: cover;
  background: #ddd;
}

.article-body {
  margin-top: 28px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  line-height: 1.65;
}

.article-body p {
  margin: 0 0 1.1em;
}

.article-body > p:first-of-type {
  margin-bottom: 40px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 20px;
  font-weight: 650;
  line-height: 1.5;
}

.article-body iframe,
.article-body script,
.article-body style,
.article-body form {
  display: none;
}

.article-body figure {
  margin: 1.5em 0;
}

.article-body img,
.article-body video {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.article-body video {
  width: 100%;
  max-height: 72vh;
  background: #111;
}

.article-body figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
}

.article-body .ad-content img,
.article-body .ad-content iframe,
.article-body .ad-content ins {
  display: block;
}

.article-gallery {
  margin-top: 26px;
  outline: none;
}

.article-gallery-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.article-gallery-heading h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.1;
  text-transform: uppercase;
}

.article-gallery-counter {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.article-gallery-stage {
  position: relative;
  overflow: hidden;
  background: #111;
}

.article-gallery-stage a {
  display: block;
}

.article-gallery-main {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(72vh, 720px);
  aspect-ratio: 3 / 2;
  object-fit: contain;
}

.gallery-nav {
  position: absolute;
  z-index: 2;
  top: 50%;
  display: grid;
  width: 42px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 0;
  place-items: center;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.68);
  color: #fff;
  font-size: 30px;
  line-height: 1;
}

.gallery-nav:hover {
  background: var(--accent);
}

.gallery-nav-prev {
  left: 0;
}

.gallery-nav-next {
  right: 0;
}

.article-gallery-caption {
  min-height: 20px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.article-gallery-thumbs {
  display: flex;
  gap: 7px;
  margin-top: 12px;
  padding: 2px 0 8px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
}

.gallery-thumb {
  flex: 0 0 72px;
  width: 72px;
  height: 54px;
  padding: 2px;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 4px;
  background: #fff;
  scroll-snap-align: center;
}

.gallery-thumb[aria-current="true"] {
  border-color: var(--accent);
}

.gallery-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.comments-section {
  margin-top: 30px;
  padding-top: 22px;
  border-top: 3px solid var(--ink);
}

.comments-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.comments-header h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

.comments-header a,
.comment-status a {
  color: var(--accent);
  font-weight: 800;
}

.comments-list {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.comment-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.comment-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.comment-meta strong {
  color: var(--ink);
  font-size: 15px;
}

.comment-content {
  margin-top: 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.55;
}

.comment-content p {
  margin: 0 0 0.8em;
}

.comments-state,
.comment-note,
.comment-status {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.comment-form {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.comment-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.comment-form input,
.comment-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  text-transform: none;
}

.comment-form button {
  justify-self: start;
  min-height: 42px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
}

.state {
  display: grid;
  gap: 12px;
  place-items: center;
  min-height: 42vh;
  text-align: center;
  color: var(--muted);
}

.state strong {
  color: var(--ink);
  font-size: 22px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

@media (max-width: 820px) {
  .lead-grid,
  .story-list,
  .featured-grid {
    grid-template-columns: 1fr;
  }

  .feed-header {
    display: block;
  }

  .feed-header p {
    margin-top: 8px;
  }
}

@media (max-width: 520px) {
  .compact-grid {
    gap: 12px;
  }

  .story-card.compact {
    padding: 8px;
  }

  .story-card.compact .story-title {
    font-size: 16px;
  }

  .story-card.compact .story-meta {
    display: none;
  }

  .section-heading {
    display: block;
  }

  .section-heading span {
    display: block;
    margin-top: 4px;
  }

  .share-action {
    flex-direction: column;
    gap: 3px;
    min-height: 52px;
    padding: 4px 2px;
    font-size: 10px;
  }

  .system-notice {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .notice-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .update-notice button {
    width: 100%;
  }
}

@media (min-width: 1180px) {
  .app-shell {
    max-width: 1280px;
    margin: 0 auto;
    box-shadow: var(--shadow);
  }
}
