/* ====================================================
   DUSHYANTH RAMALINGAM — "THE ENCHANTED MAP"
   A wizarding-world-inspired portfolio: parchment by day,
   candle-lit by night.
   ==================================================== */

/* ---------- Tokens ---------- */
:root {
  --bg: #efe3c6;
  --bg-2: #e6d5ae;
  --card: #f6ecd3;
  --ink: #33200f;
  --ink-2: #6a4a2b;
  --line: rgba(58, 36, 19, 0.32);
  --line-soft: rgba(58, 36, 19, 0.15);
  --seal: #7c1d1d;
  --seal-hi: #a83232;
  --gold: #9c7424;
  --emerald: #1f5b43;
  --glow: rgba(255, 214, 140, 0.32);
  --shade: rgba(60, 34, 10, 0.34);

  --lion-a: #8e1b1b;   --lion-b: #c9962c;
  --eagle-a: #1d3a6b;  --eagle-b: #a8743a;
  --serpent-a: #1f5b43; --serpent-b: #a7afb4;
  --badger-a: #d3a126; --badger-b: #2a2118;

  --f-brand: 'Cinzel Decorative', 'Cinzel', serif;
  --f-head: 'Cinzel', 'Trajan Pro', serif;
  --f-body: 'EB Garamond', Garamond, Georgia, serif;
  --f-fell: 'IM Fell English', 'EB Garamond', serif;
  --f-black: 'UnifrakturCook', 'Cinzel Decorative', serif;

  --nav-h: 84px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html.night {
  --bg: #16100a;
  --bg-2: #1d150d;
  --card: #231a10;
  --ink: #eedfbd;
  --ink-2: #bea67a;
  --line: rgba(238, 223, 189, 0.3);
  --line-soft: rgba(238, 223, 189, 0.13);
  --seal: #a8362a;
  --seal-hi: #c9493a;
  --gold: #d9ac52;
  --emerald: #6fbb93;
  --glow: rgba(255, 190, 90, 0.2);
  --shade: rgba(0, 0, 0, 0.6);
}

/* ---------- Reset ---------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { overflow-x: clip; scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 12px); }
[hidden] { display: none !important; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

body {
  font-family: var(--f-body);
  font-size: 19px;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse at 12% 8%, rgba(255, 255, 255, 0.35), transparent 50%),
    radial-gradient(ellipse at 88% 92%, rgba(120, 76, 28, 0.22), transparent 55%),
    radial-gradient(ellipse at 50% 50%, transparent 60%, rgba(90, 55, 20, 0.18) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.5s, color 0.5s;
}
html.night body {
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(255, 170, 70, 0.1), transparent 55%),
    radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}
::selection { background: var(--seal); color: #f6ecd3; }

.container { width: min(1200px, 92vw); margin-inline: auto; }
.fell { font-family: var(--f-fell); font-style: italic; }
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 2000;
  background: var(--seal); color: #f6ecd3; padding: 10px 16px;
  font-family: var(--f-head); font-size: 13px;
}
.skip:focus { top: 12px; }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--seal);
  outline-offset: 3px;
}

/* Paper grain over everything */
.grain {
  position: fixed; inset: 0; z-index: 900; pointer-events: none;
  opacity: 0.2; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
html.night .grain { opacity: 0.12; mix-blend-mode: screen; }

/* Lantern light that follows the cursor */
.lantern {
  position: fixed; inset: 0; z-index: 901; pointer-events: none;
  background: radial-gradient(380px circle at var(--lx, 70%) var(--ly, 30%), var(--glow), transparent 65%);
  mix-blend-mode: soft-light;
}
html.night .lantern {
  mix-blend-mode: normal;
  background:
    radial-gradient(300px circle at var(--lx, 70%) var(--ly, 30%), rgba(255, 190, 90, 0.13), transparent 70%);
}

/* ---------- Typography primitives ---------- */
h1, h2, h3, h4 { font-family: var(--f-head); font-weight: 700; line-height: 1.1; letter-spacing: 0.01em; }
p strong, li strong { font-weight: 600; }
.kicker {
  font-family: var(--f-fell); font-style: italic;
  font-size: clamp(17px, 1.6vw, 20px); color: var(--ink-2);
}
.label {
  font-family: var(--f-head); font-weight: 500;
  font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--seal);
}
.text-link {
  font-family: var(--f-head); font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase;
  border-bottom: 1px solid currentColor; padding-bottom: 2px;
  display: inline-flex; gap: 10px; align-items: center;
  transition: color 0.3s;
}
.text-link:hover { color: var(--seal); }
.text-link i { font-size: 11px; transition: transform 0.3s var(--ease); }
.text-link:hover i { transform: translateX(4px); }
.inline-link { border-bottom: 1px solid var(--line); transition: border-color 0.3s, color 0.3s; }
.inline-link:hover { color: var(--seal); border-color: var(--seal); }

/* Ornamental divider */
.flourish { display: block; width: min(340px, 70%); height: 26px; margin-top: 14px; color: var(--ink); }
.flourish path { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.js .flourish path { stroke-dasharray: 620; stroke-dashoffset: 620; animation: draw 1.6s var(--ease) 1.2s forwards; }
.divider {
  display: flex; align-items: center; gap: 16px; color: var(--ink-2);
  margin: 0 auto; width: min(420px, 80%);
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* Ink-written titles: each line is revealed left to right */
.ink-line { display: block; }
.js .ink .ink-line {
  clip-path: inset(0 100% 0 0);
  animation: write 1.3s steps(24) forwards;
  animation-delay: calc(var(--i, 0) * 1.1s + var(--ink-delay, 0.25s));
}
@keyframes write { to { clip-path: inset(0 -2% 0 0); } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--f-head); font-weight: 500; font-size: 13px;
  letter-spacing: 0.16em; text-transform: uppercase;
  padding: 15px 26px;
  border: 1.5px solid var(--ink); color: var(--ink);
  transition: background-color 0.3s, color 0.3s, transform 0.3s var(--ease), box-shadow 0.3s;
}
.btn:hover { background: var(--ink); color: var(--bg); }
.btn i { font-size: 12px; }
.btn-seal {
  position: relative;
  padding-left: 56px;
  background: var(--seal); border-color: var(--seal); color: #f6ecd3;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
}
.btn-seal:hover { background: var(--seal-hi); border-color: var(--seal-hi); color: #fff; transform: translateY(-2px); box-shadow: 0 6px 0 rgba(0, 0, 0, 0.3); }
.btn-seal::before {
  content: 'D';
  position: absolute; left: 12px; top: 50%; translate: 0 -50%;
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--f-brand); font-size: 14px; letter-spacing: 0;
  background: radial-gradient(circle at 35% 30%, #c44545, #5a1010 70%);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.25), 0 0 0 3px rgba(90, 16, 16, 0.35);
  transition: transform 0.5s var(--ease);
}
.btn-seal:hover::before { transform: rotate(-20deg) scale(1.08); }

/* ---------- Header ---------- */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  height: var(--nav-h);
  transition: transform 0.45s var(--ease), background-color 0.4s, box-shadow 0.4s;
}
.navbar.scrolled {
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(6px);
  box-shadow: 0 1px 0 var(--line), 0 10px 30px -20px var(--shade);
}
.navbar.nav-hidden { transform: translateY(-100%); }
.nav-inner {
  width: min(1320px, 94vw); margin-inline: auto; height: 100%;
  display: flex; align-items: center; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 46px; height: 30px; color: var(--ink); flex-shrink: 0; }
.brand-mark .bolt { fill: var(--seal); stroke: none; }
.brand-name { font-family: var(--f-brand); font-weight: 700; font-size: 19px; line-height: 1; }
.brand-name small { display: block; font-family: var(--f-fell); font-style: italic; font-weight: 400; font-size: 13px; color: var(--ink-2); margin-top: 3px; letter-spacing: 0; }
.nav-menu { margin-left: auto; display: flex; align-items: center; gap: 22px; }
.nav-list { display: flex; gap: 22px; }
.nav-link {
  display: flex; flex-direction: column; align-items: center;
  font-family: var(--f-head); font-weight: 500; font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase;
  position: relative; padding-bottom: 4px;
}
.nav-link i { font-family: var(--f-fell); font-weight: 400; font-size: 12px; letter-spacing: 0; text-transform: none; color: var(--ink-2); }
.nav-link::after {
  content: ''; position: absolute; left: 10%; right: 10%; bottom: -3px; height: 1.5px; background: var(--seal);
  transform: scaleX(0); transition: transform 0.35s var(--ease);
}
.nav-link:hover::after, .nav-link[aria-current]::after { transform: scaleX(1); }
.nav-link[aria-current] { color: var(--seal); }
.nav-owl { padding: 12px 20px 12px 52px; font-size: 12px; }
.nav-owl::before { width: 26px; height: 26px; font-size: 12px; left: 12px; }
.nav-cv { font-family: var(--f-head); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; border-bottom: 1px solid var(--line); padding-bottom: 2px; }
.nav-cv:hover { color: var(--seal); border-color: var(--seal); }
.theme-toggle {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1.5px solid var(--line); color: var(--ink);
  display: grid; place-items: center; font-size: 16px; flex-shrink: 0;
  transition: border-color 0.3s, color 0.3s, transform 0.5s var(--ease);
}
.theme-toggle:hover { border-color: var(--seal); color: var(--seal); transform: rotate(-12deg); }
.nav-toggle { display: none; }
.music-toggle { margin-left: -8px; }
.music-toggle[aria-pressed="true"] { color: var(--seal); border-color: var(--seal); }
.music-toggle[aria-pressed="true"] i { animation: note 1.2s ease-in-out infinite alternate; }
@keyframes note { from { transform: translateY(1px) rotate(-8deg); } to { transform: translateY(-2px) rotate(8deg); } }
.nav-menu-foot { display: none; }

/* ---------- Home hero ---------- */
.hero {
  position: relative; overflow: hidden;
  min-height: 100svh;
  padding: calc(var(--nav-h) + 40px) 0 60px;
  display: flex; flex-direction: column; justify-content: center;
}
.hero-grid { display: grid; grid-template-columns: 1.25fr 0.75fr; gap: clamp(32px, 5vw, 72px); align-items: center; }
.hero h1 { font-size: clamp(38px, 5.4vw, 74px); line-height: 1.02; margin-top: 12px; }
.hero h1 .ink-line + .ink-line { color: var(--seal); }
.hero-lede { font-size: clamp(19px, 1.7vw, 22px); line-height: 1.55; max-width: 32em; margin-top: 20px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 18px 24px; align-items: center; margin-top: 30px; position: relative; }
.js .hero .after-ink { opacity: 0; animation: fade-up 0.9s var(--ease) forwards; animation-delay: var(--after, 2.6s); }
@keyframes fade-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* Moving portrait */
.portrait {
  position: relative; padding: 16px;
  background: linear-gradient(140deg, #7a5530, #3a2413 60%, #5e3f22);
  box-shadow: 0 24px 50px -10px var(--shade);
  transform: rotate(1.8deg);
}
.portrait::before { content: ''; position: absolute; inset: 7px; border: 1px solid rgba(214, 170, 90, 0.8); pointer-events: none; }
.portrait-photo { position: relative; aspect-ratio: 4 / 5; overflow: hidden; background: #2a1a0d; }
.portrait-photo img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  filter: sepia(0.5) contrast(1.05) brightness(0.96);
  opacity: 0; transition: opacity 1.8s ease;
  animation: breathe 9s ease-in-out infinite alternate;
}
.portrait-photo img.on { opacity: 1; }
.portrait-photo::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 32%, rgba(255, 236, 190, 0.35) 50%, transparent 68%);
  background-size: 260% 100%; mix-blend-mode: screen;
  animation: sheen 6.5s ease-in-out infinite;
}
@keyframes breathe { from { transform: scale(1.02); } to { transform: scale(1.09) translate(-1.5%, -1%); } }
@keyframes sheen { 0%, 62% { background-position: 130% 0; } 100% { background-position: -70% 0; } }
.plaque { text-align: center; font-family: var(--f-fell); font-style: italic; font-size: 15px; color: #f1ddb2; margin-top: 10px; }

/* Stats ledger */
.ledger {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 2px solid var(--ink); border-bottom: 1px solid var(--ink);
  margin-top: clamp(36px, 5vw, 56px);
}
.ledger > div { padding: 18px 16px; border-right: 1px dashed var(--line); }
.ledger > div:last-child { border-right: 0; }
.ledger b { display: block; font-family: var(--f-head); font-size: clamp(30px, 3.4vw, 44px); line-height: 1.1; }
.ledger > div > span { font-family: var(--f-fell); font-style: italic; color: var(--ink-2); font-size: 17px; }

/* Footprints wandering the map */
.steps-layer { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.fp { position: absolute; width: 13px; height: 21px; opacity: 0; color: var(--ink); }
.fp svg { width: 100%; height: 100%; fill: currentColor; }
.fp.go { animation: step var(--life, 3.4s) linear forwards; }
@keyframes step { 0% { opacity: 0; } 8% { opacity: 0.75; } 55% { opacity: 0.75; } 100% { opacity: 0; } }
.fp-name {
  position: absolute; z-index: 3; pointer-events: none;
  font-family: var(--f-fell); font-style: italic; font-size: 14px; white-space: nowrap;
  padding: 1px 10px; border: 1px solid var(--ink); background: var(--card);
  opacity: 0; transition: opacity 0.6s, left 0.35s linear, top 0.35s linear;
}
.fp-name.on { opacity: 0.9; }

/* ---------- Map unfold intro ---------- */
.map-intro {
  position: fixed; inset: 0; z-index: 3000;
  display: grid; grid-template-columns: repeat(3, 1fr);
  perspective: 2400px;
  pointer-events: none;
}
.map-intro .leaf {
  background-color: var(--bg-2);
  background-image:
    radial-gradient(ellipse at 30% 20%, rgba(255, 255, 255, 0.3), transparent 60%),
    linear-gradient(var(--bg), var(--bg-2));
  box-shadow: inset 0 0 90px var(--shade);
  backface-visibility: hidden;
}
.map-intro .leaf:nth-child(1) { transform-origin: left center; animation: leaf-l 1.5s var(--ease) 0.75s forwards; }
.map-intro .leaf:nth-child(2) { animation: leaf-m 0.8s ease 1.45s forwards; }
.map-intro .leaf:nth-child(3) { transform-origin: right center; animation: leaf-r 1.5s var(--ease) 0.75s forwards; }
.map-intro-title {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 10px;
  font-family: var(--f-brand); font-size: clamp(24px, 3.4vw, 42px); color: var(--ink);
  animation: leaf-m 0.5s ease 0.7s forwards;
}
.map-intro-title small { font-family: var(--f-fell); font-style: italic; font-size: 0.5em; color: var(--ink-2); }
@keyframes leaf-l { to { transform: rotateY(-100deg); opacity: 0; } }
@keyframes leaf-r { to { transform: rotateY(100deg); opacity: 0; } }
@keyframes leaf-m { to { opacity: 0; } }

/* ---------- Golden flier (easter egg) ---------- */
.flier {
  position: fixed; left: 0; top: 0; z-index: 950;
  width: 58px; height: 26px; margin: -13px 0 0 -29px;
  cursor: pointer; pointer-events: auto;
  transition: opacity 0.6s;
}
.flier .ball {
  position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3b8, #e2b33f 45%, #9a6d12 100%);
  box-shadow: 0 0 14px rgba(255, 205, 90, 0.8);
}
.flier .wing {
  position: absolute; top: 3px; width: 22px; height: 12px;
  background: linear-gradient(90deg, rgba(255, 250, 235, 0.95), rgba(235, 220, 180, 0.5));
  border-radius: 100% 0 100% 0;
  animation: flap 0.12s ease-in-out infinite alternate;
}
.flier .wing.l { left: 0; transform-origin: right bottom; border-radius: 0 100% 0 100%; }
.flier .wing.r { right: 0; transform-origin: left bottom; }
@keyframes flap { from { transform: rotate(-24deg) scaleY(0.6); } to { transform: rotate(18deg) scaleY(1); } }
.flier.caught { opacity: 0; }
.toast {
  position: fixed; left: 50%; bottom: 32px; z-index: 1200; translate: -50% 20px;
  background: var(--card); border: 1.5px solid var(--ink);
  box-shadow: 0 14px 40px -10px var(--shade);
  padding: 14px 22px; font-family: var(--f-head); font-size: 15px; letter-spacing: 0.06em;
  opacity: 0; transition: opacity 0.4s, translate 0.4s var(--ease);
}
.toast.on { opacity: 1; translate: -50% 0; }
.toast b { color: var(--seal); }

/* ---------- Floating candles ---------- */
.candles { position: absolute; inset: 0 0 auto 0; height: 70%; pointer-events: none; z-index: 0; }
.hero .container, .section > .container { position: relative; z-index: 2; }
.candle {
  position: absolute; width: 10px; height: 44px;
  background: linear-gradient(90deg, #d9ccb0, #fbf5e6 45%, #cdbd9c);
  border-radius: 2px 2px 3px 3px;
  animation: bob var(--bob, 6s) ease-in-out infinite alternate;
  opacity: 0; transition: opacity 1.2s;
}
.candle::before {
  content: ''; position: absolute; left: 50%; top: -15px; width: 8px; height: 14px; margin-left: -4px;
  border-radius: 50% 50% 45% 45% / 65% 65% 35% 35%;
  background: radial-gradient(circle at 50% 70%, #fff7d6, #ffc24a 45%, rgba(255, 120, 20, 0.2) 75%);
  box-shadow: 0 0 18px 6px rgba(255, 175, 60, 0.45);
  animation: flicker 0.18s ease-in-out infinite alternate;
}
html.night .candle, .candles.always .candle { opacity: 0.9; }
@keyframes bob { from { transform: translateY(0); } to { transform: translateY(-16px); } }
@keyframes flicker { from { transform: scale(1, 1) rotate(-2deg); opacity: 0.9; } to { transform: scale(0.92, 1.08) rotate(2deg); opacity: 1; } }

/* ---------- Ribbon marquee ---------- */
.ribbon {
  border-block: 2px solid var(--ink); background: var(--ink); color: var(--bg);
  overflow: hidden; padding: 12px 0; transform: rotate(-1deg); margin: 10px 0;
}
.ribbon-track { display: flex; gap: 34px; width: max-content; animation: ribbon 44s linear infinite; font-family: var(--f-head); font-size: 17px; letter-spacing: 0.18em; }
.ribbon-track i { font-style: normal; color: var(--gold); }
@keyframes ribbon { to { transform: translateX(-50%); } }

/* ---------- Sections & chapters ---------- */
.section { position: relative; padding-block: clamp(80px, 10vw, 130px); }
.section-alt { background: color-mix(in srgb, var(--bg-2) 70%, transparent); border-block: 1px solid var(--line-soft); }
.chapter { display: grid; gap: 10px; margin-bottom: clamp(40px, 5vw, 64px); max-width: 860px; }
.chapter h2 { font-size: clamp(32px, 4.6vw, 56px); }
.chapter p { color: var(--ink-2); font-size: 19px; max-width: 42em; }
.chapter-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px 32px; margin-bottom: clamp(40px, 5vw, 64px); }
.chapter-row .chapter { margin-bottom: 0; }

/* Page hero for inner pages */
.page-hero { position: relative; overflow: hidden; padding: calc(var(--nav-h) + clamp(50px, 8vw, 100px)) 0 clamp(50px, 7vw, 80px); border-bottom: 2px solid var(--ink); }
.page-hero .container { position: relative; z-index: 2; }
.crumbs { font-family: var(--f-head); font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-2); display: flex; gap: 10px; flex-wrap: wrap; }
.crumbs a:hover { color: var(--seal); }
.crumbs [aria-current] { color: var(--seal); }
.page-hero h1 { font-size: clamp(42px, 7.4vw, 100px); line-height: 1; margin-top: 18px; max-width: 16ch; }
.page-hero h1 em { font-style: normal; color: var(--seal); }
.page-lede { font-size: clamp(19px, 1.7vw, 22px); max-width: 36em; margin-top: 22px; color: var(--ink); }
.js .page-hero .after-ink { opacity: 0; animation: fade-up 0.9s var(--ease) forwards; animation-delay: var(--after, 1.6s); }
.page-hero-actions { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 28px; }

/* ---------- Parchment cards ---------- */
.card {
  position: relative;
  background: var(--card);
  border: 1.5px solid var(--ink);
  padding: clamp(24px, 2.8vw, 34px);
  box-shadow: 6px 6px 0 var(--line-soft);
  transition: transform 0.4s var(--ease), box-shadow 0.4s;
}
.card::before { content: ''; position: absolute; inset: 5px; border: 1px solid var(--line); pointer-events: none; }
a.card:hover, .card.lift:hover { transform: translate(-3px, -3px); box-shadow: 10px 10px 0 var(--line); }
.card-label { font-family: var(--f-head); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--seal); }
.card h3 { font-size: clamp(22px, 2.2vw, 28px); margin-top: 12px; }
.card .tagline { font-family: var(--f-fell); font-style: italic; color: var(--ink-2); margin-top: 6px; }
.card p.desc { margin-top: 12px; font-size: 17.5px; }
.card-foot { margin-top: 20px; font-family: var(--f-head); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; display: flex; gap: 10px; align-items: center; }
.card-seal {
  position: absolute; right: -14px; top: -14px; width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; color: #f6ecd3; font-size: 16px;
  background: radial-gradient(circle at 35% 30%, #c44545, #5a1010 70%);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35), inset 0 0 0 3px rgba(0, 0, 0, 0.2);
  transform: rotate(-12deg); transition: transform 0.5s var(--ease);
}
a.card:hover .card-seal { transform: rotate(8deg) scale(1.06); }
.card-seal.gold { background: radial-gradient(circle at 35% 30%, #f3cf6d, #8a6214 75%); color: #3a2413; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 28px; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tags span {
  font-family: var(--f-head); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  border: 1px solid var(--line); padding: 5px 10px;
}

/* ---------- Home: intro ---------- */
.intro-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: clamp(32px, 6vw, 80px); align-items: end; }
.intro-lead { font-family: var(--f-body); font-size: clamp(24px, 2.6vw, 32px); line-height: 1.35; }
.intro-lead::first-letter {
  font-family: var(--f-brand); float: left; font-size: 3.1em; line-height: 0.85; margin: 6px 12px 0 0; color: var(--seal);
}
.intro-side p { color: var(--ink-2); margin-bottom: 20px; }

/* ---------- Home: the map ---------- */
.map {
  position: relative; border: 2px solid var(--ink); background: var(--card);
  padding: clamp(18px, 3vw, 36px);
  box-shadow: 8px 8px 0 var(--line-soft);
}
.map::before { content: ''; position: absolute; inset: 7px; border: 1px solid var(--line); pointer-events: none; }
.map-grid { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(28px, 5vw, 70px) clamp(20px, 4vw, 56px); z-index: 1; }
.map-paths { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; color: var(--ink-2); }
.map-paths path { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-dasharray: 5 7; opacity: 0.7; }
.room {
  position: relative; display: block; text-align: center;
  border: 1.5px solid var(--ink); background: var(--bg);
  padding: 22px 16px 18px;
  transition: transform 0.35s var(--ease), background-color 0.3s;
}
.room:hover { transform: translateY(-4px); background: var(--card); }
.room .room-num { font-family: var(--f-head); font-size: 11px; letter-spacing: 0.2em; color: var(--seal); }
.room h3 { font-size: clamp(19px, 2vw, 24px); margin-top: 6px; }
.room p { font-family: var(--f-fell); font-style: italic; color: var(--ink-2); font-size: 16px; margin-top: 4px; }
.room i.fa-solid { font-size: 20px; color: var(--ink-2); margin-bottom: 8px; display: block; }
.compass { position: absolute; right: 16px; bottom: 12px; width: 64px; height: 64px; color: var(--ink-2); opacity: 0.7; z-index: 1; animation: spin 60s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.map-legend { font-family: var(--f-fell); font-style: italic; color: var(--ink-2); margin-top: 16px; text-align: center; }

/* ---------- Writing rows (shared) ---------- */
.scrolls { border-top: 2px solid var(--ink); }
.scroll-row {
  display: grid; grid-template-columns: 110px 1fr auto; gap: clamp(16px, 3vw, 36px); align-items: baseline;
  padding: 22px 6px; border-bottom: 1px solid var(--line);
  transition: background-color 0.3s, padding 0.35s var(--ease);
}
.scroll-row:hover { background: var(--card); padding-inline: 16px; }
.scroll-date { font-family: var(--f-head); font-size: 12px; letter-spacing: 0.16em; color: var(--seal); }
.scroll-title { display: block; font-family: var(--f-head); font-weight: 700; font-size: clamp(18px, 1.9vw, 23px); line-height: 1.25; }
.scroll-blurb { display: block; font-family: var(--f-fell); font-style: italic; color: var(--ink-2); font-size: 17px; margin-top: 6px; }
.scroll-quill { color: var(--ink-2); font-size: 16px; transition: transform 0.35s var(--ease), color 0.3s; }
.scroll-row:hover .scroll-quill { transform: translate(4px, -4px) rotate(-10deg); color: var(--seal); }

/* ---------- Writing: newspaper ---------- */
.gazette { border: 2px solid var(--ink); background: var(--card); padding: clamp(18px, 3vw, 34px); box-shadow: 8px 8px 0 var(--line-soft); }
.gazette-mast { text-align: center; border-bottom: 3px double var(--ink); padding-bottom: 12px; }
.gazette-mast .masthead { font-family: var(--f-black); font-size: clamp(44px, 7vw, 92px); line-height: 1; }
.gazette-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-family: var(--f-head); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; padding: 8px 0; border-bottom: 1px solid var(--ink); }
.gazette-lead { display: grid; grid-template-columns: 1.3fr 0.7fr; gap: clamp(20px, 4vw, 44px); padding-top: 22px; align-items: start; }
.gazette-lead h2 { font-size: clamp(28px, 3.8vw, 48px); line-height: 1.05; }
.gazette-lead h2 a:hover { color: var(--seal); }
.gazette-lead .deck { font-family: var(--f-fell); font-style: italic; font-size: 20px; color: var(--ink-2); margin-top: 12px; }
.gazette-photo { border: 1.5px solid var(--ink); padding: 6px; background: var(--bg); }
.gazette-photo .portrait-photo { aspect-ratio: 4 / 5; }
.gazette-photo figcaption { font-family: var(--f-fell); font-style: italic; font-size: 14px; text-align: center; margin-top: 6px; color: var(--ink-2); }
.column-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 28px; margin: clamp(48px, 6vw, 72px) 0 22px; }
.column-head h2 { font-size: clamp(28px, 3.4vw, 42px); }
.column-head p { font-family: var(--f-fell); font-style: italic; color: var(--ink-2); margin-top: 6px; }

/* ---------- Houses (skills) ---------- */
.houses { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.house { text-align: center; padding-top: 30px; }
.crest { transition: transform 0.5s var(--ease); }
.house:hover .crest { transform: rotate(-4deg) scale(1.05); }
.house h3 { font-size: 22px; margin-top: 0; }
.house .motto { font-family: var(--f-fell); font-style: italic; color: var(--ink-2); font-size: 16px; }
.house .tags { justify-content: center; }
.house .tags span.hot { border-color: var(--seal); color: var(--seal); }
.house[data-house="lion"] { --ha: var(--lion-a); --hb: var(--lion-b); }
.house[data-house="eagle"] { --ha: var(--eagle-a); --hb: var(--eagle-b); }
.house[data-house="serpent"] { --ha: var(--serpent-a); --hb: var(--serpent-b); }
.house[data-house="badger"] { --ha: var(--badger-a); --hb: var(--badger-b); }
.house { border-top: 6px solid var(--ha); }


/* Painted crests (img/crest-*.webp) */
.crest, .mini-crest { display: block; }
.crest img, .mini-crest img { width: 100%; height: auto; filter: drop-shadow(0 6px 8px var(--shade)); }
.crest { width: 132px; height: auto; margin: 0 auto 12px; }
.mini-crest { width: 52px; height: auto; }
.sort-result .mini-crest { width: 72px; float: right; margin: 0 0 8px 16px; }
.house-name { display: block; font-family: var(--f-head); font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ha); margin-bottom: 6px; }
html.night .house-name { color: var(--hb); }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: minmax(260px, 380px) 1fr; gap: clamp(36px, 6vw, 84px); align-items: start; }
.about-grid .portrait { position: sticky; top: calc(var(--nav-h) + 30px); }
.about-lead { font-size: clamp(22px, 2.3vw, 28px); line-height: 1.4; font-family: var(--f-body); }
.about-lead::first-letter { font-family: var(--f-brand); float: left; font-size: 3em; line-height: 0.85; margin: 6px 12px 0 0; color: var(--seal); }
.about-body { margin-top: 22px; }
.record { display: grid; grid-template-columns: repeat(2, 1fr); border-top: 2px solid var(--ink); margin-top: 32px; }
.record div { padding: 14px 4px; border-bottom: 1px dashed var(--line); display: grid; gap: 2px; }
.record dt { font-family: var(--f-head); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--seal); }
.record dd { font-size: 18px; }

