/*
Theme Name: TGTL Sacra — Thế Giới Tâm Linh
Theme URI: https://tgtl.danhliam.com
Author: Neo
Description: Illuminated-sacred redesign for Thế Giới Tâm Linh — a Vietnamese Catholic spiritual journal. Built on the visual language of the missal and the illuminated manuscript: aged parchment, gold leaf, lapis lazuli and crimson inks, letterpress serif headings, and original hand-rendered sacred art — a stained-glass rose window, Chi-Rho, Holy Spirit dove, Sacred Heart, IHS and the Ave Maria monogram. Includes a candlelit night mode, scroll reveals, and full respect for prefers-reduced-motion.
Version: 5.3
Text Domain: tgtl
*/

/* ══════════════════════════ LITURGICAL TOKENS ══════════════════════════ */
:root {
  /* Parchment */
  --parchment:      #f7f1e2;
  --parchment-deep: #efe5cf;
  --vellum:         #fffcf5;
  --vellum-warm:    #fbf6ea;

  /* Inks */
  --ink:        #2b2117;
  --ink-soft:   #574936;
  --ink-muted:  #8b7a61;
  --rule:       rgba(139, 106, 24, 0.26);
  --rule-soft:  rgba(139, 106, 24, 0.15);

  /* Liturgical colours */
  --lapis:       #16307a;
  --lapis-deep:  #0d1f4d;
  --lapis-light: #274fc4;
  --crimson:     #8e1b2c;
  --garnet:      #6f1524;
  --emerald:     #1c6b4a;
  --amethyst:    #5b2d7a;

  /* Gold leaf */
  --gold:       #b8912a;
  --gold-leaf:  #d4af37;
  --gold-light: #e9cd74;
  --gold-pale:  #f6e7b4;
  --gold-deep:  #8a6a18;
  --gold-faint: rgba(184, 145, 42, 0.12);
  --gold-glow:  rgba(212, 175, 55, 0.34);

  /* Surfaces */
  --bg:      var(--parchment);
  --surface: var(--vellum);
  --panel:   var(--vellum-warm);
  --hero-bg:
    radial-gradient(1100px 620px at 78% -10%, rgba(212, 175, 55, 0.24), transparent 64%),
    radial-gradient(900px 560px at 6% 112%, rgba(22, 48, 122, 0.14), transparent 62%),
    linear-gradient(172deg, #fbf6ea 0%, #f0e6d0 100%);
  --hero-color: var(--lapis-deep);
  --hero-muted: rgba(43, 33, 23, 0.66);
  --hero-hairline: rgba(139, 106, 24, 0.30);

  /* Type */
  --display: 'Cormorant Garamond', 'Playfair Display', Georgia, 'Times New Roman', serif;
  --serif:   'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans:    'Be Vietnam Pro', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* Fluid scale */
  --step--1: clamp(0.79rem, 0.76rem + 0.14vw, 0.87rem);
  --step-0:  clamp(0.96rem, 0.93rem + 0.18vw, 1.04rem);
  --step-1:  clamp(1.08rem, 1.02rem + 0.30vw, 1.22rem);
  --step-2:  clamp(1.36rem, 1.24rem + 0.62vw, 1.72rem);
  --step-3:  clamp(1.78rem, 1.52rem + 1.30vw, 2.60rem);
  --step-4:  clamp(2.15rem, 1.66rem + 2.60vw, 3.70rem);

  /* Shape */
  --radius:    6px;
  --radius-lg: 10px;
  --shadow-sm: 0 2px 10px rgba(74, 56, 20, 0.10);
  --shadow:    0 14px 44px rgba(74, 56, 20, 0.16);
  --shadow-lg: 0 28px 80px rgba(74, 56, 20, 0.22);
  --transition: 0.32s cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.65, 0, 0.35, 1);
}

