@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400..800;1,400..800&family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&family=Outfit:wght@100..900&display=swap');

:root {
  /* Dark Scholarly Theme (Arcane Scholar) */
  --background: #141313;
  --surface: #141313;
  --surface-dim: #141313;
  --surface-bright: #3a3939;
  --surface-container-lowest: #0f0e0e;
  --surface-container-low: #1c1b1b;
  --surface-container: #201f1f;
  --surface-container-high: #2b2a2a;
  --surface-container-highest: #363434;
  --on-surface: #e6e1e1;
  --on-surface-variant: #d0c5b6;
  --outline: #998f81;
  --outline-variant: #4d463a;
  --surface-tint: #e2c287;

  --primary: #ffdea2;
  --on-primary: #402d01;
  --primary-container: #e2c287;
  --on-primary-container: #664f1f;
  --inverse-primary: #735b2a;

  --secondary: #b0ceb5;
  --on-secondary: #1c3624;
  --secondary-container: #324d3a;
  --on-secondary-container: #9fbca4;

  --tertiary: #ffdad5;
  --on-tertiary: #670409;
  --tertiary-container: #ffb3ab;
  --on-tertiary-container: #982a26;

  /* Semantic Brand Names */
  --oxidized-espresso: #2B160C;
  --tarnished-gold: #C2A46B;
  --ancient-moss: #3F5A46;
  --blackened-ivy: #0F2A22;
  --burnt-rust: #A13E1E;
  --parchment: #fdf5e6;

  /* Typography variables */
  --font-serif: 'EB Garamond', serif;
  --font-sans: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --transition-slow: 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
  --transition-md: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --transition-fast: 0.15s ease;

  --gold-glow: 0 0 15px rgba(226, 194, 135, 0.4);
  --gold-glow-intense: 0 0 25px rgba(226, 194, 135, 0.85);
  --moss-glow: 0 0 15px rgba(176, 206, 181, 0.4);
  --rust-glow: 0 0 15px rgba(161, 62, 30, 0.5);
}

/* Light Manuscript Theme */
body.light-theme {
  --background: #fdf5e6;
  /* parchment */
  --surface: #f7ede2;
  --surface-dim: #ebd7c0;
  --surface-bright: #fffdf9;
  --surface-container-lowest: #fcf8f2;
  --surface-container-low: #f4e7d3;
  --surface-container: #fdf5e6;
  --surface-container-high: #ebdcc5;
  --surface-container-highest: #dec7a5;
  --on-surface: #2B160C;
  /* espresso ink */
  --on-surface-variant: #543425;
  --outline: #785a4a;
  --outline-variant: #bca08d;

  --primary: #855f10;
  --on-primary: #fdf5e6;
  --primary-container: #ebd09b;
  --on-primary-container: #3a2700;

  --secondary: #324d3a;
  --on-secondary: #fdf5e6;

  --tertiary: #A13E1E;

  --gold-glow: 0 0 12px rgba(133, 95, 16, 0.3);
  --gold-glow-intense: 0 0 20px rgba(133, 95, 16, 0.6);
}

/* Base resets & styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  background-color: var(--background);
}

body {
  font-family: var(--font-sans);
  background-color: var(--background);
  color: var(--on-surface);
  transition: background-color var(--transition-slow), color var(--transition-slow);
  overflow-x: hidden;
  position: relative;
  min-height: 100dvh;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--surface-container-lowest);
  border-left: 1px solid var(--outline-variant);
}

::-webkit-scrollbar-thumb {
  background: var(--outline-variant);
  border: 2px solid var(--surface-container-lowest);
  border-radius: var(--rounded-md);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--tarnished-gold);
}

/* Noise overlay */
.noise-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.04;
}

/* Parchment light mode texture */
.parchment-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  background-color: #fdf5e6;
  background-image:
    radial-gradient(circle at 30% 20%, rgba(240, 220, 190, 0.15) 0%, transparent 60%),
    radial-gradient(circle at 80% 70%, rgba(220, 190, 160, 0.2) 0%, transparent 50%),
    linear-gradient(rgba(43, 22, 12, 0.02) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 100% 4px;
  opacity: 0;
  transition: opacity var(--transition-slow);
}

body.light-theme .parchment-overlay {
  opacity: 1;
}

