:root {
  --ink: #121212;
  --muted: #666;
  --hairline: #d7d7d7;
  --page: #fff;
  --header-h: 74px;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--page);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background: var(--page);
  font-family: Arial, Helvetica, sans-serif;
}

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }

.site-header {
  position: relative;
  z-index: 10;
  background: rgba(255, 255, 255, 0.98);
}

.masthead {
  min-height: var(--header-h);
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 8px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 22px;
  border-bottom: 1px solid var(--ink);
}

.wordmark {
  min-width: 0;
  text-align: center;
  font-family: "Old English Text MT", "Times New Roman", Times, serif;
  font-size: clamp(30px, 4vw, 48px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.045em;
  white-space: nowrap;
}

.icon-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 22px;
  cursor: pointer;
}

.section-strip {
  display: flex;
  align-items: center;
  gap: 23px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
  padding: 11px max(22px, calc((100vw - 1280px) / 2 + 22px));
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}

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

.section-strip a {
  flex: 0 0 auto;
  color: var(--ink);
  text-decoration: none;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  font-weight: 700;
}

.page-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 22px 56px;
}

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

.story-card {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.story-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #eee;
}

.story-card h2 {
  margin: 11px 0 0;
  max-width: 26ch;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(22px, 2.3vw, 32px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.article-viewer {
  position: relative;
  z-index: 1000;
  width: 100%;
  min-height: 100vh;
  min-height: 100lvh;
  background: #000;
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

.article-viewer:not(.is-mounted) {
  display: none;
}

.article-viewer.is-mounted {
  display: block;
  visibility: visible;
  pointer-events: auto;
  opacity: 1;
}

.article-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  user-select: none;
  -webkit-user-drag: none;
}

.article-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(0,0,0,.55) 0%, rgba(0,0,0,.22) 22%, rgba(0,0,0,0) 48%),
    linear-gradient(to top, rgba(0,0,0,.20) 0%, rgba(0,0,0,0) 26%);
  opacity: 0;
  transition: opacity 300ms ease 170ms;
  pointer-events: none;
}

.article-chrome {
  position: absolute;
  inset: 0;
  z-index: 2;
  color: #fff;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 320ms ease 190ms, transform 430ms cubic-bezier(.22,1,.36,1) 190ms;
}

.article-viewer.is-open .article-shade,
.article-viewer.is-open .article-chrome { opacity: 1; }

.article-viewer.is-open .article-chrome { transform: translateY(0); }

.article-title {
  position: absolute;
  top: 0;
  left: 0;
  max-width: min(900px, 88vw);
  margin: 0;
  padding-top: max(34px, calc(env(safe-area-inset-top) + 22px));
  padding-left: max(22px, calc(env(safe-area-inset-left) + 22px));
  padding-right: 96px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(36px, 6vw, 72px);
  font-weight: 700;
  line-height: .98;
  letter-spacing: -0.035em;
  text-wrap: balance;
  text-shadow: 0 2px 22px rgba(0,0,0,.42);
}

.article-close {
  position: absolute;
  top: max(17px, calc(env(safe-area-inset-top) + 10px));
  right: max(16px, calc(env(safe-area-inset-right) + 14px));
  z-index: 3;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 999px;
  background: rgba(0,0,0,.22);
  color: #fff;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
}

body.article-open {
  min-height: calc(100lvh + 2px);
  overflow-x: hidden;
  overflow-y: auto;
  background: #000;
}

body.article-open .site-header,
body.article-open .page-shell {
  display: none;
}

body.article-open .article-viewer {
  display: block;
  min-height: calc(100lvh + 2px);
}

/*
  Keep the hero in the root scroll flow rather than a fixed overlay.
  Mobile Safari can composite scrolling page content behind its translucent
  browser chrome, while viewport-constrained fixed layers are clipped above it.
*/
body.article-open .article-image {
  height: 100lvh;
  min-height: 100%;
}

.zoom-ghost {
  position: fixed;
  z-index: 1100;
  display: block;
  margin: 0;
  max-width: none;
  object-fit: cover;
  pointer-events: none;
  will-change: top, left, width, height, border-radius;
}

@media (max-width: 720px) {
  :root { --header-h: 59px; }

  .masthead {
    grid-template-columns: 36px 1fr 36px;
    padding: 0 12px;
  }

  .wordmark { font-size: clamp(27px, 8vw, 38px); }

  .icon-button {
    width: 36px;
    height: 36px;
    font-size: 19px;
  }

  .section-strip {
    gap: 20px;
    padding: 10px 14px;
  }

  .page-shell { padding: 16px 14px 40px; }

  .story-grid {
    grid-template-columns: 1fr;
    gap: 29px;
  }

  .story-card h2 {
    margin-top: 9px;
    font-size: 27px;
  }

  .article-title {
    max-width: 94vw;
    padding-top: max(27px, calc(env(safe-area-inset-top) + 17px));
    padding-left: max(18px, calc(env(safe-area-inset-left) + 16px));
    padding-right: 74px;
    font-size: clamp(36px, 10.5vw, 56px);
  }

  .article-close {
    width: 43px;
    height: 43px;
    font-size: 30px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}