@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Cormorant+Garamond:ital,wght@0,400;0,600;1,400&family=Lora:ital,wght@0,400;0,600;1,400&display=swap');

html[data-theme="night"] {
  color-scheme: dark; 

  
  --bg:         #0c0e14; 
  --bg2:        #141824; 
  --card:       #1a2030; 
  --card-hover: #222a40; 

  
  --border:     #2a3348; 

  
  --accent:     #c9a227; 
  --accent-soft:#e4c46a; 

  
  --text:       #e8e2d8; 
  --muted:      #9a9284; 
  --heading-on: #f7f4ef; 

  
  --hero-mid:   #151a28;
  --hero-deep:  #080a10;

  
  --glow:       rgba(201, 162, 39, 0.14); 
  --noise:      rgba(255, 255, 255, 0.03); 

  
  --font-title: 'Cinzel', serif;          
  --font-body:  'Lora', serif;            

  
  --radius:     12px;                     
  --shadow:     0 8px 32px rgba(0, 0, 0, 0.45); 

  
  --pattern:    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='49' viewBox='0 0 28 49'%3E%3Cpath fill='%23c9a227' fill-opacity='0.04' d='M28 0v17L14 8.5 0 17V0l14 8.5L28 0zm0 32v17l-14-8.5L0 49V32l14-8.5 14 8.5z'/%3E%3C/svg%3E");

  
  --gold:       var(--accent);
  --gold-light: var(--accent-soft);
  --white:      var(--heading-on);
}

html[data-theme="day"] {
  color-scheme: light;

  
  --bg:         #f3efe6;
  --bg2:        #ebe4d6;
  --card:       #fffcf5;
  --card-hover: #f5eee3;

  
  --border:     #c4b8a4;

  
  --accent:     #6b4c2a;
  --accent-soft:#8a6238;

  
  --text:       #2a241c;
  --muted:      #5c5348;
  --heading-on: #1a1612;

  
  --hero-mid:   #e8dfd0;
  --hero-deep:  #ddd2c0;

  
  --glow:       rgba(107, 76, 42, 0.12);
  --noise:      rgba(0, 0, 0, 0.02);

  
  --font-title: 'Cinzel', serif;
  --font-body:  'Cormorant Garamond', serif;

  --shadow:     0 6px 28px rgba(62, 52, 38, 0.12);

  
  --pattern:    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Ccircle cx='3' cy='3' r='1' fill='%236b4c2a' fill-opacity='0.07'/%3E%3Ccircle cx='15' cy='15' r='1' fill='%236b4c2a' fill-opacity='0.07'/%3E%3C/svg%3E");

  --gold:       var(--accent);
  --gold-light: var(--accent-soft);
  --white:      var(--heading-on);
}

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

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;              
  background-color: var(--bg);   
  color: var(--text);            
  font-family: var(--font-body); 
  font-size: 18px;               
  line-height: 1.72;             

  
  transition: background-color 0.35s ease, color 0.35s ease;
}

body::before {
  content: "";            
  position: fixed;        
  inset: 0;              
  pointer-events: none;  
  background-image: var(--pattern);
  opacity: 1;
  z-index: 0;            
}

body > * {
  position: relative;
  z-index: 1;
}

a {
  color: var(--accent);    
  text-decoration: none;   
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-soft);
  text-decoration: underline;
}

nav {
  position: sticky;    
  top: 0;
  z-index: 100;        

  
  display: flex;
  align-items: center;        
  justify-content: space-between; 
  gap: 1rem;                  

  min-height: 60px;
  padding: 0 1.25rem 0 1.5rem; 

  
  background: color-mix(in srgb, var(--bg) 92%, transparent);

  border-bottom: 2px solid var(--accent); 
  backdrop-filter: blur(10px); 
  transition: background 0.35s ease, border-color 0.35s ease;
}

.nav-logo {
  font-family: var(--font-title);
  font-size: clamp(0.95rem, 2.5vw, 1.12rem); 
  color: var(--accent);
  letter-spacing: 0.08em; 
  text-transform: uppercase;
  white-space: nowrap;    
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;        
  justify-content: flex-end;
  min-width: 0;
}

.theme-toggle {
  position: relative;
  flex-shrink: 0;           
  width: 42px;
  height: 42px;
  border-radius: 50%;       
  border: 1px solid var(--accent);
  background: color-mix(in srgb, var(--card) 70%, transparent);
  color: var(--accent);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  line-height: 1;
  transition: background 0.25s ease, color 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease;
}