/* Custom Cursor trailing styling */
.custom-cursor {
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
  position: fixed;
  pointer-events: none;
  z-index: 10000;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px var(--primary);
  transition: transform 0.1s ease, background 0.3s ease;
}

.cursor-trail {
  position: fixed;
  pointer-events: none;
  z-index: 9998;
  width: 4px;
  height: 4px;
  background: var(--secondary);
  border-radius: 50%;
  opacity: 0.6;
  transform: translate(-50%, -50%);
  box-shadow: var(--moss-glow);
}

/* Container */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 2;
}

/* Navigation bar */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 72px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--outline-variant);
  z-index: 1000;
  background: rgba(20, 19, 19, 0.8);
  transition: background var(--transition-slow), border-color var(--transition-slow);
}

body.light-theme .navbar {
  background: rgba(253, 245, 230, 0.85);
  border-bottom: 1px solid var(--outline-variant);
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
}

.nav-brand {
  font-family: var(--font-serif);
  font-size: 24px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-shadow: var(--gold-glow);
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-links {
  display: flex;
  gap: 32px;
  list-style: none;
  align-items: center;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--on-surface-variant);
  text-decoration: none;
  transition: color var(--transition-fast), text-shadow var(--transition-fast);
  position: relative;
  padding: 4px 0;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background-color: var(--primary);
  box-shadow: var(--gold-glow);
  transition: width var(--transition-md);
}

.nav-links a:hover {
  color: var(--primary);
  text-shadow: var(--gold-glow);
}

.nav-links a:hover::after {
  width: 100%;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 20px;
}

.btn-control {
  background: none;
  border: 1px solid var(--outline-variant);
  color: var(--on-surface);
  cursor: pointer;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all var(--transition-fast);
}

.btn-control:hover {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: var(--gold-glow);
  transform: translateY(-2px);
}

.btn-control:active {
  transform: translateY(0) scale(0.95);
}

/* Tavern Ambience Player Panel */
.tavern-player {
  position: relative;
}

.tavern-panel {
  position: absolute;
  top: 48px;
  right: 0;
  background: var(--surface-container-high);
  border: 1px solid var(--outline);
  border-radius: 4px;
  padding: 16px;
  width: 240px;
  box-shadow: var(--gold-glow), 0 10px 25px rgba(0, 0, 0, 0.5);
  display: none;
  flex-direction: column;
  gap: 12px;
  z-index: 1001;
  animation: fadeIn var(--transition-fast);
}

.tavern-panel.active {
  display: flex;
}

.tavern-title {
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--primary);
  border-bottom: 1px solid var(--outline-variant);
  padding-bottom: 6px;
  text-align: center;
}

.tavern-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.volume-slider {
  flex-grow: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--outline-variant);
  border-radius: 2px;
  outline: none;
}

.volume-slider::-webkit-scrollbar-thumb {
  background: var(--primary);
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: var(--gold-glow);
}

/* Sections General */
section {
  padding: 128px 0;
  position: relative;
  overflow: hidden;
}

.section-header {
  text-align: center;
  margin-bottom: 64px;
}

.section-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  color: var(--outline);
  text-transform: uppercase;
  margin-bottom: 12px;
  display: block;
}

.section-title {
  font-family: var(--font-serif);
  font-size: 48px;
  color: var(--primary);
  font-weight: 400;
  text-shadow: var(--gold-glow);
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: '';
  display: block;
  width: 60px;
  height: 1px;
  background: var(--primary);
  box-shadow: var(--gold-glow);
  margin: 16px auto 0 auto;
}

/* Hero Section (Aether) */
.hero {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  position: relative;
  padding-top: 96px;
  padding-bottom: 80px;
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.hero-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--secondary);
  border: 1px solid var(--secondary);
  padding: 6px 16px;
  border-radius: 9999px;
  background: rgba(176, 206, 181, 0.05);
  box-shadow: var(--moss-glow);
  animation: pulseMoss 3s infinite ease-in-out;
}

.hero-headline {
  font-family: var(--font-serif);
  font-size: 64px;
  line-height: 1.1;
  color: var(--primary);
  text-shadow: var(--gold-glow);
  font-weight: 400;
}