/* ── Candlelit night mode (🌙 toggle) ────────────────────────────────────── */
body.night-mode {
  --parchment: #0a0f22;
  --parchment-deep: #070b19;
  --vellum: #111834;
  --vellum-warm: #0e1430;
  --ink: #f2ecdd;
  --ink-soft: #c3bcd6;
  --ink-muted: #8d88a8;
  --rule: rgba(212, 175, 55, 0.26);
  --rule-soft: rgba(212, 175, 55, 0.13);
  --gold: #d4af37;
  --gold-deep: #a8871f;
  --gold-faint: rgba(212, 175, 55, 0.12);
  --bg: #0a0f22;
  --surface: #111834;
  --panel: #0e1430;
  --hero-bg:
    radial-gradient(1100px 620px at 78% -10%, rgba(212, 175, 55, 0.20), transparent 64%),
    radial-gradient(900px 560px at 6% 112%, rgba(60, 96, 200, 0.26), transparent 62%),
    linear-gradient(172deg, #101a38 0%, #070b19 100%);
  --hero-color: #fbf6ea;
  --hero-muted: rgba(240, 235, 220, 0.66);
  --hero-hairline: rgba(255, 255, 255, 0.14);
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.36);
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.46);
  --shadow-lg: 0 30px 84px rgba(0, 0, 0, 0.56);
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.78;
  color: var(--ink);
  background-color: var(--bg);
  /* faint laid-paper grain */
  background-image:
    repeating-linear-gradient(0deg, rgba(139, 106, 24, 0.028) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(90deg, rgba(139, 106, 24, 0.022) 0 1px, transparent 1px 5px);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color 0.55s ease, color 0.55s ease;
}

body.night-mode {
  background-image:
    radial-gradient(1px 1px at 12% 24%, rgba(255,255,255,0.36) 50%, transparent 51%),
    radial-gradient(1px 1px at 46% 68%, rgba(255,255,255,0.28) 50%, transparent 51%),
    radial-gradient(1.4px 1.4px at 78% 34%, rgba(255,255,255,0.34) 50%, transparent 51%);
  background-size: 420px 420px, 380px 380px, 460px 460px;
}

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

a { color: var(--lapis); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--crimson); }
body.night-mode a { color: var(--gold-light); }
body.night-mode a:hover { color: var(--gold-pale); }

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.22;
  color: var(--lapis-deep);
  letter-spacing: 0.005em;
}
body.night-mode h1, body.night-mode h2,
body.night-mode h3, body.night-mode h4 { color: var(--gold-pale); }

.container { width: min(1220px, 92%); margin: 0 auto; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 9999;
  background: var(--lapis-deep); color: var(--gold-pale);
  padding: 12px 20px; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

:focus-visible { outline: 2.5px solid var(--gold-leaf); outline-offset: 3px; border-radius: 3px; }
::selection { background: var(--gold-leaf); color: #241c0c; }

/* ══════════════════════════ ORNAMENT PRIMITIVES ══════════════════════════ */
/* The filigree rule reused between sections — GPT Image 2.5 fresco band */
.sacra-rule {
  display: block;
  width: min(680px, 92%);
  aspect-ratio: 1200 / 252;
  height: auto;
  margin: 0 auto;
  background: url('assets/art/gpt/divider.webp?v=5.3') center/contain no-repeat;
}
body.night-mode .sacra-rule { filter: brightness(1.06); }

/* Section emblem — a devotional medallion above a section heading */
.section-emblem {
  display: block;
  width: 96px; height: 96px;
  margin: 0 auto 16px;
  background: center/contain no-repeat;
  filter: drop-shadow(0 8px 22px rgba(74, 56, 20, 0.28));
}
.section-emblem--ihs { background-image: url('assets/art/gpt/ihs.webp?v=5.3'); width: 104px; height: 104px; }
.section-emblem--dove { background-image: url('assets/art/gpt/dove-rays.webp?v=5.3'); }
.section-emblem--heart { background-image: url('assets/art/gpt/sacred-heart.webp?v=5.3'); }
body.night-mode .section-emblem { filter: drop-shadow(0 8px 26px rgba(0, 0, 0, 0.55)); }

/* Devotional medallion closing an article */
.devotional-medallion {
  margin: 44px auto 0;
  text-align: center;
  max-width: 620px;
  padding: 26px 22px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.devotional-medallion .section-emblem { margin-bottom: 12px; }
.devotional-verse {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.18rem;
  color: var(--gold-deep);
  letter-spacing: 0.01em;
}
body.night-mode .devotional-verse { color: var(--gold-light); }

/* ══════════════════════════ HEADER ══════════════════════════ */
.site-header {
  position: sticky; top: 0; z-index: 500;
  background: var(--vellum);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
  backdrop-filter: blur(14px) saturate(1.25);
  border-bottom: 1px solid var(--rule);
  transition: box-shadow var(--transition), background-color var(--transition), padding var(--transition);
}
.site-header.is-scrolled { box-shadow: 0 10px 34px rgba(74, 56, 20, 0.14); }
body.night-mode .site-header.is-scrolled { box-shadow: 0 10px 40px rgba(0, 0, 0, 0.55); }

.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 26px; padding: 14px 0;
}
.site-branding { display: flex; align-items: center; gap: 14px; min-width: 0; }
.site-logo img, .site-logo svg {
  width: 54px; height: 54px;
  filter: drop-shadow(0 3px 10px rgba(74, 56, 20, 0.22));
  transition: transform var(--transition);
}
.site-header.is-scrolled .site-logo img,
.site-header.is-scrolled .site-logo svg { transform: scale(0.93); }
.site-titles { min-width: 0; }
.site-title {
  display: block;
  font-family: var(--display);
  font-size: clamp(1.15rem, 1.0rem + 0.7vw, 1.62rem);
  font-weight: 700;
  letter-spacing: 0.055em;
  text-transform: uppercase;
  color: var(--lapis-deep);
  line-height: 1.12;
}
body.night-mode .site-title { color: var(--gold-pale); }
.site-tagline {
  font-size: 0.70rem; letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--gold-deep); margin-top: 3px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}

.main-nav ul { display: flex; align-items: center; gap: 4px; list-style: none; }
.main-nav a {
  display: block; position: relative;
  padding: 9px 15px;
  font-size: 0.80rem; font-weight: 500;
  letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--ink-soft);
}
.main-nav a::after {
  content: ""; position: absolute; left: 15px; right: 15px; bottom: 2px;
  height: 1.5px; background: var(--gold-leaf);
  transform: scaleX(0); transform-origin: 50% 50%;
  transition: transform var(--transition);
}
.main-nav a:hover::after,
.main-nav .current-menu-item > a::after { transform: scaleX(1); }