.theme-toggle .tb-sun,
.theme-toggle .tb-moon {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 1.35em;
  text-align: center;
  line-height: 1;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.theme-toggle:hover {
  background: var(--accent);
  color: var(--bg);
  transform: scale(1.05); 
  box-shadow: 0 0 0 3px var(--glow);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 3px;
}

html[data-theme="night"] .theme-toggle .tb-sun  { opacity: 1; visibility: visible; }
html[data-theme="night"] .theme-toggle .tb-moon { opacity: 0; visibility: hidden; }

html[data-theme="day"] .theme-toggle .tb-sun  { opacity: 0; visibility: hidden; }
html[data-theme="day"] .theme-toggle .tb-moon { opacity: 1; visibility: visible; }

.nav-links {
  display: flex;
  gap: 0.15rem;
  list-style: none;   
  flex-wrap: nowrap;
  align-items: center;
}

.nav-links a {
  
  font-family: 'Lora', Georgia, serif;
  font-size: 0.88rem;
  color: var(--text);
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
  background: var(--accent);
  color: var(--bg);
  text-decoration: none;
}

.nav-toggle {
  display: none;        
  background: none;
  border: none;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transition: 0.3s;
}

.hero {
  position: relative;   
  overflow: hidden;     
  border-bottom: 1px solid var(--border);

  
  background: linear-gradient(165deg, var(--hero-mid) 0%, var(--hero-deep) 55%, var(--bg) 100%);

  padding: 3.5rem 1.5rem 3rem;
  text-align: center;
  transition: background 0.35s ease, border-color 0.35s ease;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  
  background: radial-gradient(ellipse 80% 60% at 50% -10%, var(--glow), transparent 65%);
  pointer-events: none; 
}

.hero-tag {
  display: inline-block;
  font-family: var(--font-title);
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.3rem 0.95rem;
  border-radius: 100px; 
  margin-bottom: 1rem;
}

.hero h1 {
  font-family: var(--font-title);
  
  font-size: clamp(1.85rem, 4.5vw, 3rem);
  color: var(--heading-on);
  line-height: 1.18;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.hero h1 span {
  color: var(--accent);
}

.hero p {
  max-width: 34rem;    
  margin: 0 auto;      
  color: var(--muted);
  font-style: italic;
  font-size: 1.05rem;
}

main {
  max-width: 920px;           
  margin: 0 auto;             
  padding: 2.75rem 1.35rem 4.5rem; 
}

.section-title {
  font-family: var(--font-title);
  font-size: 1.45rem;
  color: var(--accent);
  margin-bottom: 1.25rem;
  padding-bottom: 0.55rem;
  
  border-bottom: 2px double color-mix(in srgb, var(--accent) 35%, var(--border));
  letter-spacing: 0.02em;
}

.subheading {
  font-family: var(--font-title);
  color: var(--accent);
  margin: 1.5rem 0 1rem;
  font-size: 1.08rem;
  font-weight: 600;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);  
  padding: 1.6rem 1.5rem;
  box-shadow: var(--shadow);

  
  transition: border-color 0.25s ease, transform 0.25s ease, background 0.35s ease;
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-3px); 
}

.card h2 {
  font-family: var(--font-title);
  font-size: 1.15rem;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.card .subtitle {
  font-size: 0.88rem;
  color: var(--muted);
  font-style: italic;
  margin-bottom: 0.85rem;
}

.card p {
  color: var(--text);
  font-size: 0.98rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.35rem;   
  margin-top: 1.35rem;
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.2rem;
  margin-top: 1.5rem;
}

.chapter-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.1rem 1.5rem;
  text-align: center;
  text-decoration: none !important; 
  display: flex;
  flex-direction: column; 
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow);
  transition: border-color 0.25s ease, transform 0.25s ease, background 0.35s ease;
  overflow: hidden;
}

.chapter-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit; 
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 0%, transparent);
  pointer-events: none;
  transition: box-shadow 0.25s ease;
}

.chapter-card:hover {
  border-color: var(--accent);
  background: var(--card-hover);
  transform: translateY(-5px);
  text-decoration: none;
}

.chapter-card:hover::after {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent);
}

.chapter-card .num {
  font-family: var(--font-title);
  font-size: 1.75rem;
  color: var(--accent);
  line-height: 1;
}

.chapter-card h3 {
  font-family: var(--font-title);
  font-size: 0.95rem;
  color: var(--heading-on);
  margin-bottom: 0.25rem;
}

.chapter-card p {
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
  line-height: 1.5;
}

.img-block {
  background: color-mix(in srgb, var(--bg2) 88%, var(--card));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem 1.5rem;
  text-align: center;
  margin: 1.75rem 0;
  
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--heading-on) 6%, transparent);
  transition: background 0.35s ease, border-color 0.35s ease;
}