/* ---------- Chronicle (timeline) ---------- */
.tabs { display: inline-flex; border: 1.5px solid var(--ink); }
.tab { font-family: var(--f-head); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; padding: 12px 20px; transition: background-color 0.3s, color 0.3s; }
.tab[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.tab:hover:not([aria-pressed="true"]) { color: var(--seal); }
.chronicle { position: relative; padding-left: clamp(96px, 12vw, 150px); }
.chronicle::before { content: ''; position: absolute; left: clamp(64px, 8vw, 100px); top: 10px; bottom: 10px; border-left: 2px dotted var(--ink-2); }
.entry { position: relative; margin-bottom: 36px; }
.entry:last-child { margin-bottom: 0; }
.entry-year {
  position: absolute; left: calc(-1 * clamp(96px, 12vw, 150px)); top: 26px; width: clamp(56px, 7vw, 88px);
  text-align: right; font-family: var(--f-head); font-weight: 700; font-size: clamp(16px, 1.7vw, 20px); color: var(--seal);
}
.entry::before {
  content: ''; position: absolute; top: 30px;
  left: calc(clamp(64px, 8vw, 100px) - clamp(96px, 12vw, 150px) - 7px);
  width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #c44545, #5a1010 70%);
  box-shadow: 0 0 0 4px var(--bg);
}
.entry .date { font-family: var(--f-head); font-size: 12px; letter-spacing: 0.16em; color: var(--ink-2); }
.entry h3 { font-size: clamp(22px, 2.4vw, 30px); margin-top: 6px; }
.entry .org { font-family: var(--f-fell); font-style: italic; color: var(--ink-2); margin-top: 2px; }
.entry ul { margin-top: 14px; display: grid; gap: 8px; }
.entry li { padding-left: 26px; position: relative; font-size: 17.5px; }
.entry li::before { content: '✦'; position: absolute; left: 2px; top: 1px; color: var(--seal); font-size: 13px; }

/* ---------- Workshop filters & commissions ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; }
.filter { font-family: var(--f-head); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; padding: 10px 16px; border: 1.5px solid var(--ink); transition: background-color 0.3s, color 0.3s; }
.filter[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.filter:hover:not([aria-pressed="true"]) { color: var(--seal); border-color: var(--seal); }
.commission .card-top { display: flex; justify-content: space-between; gap: 12px; }
.commission .year { font-family: var(--f-head); font-size: 12px; letter-spacing: 0.16em; color: var(--ink-2); }
.commission .org { font-family: var(--f-fell); font-style: italic; color: var(--ink-2); margin-top: 4px; }
.card.repo .card-foot { margin-top: 14px; }

/* ---------- Great Hall (talks) ---------- */
.hall { display: grid; grid-template-columns: repeat(3, 1fr); gap: 34px 28px; }
.picture { display: grid; gap: 12px; align-content: start; }
.picture-frame {
  position: relative; padding: 10px;
  background: linear-gradient(140deg, #8a6330, #3a2413 55%, #6e4b24);
  box-shadow: 0 16px 30px -12px var(--shade);
}
.picture-frame::before { content: ''; position: absolute; inset: 5px; border: 1px solid rgba(214, 170, 90, 0.75); pointer-events: none; z-index: 2; }
.talk-card { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #1b120a; cursor: pointer; }
.talk-card img { width: 100%; height: 100%; object-fit: cover; filter: sepia(0.55) contrast(1.05); transition: filter 0.5s, transform 0.8s var(--ease); }
.picture:hover .talk-card img { filter: sepia(0.1); transform: scale(1.05); }
.talk-card iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.talk-play { position: absolute; inset: 0; display: grid; place-items: center; width: 100%; }
.talk-play i {
  width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; padding-left: 4px;
  color: #f6ecd3; font-size: 18px;
  background: radial-gradient(circle at 35% 30%, #c44545, #5a1010 70%);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4);
  transition: transform 0.4s var(--ease);
}
.picture:hover .talk-play i { transform: scale(1.1) rotate(-8deg); }
.picture figcaption { display: grid; gap: 4px; }
.picture .kind { font-family: var(--f-head); font-size: 11px; letter-spacing: 0.18em; color: var(--seal); }
.picture .title { font-family: var(--f-head); font-weight: 700; font-size: 18px; line-height: 1.3; }
.picture .src { font-family: var(--f-fell); font-style: italic; color: var(--ink-2); font-size: 16px; }

/* ---------- Owlery (contact) ---------- */
.letter-wrap { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: clamp(32px, 5vw, 64px); align-items: start; }
.letter {
  position: relative; background: var(--card); border: 1.5px solid var(--ink);
  padding: clamp(28px, 4vw, 52px);
  box-shadow: 10px 10px 0 var(--line-soft);
}
.letter::before { content: ''; position: absolute; inset: 6px; border: 1px solid var(--line); pointer-events: none; }
.letter-addr { font-family: var(--f-fell); font-style: italic; color: var(--emerald); font-size: 19px; line-height: 1.45; }
.letter-body { margin-top: 24px; font-size: 19px; }
.letter-body p + p { margin-top: 14px; }
.letter-sign { margin-top: 26px; font-family: var(--f-fell); font-style: italic; font-size: 22px; }
.letter-seal {
  position: absolute; right: clamp(20px, 4vw, 44px); bottom: -26px; width: 78px; height: 78px; border-radius: 50%;
  display: grid; place-items: center; color: #f6ecd3; font-family: var(--f-brand); font-size: 30px;
  background: radial-gradient(circle at 35% 30%, #c44545, #5a1010 72%);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.35), inset 0 0 0 5px rgba(0, 0, 0, 0.18);
  transform: rotate(-14deg);
}
.owl-post { display: grid; gap: 18px; }
.owl-post .mail { font-family: var(--f-head); font-weight: 700; font-size: clamp(20px, 2.4vw, 28px); border-bottom: 2px solid var(--seal); justify-self: start; }
.owl-post .mail:hover { color: var(--seal); }
.owl-post dl { display: grid; gap: 14px; }
.owl-post dt { font-family: var(--f-head); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--seal); }
.owl-post dd { font-size: 18px; }
.socials { display: flex; gap: 10px; }
.socials a { width: 44px; height: 44px; border: 1.5px solid var(--ink); border-radius: 50%; display: grid; place-items: center; transition: background-color 0.3s, color 0.3s; }
.socials a:hover { background: var(--ink); color: var(--bg); }

/* The owl flies across when the letter appears (img/owl-letter.webp) */
.owl { position: absolute; top: 12%; left: -200px; width: clamp(120px, 16vw, 190px); height: auto; z-index: 3; pointer-events: none; opacity: 0; filter: drop-shadow(0 10px 14px var(--shade)); }
.owl.fly { animation: owl-fly 6.5s ease-in-out forwards; }
@keyframes owl-fly {
  0% { transform: translate(0, 60px) rotate(8deg) scale(0.85); opacity: 0; }
  10% { opacity: 1; }
  30% { transform: translate(28vw, -10px) rotate(-3deg) scale(1); }
  55% { transform: translate(60vw, -40px) rotate(4deg) scale(1.02); }
  90% { opacity: 1; }
  100% { transform: translate(120vw, -150px) rotate(-6deg) scale(0.9); opacity: 0; }
}

/* Sorting */
.sorting { max-width: 980px; }
.sort-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.sort-opt {
  text-align: left; border: 1.5px solid var(--ink); background: var(--card); padding: 18px 20px;
  display: grid; grid-template-columns: 48px 1fr; gap: 16px; align-items: center;
  transition: transform 0.3s var(--ease), background-color 0.3s, border-color 0.3s;
}
.sort-opt:hover { transform: translateY(-3px); }
.sort-opt[aria-pressed="true"] { border-color: var(--ha); box-shadow: inset 0 0 0 2px var(--ha); }
.sort-opt .mini-crest { width: 52px; }
.sort-opt b { display: block; font-family: var(--f-head); font-style: normal; font-size: 16px; color: var(--ink); }
.sort-opt .sort-q > span { font-family: var(--f-fell); font-style: italic; color: var(--ink-2); font-size: 16px; }
.sort-result { margin-top: 24px; border-left: 6px solid var(--ha, var(--seal)); padding: 20px 24px; background: var(--card); }
.sort-result h3 { font-size: 24px; }
.sort-result p { margin-top: 8px; }
.sort-result .btn { margin-top: 18px; }
.sort-opt[data-house="lion"], .sort-result[data-house="lion"] { --ha: var(--lion-a); }
.sort-opt[data-house="eagle"], .sort-result[data-house="eagle"] { --ha: var(--eagle-a); }
.sort-opt[data-house="serpent"], .sort-result[data-house="serpent"] { --ha: var(--serpent-a); }
.sort-opt[data-house="badger"], .sort-result[data-house="badger"] { --ha: var(--badger-a); }

/* ---------- Credentials ---------- */
.cred-list { border-top: 2px solid var(--ink); margin-top: 10px; }
.cred-list li { display: flex; justify-content: space-between; gap: 16px; padding: 12px 2px; border-bottom: 1px dashed var(--line); }
.cred-list .meta { font-family: var(--f-head); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); }

/* ---------- Call to owl band ---------- */
.cta-band { text-align: center; }
.cta-band h2 { font-size: clamp(40px, 7vw, 92px); line-height: 1; }
.cta-band h2 em { font-style: normal; color: var(--seal); }
.cta-band p { font-family: var(--f-fell); font-style: italic; color: var(--ink-2); font-size: 20px; margin-top: 16px; }
.cta-band .actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; margin-top: 30px; }

/* ---------- Turn the page ---------- */
.next-page { border-top: 2px solid var(--ink); }
.next-page a { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-block: clamp(50px, 7vw, 90px); }
.next-page .label { display: block; margin-bottom: 10px; }
.next-page .next-title { display: block; font-family: var(--f-head); font-weight: 700; font-size: clamp(38px, 7vw, 92px); line-height: 1; transition: color 0.3s; }
.next-page .next-sub { display: block; font-family: var(--f-fell); font-style: italic; color: var(--ink-2); font-size: 20px; margin-top: 8px; }
.next-page .page-corner {
  width: clamp(56px, 7vw, 90px); aspect-ratio: 1; flex-shrink: 0;
  background: linear-gradient(135deg, transparent 49%, var(--ink) 50%, var(--bg-2) 52%);
  border: 1.5px solid var(--ink); transition: transform 0.5s var(--ease);
}
.next-page a:hover .next-title { color: var(--seal); }
.next-page a:hover .page-corner { transform: rotate(-8deg) scale(1.08); }

/* ---------- Footer ---------- */
.footer { border-top: 2px solid var(--ink); padding: clamp(56px, 7vw, 84px) 0 32px; background: color-mix(in srgb, var(--bg-2) 60%, transparent); }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 40px; padding-bottom: 40px; border-bottom: 1px solid var(--line); }
.footer .brand-name { font-size: 22px; }
.footer-blurb { font-family: var(--f-fell); font-style: italic; color: var(--ink-2); margin-top: 14px; max-width: 30ch; }
.footer-mail { display: inline-block; margin-top: 16px; font-family: var(--f-head); font-weight: 700; border-bottom: 1.5px solid var(--seal); }
.footer-mail:hover { color: var(--seal); }
.footer h4 { font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--seal); margin-bottom: 14px; }
.footer-links { display: grid; gap: 8px; }
.footer-links a { transition: color 0.3s; }
.footer-links a:hover, .footer-links a[aria-current] { color: var(--seal); }
.footer-links a small { font-family: var(--f-fell); font-style: italic; color: var(--ink-2); }
.footer-base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-top: 24px; font-size: 16px; color: var(--ink-2); }
.footer-base .motto { font-family: var(--f-fell); font-style: italic; }
.footer-base a:hover { color: var(--seal); }