.header-actions { display: flex; align-items: center; gap: 9px; }
.dark-toggle, .menu-toggle {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: var(--vellum);
  color: var(--gold-deep);
  font-size: 16px; cursor: pointer;
  transition: var(--transition);
}
.dark-toggle:hover, .menu-toggle:hover {
  border-color: var(--gold-leaf);
  box-shadow: 0 0 0 3px var(--gold-faint);
  transform: translateY(-2px);
}
.menu-toggle { display: none; }

/* ══════════════════════════ HERO ══════════════════════════ */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--hero-bg);
  color: var(--hero-color);
  padding: 74px 0 82px;
  border-bottom: 1px solid var(--hero-hairline);
}
.hero-aurora, .hero-rays, .hero-stars, .hero-canvas {
  position: absolute; inset: 0; pointer-events: none;
}
.hero-aurora { z-index: 0; opacity: 0.9; }
.hero-rays {
  top: 50%; left: 50%; inset: auto;
  width: 180%; height: 240%;
  transform: translate(-50%, -50%);
  z-index: 0;
  background: conic-gradient(from 0deg,
    transparent 0deg, rgba(212,175,55,0.16) 10deg, transparent 24deg,
    transparent 100deg, rgba(30,70,170,0.10) 112deg, transparent 130deg,
    transparent 220deg, rgba(212,175,55,0.14) 232deg, transparent 250deg,
    transparent 360deg);
  filter: blur(24px);
  animation: sacra-rays 72s linear infinite;
}
@keyframes sacra-rays { to { transform: translate(-50%, -50%) rotate(360deg); } }
.hero-stars { display: none; }
.hero-canvas { z-index: 1; }

.hero-inner {
  position: relative; z-index: 3;
  display: grid;
  grid-template-columns: 1.02fr 0.98fr;
  gap: 56px;
  align-items: center;
}

.hero-overline {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 0.70rem; font-weight: 600;
  letter-spacing: 0.32em; text-transform: uppercase;
  color: var(--gold-deep);
  padding: 7px 16px;
  border: 1px solid var(--hero-hairline);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
}
body.night-mode .hero-overline { background: rgba(255,255,255,0.05); color: var(--gold-light); }

.hero-title {
  font-family: var(--display);
  font-size: var(--step-4);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.008em;
  margin: 20px 0 14px;
  color: var(--hero-color);
}
.hero-title a { color: inherit; }
.hero-title a:hover { color: var(--crimson); }
body.night-mode .hero-title a:hover { color: var(--gold-light); }

.hero-meta {
  font-size: 0.74rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--hero-muted); margin-bottom: 20px;
}
.hero-excerpt {
  font-family: var(--serif);
  font-size: var(--step-1);
  line-height: 1.78;
  color: var(--hero-muted);
  max-width: 54ch;
}
.hero-cta { margin-top: 28px; }