.hero-headline span {
  display: block;
  font-size: 32px;
  font-family: var(--font-sans);
  color: var(--on-surface-variant);
  font-weight: 300;
  letter-spacing: 0.05em;
  text-shadow: none;
  margin-top: 10px;
}

.hero-subtext {
  font-size: 18px;
  line-height: 1.6;
  color: var(--on-surface-variant);
  max-width: 60ch;
}

.hero-ctas {
  display: flex;
  gap: 16px;
  margin-top: 16px;
}

/* Button variants */
.btn {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  padding: 14px 28px;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all var(--transition-fast);
}

.btn-primary {
  background: var(--burnt-rust);
  color: #ffffff;
  border: none;
  box-shadow: var(--rust-glow);
}

.btn-primary:hover {
  background: #c24d26;
  box-shadow: 0 0 20px rgba(194, 77, 38, 0.7);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
}

.btn-secondary {
  border: 1px solid var(--primary);
  background: transparent;
  color: var(--primary);
  box-shadow: var(--gold-glow);
}

.btn-secondary:hover {
  background: rgba(226, 194, 135, 0.1);
  box-shadow: var(--gold-glow-intense);
  transform: translateY(-2px);
}

.btn-secondary:active {
  transform: translateY(0) scale(0.98);
}

/* Digital Artifacts (3D Project Carousel) */
.chronicles {
  background: radial-gradient(circle at center, rgba(43, 22, 12, 0.15) 0%, transparent 70%);
}

.carousel-viewport {
  height: 480px;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 1200px;
  overflow: visible;
  cursor: grab;
}

.carousel-viewport:active {
  cursor: grabbing;
}

.carousel-container {
  width: 320px;
  height: 420px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.carousel-card {
  position: absolute;
  width: 320px;
  height: 420px;
  left: 0;
  top: 0;
  background: rgba(20, 19, 19, 0.95);
  border: 1px solid var(--outline-variant);
  border-top: 2px solid var(--primary);
  border-radius: 4px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  backface-visibility: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  transition: border-color var(--transition-md), box-shadow var(--transition-md);
  user-select: none;
}

body.light-theme .carousel-card {
  background: rgba(253, 245, 230, 0.95);
  border: 1px solid var(--outline);
  border-top: 2px solid var(--primary);
  box-shadow: 0 5px 15px rgba(43, 22, 12, 0.15);
}

.carousel-card:hover {
  border-color: var(--primary);
  box-shadow: var(--gold-glow), 0 15px 35px rgba(0, 0, 0, 0.6);
}

.card-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--outline);
}

.card-title {
  font-family: var(--font-serif);
  font-size: 28px;
  color: var(--primary);
  margin-top: 8px;
  line-height: 1.2;
}

.card-desc {
  font-size: 14px;
  color: var(--on-surface-variant);
  line-height: 1.5;
  margin-top: 12px;
  flex-grow: 1;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.card-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  color: var(--secondary);
  border: 1px solid rgba(176, 206, 181, 0.3);
  padding: 3px 8px;
  border-radius: 2px;
  background: rgba(176, 206, 181, 0.05);
}

.card-footer {
  margin-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-link {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--primary);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.card-link:hover {
  text-shadow: var(--gold-glow);
  transform: translateX(4px);
}

.carousel-instructions {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--outline);
  margin-top: 32px;
}

/* Grimoire of Expertise (Skills) */
.skills {
  background: radial-gradient(circle at center, rgba(15, 42, 34, 0.12) 0%, transparent 70%);
}

.skills-grid {
  display: grid;
  grid-template-cols: 1fr;
  gap: 24px;
}

@media (min-width: 768px) {
  .skills-grid {
    grid-template-cols: repeat(3, 1fr);
  }
}

.skill-class-card {
  background: var(--surface-container-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: 4px;
  padding: 32px;
  transition: all var(--transition-md);
  position: relative;
  overflow: hidden;
}

.skill-class-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--outline-variant);
  transition: all var(--transition-md);
}

.skill-class-card:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: var(--gold-glow);
}

.skill-class-card:hover::before {
  background: var(--primary);
  box-shadow: var(--gold-glow);
}

.skill-class-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.skill-class-icon {
  width: 42px;
  height: 42px;
  border: 1px solid var(--outline-variant);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  border-radius: 50%;
  box-shadow: var(--gold-glow);
  transition: border-color var(--transition-md);
}