/* ---------- Scroll reveals ---------- */
.js .reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- 404 ---------- */
.lost { min-height: 100svh; display: grid; place-items: center; text-align: center; padding: calc(var(--nav-h) + 40px) 0 60px; }
.lost .platform { font-family: var(--f-brand); font-size: clamp(64px, 14vw, 180px); line-height: 1; color: var(--seal); }
.lost p { font-family: var(--f-fell); font-style: italic; font-size: 22px; color: var(--ink-2); max-width: 30em; margin: 16px auto 28px; }

/* ---------- Cross-page transitions ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: 0.35s ease both page-out; }
::view-transition-new(root) { animation: 0.45s ease both page-in; }
@keyframes page-out { to { opacity: 0; transform: translateX(-2%) rotateY(4deg); } }
@keyframes page-in { from { opacity: 0; transform: translateX(2%); } }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .nav-list { gap: 16px; }
  .nav-cv { display: none; }
}
@media (max-width: 1080px) {
  .grid-3, .hall { grid-template-columns: repeat(2, 1fr); }
  .houses { grid-template-columns: repeat(2, 1fr); row-gap: 40px; }
}
@media (max-width: 980px) {
  :root { --nav-h: 72px; }
  .nav-toggle {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; width: 46px; height: 46px; order: 3;
    border: 1.5px solid var(--ink); z-index: 1102;
  }
  .nav-toggle span { display: block; width: 20px; height: 2px; background: var(--ink); transition: transform 0.35s var(--ease); }
  .nav-toggle.active span:first-child { transform: translateY(4px) rotate(45deg); }
  .nav-toggle.active span:last-child { transform: translateY(-4px) rotate(-45deg); }
  .theme-toggle { order: 2; }
  .music-toggle { margin-left: auto; }
  .nav-menu {
    position: fixed; inset: 0; z-index: 1101;
    background: var(--bg);
    background-image: radial-gradient(ellipse at 50% 30%, var(--card), transparent 70%);
    flex-direction: column; align-items: flex-start; justify-content: center; gap: 30px;
    padding: 12vh 9vw;
    clip-path: inset(0 0 100% 0);
    transition: clip-path 0.6s var(--ease), visibility 0s 0.6s;
    visibility: hidden;
  }
  .nav-menu.open { clip-path: inset(0 0 0 0); visibility: visible; transition: clip-path 0.6s var(--ease); }
  .nav-list { flex-direction: column; gap: 18px; }
  .nav-link { align-items: flex-start; font-size: clamp(24px, 6vw, 34px); letter-spacing: 0.08em; }
  .nav-link i { font-size: 17px; }
  .nav-link::after { display: none; }
  .nav-cv { display: inline-block; }
  .nav-menu-foot { display: flex; gap: 18px; font-family: var(--f-head); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); }
  .hero-grid, .intro-grid, .about-grid, .letter-wrap, .gazette-lead { grid-template-columns: 1fr; }
  .hero .portrait { max-width: 360px; }
  .about-grid .portrait { position: static; max-width: 360px; }
  .gazette-photo { max-width: 320px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 680px) {
  body { font-size: 18px; }
  .brand-name { font-size: 16px; }
  .brand-name small { display: none; }
  .brand-mark { width: 38px; }
  .brand-name { white-space: nowrap; }
  .nav-inner { gap: 10px; }
  .theme-toggle, .nav-toggle { width: 40px; height: 40px; }
  .music-toggle { margin-left: auto; }
  .grid-3, .grid-2, .hall, .houses, .sort-options, .record { grid-template-columns: 1fr; }
  .ledger { grid-template-columns: repeat(2, 1fr); }
  .ledger > div:nth-child(2) { border-right: 0; }
  .ledger > div:nth-child(-n+2) { border-bottom: 1px dashed var(--line); }
  .map-grid { grid-template-columns: repeat(2, 1fr); gap: 18px; }
  .map-paths, .compass { display: none; }
  .scroll-row { grid-template-columns: 1fr; gap: 6px; }
  .scroll-quill { display: none; }
  .chronicle { padding-left: 0; }
  .chronicle::before, .entry::before { display: none; }
  .entry-year { position: static; width: auto; text-align: left; margin-bottom: 8px; }
  .card-seal { right: 10px; }
  .footer-grid { grid-template-columns: 1fr; }
  .next-page .page-corner { display: none; }
}

@media (max-width: 380px) {
  .brand-name { font-size: 14px; }
  .brand-mark { width: 32px; }
  .brand { gap: 8px; }
}
.nav-toggle, .theme-toggle { flex-shrink: 0; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
  .js .ink .ink-line { clip-path: none; }
  .js .flourish path { stroke-dashoffset: 0; }
  .js .reveal, .js .hero .after-ink, .js .page-hero .after-ink { opacity: 1; transform: none; }
  .map-intro, .flier, .lantern, .owl, .steps-layer, .fp-name { display: none !important; }
  .portrait-photo video { visibility: hidden; }
  .portrait-photo video + img { display: block; }
}

/* ---------- Moving portraits on video (loops with a painted poster) ---------- */
.portrait-photo video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
  background: #2a1a0d; animation: breathe 9s ease-in-out infinite alternate;
}
.portrait-photo video + img { display: none; }   /* poster fallback, shown only under reduced motion */
.portrait-photo.wide { aspect-ratio: 16 / 9; }

