@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500;600;700&family=Space+Grotesk:wght@400;500;600&display=swap');

:root {
  --bg: #f7f2e9;
  --bg-2: #efe6d9;
  --ink: #1b1a17;
  --muted: #6a625a;
  --accent: #d1583c;
  --accent-2: #1c6b6a;
  --card: #ffffff;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.08);
  --radius: 18px;
}

[data-theme='dark'] {
  --bg: #12100d;
  --bg-2: #1b1712;
  --ink: #f5eee5;
  --muted: #b6a99a;
  --accent: #e0895f;
  --accent-2: #7fc2b6;
  --card: #1c1813;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 20% 20%, rgba(209, 88, 60, 0.08), transparent 40%),
              radial-gradient(circle at 80% 30%, rgba(28, 107, 106, 0.08), transparent 45%),
              linear-gradient(140deg, var(--bg), var(--bg-2));
  min-height: 100vh;
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="160" height="160" viewBox="0 0 160 160"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="2" stitchTiles="stitch"/></filter><rect width="160" height="160" filter="url(%23n)" opacity="0.06"/></svg>');
  mix-blend-mode: multiply;
  z-index: 1;
}

main, header, footer {
  position: relative;
  z-index: 2;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 8vw;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  gap: 16px;
  flex-wrap: wrap;
}

.logo {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  letter-spacing: 1px;
}

.nav a {
  margin: 0 12px;
  text-decoration: none;
  color: var(--muted);
  font-size: 15px;
}

.nav a.active,
.nav a:hover {
  color: var(--ink);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.search-box {
  position: relative;
}

.search-input {
  border: 1px solid rgba(0,0,0,0.15);
  background: var(--card);
  padding: 8px 14px;
  border-radius: 999px;
  min-width: 220px;
  color: var(--ink);
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: min(420px, 90vw);
  min-width: 100%;
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,0.08);
  padding: 6px;
  display: none;
  z-index: 5;
  max-height: 320px;
  overflow: auto;
}

.search-results.active {
  display: block;
}

.search-item {
  display: block;
  padding: 10px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--ink);
}

.search-item:hover {
  background: rgba(0,0,0,0.06);
}

.search-item small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

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

.theme-toggle {
  border: 1px solid rgba(0,0,0,0.15);
  background: transparent;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--ink);
}

.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  padding: 70px 8vw 40px;
  align-items: center;
}

.kicker {
  text-transform: uppercase;
  letter-spacing: 3px;
  font-size: 12px;
  color: var(--accent-2);
}

.hero h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(36px, 4vw, 64px);
  margin: 12px 0;
}

.subtitle {
  font-size: 18px;
  color: var(--muted);
  line-height: 1.6;
}

.hero-cta {
  margin-top: 26px;
  display: flex;
  gap: 14px;
}

.btn {
  background: var(--accent);
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 14px;
}

.btn.ghost {
  background: transparent;
  border: 1px solid rgba(0,0,0,0.15);
  color: var(--ink);
}

.hero-cover {
  display: flex;
  justify-content: center;
}

.cover-frame {
  background: var(--card);
  padding: 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.cover-image {
  width: min(320px, 70vw);
  height: 420px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(209,88,60,0.8), rgba(28,107,106,0.8));
  position: relative;
  overflow: hidden;
}

.cover-image::after {
  content: '';
  position: absolute;
  inset: 16px;
  border: 1px solid rgba(255,255,255,0.5);
}

.cover-caption {
  margin-top: 12px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.label {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--accent-2);
}

.latest {
  padding: 40px 8vw 80px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.section-title h2,
.section-title h1 {
  font-family: 'Playfair Display', serif;
}

.filters {
  display: flex;
  gap: 12px;
}

select {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.12);
  background: var(--card);
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.post-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 280px;
}

.post-card .image {
  height: 160px;
  background-size: cover;
  background-position: center;
}

.post-card .content {
  padding: 16px;
}

.post-card h3 {
  margin: 8px 0 6px;
  font-family: 'Playfair Display', serif;
}

.post-card p {
  color: var(--muted);
  font-size: 14px;
}