.skill-class-card:hover .skill-class-icon {
  border-color: var(--primary);
}

.skill-class-title {
  font-family: var(--font-serif);
  font-size: 22px;
  color: var(--primary);
}

.skill-class-subtitle {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--outline);
  display: block;
}

.skill-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.skill-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.skill-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.skill-name {
  font-size: 15px;
  color: var(--on-surface);
}

.skill-level-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--secondary);
}

.skill-progress-bar {
  height: 3px;
  background: var(--surface-container-high);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}

.skill-progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: var(--secondary);
  box-shadow: var(--moss-glow);
  width: 0%;
  transition: width 1.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* The Living Grimoire (3D Book Portal) */
.grimoire-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.grimoire-wrapper {
  perspective: 1500px;
  width: 100%;
  max-width: 800px;
  height: 500px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 32px;
}

.book {
  width: 720px;
  height: 480px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 1s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
}

.book-cover {
  position: absolute;
  width: 360px;
  height: 480px;
  background: #2B160C;
  /* Espresso leather */
  border: 4px solid var(--tarnished-gold);
  border-radius: 4px;
  transform-origin: left center;
  transition: transform 1s cubic-bezier(0.25, 0.8, 0.25, 1);
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: var(--primary);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8);
}

.book-cover.left {
  left: 0;
  transform: rotateY(0deg);
  backface-visibility: hidden;
}

.book-cover.right {
  right: 0;
  transform-origin: right center;
  transform: rotateY(0deg);
  z-index: 1;
  backface-visibility: hidden;
}

.book.open .book-cover.left {
  transform: rotateY(-180deg);
  z-index: 1;
}

/* Book pages */
.book-page {
  position: absolute;
  width: 360px;
  height: 480px;
  top: 0;
  background-color: var(--parchment);
  background-image: radial-gradient(circle at center, rgba(240, 220, 190, 0.2) 0%, transparent 80%);
  color: #2B160C;
  /* espresso text */
  box-shadow: inset 3px 0 20px rgba(0, 0, 0, 0.15), inset -3px 0 20px rgba(0, 0, 0, 0.15);
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform 1s cubic-bezier(0.25, 0.8, 0.25, 1), z-index 1s ease;
  z-index: 1;
}

.book-page.left-side {
  left: 0;
  transform-origin: right center;
}

.book-page.right-side {
  right: 0;
}

.page-content {
  padding: 40px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  backface-visibility: hidden;
  position: relative;
}

.page-content::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  border: 1px solid rgba(194, 164, 107, 0.4);
  pointer-events: none;
}

/* Filigree ornaments inside book */
.filigree-corner {
  position: absolute;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(194, 164, 107, 0.7);
  pointer-events: none;
}

.fc-tl {
  top: 12px;
  left: 12px;
  border-right: none;
  border-bottom: none;
}

.fc-tr {
  top: 12px;
  right: 12px;
  border-left: none;
  border-bottom: none;
}

.fc-bl {
  bottom: 12px;
  left: 12px;
  border-right: none;
  border-top: none;
}

.fc-br {
  bottom: 12px;
  right: 12px;
  border-left: none;
  border-top: none;
}

.page-title {
  font-family: var(--font-serif);
  font-size: 26px;
  color: #2B160C;
  text-align: center;
  margin-top: 10px;
  border-bottom: 1px solid rgba(43, 22, 12, 0.15);
  padding-bottom: 8px;
}

.page-body {
  font-size: 14px;
  line-height: 1.6;
  color: #4A2E20;
  flex-grow: 1;
  margin: 20px 0;
  overflow-y: auto;
}

.page-footer {
  font-family: var(--font-mono);
  font-size: 10px;
  text-align: center;
  color: rgba(43, 22, 12, 0.5);
  margin-bottom: 5px;
}

/* Social link buttons inside book */
.book-socials {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.book-social-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border: 1px solid rgba(43, 22, 12, 0.2);
  background: rgba(43, 22, 12, 0.03);
  text-decoration: none;
  color: #2B160C;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  transition: all var(--transition-fast);
  border-radius: 2px;
}

.book-social-btn:hover {
  background: rgba(43, 22, 12, 0.08);
  border-color: #2B160C;
  transform: translateX(4px);
}

