/* ============================================================
   Collected Treasures of Dudjom Lingpa
   Translation Project Site — Stylesheet
   ============================================================ */

:root {
  --parchment: #f4ecd8;
  --parchment-deep: #ebe0c4;
  --cream: #faf4e3;
  --ink: #1f1a14;
  --ink-soft: #3d342a;
  --ink-faint: #7a6a55;
  --maroon: #6b2117;
  --maroon-deep: #4a1610;
  --gold: #b08738;
  --gold-soft: #d4b572;
  --rule: #c6b48a;
  --shadow: 0 1px 0 rgba(31, 26, 20, 0.06), 0 30px 60px -30px rgba(31, 26, 20, 0.25);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--parchment);
  color: var(--ink);
  font-family: 'EB Garamond', Garamond, 'Adobe Caslon Pro', Cambria, serif;
  font-size: 19px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle parchment grain — using background-image on body itself so old renderers don't get a black overlay */
body {
  background-image:
    radial-gradient(ellipse at top, rgba(255,255,255,0.35) 0%, rgba(244,236,216,0) 55%),
    radial-gradient(ellipse at bottom, rgba(176,135,56,0.06) 0%, rgba(244,236,216,0) 55%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.42 0 0 0 0 0.32 0 0 0 0 0.16 0 0 0 0.045 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

main { position: relative; }

/* ----- Language toggle ----- */
.lang-en [data-lang="es"] { display: none !important; }
.lang-es [data-lang="en"] { display: none !important; }

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  position: sticky; top: 0;
  background: rgba(244, 236, 216, 0.92);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--rule);
  z-index: 100;
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
  flex: 0 0 auto;
}
.brand-mark {
  font-family: 'Noto Serif Tibetan', serif;
  font-size: 28px;
  color: var(--maroon);
}
.brand-text {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.02em;
  font-variant: small-caps;
}
.nav {
  display: flex;
  gap: 28px;
  flex: 1;
  justify-content: center;
}
.nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-family: 'Cormorant Garamond', serif;
  font-size: 16px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
  position: relative;
  padding: 4px 0;
  transition: color 0.2s;
}
.nav a:hover { color: var(--maroon); }
.nav a::after {
  content: "";
  position: absolute;
  bottom: -2px; left: 50%;
  width: 0;
  height: 1px;
  background: var(--maroon);
  transition: all 0.25s ease;
  transform: translateX(-50%);
}
.nav a:hover::after { width: 100%; }

.lang-toggle {
  display: flex;
  gap: 2px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  overflow: hidden;
  flex: 0 0 auto;
}
.lang-toggle button {
  background: transparent;
  border: none;
  font-family: 'Cormorant Garamond', serif;
  font-size: 13px;
  letter-spacing: 0.1em;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.lang-toggle button.active {
  background: var(--maroon);
  color: var(--cream);
}
.lang-toggle button:not(.active):hover {
  background: rgba(107, 33, 23, 0.08);
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  text-align: center;
  padding: 90px 32px 100px;
  max-width: 900px;
  margin: 0 auto;
  position: relative;
}
.hero-ornament {
  font-family: 'Noto Serif Tibetan', serif;
  font-size: 36px;
  color: var(--gold);
  margin-bottom: 32px;
  letter-spacing: 0.2em;
}
.hero-title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 500;
  font-size: clamp(48px, 7vw, 84px);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 32px;
  color: var(--ink);
}
.hero-title-of {
  font-style: italic;
  font-weight: 400;
  font-size: 0.55em;
  color: var(--maroon);
  display: inline-block;
  padding: 0 0.3em;
}
.hero-tib {
  font-family: 'Noto Serif Tibetan', serif;
  font-size: 22px;
  color: var(--maroon);
  margin: 0 0 36px;
  letter-spacing: 0.04em;
}
.hero-sub {
  font-size: 21px;
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 640px;
  margin: 0 auto 28px;
}
.hero-byline {
  font-family: 'Cormorant Garamond', serif;
  font-size: 16px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0;
}

