/* Elephant in the Room — NYT Editorial Style */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;0,900;1,400&family=Lora:ital,wght@0,400;0,500;0,600;1,400&family=DM+Sans:wght@400;500;600&display=swap');

/* --- Variables --- */

:root {
  --bg: #FAF9F6;
  --text: #1a1a1a;
  --text-secondary: #6b6860;
  --accent: #B8342A;
  --border: #d8d4cb;
  --border-light: #ece9e1;
  --serif-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --serif-body: 'Lora', Georgia, serif;
  --sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --content-width: 680px;
  --wide-width: 1080px;
}

/* --- Reset --- */

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--serif-body);
  color: var(--text);
  background: var(--bg);
  font-size: 19px;
  line-height: 1.78;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

::selection {
  background: rgba(184, 52, 42, 0.15);
  color: var(--text);
}

/* --- Navigation --- */

nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 18px 32px;
  display: flex;
  align-items: center;
  gap: 28px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: background 0.4s ease, box-shadow 0.4s ease;
}

nav.scrolled {
  background: rgba(250, 249, 246, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 var(--border-light);
}

nav a {
  color: #fff;
  text-decoration: none;
  transition: opacity 0.3s ease;
}

nav a:hover {
  opacity: 0.7;
  text-decoration: none;
}

nav.scrolled a {
  color: var(--text);
}

nav .site-title {
  font-weight: 600;
  letter-spacing: 0.06em;
}

/* --- Hero (Post Pages) --- */

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding: 0 24px 14vh;
  overflow: hidden;
  background:
    linear-gradient(
      165deg,
      hsl(var(--hero-hue, 220), 22%, 7%) 0%,
      hsl(calc(var(--hero-hue, 220) + 20), 18%, 12%) 40%,
      hsl(calc(var(--hero-hue, 220) + 40), 12%, 18%) 100%
    );
}

/* Grain texture overlay */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 256px 256px;
}

/* Subtle vignette */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.35) 100%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 820px;
  animation: heroFadeIn 1.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

