/* ── DESIGN TOKENS & TYPOGRAPHY (IDENTICAL TO INDEX.HTML) ── */
:root {
  --gold: #9b6a32;
  --gold-light: #c5975f;
  --gold-dim: #73502b;
  --gold-glow: rgba(155, 106, 50, 0.12);
  
  --bg-dark: #f1ecdf;
  --bg-surface: #e8e0d0;
  --glass-bg: rgba(255, 252, 244, 0.58);
  --glass-border: rgba(31, 29, 25, 0.18);
  --glass-border-hover: rgba(31, 29, 25, 0.55);
  
  --text-main: #1d1b18;
  --text-muted: #625e56;
  --text-dim: #817a6e;
  
  --serif: 'Cormorant Garamond', Georgia, serif;
  --mono: 'DM Mono', monospace;
  --sans: 'Outfit', sans-serif;

  --radius-sm: 2px;
  --radius-md: 3px;
  --radius-pill: 2px;
  --transition: 0.4s cubic-bezier(0.25, 1, 0.5, 1);

  --type-display: clamp(2.75rem, 4.4vw, 4.25rem);
  --type-section: clamp(1.875rem, 2.8vw, 2.5rem);
  --type-subhead: clamp(1.375rem, 1.65vw, 1.625rem);
  --type-body-lg: 1.15rem;
  --type-body: 1rem;
  --type-label: 0.75rem;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; scrollbar-gutter: stable; overflow-y: scroll; }

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--sans);
  font-weight: 300;
  font-size: var(--type-body);
  line-height: 1.68;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background-image:
    linear-gradient(rgba(34, 31, 27, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 31, 27, 0.025) 1px, transparent 1px);
  background-size: 100% 32px, 32px 100%;
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; padding: 0; margin: 0; }

h1, h2, h3, .nav-logo { font-family: var(--serif); text-wrap: balance; }
p, li, .card-desc { text-wrap: pretty; }
.font-serif { font-family: var(--serif); }
.font-mono { font-family: var(--mono); }

/* ── BACKGROUND GRAIN & SCROLL PROGRESS ── */
.bg-grain {
  position: fixed; inset: 0; z-index: 9000; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  opacity: 0.5; mix-blend-mode: multiply;
}

#scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; background: var(--text-main);
  width: 100%; z-index: 10000; transform: scaleX(0); transform-origin: left center; will-change: transform;
}

/* ── NAVIGATION (PIXEL-PERFECT SYNC WITH INDEX.HTML) ── */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000; padding: 0 5vw; height: 82px;
  display: flex; align-items: center; justify-content: space-between; transition: var(--transition);
  border-bottom: 1px solid transparent;
}
nav.scrolled {
  height: 66px; background: rgba(241, 236, 223, 0.94);
  border-bottom: 1px solid var(--glass-border); box-shadow: 0 8px 30px rgba(45, 37, 27, 0.05);
  backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
}
.nav-logo { font-family: var(--serif); font-size: 1.5rem; color: var(--text-main); font-weight: 500; letter-spacing: -0.03em; line-height: 1; }
.nav-links { display: flex; gap: 2.25rem; }
.nav-links a {
  font-family: var(--mono); font-size: 0.875rem !important; letter-spacing: 0.06em !important; text-transform: uppercase;
  color: var(--text-muted); position: relative; padding: 10px; font-weight: 500; transition: color 0.3s; line-height: 1.45;
}
.nav-links a::after {
  content: ''; position: absolute; bottom: 4px; left: 10px; right: 10px; height: 1.5px;
  background: var(--text-main); transform: scaleX(0); transform-origin: right; transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}
.nav-links a:hover, .nav-links a.active { color: var(--text-main); }
.nav-links a:hover::after, .nav-links a.active::after { transform: scaleX(1); transform-origin: left; }

.menu-btn { display: none; flex-direction: column; gap: 6px; cursor: pointer; border: 0; background: transparent; padding: 10px; }
.menu-btn span { width: 28px; height: 2px; background: var(--text-main); transition: 0.3s; }
.mobile-menu {
  position: fixed; inset: 0; background: rgba(241, 236, 223, 0.98); backdrop-filter: blur(20px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2rem;
  z-index: 999; opacity: 0; visibility: hidden; transition: 0.3s ease;
}
.mobile-menu.active { opacity: 1; visibility: visible; }
.mobile-menu a { font-family: var(--serif); font-size: 2.2rem; color: var(--text-main); }

/* ── MAIN CONTAINER ── */
.container { max-width: 1200px; margin: 0 auto; padding: 120px 5vw 80px; min-height: calc(100vh - 90px); }

.page-header { margin: 0 auto 3.5rem auto; padding-bottom: 2.5rem; text-align: center; max-width: 780px; border-bottom: 1px solid var(--glass-border); }
.hero-tag {
  font-family: var(--mono); font-size: var(--type-label); letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--text-main); background: transparent; border-top: 1px solid var(--text-main); border-bottom: 1px solid var(--text-main);
  padding: 0.55rem 0; margin-bottom: 1.5rem; display: inline-block; line-height: 1.45;
}
h1.hero-name { font-family: var(--serif); font-size: var(--type-display); font-weight: 400; line-height: 1.08; letter-spacing: -0.025em; margin-bottom: 1.25rem; }
h1.hero-name em { color: var(--gold-dim); font-style: italic; text-decoration: underline; text-underline-offset: 0.12em; text-decoration-thickness: 1px; }
.hero-subtitle { font-family: var(--sans); color: var(--text-muted); font-size: var(--type-body-lg); line-height: 1.72; margin: 0 auto; max-width: 620px; }