.book-nav-btn {
  position: absolute;
  bottom: -60px;
  background: var(--surface-container-high);
  color: var(--primary);
  border: 1px solid var(--outline);
  padding: 10px 20px;
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  border-radius: 4px;
  transition: all var(--transition-fast);
}

.book-nav-btn:hover {
  border-color: var(--primary);
  box-shadow: var(--gold-glow);
  color: var(--primary);
}

.book-nav-btn.prev {
  left: 40px;
}

.book-nav-btn.next {
  right: 40px;
}

/* The Enchanted Scroll (WhatsApp CTA) */
.cta-scroll {
  background: radial-gradient(circle at center, rgba(161, 62, 30, 0.08) 0%, transparent 70%);
}

.scroll-container {
  max-width: 600px;
  margin: 0 auto;
  background: var(--surface-container-low);
  border: 1px solid var(--outline-variant);
  border-radius: 4px;
  padding: 40px;
  text-align: center;
  position: relative;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

body.light-theme .scroll-container {
  background: rgba(253, 245, 230, 0.95);
  border: 1px solid var(--outline);
  box-shadow: 0 10px 20px rgba(43, 22, 12, 0.1);
}

.scroll-container::before,
.scroll-container::after {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 8px;
  background: repeating-linear-gradient(90deg, var(--primary), var(--primary) 10px, transparent 10px, transparent 20px);
  opacity: 0.3;
}

.scroll-container::before {
  top: 0;
}

.scroll-container::after {
  bottom: 0;
}

.runes-title {
  font-family: var(--font-serif);
  font-size: 32px;
  color: var(--primary);
  text-shadow: var(--gold-glow-intense);
  margin-bottom: 12px;
}

.runes-animation {
  font-family: var(--font-serif);
  font-size: 24px;
  color: var(--tertiary);
  letter-spacing: 0.5em;
  margin: 16px 0;
  height: 32px;
  overflow: hidden;
  text-shadow: var(--rust-glow);
  animation: flickerRunes 2s infinite alternate;
}

.cta-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.form-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  color: var(--outline);
  letter-spacing: 0.15em;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface-container-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: 4px;
  color: var(--on-surface);
  font-family: var(--font-sans);
  font-size: 15px;
  transition: all var(--transition-fast);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--gold-glow);
}

textarea.form-input {
  min-height: 120px;
  resize: vertical;
}

/* Merlin, the Wizard Companion chatbot */
.merlin-companion {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;
}

.merlin-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  pointer-events: auto;
}

.merlin-speech {
  position: absolute;
  bottom: 110px;
  right: 0;
  width: 280px;
  background: var(--surface-container-high);
  border: 1px solid var(--outline);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), var(--gold-glow);
  opacity: 0;
  transform: translateY(10px) scale(0.95);
  pointer-events: none;
  transition: opacity var(--transition-md), transform var(--transition-md);
  z-index: 1001;
}

body.light-theme .merlin-speech {
  background: #fdf5e6;
  border: 1px solid var(--outline);
  box-shadow: 0 10px 20px rgba(43, 22, 12, 0.15);
}

.merlin-speech.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.merlin-speech::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 35px;
  width: 14px;
  height: 14px;
  background: var(--surface-container-high);
  border-right: 1px solid var(--outline);
  border-bottom: 1px solid var(--outline);
  transform: rotate(45deg);
}

body.light-theme .merlin-speech::after {
  background: #fdf5e6;
}

.merlin-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--on-surface);
  margin-bottom: 10px;
}

.merlin-mini-scroll {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-container-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: 4px;
  padding: 6px 10px;
  margin-top: 8px;
  transition: all var(--transition-fast);
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32' fill='none'><path d='M28 4c-3 0-14 6-18 12c-2 3-3 6-3 9l-3 4l4-3c3 0 6-1 9-3c6-4 12-15 12-18Z' stroke='%23e2c287' stroke-width='2' fill='%232B160C'/><path d='M10 16l8 8' stroke='%23e2c287' stroke-width='1.5'/></svg>") 0 32, auto !important;
}

body.light-theme .merlin-mini-scroll {
  background: #fdf5e6;
  border-color: var(--outline);
}