@keyframes heroFadeIn {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero h1 {
  font-family: var(--serif-display);
  font-weight: 900;
  font-size: clamp(2.4rem, 6vw, 4.8rem);
  color: #fff;
  line-height: 1.08;
  letter-spacing: -0.025em;
  margin-bottom: 28px;
  text-wrap: balance;
}

.hero time {
  display: block;
  color: rgba(255, 255, 255, 0.45);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.hero .draft-badge {
  display: inline-block;
  padding: 4px 14px;
  margin-bottom: 16px;
  background: rgba(184, 52, 42, 0.8);
  color: #fff;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border-radius: 3px;
}

/* Scroll indicator */
.scroll-indicator {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: 0;
  animation: scrollIndicatorIn 1s 1.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes scrollIndicatorIn {
  to { opacity: 0.4; }
}

.scroll-indicator span {
  font-family: var(--sans);
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

.scroll-indicator svg {
  width: 20px;
  height: 20px;
  stroke: rgba(255,255,255,0.4);
  animation: scrollBounce 2.5s ease-in-out infinite;
}

@keyframes scrollBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* --- Article --- */

article {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 80px 24px 120px;
}

/* First paragraph — drop cap or larger */
article > p:first-of-type {
  font-size: 1.15em;
  line-height: 1.7;
  color: #111;
}

article > p:first-of-type::first-letter {
  font-family: var(--serif-display);
  font-weight: 900;
  font-size: 3.6em;
  float: left;
  line-height: 0.8;
  margin: 6px 12px 0 -4px;
  color: var(--accent);
}

/* Headings */

article h1 {
  font-family: var(--serif-display);
  font-size: 1.8em;
  font-weight: 700;
  line-height: 1.2;
  margin-top: 2.4em;
  margin-bottom: 0.6em;
  color: #111;
  letter-spacing: -0.01em;
}

article h2 {
  font-family: var(--serif-display);
  font-size: 1.5em;
  font-weight: 700;
  line-height: 1.25;
  margin-top: 2.4em;
  margin-bottom: 0.6em;
  color: #111;
  letter-spacing: -0.01em;
}

article h3 {
  font-family: var(--serif-display);
  font-size: 1.15em;
  font-weight: 700;
  line-height: 1.35;
  margin-top: 2em;
  margin-bottom: 0.5em;
  color: #222;
}

/* Paragraphs */

article p {
  margin-bottom: 1.3em;
  color: var(--text);
}

/* Links */

a {
  color: inherit;
  text-decoration: none;
}

article a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: text-decoration-color 0.3s ease;
}

article a:hover {
  text-decoration-color: var(--accent);
}

/* Lists */

article ul, article ol {
  margin-bottom: 1.3em;
  padding-left: 1.4em;
}

article li {
  margin-bottom: 0.5em;
}

article li strong {
  color: #111;
}

/* Blockquotes */

blockquote {
  position: relative;
  margin: 2.4em 0;
  padding: 0 0 0 28px;
  border-left: 3px solid var(--accent);
  font-style: italic;
  color: var(--text-secondary);
}

blockquote p {
  margin-bottom: 0.6em;
}

/* Code */

code {
  font-family: 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
  font-size: 0.85em;
  background: rgba(0, 0, 0, 0.04);
  padding: 2px 7px;
  border-radius: 3px;
  color: #444;
}

pre {
  background: #1a1a1a;
  color: #e0e0e0;
  padding: 24px 28px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 2em 0;
  line-height: 1.55;
}

pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: 0.82em;
}

/* Images — full-bleed */

article figure,
article .wp-block-embed {
  max-width: 100vw;
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  margin-top: 2.4em;
  margin-bottom: 2.4em;
}

article figure img,
article img {
  width: 100%;
  max-width: var(--wide-width);
  margin: 2em auto;
  display: block;
  height: auto;
  border-radius: 2px;
}

article figcaption {
  text-align: center;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 12px;
  padding: 0 24px;
}

/* Horizontal rule */

hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 3em auto;
  max-width: 120px;
}

/* Sup / footnotes */

sup {
  font-size: 0.7em;
  color: var(--accent);
  font-weight: 600;
}

/* --- Scroll Reveal --- */

.reveal {
  opacity: 0;
  transform: translateY(36px);
  transition:
    opacity 0.85s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    transform 0.85s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger the first few reveals */
.reveal.visible:nth-child(2) { transition-delay: 0.08s; }
.reveal.visible:nth-child(3) { transition-delay: 0.14s; }
.reveal.visible:nth-child(4) { transition-delay: 0.18s; }

/* --- Index Page — Magazine Layout --- */

.index-hero {
  position: relative;
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 32px 64px;
  margin-bottom: 0;
  overflow: hidden;
  background:
    linear-gradient(
      165deg,
      hsl(var(--hero-hue, 200), 22%, 7%) 0%,
      hsl(calc(var(--hero-hue, 200) + 25), 15%, 13%) 50%,
      hsl(calc(var(--hero-hue, 200) + 45), 10%, 19%) 100%
    );
}

.index-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 256px 256px;
}

.index-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: radial-gradient(ellipse at center, transparent 30%, rgba(0,0,0,0.4) 100%);
  pointer-events: none;
}

.index-hero-content {
  position: relative;
  z-index: 2;
  max-width: var(--wide-width);
  margin: 0 auto;
  width: 100%;
}

.index-hero .blog-title {
  font-family: var(--serif-display);
  font-weight: 900;
  font-size: clamp(2.8rem, 7vw, 5.5rem);
  color: #fff;
  line-height: 1.02;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}

.index-hero .subtitle {
  font-family: var(--serif-body);
  font-style: italic;
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: rgba(255, 255, 255, 0.5);
  font-weight: 400;
  max-width: 480px;
}