/* ── FILTER BAR ── */
.filter-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; margin-bottom: 3rem; }
.filter-group { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-btn {
  font-family: var(--mono); font-size: var(--type-label); letter-spacing: 0.13em; padding: 8px 18px;
  border: 1px solid var(--text-main); background: transparent; color: var(--text-main); cursor: pointer;
  text-transform: uppercase; border-radius: var(--radius-sm); transition: var(--transition); line-height: 1.45;
}
.filter-btn:hover { border-color: var(--gold-dim); color: var(--gold-dim); }
.filter-btn.active { background: var(--text-main); color: #f7f1e5; border-color: var(--text-main); font-weight: 500; }
.filter-count { font-family: var(--mono); font-size: var(--type-label); color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.13em; line-height: 1.45; }

/* ── CARDS GRID ── */
.topics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(350px, 100%), 1fr)); gap: 2.5rem; min-height: 550px; align-content: start; }
.topic-card {
  background: rgba(255, 252, 244, 0.42); border: 1px solid rgba(29, 27, 24, 0.35); border-radius: var(--radius-md);
  display: flex; flex-direction: column; cursor: pointer; transition: transform 0.4s var(--transition), border-color 0.3s, box-shadow 0.3s;
  overflow: hidden; text-decoration: none; position: relative;
}
.topic-card.hidden { display: none; }
@media (hover: hover) and (pointer: fine) {
  .topic-card:hover { transform: translateY(-8px); border-color: var(--text-main); box-shadow: 9px 9px 0 rgba(29, 27, 24, 0.1); }
  .topic-card:hover .card-img { filter: grayscale(0%); transform: scale(1.03); }
}
.card-img-wrap { height: 210px; overflow: hidden; position: relative; border-bottom: 1px solid rgba(29, 27, 24, 0.2); background: #ded7c8; }
.card-img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(100%); transition: filter 0.4s ease, transform 0.6s var(--transition); }
.card-tag, .card-number { z-index: 1; }
.card-tag { position: absolute; top: 12px; left: 12px; background: var(--text-main); color: #f7f1e5; font-family: var(--mono); font-size: 0.65rem; letter-spacing: 0.13em; padding: 4px 8px; text-transform: uppercase; }
.card-number { position: absolute; top: 12px; right: 12px; background: rgba(255, 252, 244, 0.9); color: var(--text-main); border: 1px solid var(--glass-border); font-family: var(--mono); font-size: 0.7rem; font-weight: 500; padding: 3px 8px; }
.card-body { padding: 2rem; display: flex; flex-direction: column; flex-grow: 1; }
.card-date { font-family: var(--mono); font-size: var(--type-label); letter-spacing: 0.13em; color: var(--gold-dim); margin-bottom: 0.75rem; line-height: 1.45; }
.card-title { font-family: var(--serif); font-size: var(--type-subhead); line-height: 1.15; letter-spacing: -0.018em; margin-bottom: 0.75rem; color: var(--text-main); font-weight: 400; }
.card-desc { font-family: var(--sans); font-size: var(--type-body); color: var(--text-muted); line-height: 1.68; font-weight: 300; margin-bottom: 1.5rem; flex-grow: 1; }
.card-footer { border-top: 1px solid var(--glass-border); padding-top: 1rem; display: flex; justify-content: space-between; font-family: var(--mono); font-size: var(--type-label); letter-spacing: 0.13em; color: var(--text-dim); text-transform: uppercase; line-height: 1.45; }

/* ── FOOTER (MATCHED TO INDEX.HTML) ── */
footer { 
  background: var(--text-main) !important; border-top: 0 !important; color: #eee6d7;
  padding: 2rem 5vw; display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between;
}
footer .footer-title { font-family: var(--serif); font-size: 1.35rem; line-height: 1.2; }
footer .text-gold { color: #d0aa7d; }
footer .footer-meta { font-family: var(--mono); font-size: 0.75rem; line-height: 1.4; letter-spacing: 0.1em; }
footer .text-dim { color: #aaa296; }

/* ============================================================
   OPTIMAL MOBILE SPACE MANAGEMENT (< 768px)
   ============================================================ */
@media (max-width: 900px) {
  .nav-links { display: none; }
  .menu-btn { display: flex; }
}

@media (max-width: 768px) {
  .page-header { margin-bottom: 2.5rem; }
  .filter-bar { justify-content: center; }
}

@media (max-width: 600px) {
  :root { 
    --type-display: clamp(2.25rem, 9vw, 2.875rem); 
    --type-subhead: 1.375rem; 
    --type-body-lg: 1rem; 
    --type-label: 0.75rem; 
  }
  h1.hero-name { line-height: 0.96; letter-spacing: -0.035em; }
  .nav-logo { font-size: 1.35rem; }
  .mobile-menu a { font-size: 2rem; }
  .footer-title, .footer-meta { width: 100%; }
  .footer-meta { margin-top: 0.6rem; }
}