.scroll-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.merlin-chat-input {
  flex-grow: 1;
  background: transparent;
  border: none;
  color: var(--on-surface);
  font-family: var(--font-sans);
  font-size: 11px;
  width: 100%;
}

.merlin-chat-input:focus {
  outline: none;
}

/* Custom cursor feather style override */
.custom-cursor.quill-mode {
  width: 24px !important;
  height: 24px !important;
  background: transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'><path d='M20 4C18 4 11 7 8 11C6.5 13 6 15 6 17L4 20L7 18C9 18 11 17.5 13 16C17 13 20 6 20 4Z' stroke='%23e2c287' stroke-width='1.5' fill='%232B160C'/><path d='M8 11L13 16' stroke='%23e2c287' stroke-width='1'/></svg>") !important;
  background-size: contain !important;
  background-repeat: no-repeat !important;
  transform: translate(-4px, -20px) rotate(-15deg) !important;
}

/* Merlin visual character */
.merlin-sprite {
  width: 80px;
  height: 80px;
  position: relative;
  animation: floatWizard 4s infinite ease-in-out;
}

.merlin-sprite svg {
  width: 100%;
  height: 100%;
}

/* Staff casting sparks animation */
.staff-sparkle {
  position: absolute;
  top: 15px;
  left: 20px;
  width: 10px;
  height: 10px;
  background: var(--primary);
  border-radius: 50%;
  box-shadow: var(--gold-glow-intense);
  opacity: 0;
  pointer-events: none;
}

.merlin-sprite.casting .staff-sparkle {
  animation: castSpell 0.8s ease-out forwards;
}

/* Footer Section */
.footer {
  border-top: 1px solid var(--outline-variant);
  padding: 48px 0;
  background: var(--surface-container-lowest);
  text-align: center;
}

.footer-logo {
  font-family: var(--font-serif);
  font-size: 20px;
  color: var(--primary);
  margin-bottom: 12px;
}

.footer-text {
  font-size: 13px;
  color: var(--outline);
}

/* Keyframe Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes floatWizard {
  0% {
    transform: translateY(0px) rotate(0deg);
  }

  50% {
    transform: translateY(-8px) rotate(2deg);
  }

  100% {
    transform: translateY(0px) rotate(0deg);
  }
}

@keyframes castSpell {
  0% {
    transform: scale(0.5);
    opacity: 1;
  }

  50% {
    transform: scale(1.8) translate(-10px, -15px);
    opacity: 0.9;
  }

  100% {
    transform: scale(0);
    opacity: 0;
  }
}

@keyframes pulseMoss {

  0%,
  100% {
    opacity: 0.8;
    box-shadow: 0 0 10px var(--secondary);
  }

  50% {
    opacity: 1;
    box-shadow: 0 0 20px var(--secondary);
  }
}

@keyframes flickerRunes {

  0%,
  100% {
    opacity: 0.7;
    text-shadow: 0 0 8px var(--tertiary);
  }

  50% {
    opacity: 1;
    text-shadow: 0 0 18px var(--tertiary);
  }
}

/* responsive media queries */
@media (max-width: 767px) {
  section {
    padding: 80px 0;
  }

  .navbar {
    height: 64px;
  }

  .nav-links {
    display: none;
    /* simple collapse for layout cleanliness */
  }

  .hero-headline {
    font-size: 40px;
  }

  .hero-headline span {
    font-size: 20px;
  }

  .carousel-viewport {
    height: 380px;
  }

  .carousel-container {
    width: 260px;
    height: 340px;
  }

  .carousel-card {
    width: 260px;
    height: 340px;
    padding: 16px;
  }

  .card-title {
    font-size: 22px;
  }

  .grimoire-wrapper {
    height: auto;
    perspective: none;
  }

  .book {
    width: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
    box-shadow: none;
    transform: none !important;
  }

  .book-cover {
    display: none;
    /* simplified for mobile layout performance */
  }

  .book-page {
    position: relative;
    width: 100%;
    height: auto;
    left: auto !important;
    right: auto !important;
    transform: none !important;
    margin-bottom: 16px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  }

  .page-content {
    padding: 24px;
  }

  .book-nav-btn {
    display: none;
  }

  .merlin-companion {
    bottom: 20px;
    right: 20px;
  }

  .merlin-speech {
    width: 220px;
    right: -10px;
  }
}