/* Featured post card */
.featured-post {
  display: block;
  position: relative;
  max-width: var(--wide-width);
  margin: -48px auto 0;
  padding: 48px 48px 44px;
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 4px 40px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0,0,0,0.04);
  z-index: 10;
  text-decoration: none;
  transition: box-shadow 0.4s ease, transform 0.25s ease;
}

.featured-post:hover {
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(0,0,0,0.05);
  transform: translateY(-2px);
  text-decoration: none;
}

.featured-label {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin-bottom: 16px;
  display: block;
}

.featured-post h2 {
  font-family: var(--serif-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1.15;
  color: #111;
  letter-spacing: -0.015em;
  margin-bottom: 12px;
}

.featured-post time {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

/* Section divider */
.section-divider {
  max-width: var(--wide-width);
  margin: 56px auto 0;
  padding: 0 32px;
  border-top: 1px solid var(--border);
}

.section-label {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-secondary);
  margin: 40px 0 32px;
  max-width: var(--wide-width);
  padding: 0 32px;
  display: block;
}

/* Post grid — staggered layout for clear chronological reading */
.post-grid {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 0 32px 80px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.post-grid .post-entry {
  padding: 24px 28px 24px 0;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.3s ease;
}

.post-grid .post-entry:nth-child(even) {
  padding-left: 28px;
  padding-right: 0;
  border-left: 1px solid var(--border-light);
  transform: translateY(50%);
}

.post-grid .post-entry:hover {
  background: rgba(0, 0, 0, 0.015);
}

.post-grid .post-entry a {
  display: block;
  font-family: var(--serif-display);
  font-weight: 600;
  font-size: 1.1em;
  line-height: 1.3;
  color: #111;
  text-decoration: none;
  margin-bottom: 6px;
  transition: color 0.3s ease;
}

.post-grid .post-entry a:hover {
  color: var(--accent);
  text-decoration: none;
}

.post-grid .post-entry time {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

/* --- Footer --- */

footer {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 40px 32px;
  border-top: 1px solid var(--border);
  font-family: var(--sans);
  font-size: 14px;
  color: var(--text-secondary);
}

footer a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.3s ease;
}

footer a:hover {
  color: var(--text);
}

/* --- WordPress Overrides --- */

.wp-block-heading {
  /* Reset WordPress heading classes */
}

.has-small-font-size {
  font-size: 1em !important;
}

.has-medium-font-size {
  font-size: inherit !important;
}

.wp-block-embed {
  margin: 2em 0;
}

.wp-block-embed__wrapper {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 4px;
  max-width: var(--wide-width);
  margin: 0 auto;
}

.wp-block-embed__wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* --- Responsive --- */

@media (max-width: 768px) {
  body {
    font-size: 17px;
  }

  nav {
    padding: 16px 20px;
    gap: 20px;
  }

  .hero {
    padding-bottom: 18vh;
  }

  .hero h1 {
    font-size: clamp(2rem, 8vw, 3rem);
    margin-bottom: 20px;
  }

  article {
    padding: 56px 20px 80px;
  }

  article > p:first-of-type::first-letter {
    font-size: 3em;
    margin: 4px 8px 0 -2px;
  }

  .index-hero {
    min-height: 55vh;
    padding: 0 20px 48px;
  }

  .featured-post {
    margin: -32px 16px 0;
    padding: 32px 28px 28px;
  }

  .section-label {
    padding: 0 20px;
  }

  .post-grid {
    grid-template-columns: 1fr;
    padding: 0 20px 60px;
  }

  .post-grid .post-entry {
    padding: 20px 0;
  }

  .post-grid .post-entry:nth-child(even) {
    padding-left: 0;
    border-left: none;
    transform: none;
  }

  .scroll-indicator {
    bottom: 20px;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.9rem;
  }

  .index-hero .blog-title {
    font-size: 2.4rem;
  }

  .featured-post h2 {
    font-size: 1.3rem;
  }

  article h2 {
    font-size: 1.3em;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .hero-content {
    animation: none;
  }

  .scroll-indicator {
    animation: none;
    opacity: 0.4;
  }

  .scroll-indicator svg {
    animation: none;
  }
}