.btn-read {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 34px;
  font-size: 0.78rem; font-weight: 600;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--gold-pale);
  background: linear-gradient(150deg, var(--lapis), var(--lapis-deep));
  border: 1px solid var(--gold-leaf);
  border-radius: 999px;
  box-shadow: 0 10px 28px rgba(13, 31, 77, 0.30);
  transition: transform var(--transition), box-shadow var(--transition);
}
.btn-read:hover {
  color: #fff;
  transform: translateY(-3px);
  box-shadow: 0 18px 44px rgba(13, 31, 77, 0.42), 0 0 0 4px var(--gold-faint);
}
.btn-read::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.42), transparent);
  transform: skewX(-18deg);
  transition: left 0.8s var(--ease-out-expo);
}
.btn-read:hover::after { left: 135%; }

.hero-verse {
  display: inline-block;
  margin-top: 26px;
  padding: 12px 22px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.03rem;
  color: var(--hero-color);
  border: 1px solid var(--hero-hairline);
  border-left: 3px solid var(--gold-leaf);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: rgba(255,255,255,0.42);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: opacity 0.6s var(--ease-soft), transform 0.6s var(--ease-out-expo);
}
body.night-mode .hero-verse { background: rgba(255,255,255,0.05); }
.hero-verse.is-swapping { opacity: 0; transform: translateY(-5px); }

/* The rose window centrepiece */
.hero-art { position: relative; display: grid; place-items: center; }
.hero-art img, .hero-art .rose {
  width: min(100%, 560px);
  height: auto;
  filter: drop-shadow(0 26px 60px rgba(74, 56, 20, 0.34));
  /* No rotation: the painted window is not perfectly radially symmetric, so
     spinning it would read as a wobble rather than as a turning wheel. */
  transition: transform 1.1s var(--ease-out-expo);
}
.hero-art:hover img, .hero-art:hover .rose { transform: scale(1.03); }
@keyframes sacra-rose-spin { to { transform: rotate(360deg); } }
.hero-art::before {
  content: ""; position: absolute; inset: -12%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--gold-glow) 0%, transparent 62%);
  animation: sacra-halo 7.5s var(--ease-soft) infinite alternate;
  pointer-events: none;
}
@keyframes sacra-halo {
  from { opacity: 0.42; transform: scale(0.94); }
  to   { opacity: 0.92; transform: scale(1.06); }
}
.hero-image img {
  border-radius: var(--radius-lg);
  border: 1px solid var(--hero-hairline);
  box-shadow: var(--shadow-lg);
}

/* Hero entrance */
.hero-text > * { opacity: 0; animation: sacra-rise 0.9s var(--ease-out-expo) forwards; }
.hero-text > *:nth-child(1) { animation-delay: 0.05s; }
.hero-text > *:nth-child(2) { animation-delay: 0.15s; }
.hero-text > *:nth-child(3) { animation-delay: 0.24s; }
.hero-text > *:nth-child(4) { animation-delay: 0.33s; }
.hero-text > *:nth-child(5) { animation-delay: 0.42s; }
.hero-text > *:nth-child(6) { animation-delay: 0.51s; }
@keyframes sacra-rise {
  from { opacity: 0; transform: translate3d(0, 26px, 0); filter: blur(7px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}
.hero-art { opacity: 0; animation: sacra-art-in 1.5s var(--ease-out-expo) 0.25s forwards; }
@keyframes sacra-art-in {
  from { opacity: 0; transform: scale(0.9) rotate(-10deg); }
  to   { opacity: 1; transform: none; }
}

/* ══════════════════════════ SECTIONS ══════════════════════════ */
.section { padding: 66px 0; }
.section-head { text-align: center; margin-bottom: 44px; }
.section-title {
  font-family: var(--display);
  font-size: var(--step-3);
  font-weight: 700;
  letter-spacing: 0.012em;
  color: var(--lapis-deep);
}
body.night-mode .section-title { color: var(--gold-pale); }
.section-ornament {
  display: block;
  width: 116px; height: 2px;
  margin: 18px auto 0;
  background: linear-gradient(90deg, transparent, var(--gold-leaf), transparent);
  box-shadow: 0 0 12px var(--gold-glow);
}
.section + .section::before {
  content: ""; display: block;
  width: min(680px, 92%);
  aspect-ratio: 1200 / 252;
  height: auto;
  margin: 0 auto 40px;
  background: url('assets/art/gpt/divider.webp?v=5.3') center/contain no-repeat;
}

/* ══════════════════════════ POST GRID & CARDS ══════════════════════════ */
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }

.post-card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transform:
    perspective(1100px)
    rotateX(var(--ry, 0deg))
    rotateY(var(--rx, 0deg))
    translate3d(0, var(--lift, 0px), 0)
    scale(var(--card-scale, 1));
  transition: transform 0.5s var(--ease-out-expo),
              box-shadow 0.5s var(--ease-out-expo),
              border-color 0.5s var(--ease-out-expo);
  will-change: transform;
}
.post-card::after {
  content: ""; position: absolute; inset: 5px;
  border: 1px solid var(--rule-soft);
  border-radius: calc(var(--radius-lg) - 3px);
  pointer-events: none;
}
.post-card:hover {
  --lift: -10px;
  --card-scale: 1.018;
  border-color: var(--gold-leaf);
  box-shadow: var(--shadow-lg), 0 0 0 3px var(--gold-faint);
}