.img-block img {
  max-width: 100%;                           
  border-radius: calc(var(--radius) - 2px); 
  display: block;
  margin: 0 auto 0.65rem; 
}

.img-block em {
  font-size: 0.84rem;
  color: var(--muted);
  font-style: italic;
  line-height: 1.5;
}

blockquote {
  border-left: 3px solid var(--accent);
  margin: 2rem 0;
  padding: 1.1rem 1.4rem;
  background: var(--bg2);
  border-radius: 0 var(--radius) var(--radius) 0; 
  font-style: italic;
  color: var(--text);
  transition: background 0.35s ease;
}

blockquote cite {
  display: block;
  margin-top: 0.55rem;
  font-size: 0.82rem;
  color: var(--muted);
  font-style: normal; 
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.25rem 0;
}

.page-nav {
  display: flex;
  justify-content: space-between; 
  flex-wrap: wrap;                
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.page-nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-title);
  font-size: 0.82rem;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.5rem 1.05rem;
  border-radius: 6px;
  transition: background 0.2s ease, color 0.2s ease;
}

.page-nav a:hover {
  background: var(--accent);
  color: var(--bg);
  text-decoration: none;
}

footer {
  background: var(--bg2);
  border-top: 2px solid var(--accent);
  text-align: center;
  padding: 2rem 1rem;
  font-size: 0.82rem;
  color: var(--muted);
  transition: background 0.35s ease;
}

footer strong {
  color: var(--accent);
  font-family: var(--font-title);
}

.facts-strip {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;          
  gap: 0.75rem 2rem;        
  margin: 2rem 0;
  padding: 1.25rem 1rem;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.facts-strip .fact-item {
  font-family: var(--font-title);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}

.facts-strip .fact-item strong {
  display: block;       
  font-size: 1.5rem;
  color: var(--accent);
  letter-spacing: 0;
  text-transform: none; 
  margin-bottom: 0.15rem;
}

.dyk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.2rem;
  margin-top: 1.35rem;
}

.dyk-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.25rem;
  box-shadow: var(--shadow);
}

.dyk-card .dyk-label {
  font-family: var(--font-title);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.dyk-card p {
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.6;
}

.dyk-card .dyk-link {
  display: inline-block;
  margin-top: 0.75rem;
  font-family: var(--font-title);
  font-size: 0.75rem;
  color: var(--accent);
  letter-spacing: 0.05em;
}

.featured {
  background: var(--card);
  border: 1px solid var(--accent); 
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  box-shadow: var(--shadow);
  margin-top: 1.35rem;
}

.featured-label {
  font-family: var(--font-title);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.6rem;
}

.featured h3 {
  font-family: var(--font-title);
  font-size: 1.25rem;
  color: var(--heading-on);
  margin-bottom: 0.75rem;
}

.featured p {
  color: var(--text);
  font-size: 0.97rem;
  line-height: 1.68;
  margin-bottom: 1rem;
}

.featured-link {
  display: inline-block;
  font-family: var(--font-title);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: var(--bg);        
  background: var(--accent);
  padding: 0.45rem 1.1rem;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.2s ease;
}

.featured-link:hover {
  background: var(--accent-soft);
  color: var(--bg);
  text-decoration: none;
}

#quiz-root,
#character-root {
  margin: 2rem 0;
}

.react-widget {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  box-shadow: var(--shadow);
}

#back-to-top {
  position: fixed;          
  bottom: 1.75rem;
  right: 1.75rem;
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 50%;       
  background: var(--accent);
  color: var(--bg);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  display: none;            
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  z-index: 200;             
  transition: opacity 0.3s ease, transform 0.2s ease, background 0.35s ease, color 0.35s ease;
  font-family: system-ui, sans-serif;
}

#back-to-top:hover {
  transform: scale(1.06);
}

@media (max-width: 700px) {

  
  .nav-links {
    display: none;            
    flex-direction: column;   
    position: absolute;       
    top: 100%;                
    left: 0;
    right: 0;
    z-index: 110;
    background: var(--bg);
    border-bottom: 2px solid var(--accent);
    padding: 1rem 1.25rem 1.25rem;
    gap: 0.35rem;
  }

  
  .nav-links.open {
    display: flex;
  }

  
  .nav-toggle {
    display: flex;
  }

  
  nav {
    position: relative;
    flex-wrap: wrap;
  }

  
  .nav-right {
    flex: 1;
    justify-content: flex-end;
  }

  
  .hero {
    padding: 2.75rem 1.15rem 2.25rem;
  }

  
  main {
    padding: 2rem 1rem 3.5rem;
  }

  
  .page-nav {
    flex-direction: column;
  }
}