/* ============================================================
   SECTIONS
   ============================================================ */
.section {
  padding: 100px 32px;
  position: relative;
}
.section-cream { background: var(--cream); }
.section-cream + .section { padding-top: 100px; }
.section-inner {
  max-width: 1100px;
  margin: 0 auto;
}
.section-head {
  text-align: center;
  margin-bottom: 64px;
}
.eyebrow {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 15px;
  color: var(--gold);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin: 0 0 12px;
}
.section-head h2 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 500;
  font-size: clamp(36px, 5vw, 56px);
  letter-spacing: -0.01em;
  margin: 0 0 12px;
  color: var(--ink);
  line-height: 1.1;
}
.section-sub {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 18px;
  color: var(--ink-faint);
  margin: 0;
}

/* ============================================================
   PROGRESS
   ============================================================ */
.progress-card {
  background: var(--parchment);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 56px 64px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 56px;
  align-items: center;
  box-shadow: var(--shadow);
  position: relative;
}
.progress-card::before,
.progress-card::after {
  content: "";
  position: absolute;
  width: 28px; height: 28px;
  border: 1px solid var(--gold);
}
.progress-card::before { top: 12px; left: 12px; border-right: none; border-bottom: none; }
.progress-card::after { bottom: 12px; right: 12px; border-left: none; border-top: none; }

.progress-fig {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 500;
  text-align: center;
  line-height: 1;
}
.big-num {
  display: block;
  font-size: 140px;
  color: var(--maroon);
  line-height: 0.9;
}
.of {
  display: block;
  font-size: 36px;
  color: var(--gold);
  font-style: italic;
  margin: 4px 0 -2px;
}
.big-denom {
  display: block;
  font-size: 56px;
  color: var(--ink-soft);
}

.progress-meter { display: contents; }
.meter-track {
  grid-column: 2;
  height: 6px;
  background: var(--parchment-deep);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 24px;
  border: 1px solid var(--rule);
}
.meter-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--maroon), var(--gold));
  border-radius: 3px;
}
.vol-grid {
  grid-column: 2;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 28px;
}
.vol {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cormorant Garamond', serif;
  font-size: 14px;
  font-weight: 600;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-faint);
  border-radius: 2px;
}
.vol.done {
  background: var(--maroon);
  color: var(--cream);
  border-color: var(--maroon);
  position: relative;
}
.vol.done::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(212, 181, 114, 0.5);
  border-radius: 1px;
}
.progress-prose {
  grid-column: 1 / -1;
  font-size: 19px;
  color: var(--ink-soft);
  line-height: 1.7;
}
.progress-prose p { margin: 0; }
.progress-prose p + p { margin-top: 1em; }

/* ============================================================
   BIO PROSE (DUDJOM LINGPA)
   ============================================================ */
.bio-prose {
  max-width: 720px;
  margin: 0 auto;
  font-size: 20px;
  line-height: 1.75;
  color: var(--ink-soft);
}
.bio-prose p {
  margin: 0 0 1.4em;
}
.bio-prose p:first-of-type::first-letter {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 4.5em;
  float: left;
  line-height: 0.85;
  padding: 0.1em 0.12em 0 0;
  color: var(--maroon);
  font-style: normal;
}
.bio-prose em { color: var(--ink); }

/* ============================================================
   VOLUMES
   ============================================================ */
.volume {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 56px;
  align-items: start;
  padding: 64px 0;
  border-top: 1px solid var(--rule);
}
.volume:last-of-type { border-bottom: 1px solid var(--rule); }
.volume-head {
  position: sticky;
  top: 88px;
  text-align: right;
}
.vol-numeral {
  font-family: 'Cormorant Garamond', serif;
  font-size: 96px;
  font-weight: 500;
  line-height: 1;
  color: var(--maroon);
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}
.volume-titles h3 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 500;
  font-size: 24px;
  line-height: 1.2;
  margin: 0 0 10px;
  color: var(--ink);
}
.vol-meta {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  margin: 0;
  line-height: 1.4;
}
.volume-body {
  font-size: 19px;
  line-height: 1.75;
  color: var(--ink-soft);
}
.volume-body p { margin: 0 0 1.2em; }
.volume-body p:last-child { margin-bottom: 0; }
.volume-body em { color: var(--ink); }