/* Gothic-arch thumbnail */
.post-thumb {
  display: block;
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 11;
  background: var(--parchment-deep);
  border-bottom: 1px solid var(--rule);
}
.post-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.9s var(--ease-out-expo), filter 0.9s var(--ease-out-expo);
  filter: saturate(0.94) contrast(1.02);
}
.post-card:hover .post-thumb img { transform: scale(1.09); filter: saturate(1.1) contrast(1.05); }

.post-card-content { padding: 26px 24px 22px; flex: 1; display: flex; flex-direction: column; }

.post-cats { margin-bottom: 13px; display: flex; flex-wrap: wrap; gap: 7px; }
.post-cats a {
  display: inline-block;
  font-size: 0.63rem; font-weight: 600;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--crimson);
  padding: 4px 12px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--gold-faint);
}
.post-cats a:hover { background: var(--crimson); color: var(--vellum); border-color: var(--crimson); }

.post-card-title {
  font-family: var(--display);
  font-size: 1.28rem; font-weight: 700;
  line-height: 1.3; margin-bottom: 11px;
}
.post-card-title a { color: var(--lapis-deep); }
body.night-mode .post-card-title a { color: var(--gold-pale); }
.post-card-title a:hover { color: var(--crimson); }
body.night-mode .post-card-title a:hover { color: var(--gold-light); }

.post-card-meta {
  font-size: 0.68rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-muted); margin-bottom: 13px;
}
.post-card-excerpt {
  font-family: var(--serif);
  font-size: 1.02rem; line-height: 1.7;
  color: var(--ink-soft); flex: 1;
}
.post-card-more {
  margin-top: 20px; padding-top: 15px;
  border-top: 1px solid var(--rule-soft);
  font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--gold-deep);
  display: inline-flex; align-items: center; gap: 9px;
  transition: gap var(--transition);
}
.post-card-more::after { content: "→"; transition: transform var(--transition); }
.post-card:hover .post-card-more { gap: 13px; }
.post-card:hover .post-card-more::after { transform: translateX(4px); }

/* ══════════════════════════ CATEGORY STRIP ══════════════════════════ */
.category-strip {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 30px;
}
.cat-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 26px 24px;
  box-shadow: var(--shadow-sm);
  transform:
    perspective(1100px)
    rotateX(var(--ry, 0deg))
    rotateY(var(--rx, 0deg))
    translate3d(0, var(--lift, 0px), 0)
    scale(var(--card-scale, 1));
  transition: transform 0.5s var(--ease-out-expo),
              box-shadow 0.5s var(--ease-out-expo),
              border-color 0.5s var(--ease-out-expo);
}
.cat-card::before {
  content: ""; position: absolute; top: 0; left: 16px; right: 16px; height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold-leaf), transparent);
  opacity: 0.8;
}
.cat-card:hover {
  --lift: -9px;
  border-color: var(--gold-leaf);
  box-shadow: var(--shadow-lg), 0 0 0 3px var(--gold-faint);
}
.cat-card-header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.cat-card-title { font-size: 1.32rem; font-weight: 700; }
.cat-card-title a { color: var(--lapis-deep); }
body.night-mode .cat-card-title a { color: var(--gold-pale); }
.cat-card-count { font-size: 0.65rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-muted); white-space: nowrap; }
.cat-card-list { list-style: none; display: grid; gap: 12px; }
.cat-card-list li {
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--rule-soft);
  transition: transform var(--transition);
}
.cat-card-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.cat-card-list li:hover { transform: translateX(4px); }
.cat-card-list a { font-family: var(--serif); font-size: 1.04rem; color: var(--ink); line-height: 1.5; }
.cat-card-list a:hover { color: var(--crimson); }
body.night-mode .cat-card-list a { color: var(--ink-soft); }
.cat-date { font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-muted); margin-top: 3px; }
.cat-card-more {
  display: inline-block; margin-top: 18px;
  font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold-deep);
}