.post-grid.list-mode {
  grid-template-columns: 1fr;
}

@media (min-width: 960px) {
  .post-card {
    flex-direction: row;
    min-height: 0;
  }

  .post-card .image {
    width: 280px;
    height: auto;
    min-height: 200px;
  }

  .post-card .content {
    padding: 22px 24px;
  }
}

.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(209,88,60,0.12);
  color: var(--accent);
  font-size: 12px;
}

.issue-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(28,107,106,0.12);
  color: var(--accent-2);
  font-size: 12px;
  margin-left: 6px;
}

.tag-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tag {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(28,107,106,0.12);
  color: var(--accent-2);
}

.post-page {
  padding: 40px 8vw 80px;
}

.progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  z-index: 6;
}

.post-article {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
  max-width: 980px;
  margin: 0 auto;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.post-hero {
  display: grid;
  grid-template-columns: 1fr 0.8fr;
  gap: 24px;
  align-items: start;
}

.post-hero #postCover {
  grid-column: 2;
  grid-row: 1 / span 3;
}

.post-hero h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(30px, 4vw, 52px);
}

.post-excerpt {
  font-size: 18px;
  color: var(--muted);
}

.post-cover {
  margin-top: 20px;
  height: 320px;
  border-radius: 16px;
  background-size: cover;
  background-position: center;
}

.post-body {
  margin-top: 28px;
  line-height: 1.8;
  font-size: 17px;
}

.post-body h2 {
  font-family: 'Playfair Display', serif;
}

.more {
  margin-top: 40px;
}

.list-page {
  padding: 40px 8vw 80px;
}

.issues-page {
  padding: 40px 8vw 80px;
}

.issues-grid {
  display: grid;
  gap: 24px;
}

.issue-card {
  display: grid;
  grid-template-columns: 0.7fr 1.3fr;
  gap: 20px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.issue-cover {
  min-height: 240px;
  background-size: cover;
  background-position: center;
}

.issue-body {
  padding: 24px;
}

.issue-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}

.issue-body h2 {
  margin: 6px 0 8px;
  font-family: 'Playfair Display', serif;
}

.issue-note {
  background: rgba(0,0,0,0.04);
  padding: 12px;
  border-radius: 12px;
  margin: 12px 0;
  color: var(--muted);
}

.issue-posts {
  display: grid;
  gap: 8px;
}

.issue-post {
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-decoration: none;
  color: var(--ink);
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(0,0,0,0.03);
}

.issue-post small {
  color: var(--muted);
}

.chip-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.chip {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--shadow);
  cursor: pointer;
  font-size: 13px;
}

.chip.active {
  background: var(--accent);
  color: #fff;
}

.about {
  padding: 60px 8vw 100px;
  display: flex;
  justify-content: center;
}

.about-card {
  background: var(--card);
  padding: 40px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 760px;
}

.about-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 16px;
  margin-top: 24px;
}

.meta-label {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
}

.site-footer {
  padding: 30px 8vw 40px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  border-top: 1px solid rgba(0,0,0,0.08);
  color: var(--muted);
}

.footer-links a {
  margin-left: 12px;
  color: var(--muted);
  text-decoration: none;
}

@media (max-width: 960px) {
  .hero {
    grid-template-columns: 1fr;
  }
  .highlights {
    grid-template-columns: 1fr;
  }
  .section-title {
    flex-direction: column;
    align-items: flex-start;
  }
  .about-meta {
    grid-template-columns: 1fr;
  }
  .post-article {
    padding: 24px;
  }

  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
    gap: 10px;
  }

  .search-input {
    flex: 1;
    min-width: 0;
  }

  .issue-card {
    grid-template-columns: 1fr;
  }

  .post-hero {
    grid-template-columns: 1fr;
  }

  .post-hero #postCover {
    grid-column: 1;
    grid-row: auto;
  }
}

@media (max-width: 600px) {
  .hero {
    padding: 50px 6vw 30px;
  }

  .site-header {
    padding: 18px 6vw;
  }

  .latest,
  .post-page,
  .list-page,
  .about {
    padding-left: 6vw;
    padding-right: 6vw;
  }
}
