@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/fraunces-variable.woff2") format("woff2");
}

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/sourceserif-roman.woff2") format("woff2");
}

@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/sourceserif-italic.woff2") format("woff2");
}

:root {
  --sand: #f5eee2;
  --navy: #14213d;
  --eco: #c4552d;
  --fin: #0f6b5c;
  --trv: #1f6fb2;
  --card-radius: 16px;
  --shadow: 0 10px 30px -12px rgba(20, 33, 61, 0.28);
  --font-head: "Fraunces", Georgia, serif;
  --font-body: "Source Serif 4", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--sand);
  color: var(--navy);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

/* ---------- Masthead ---------- */

.masthead {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 20px 16px;
}

.masthead__logo {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.masthead__wordmark {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.6rem;
  letter-spacing: 0.01em;
  color: var(--navy);
}

.masthead__rule {
  margin: 0 20px 18px;
  border-top: 3px double var(--navy);
}

/* ---------- Feed ---------- */

.feed {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px 8px;
}

.section-group {
  margin-top: 36px;
}

.section-group:first-child {
  margin-top: 4px;
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 18px;
}

.section-header__numeral {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 2.6rem;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 2px var(--accent, var(--eco));
  text-stroke: 2px var(--accent, var(--eco));
}

.section-header__name {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.35rem;
  color: var(--navy);
}

.section-header__line {
  flex: 1;
  height: 2px;
  background: var(--accent, var(--eco));
  opacity: 0.55;
  margin-left: 4px;
}

.cards {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* ---------- Card ---------- */

.card {
  background: #fffdf8;
  border-radius: var(--card-radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: none;
  padding: 0;
  text-align: left;
  width: 100%;
  cursor: pointer;
  font: inherit;
  color: inherit;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.card.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.card__media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--accent, var(--eco));
  overflow: hidden;
}

.card--lead .card__media {
  aspect-ratio: 4 / 3;
}

.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.card__media img.is-loaded {
  opacity: 1;
}

.card__media::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 55%;
  background: linear-gradient(to top, rgba(20, 33, 61, 0.55), rgba(20, 33, 61, 0));
  pointer-events: none;
}

.card__body {
  padding: 18px 20px 20px;
}

.card__headline {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.15rem;
  line-height: 1.28;
  margin: 0 0 10px;
}

.card--lead .card__headline {
  font-size: 1.5rem;
}

.card__preview {
  font-family: var(--font-body);
  font-size: 0.98rem;
  line-height: 1.5;
  color: #3a4660;
  margin: 0 0 12px;
}

.card__more {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--accent, var(--eco));
}

/* ---------- Footer ---------- */

.site-footer {
  max-width: 640px;
  margin: 24px auto 0;
  padding: 24px 20px 40px;
  text-align: left;
  border-top: 1px solid rgba(20, 33, 61, 0.15);
}

.site-footer__tagline {
  font-family: var(--font-head);
  font-style: italic;
  font-size: 1.05rem;
  margin: 0 0 6px;
}

.site-footer__email {
  font-size: 0.88rem;
  color: #3a4660;
}

/* ---------- Overlay ---------- */

.overlay {
  position: fixed;
  inset: 0;
  background: var(--sand);
  z-index: 100;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1);
}

.overlay.is-open {
  transform: translateY(0);
}

.overlay-close {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 101;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(20, 33, 61, 0.85);
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(20, 33, 61, 0.3);
}

.overlay-hero {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.overlay-content {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 20px 56px;
}

.overlay-pill {
  display: inline-block;
  margin-top: 18px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #fff;
  background: var(--accent, var(--eco));
}

.overlay-headline {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.8rem;
  line-height: 1.22;
  margin: 14px 0 8px;
}

.overlay-reading-time {
  font-size: 0.85rem;
  color: #5c6680;
  margin-bottom: 18px;
}

.overlay-body p {
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.65;
  margin: 0 0 18px;
}

.overlay-body p:first-of-type::first-letter {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 3.4rem;
  float: left;
  line-height: 0.85;
  padding: 4px 8px 0 0;
  color: var(--accent, var(--eco));
}

body.overlay-locked {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .card {
    transition: opacity 0.3s ease;
    transform: none;
  }

  .overlay {
    transition: none;
  }

  .card__media img {
    transition: none;
  }
}