/* ══════════════════════════ SINGLE / PAGE ══════════════════════════ */
.single-layout, .archive-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px;
  gap: 52px; padding: 56px 0 40px; align-items: start;
}
.post-full { min-width: 0; }
.post-header { text-align: center; margin-bottom: 34px; }
.post-header .post-title {
  font-size: var(--step-4);
  font-weight: 700;
  line-height: 1.14;
  margin: 14px 0 16px;
}
.post-meta {
  display: flex; justify-content: center; gap: 20px; flex-wrap: wrap;
  font-size: 0.7rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-muted);
}
.post-featured-image { margin: 34px 0; }
.post-featured-image img {
  width: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow-lg);
}
.post-body {
  font-family: var(--serif);
  font-size: var(--step-1);
  line-height: 1.92;
  color: var(--ink);
  max-width: 74ch;
  margin: 0 auto;
}
.post-body p { margin-bottom: 1.35em; }
.post-body > p:first-of-type::first-letter {
  font-family: var(--display);
  float: left;
  font-size: 4.1em;
  line-height: 0.80;
  padding: 0.04em 0.10em 0 0;
  color: var(--crimson);
  text-shadow: 2px 2px 0 var(--gold-pale), 0 4px 22px var(--gold-glow);
}
body.night-mode .post-body > p:first-of-type::first-letter { text-shadow: 2px 2px 0 #3a2f10, 0 4px 22px var(--gold-glow); }
.post-body h2, .post-body h3 { margin: 1.9em 0 0.6em; font-weight: 700; }
.post-body h2 { font-size: var(--step-2); }
.post-body h3 { font-size: var(--step-1); }
.post-body blockquote {
  margin: 1.8em 0;
  padding: 20px 26px;
  border-left: 3px solid var(--gold-leaf);
  background: var(--gold-faint);
  font-style: italic;
  font-size: 1.1em;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.post-body img { border-radius: var(--radius); margin: 1.4em auto; box-shadow: var(--shadow); }
.post-body ul, .post-body ol { margin: 0 0 1.35em 1.5em; }
.post-body li { margin-bottom: 0.5em; }

.post-footer {
  margin-top: 46px; padding-top: 26px;
  border-top: 1px solid var(--rule);
  display: flex; flex-wrap: wrap; gap: 18px; justify-content: space-between; align-items: center;
}
.post-tags a {
  display: inline-block; margin: 0 6px 6px 0;
  font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase;
  padding: 5px 12px; border: 1px solid var(--rule); border-radius: 999px; color: var(--ink-soft);
}
.post-share { font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-muted); }

.post-nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
  margin-top: 40px;
}
.post-nav a {
  display: block; padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  font-family: var(--serif); font-size: 1.06rem;
  color: var(--ink); line-height: 1.45;
  transition: var(--transition);
}
.post-nav a:hover { border-color: var(--gold-leaf); box-shadow: var(--shadow); transform: translateY(-3px); }
.nav-label {
  display: block; margin-bottom: 7px;
  font-family: var(--sans); font-size: 0.64rem;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold-deep);
}

/* ── Sidebar ── */
.sidebar { position: sticky; top: 100px; }
.widget {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 24px 22px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.widget-title {
  font-size: 0.94rem; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase;
  padding-bottom: 12px; margin-bottom: 14px;
  border-bottom: 1px solid var(--rule);
  color: var(--lapis-deep);
}
body.night-mode .widget-title { color: var(--gold-pale); }
.widget ul { list-style: none; }
.widget li { padding: 9px 0; border-bottom: 1px dashed var(--rule-soft); font-size: 0.92rem; }
.widget li:last-child { border-bottom: 0; }
.widget a { color: var(--ink-soft); }

/* ══════════════════════════ ARCHIVE / SEARCH / 404 ══════════════════════════ */
.archive-header, .search-header { text-align: center; margin-bottom: 46px; }
.archive-kicker {
  font-size: 0.68rem; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--gold-deep); margin-bottom: 12px;
}
.archive-title, .search-header h1 { font-size: var(--step-3); font-weight: 700; }
.search-header h1 span { color: var(--crimson); }
.archive-description { color: var(--ink-soft); max-width: 62ch; margin: 14px auto 0; font-family: var(--serif); font-size: 1.08rem; }