/* ---------- Page heroes with a framed picture ---------- */
.page-hero-grid { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: clamp(32px, 5vw, 72px); align-items: center; }
.page-hero-grid .portrait { width: 100%; max-width: 520px; justify-self: end; }
.page-hero-grid .portrait.wide-frame { max-width: 640px; }

/* ---------- Home: the illustrated castle map ---------- */
.map-illustrated { padding: 0; background: var(--card); }
.map-illustrated .map-art { width: 100%; height: auto; display: block; }
html.night .map-illustrated .map-art { filter: brightness(0.7) sepia(0.25); }
.map-illustrated .map-paths, .map-illustrated .compass { display: none; }
.map-illustrated .map-grid { position: absolute; inset: 0; display: block; }
.map-illustrated .room {
  position: absolute; width: clamp(150px, 24%, 290px); transform: translate(-50%, -50%);
  padding: clamp(8px, 1.2vw, 14px) clamp(8px, 1.2vw, 16px) clamp(8px, 1vw, 12px);
  background: color-mix(in srgb, var(--card) 90%, transparent);
  box-shadow: 0 10px 24px -12px var(--shade);
  transition: transform 0.35s var(--ease), background-color 0.3s;
}
.map-illustrated .room:hover { transform: translate(-50%, -50%) translateY(-4px); background: var(--card); }
.map-illustrated .room i.fa-solid { display: none; }
.map-illustrated .room h3 { font-size: clamp(15px, 1.7vw, 22px); margin-top: 2px; }
.map-illustrated .room p { font-size: clamp(12px, 1.2vw, 15px); margin-top: 2px; line-height: 1.3; }
.map-illustrated .room .room-num { font-size: clamp(9px, 0.9vw, 11px); }
.map-illustrated .room[data-spot="study"]     { left: 23.5%; top: 42%; }
.map-illustrated .room[data-spot="chronicle"] { left: 50%;   top: 36%; }
.map-illustrated .room[data-spot="hall"]      { left: 76.5%; top: 43%; }
.map-illustrated .room[data-spot="workshop"]  { left: 21%;   top: 77%; }
.map-illustrated .room[data-spot="owlery"]    { left: 51%;   top: 86%; }
.map-illustrated .room[data-spot="writing"]   { left: 80%;   top: 78%; }
@media (max-width: 680px) {
  .map-illustrated .map-art { border-bottom: 2px solid var(--ink); }
  .map-illustrated .map-grid { position: static; display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; padding: 14px; }
  .map-illustrated .room { position: static; transform: none; width: auto; padding: 18px 12px 14px; background: var(--bg); box-shadow: none; }
  .map-illustrated .room:hover { transform: translateY(-4px); }
  .map-illustrated .room i.fa-solid { display: block; }
}