/* ============================================================
   LINEAGE
   ============================================================ */
.lineage-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: start;
}
.lineage-prose {
  font-size: 19px;
  line-height: 1.75;
  color: var(--ink-soft);
}
.lineage-prose p { margin: 0 0 1.3em; }
.lineage-prose strong { color: var(--maroon); font-weight: 600; }
.lineage-prose a {
  color: var(--maroon);
  text-decoration: none;
  border-bottom: 1px solid var(--gold-soft);
  transition: all 0.2s;
}
.lineage-prose a:hover {
  border-bottom-color: var(--maroon);
  color: var(--maroon-deep);
}
.lineage-prose em { color: var(--ink); }

.garland-card {
  background: var(--cream);
  border: 1px solid var(--rule);
  padding: 36px 32px;
  border-radius: 2px;
  position: relative;
  box-shadow: var(--shadow);
}
.garland-card::before {
  content: "";
  position: absolute;
  top: -8px; left: -8px; right: -8px; bottom: -8px;
  border: 1px solid var(--gold-soft);
  pointer-events: none;
  border-radius: 2px;
}
.garland-eyebrow {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 14px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 4px;
  text-align: center;
}
.garland-sub {
  font-family: 'Cormorant Garamond', serif;
  font-size: 16px;
  color: var(--ink-faint);
  margin: 0 0 24px;
  text-align: center;
  font-style: italic;
}
.garland-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.35;
}
.garland-table thead th {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 6px 8px;
  border-bottom: 1px solid var(--rule);
  text-align: left;
}
.garland-table thead th:first-child { width: 24px; text-align: center; }
.garland-table tbody td {
  padding: 10px 8px;
  border-bottom: 1px dotted var(--rule);
  vertical-align: top;
  color: var(--ink-soft);
}
.garland-table tbody td:first-child {
  text-align: center;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  color: var(--gold);
  font-weight: 500;
}
.garland-table tbody tr.shared td {
  background: rgba(176, 135, 56, 0.05);
  border-bottom: 1px solid var(--rule);
  font-size: 13px;
}
.shared-note {
  display: block;
  margin-top: 2px;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}
.garland-table tbody tr.highlight td { background: rgba(176, 135, 56, 0.08); }
.garland-table tbody tr.present td { background: rgba(107, 33, 23, 0.06); }
.present-note {
  display: inline-block;
  margin-top: 2px;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 12px;
  color: var(--maroon);
  letter-spacing: 0.05em;
}
.garland-footnote {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 13px;
  color: var(--ink-faint);
  line-height: 1.45;
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px dotted var(--rule);
}

/* ============================================================
   CONTACT
   ============================================================ */
.contact-card {
  max-width: 720px;
  margin: 0 auto;
  background: var(--parchment);
  border: 1px solid var(--rule);
  padding: 56px 56px 48px;
  text-align: center;
  position: relative;
  box-shadow: var(--shadow);
}
.contact-card::before,
.contact-card::after {
  content: "";
  position: absolute;
  width: 28px; height: 28px;
  border: 1px solid var(--gold);
}
.contact-card::before { top: 12px; left: 12px; border-right: none; border-bottom: none; }
.contact-card::after { bottom: 12px; right: 12px; border-left: none; border-top: none; }

.contact-prose {
  font-size: 19px;
  line-height: 1.7;
  color: var(--ink-soft);
  text-align: left;
  max-width: 560px;
  margin: 0 auto 32px;
}
.contact-prose p { margin: 0 0 1.1em; }
.contact-prose p:last-child { margin-bottom: 0; }

