:root {
  color-scheme: light;
  --bg: #f8faf9;
  --surface: #ffffff;
  --surface-soft: #eef5f1;
  --ink: #17211f;
  --muted: #66736f;
  --line: #d9e2de;
  --accent: #2f7d69;
  --accent-dark: #173b35;
  --warm: #d98f45;
  --rose: #bd5267;
  --shadow: 0 18px 50px rgba(24, 34, 31, 0.16);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
}

body {
  min-height: 100%;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(47, 125, 105, 0.08), rgba(248, 250, 249, 0) 19rem),
    var(--bg);
}

body.story-open {
  overflow: hidden;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

img {
  display: block;
  max-width: 100%;
}

.site-shell {
  width: 100%;
  max-width: 1560px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px clamp(14px, 3vw, 34px) 28px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  padding: 2px 0 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
}

.brand:focus-visible,
.story-tile:focus-visible,
.story-close:focus-visible {
  outline: 3px solid rgba(47, 125, 105, 0.38);
  outline-offset: 4px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--accent-dark);
  color: #f7f8f3;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
  line-height: 1;
}

.brand-name {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.65rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: 0;
}

.brand-line {
  max-width: 18rem;
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.88rem, 2vw, 1rem);
  line-height: 1.35;
  text-align: right;
}

.home-shell {
  min-height: 60vh;
}

.story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(10.5rem, 24vw, 19rem), 1fr));
  grid-auto-rows: clamp(11rem, 25vw, 17.5rem);
  grid-auto-flow: dense;
  gap: clamp(10px, 1.8vw, 20px);
  align-items: stretch;
}

.story-tile {
  position: relative;
  isolation: isolate;
  display: flex;
  min-width: 0;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: #fff;
  box-shadow: 0 1px 0 rgba(24, 34, 31, 0.06);
  text-decoration: none;
  transform: translateZ(0);
}

.story-tile:nth-child(10n + 3),
.story-tile:nth-child(10n + 8) {
  grid-row: span 2;
}

.story-tile:nth-child(12n + 6) {
  grid-column: span 2;
}

.story-tile-image,
.story-tile-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.story-tile-image {
  z-index: -2;
  object-fit: cover;
  transition: transform 420ms ease;
}

.story-tile-shade {
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(10, 16, 15, 0.04), rgba(10, 16, 15, 0.34) 42%, rgba(10, 16, 15, 0.82)),
    linear-gradient(120deg, rgba(47, 125, 105, 0.34), rgba(189, 82, 103, 0.16));
}

.story-tile:hover .story-tile-image {
  transform: scale(1.035);
}

.story-tile-content {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: 100%;
  min-width: 0;
  gap: 8px;
  padding: clamp(14px, 2.5vw, 22px);
}

.story-tile-date {
  width: fit-content;
  max-width: 100%;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
}

.story-tile-title {
  display: -webkit-box;
  overflow: hidden;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.15rem, 2.8vw, 2rem);
  font-weight: 700;
  line-height: 1.05;
  overflow-wrap: anywhere;
  text-shadow: 0 1px 18px rgba(0, 0, 0, 0.38);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
}

.feed-status {
  min-height: 44px;
  padding: 24px 0 6px;
  color: var(--muted);
  font-size: 0.96rem;
  text-align: center;
}

.feed-sentinel {
  width: 100%;
  height: 1px;
}

.site-footer {
  padding: 28px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}

.story-overlay {
  position: fixed;
  z-index: 20;
  inset: 0;
  overflow: auto;
  background: #fffdfb;
  color: var(--ink);
}

.story-overlay[hidden] {
  display: none;
}

.story-close {
  position: fixed;
  z-index: 24;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(23, 33, 31, 0.1);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 30px rgba(24, 34, 31, 0.14);
  color: var(--ink);
  cursor: pointer;
  font-size: 2rem;
  line-height: 1;
  backdrop-filter: blur(14px);
}

.story-article {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: clamp(56px, 10vw, 90px) clamp(18px, 5vw, 52px) 64px;
}

.story-reader-header {
  max-width: 780px;
  margin: 0 auto;
}

.story-date {
  display: inline-flex;
  margin-bottom: 16px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.story-reader-header h1,
.story-loading-title {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.3rem, 7vw, 4.7rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.story-cover {
  width: 100%;
  max-width: 920px;
  margin: clamp(28px, 6vw, 48px) auto clamp(28px, 5vw, 44px);
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface-soft);
  box-shadow: var(--shadow);
}

.story-cover img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.story-body,
.story-sources,
.story-error {
  max-width: 720px;
  margin: 0 auto;
}

.story-body {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.14rem, 2.2vw, 1.34rem);
  line-height: 1.74;
}

.story-body p {
  margin: 0 0 1.25em;
}

.story-body h2,
.story-body h3 {
  margin: 1.7em 0 0.7em;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  line-height: 1.12;
}

.story-body h2 {
  font-size: 1.45rem;
}

.story-body h3 {
  font-size: 1.18rem;
}

.story-body blockquote {
  margin: 1.4em 0;
  padding: 0.1em 0 0.1em 1em;
  border-left: 4px solid var(--warm);
  color: #34433f;
}

.story-body a,
.story-sources a,
.story-error a {
  color: var(--accent-dark);
  text-decoration-color: rgba(47, 125, 105, 0.38);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.18em;
}

.story-sources {
  margin-top: 44px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.93rem;
}

.story-sources h2 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 0.82rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

.story-sources ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 1.1rem;
}

.story-error {
  padding-top: 18px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.55;
}

.story-loading {
  max-width: 760px;
  margin: 0 auto;
}

.story-loading-line {
  display: block;
  height: 14px;
  margin-top: 22px;
  border-radius: 999px;
  background: linear-gradient(90deg, #e3ece8, #f6faf8, #e3ece8);
  background-size: 200% 100%;
  animation: story-pulse 1.2s linear infinite;
}

.story-loading-line:nth-child(3) {
  width: 78%;
}

.story-loading-line:nth-child(4) {
  width: 58%;
}

@keyframes story-pulse {
  from {
    background-position: 200% 0;
  }

  to {
    background-position: -200% 0;
  }
}

@media (max-width: 760px) {
  .site-shell {
    padding-top: 12px;
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 16px;
  }

  .brand-line {
    max-width: none;
    padding-left: 48px;
    text-align: left;
  }

  .story-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: clamp(10rem, 48vw, 15rem);
  }

  .story-tile:nth-child(n) {
    grid-column: span 1;
    grid-row: span 1;
  }

  .story-tile:nth-child(7n + 3) {
    grid-column: span 2;
  }

  .story-tile-title {
    font-size: clamp(1.04rem, 5vw, 1.7rem);
    -webkit-line-clamp: 4;
  }

  .story-close {
    width: 42px;
    height: 42px;
  }
}

@media (max-width: 420px) {
  .story-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: clamp(12rem, 70vw, 17rem);
  }

  .story-tile:nth-child(n) {
    grid-column: span 1;
  }

  .story-article {
    padding-right: 16px;
    padding-left: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}