/* ---------- Platform 404¾ on a sealed parchment ---------- */
.lost-sheet {
  position: relative; width: min(1000px, 100%); margin: 0 auto; aspect-ratio: 1731 / 909;
  background: url("../img/parchment-seal.webp") center / cover no-repeat;
  display: grid; align-content: center; justify-items: center; text-align: center;
  padding: 7% 26% 8% 12%; color: #33200f;
  filter: drop-shadow(0 24px 40px var(--shade));
}
html.night .lost-sheet { filter: drop-shadow(0 24px 40px var(--shade)) brightness(0.85); }
.lost-sheet .label { color: #7c1d1d; }
.lost-sheet .platform { color: #7c1d1d; font-size: clamp(56px, 10vw, 150px); }
.lost-sheet p { color: #5a3d20; font-size: clamp(17px, 1.8vw, 22px); margin: 10px auto 22px; }
@media (max-width: 680px) {
  .lost-sheet { aspect-ratio: auto; padding: 56px 26px 48px; background-size: cover; }
  .lost-sheet .platform { font-size: clamp(56px, 18vw, 96px); }
}
@media (max-width: 980px) {
  .page-hero-grid { grid-template-columns: 1fr; }
  .page-hero-grid .portrait { justify-self: start; max-width: 360px; }
}