.whatsapp-button {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  padding: 18px 32px;
  background: #25D366;
  background-image: linear-gradient(180deg, #2EE375 0%, #1FB855 100%);
  color: #ffffff;
  text-decoration: none;
  border-radius: 4px;
  margin: 8px 0 4px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.25) inset,
    0 8px 24px -8px rgba(31, 184, 85, 0.45),
    0 2px 4px rgba(31, 26, 20, 0.12);
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
  text-align: left;
}
.whatsapp-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.25) inset,
    0 12px 28px -8px rgba(31, 184, 85, 0.55),
    0 4px 6px rgba(31, 26, 20, 0.15);
}
.whatsapp-button:active { transform: translateY(0); filter: brightness(0.98); }

.wa-icon {
  width: 32px; height: 32px;
  flex: 0 0 auto;
  fill: #ffffff;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.15));
}
.wa-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.2;
}
.wa-label {
  font-family: 'Cormorant Garamond', serif;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.wa-number {
  font-family: 'EB Garamond', Garamond, serif;
  font-size: 15px;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.92);
  font-variant-numeric: tabular-nums;
}

.contact-footnote {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 14px;
  color: var(--ink-faint);
  letter-spacing: 0.03em;
  margin: 24px 0 0;
}

@media (max-width: 600px) {
  .contact-card { padding: 36px 24px 32px; }
  .whatsapp-button { padding: 14px 22px; gap: 14px; }
  .wa-icon { width: 26px; height: 26px; }
  .wa-label { font-size: 15px; }
  .wa-number { font-size: 13px; }
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  background: var(--maroon-deep);
  color: var(--parchment);
  padding: 56px 32px 64px;
  text-align: center;
  position: relative;
  z-index: 2;
}
.footer-inner {
  max-width: 720px;
  margin: 0 auto;
}
.footer-mantra {
  font-family: 'Noto Serif Tibetan', serif;
  font-size: 22px;
  color: var(--gold-soft);
  margin: 0 0 28px;
  letter-spacing: 0.05em;
}
.footer-source {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 14px;
  color: rgba(244, 236, 216, 0.6);
  letter-spacing: 0.03em;
  margin: 0 0 12px;
}
.footer-credit {
  font-size: 16px;
  margin: 0 0 28px;
  color: var(--parchment);
}
.footer-credit a {
  color: var(--gold-soft);
  text-decoration: none;
  border-bottom: 1px solid rgba(212, 181, 114, 0.4);
}
.footer-credit a:hover { color: var(--cream); border-bottom-color: var(--cream); }
.footer-dedication {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 18px;
  color: var(--gold-soft);
  margin: 0;
  letter-spacing: 0.02em;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  body { font-size: 17px; }
  .topbar-inner { padding: 12px 16px; gap: 16px; flex-wrap: wrap; }
  .nav { order: 3; width: 100%; gap: 14px; justify-content: flex-start; overflow-x: auto; }
  .nav a { font-size: 13px; white-space: nowrap; }
  .brand-text { font-size: 14px; }
  .hero { padding: 56px 20px 64px; }
  .hero-title { font-size: 44px; }
  .section { padding: 64px 20px; }
  .section-head { margin-bottom: 40px; }
  .progress-card {
    padding: 32px 24px;
    grid-template-columns: 1fr;
    gap: 24px;
    text-align: center;
  }
  .big-num { font-size: 96px; }
  .of { font-size: 28px; }
  .big-denom { font-size: 40px; }
  .vol-grid { grid-template-columns: repeat(7, 1fr); }
  .volume {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 48px 0;
  }
  .volume-head { position: static; text-align: left; }
  .vol-numeral { font-size: 64px; margin-bottom: 8px; }
  .lineage-grid { grid-template-columns: 1fr; gap: 40px; }
  .garland-table { font-size: 12px; }
  .garland-table tbody td { padding: 8px 4px; }
}

@media (max-width: 600px) {
  .vol-grid { grid-template-columns: repeat(5, 1fr); }
  .nav { gap: 10px; }
}