.pagination { margin-top: 48px; text-align: center; }
.pagination .page-numbers {
  display: inline-grid; place-items: center;
  min-width: 42px; height: 42px; padding: 0 12px;
  margin: 0 4px;
  border: 1px solid var(--rule); border-radius: var(--radius);
  color: var(--ink-soft); font-size: 0.88rem;
  transition: var(--transition);
}
.pagination .page-numbers:hover,
.pagination .page-numbers.current {
  background: var(--lapis); color: var(--gold-pale);
  border-color: var(--lapis); box-shadow: var(--shadow-sm);
}

.notfound { text-align: center; padding: 90px 0 110px; }
.nf-code {
  font-family: var(--display);
  font-size: clamp(5rem, 4rem + 8vw, 10rem);
  font-weight: 700; line-height: 1;
  color: transparent;
  -webkit-text-stroke: 2px var(--gold-leaf);
  margin-bottom: 12px;
}
.notfound h1 { font-size: var(--step-3); margin-bottom: 16px; }
.notfound p { color: var(--ink-soft); max-width: 56ch; margin: 0 auto 14px; font-family: var(--serif); font-size: 1.1rem; }
.notfound .btn-read { margin-top: 22px; }

/* ══════════════════════════ COMMENTS ══════════════════════════ */
.comments-area { margin-top: 54px; padding-top: 34px; border-top: 1px solid var(--rule); }
.comments-title, .comment-reply-title { font-size: var(--step-2); margin-bottom: 22px; }
.comment-list { list-style: none; display: grid; gap: 20px; }
.comment-list .children { list-style: none; margin: 18px 0 0 26px; display: grid; gap: 18px; }
.comment-body {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
}
.comment-meta { font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 10px; }
.comment-content { font-family: var(--serif); font-size: 1.04rem; line-height: 1.75; }
.comment-form input, .comment-form textarea {
  width: 100%; padding: 13px 16px; margin-bottom: 14px;
  font-family: var(--sans); font-size: 0.94rem;
  color: var(--ink); background: var(--vellum);
  border: 1px solid var(--rule); border-radius: var(--radius);
  transition: var(--transition);
}
.comment-form input:focus, .comment-form textarea:focus {
  outline: none; border-color: var(--gold-leaf); box-shadow: 0 0 0 3px var(--gold-faint);
}
.comment-form .submit, .comment-form input[type="submit"] {
  width: auto; cursor: pointer;
  padding: 13px 34px;
  font-size: 0.76rem; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--gold-pale); background: linear-gradient(150deg, var(--lapis), var(--lapis-deep));
  border: 1px solid var(--gold-leaf); border-radius: 999px;
}

/* ══════════════════════════ FOOTER ══════════════════════════ */
.site-footer {
  margin-top: 70px;
  background: var(--lapis-deep);
  color: rgba(246, 231, 180, 0.78);
  border-top: 3px solid var(--gold-leaf);
  position: relative;
}
.site-footer::before {
  content: ""; display: block;
  height: 64px;
  background: url('assets/art/divider.svg') center/contain no-repeat;
  opacity: 0.5;
  margin-top: -32px;
}
.footer-inner {
  display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 44px;
  padding: 34px 0 40px;
}
.footer-branding h3 {
  font-family: var(--display); font-size: 1.5rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--gold-pale); margin-bottom: 10px;
}
.footer-branding p { font-size: 0.92rem; color: rgba(246, 231, 180, 0.66); }
.footer-verse {
  margin-top: 16px; font-family: var(--serif); font-style: italic;
  font-size: 1.05rem; color: var(--gold-light) !important;
}
.footer-col h4 {
  font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--gold-leaf); margin-bottom: 16px;
}
.footer-col a { display: block; padding: 6px 0; font-size: 0.92rem; color: rgba(246, 231, 180, 0.74); }
.footer-col a:hover { color: var(--gold-pale); transform: translateX(3px); }
.footer-nav ul { list-style: none; }
.footer-bottom {
  padding: 20px 0 26px;
  border-top: 1px solid rgba(212, 175, 55, 0.22);
  text-align: center;
  font-size: 0.72rem; letter-spacing: 0.14em;
  color: rgba(246, 231, 180, 0.55);
}

/* ══════════════════════════ MOTION SUPPORT ══════════════════════════ */
.scroll-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px;
  z-index: 999; pointer-events: none;
}
.scroll-progress span {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--lapis), var(--gold-leaf), var(--gold-pale));
  box-shadow: 0 0 12px var(--gold-glow);
  transition: width 0.12s linear;
}

.reveal {
  opacity: 0;
  transform: translate3d(0, 24px, 0);
  filter: blur(6px);
  transition: opacity 0.8s var(--ease-out-expo),
              transform 0.8s var(--ease-out-expo),
              filter 0.8s var(--ease-out-expo);
  transition-delay: calc(var(--stagger, 0) * 75ms);
}
.reveal.in-view { opacity: 1; transform: none; filter: blur(0); }

.to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 900;
  width: 50px; height: 50px;
  display: grid; place-items: center;
  border: 1px solid var(--gold-leaf);
  border-radius: 50%;
  background: linear-gradient(150deg, var(--lapis), var(--lapis-deep));
  color: var(--gold-pale);
  font-size: 17px; cursor: pointer;
  opacity: 0; transform: translate3d(0, 16px, 0) scale(0.86);
  pointer-events: none;
  box-shadow: 0 10px 30px rgba(13, 31, 77, 0.34);
  transition: opacity var(--transition), transform var(--transition), box-shadow var(--transition);
}
.to-top.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { transform: translateY(-4px) scale(1.06); box-shadow: 0 16px 40px rgba(13,31,77,0.44), 0 0 0 4px var(--gold-faint); }
.to-top svg { position: absolute; inset: -1px; transform: rotate(-90deg); }
.to-top svg circle { fill: none; stroke: var(--gold-light); stroke-width: 2; opacity: 0.9; }

img.tgtl-loading { filter: blur(10px); opacity: 0.35; transition: filter .7s var(--ease-out-expo), opacity .7s var(--ease-out-expo); }
img.tgtl-loaded { filter: blur(0); opacity: 1; }

@view-transition { navigation: auto; }
::view-transition-old(root) { animation: sacra-fade-out 0.24s var(--ease-soft) both; }
::view-transition-new(root) { animation: sacra-fade-in 0.36s var(--ease-out-expo) both; }
@keyframes sacra-fade-out { to { opacity: 0; } }
@keyframes sacra-fade-in { from { opacity: 0; } }

@supports (scrollbar-color: red blue) {
  html { scrollbar-color: var(--gold-deep) transparent; scrollbar-width: thin; }
}

/* ══════════════════════════ RESPONSIVE ══════════════════════════ */
@media (max-width: 1080px) {
  .single-layout, .archive-layout { grid-template-columns: 1fr; gap: 40px; }
  .sidebar { position: static; }
  .post-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-inner { grid-template-columns: 1fr; gap: 42px; }
  .hero-art { order: -1; }
  .hero-art img, .hero-art .rose { width: min(74%, 380px); }
}

@media (max-width: 820px) {
  .header-inner { padding: 11px 0; }
  .menu-toggle { display: grid; }
  .main-nav {
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--vellum);
    border-bottom: 1px solid var(--rule);
    box-shadow: var(--shadow);
    max-height: 0; overflow: hidden;
    transition: max-height 0.42s var(--ease-out-expo);
  }
  .main-nav.active { max-height: 70vh; overflow-y: auto; }
  .main-nav ul { flex-direction: column; align-items: stretch; gap: 0; padding: 10px 0; }
  .main-nav a { padding: 14px 24px; border-bottom: 1px solid var(--rule-soft); }
  .main-nav a::after { display: none; }
  .site-tagline { display: none; }
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 30px; }
  .footer-branding { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
  .post-grid { grid-template-columns: 1fr; }
  .hero { padding: 52px 0 60px; }
  .hero-title { font-size: clamp(2rem, 1.6rem + 3vw, 2.6rem); }
  .post-nav { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
  .to-top { right: 14px; bottom: 14px; width: 46px; height: 46px; }
  .post-header .post-title { font-size: clamp(1.8rem, 1.5rem + 2.4vw, 2.3rem); }
}

@media (hover: none) {
  .post-card, .cat-card { transform: none; }
}

/* ══════════════════════════ MOTION SAFETY NET ══════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .hero-rays, .hero-aurora, .hero-art img, .hero-art .rose,
  .hero-art::before {
    animation: none !important;
  }
  .hero-text > *, .hero-art {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    animation: none !important;
  }
  .post-card, .cat-card { transform: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; filter: none !important; }
  .scroll-progress span { transition: none; }
  .hero-canvas { display: none !important; }
}

@media print {
  .site-header, .site-footer, .scroll-progress, .to-top, .sidebar, .hero-canvas { display: none !important; }
  body { background: #fff; color: #000; }
  .post-body { font-size: 12pt; }
}
