/* ============================================
   КРАТКО СЛЪНЦЕ - Layout Styles
   Grid, Sections, Navigation
   ============================================ */

/* ---------- Main Layout ---------- */
.site-wrapper {
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
}

main {
  position: relative;
  z-index: var(--z-base);
}

/* Container */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.container--narrow {
  max-width: var(--content-max);
}

/* ---------- Floating Navigation Elements ---------- */
.floating-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-fixed);
  pointer-events: none;
  padding: var(--space-md);
}

/* Sun Icon - Top Left */
.floating-sun {
  position: fixed;
  top: var(--space-md);
  left: var(--space-md);
  z-index: var(--z-fixed);
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  color: var(--sun-gold);
  transition: transform var(--duration-normal) var(--ease-spring),
              filter var(--duration-normal) var(--ease-out);
}

.floating-sun .logo-sun {
  width: 32px;
  height: 32px;
}

.floating-sun:hover {
  transform: scale(1.15) rotate(15deg);
  filter: drop-shadow(0 0 20px rgba(232, 184, 48, 0.6));
}

/* Logo Text - Slides in from left after hero */
.floating-logo-text {
  position: fixed;
  top: var(--space-md);
  left: calc(var(--space-md) + 56px);
  z-index: var(--z-fixed);
  pointer-events: none;
  font-family: "Times New Roman", Times, serif;
  font-size: var(--font-size-md);
  color: var(--cream-heat);
  opacity: 0;
  transform: translateX(-20px);
  transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out);
  line-height: 48px;
  white-space: nowrap;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.floating-nav.is-past-hero .floating-logo-text {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

/* Actions Group - Top Right */
.floating-actions {
  position: fixed;
  top: var(--space-md);
  right: var(--space-md);
  z-index: var(--z-fixed);
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* Floating Button - Scale + Glow Hover */
.floating-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  color: var(--cream-heat);
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: transform var(--duration-normal) var(--ease-spring),
              color var(--duration-fast) var(--ease-out),
              filter var(--duration-normal) var(--ease-out);
}

.floating-btn svg {
  width: 24px;
  height: 24px;
}

.floating-btn:hover {
  transform: scale(1.15);
  color: var(--sun-gold);
  filter: drop-shadow(0 0 15px rgba(232, 184, 48, 0.5));
}

/* Audio toggle states */
.floating-btn.audio-toggle .icon-muted { display: block; }
.floating-btn.audio-toggle .icon-unmuted { display: none; }
.floating-btn.audio-toggle.is-playing .icon-muted { display: none; }
.floating-btn.audio-toggle.is-playing .icon-unmuted { display: block; }
.floating-btn.audio-toggle.is-playing {
  color: var(--sun-gold);
  animation: icon-pulse 2s ease-in-out infinite;
}

@keyframes icon-pulse {
  0%, 100% { filter: drop-shadow(0 0 10px rgba(232, 184, 48, 0.3)); }
  50% { filter: drop-shadow(0 0 20px rgba(232, 184, 48, 0.6)); }
}

/* Menu toggle states */
.floating-btn.menu-toggle .icon-open { display: block; }
.floating-btn.menu-toggle .icon-close { display: none; }
.floating-btn.menu-toggle[aria-expanded="true"] .icon-open { display: none; }
.floating-btn.menu-toggle[aria-expanded="true"] .icon-close { display: block; }

/* Mobile floating nav */
@media (max-width: 768px) {
  .floating-sun,
  .floating-actions {
    top: var(--space-sm);
  }
  .floating-sun {
    left: var(--space-sm);
  }
  .floating-actions {
    right: var(--space-sm);
  }
  .floating-logo-text {
    display: none;
  }
}

/* ---------- Progress Dots Navigation ---------- */
.nav-dots {
  position: fixed;
  right: var(--space-md);
  top: 50%;
  transform: translateY(-50%);
  z-index: calc(var(--z-fixed) + 10); /* Higher than floating nav */
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-sm);
}

@media (max-width: 768px) {
  .nav-dots {
    display: none;
  }
}

.nav-dot {
  position: relative;
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  border: 2px solid var(--ochre-dust);
  background: transparent;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
}

/* Outer glow ring */
.nav-dot::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: var(--radius-full);
  background: radial-gradient(circle, rgba(232, 184, 48, 0.3) 0%, transparent 70%);
  opacity: 0;
  transform: scale(0.5);
  transition: all var(--duration-normal) var(--ease-spring);
}

/* Inner fill */
.nav-dot::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: var(--radius-full);
  background: var(--ochre-dust);
  transform: scale(0);
  transition: transform var(--duration-fast) var(--ease-spring);
}

.nav-dot:hover {
  border-color: var(--sun-gold);
  transform: scale(1.3);
  box-shadow: 0 0 20px rgba(232, 184, 48, 0.4);
}

.nav-dot:hover::before {
  opacity: 1;
  transform: scale(1.5);
}

.nav-dot:hover::after {
  background: var(--sun-gold);
  transform: scale(1);
}

/* Visited state */
.nav-dot.is-visited::after {
  transform: scale(1);
}

/* Active state */
.nav-dot.is-active {
  border-color: var(--sun-gold);
  box-shadow: 0 0 15px rgba(232, 184, 48, 0.3);
}

.nav-dot.is-active::before {
  animation: dot-glow-pulse 2s ease-in-out infinite;
}

.nav-dot.is-active::after {
  background: var(--sun-gold);
  transform: scale(1);
}

@keyframes dot-glow-pulse {
  0%, 100% {
    opacity: 0.5;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.8);
  }
}

/* Tooltip */
.nav-dot-tooltip {
  position: absolute;
  right: calc(100% + var(--space-sm));
  top: 50%;
  transform: translateY(-50%);
  padding: var(--space-xs) var(--space-sm);
  background: var(--earth-deep);
  color: var(--cream-heat);
  font-size: var(--font-size-xs);
  white-space: nowrap;
  border-radius: var(--radius-sm);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all var(--duration-fast) var(--ease-out);
}

.nav-dot-tooltip::after {
  content: "";
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  border: 4px solid transparent;
  border-left-color: var(--earth-deep);
}

.nav-dot:hover .nav-dot-tooltip,
.nav-dot:focus .nav-dot-tooltip {
  opacity: 1;
  visibility: visible;
}

/* ---------- Menu Overlay ---------- */
.menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-overlay);
  background: rgba(44, 36, 22, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--duration-normal) var(--ease-out),
              visibility var(--duration-normal) var(--ease-out);
  /* Enable scrolling on the overlay itself */
  overflow-x: hidden;
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.menu-overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.menu-overlay-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  width: 100%;
  /* Use padding to create scrollable space */
  padding: 100px var(--space-xl) 60px;
}

.menu-overlay::-webkit-scrollbar {
  width: 6px;
}

.menu-overlay::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

.menu-overlay::-webkit-scrollbar-thumb {
  background: var(--ochre-dust);
  border-radius: 3px;
}

.menu-close {
  position: fixed;
  top: var(--space-md);
  right: var(--space-md);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  color: var(--cream-heat);
  cursor: pointer;
  z-index: 10001;
  transition: all var(--duration-fast) var(--ease-out);
}

.menu-close svg {
  width: 24px;
  height: 24px;
}

.menu-close:hover {
  color: var(--sun-gold);
  background: rgba(232, 184, 48, 0.1);
  transform: scale(1.1);
}

.menu-title {
  font-family: "Times New Roman", Times, serif;
  font-size: var(--font-size-sm);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--ochre-dust);
  margin-bottom: var(--space-lg);
}

.menu-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  width: 100%;
  max-width: 400px;
}

.menu-nav::-webkit-scrollbar {
  width: 4px;
}

.menu-nav::-webkit-scrollbar-track {
  background: rgba(201, 166, 107, 0.1);
}

.menu-nav::-webkit-scrollbar-thumb {
  background: var(--ochre-dust);
  border-radius: var(--radius-full);
}

.menu-link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  color: var(--cream-heat);
  font-family: "Times New Roman", Times, serif;
  font-size: var(--font-size-md);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) var(--ease-out);
  opacity: 0;
  transform: translateY(10px);
}

.menu-overlay.is-open .menu-link {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger animation */
.menu-overlay.is-open .menu-link:nth-child(1) { transition-delay: 50ms; }
.menu-overlay.is-open .menu-link:nth-child(2) { transition-delay: 80ms; }
.menu-overlay.is-open .menu-link:nth-child(3) { transition-delay: 110ms; }
.menu-overlay.is-open .menu-link:nth-child(4) { transition-delay: 140ms; }
.menu-overlay.is-open .menu-link:nth-child(5) { transition-delay: 170ms; }
.menu-overlay.is-open .menu-link:nth-child(6) { transition-delay: 200ms; }
.menu-overlay.is-open .menu-link:nth-child(7) { transition-delay: 230ms; }
.menu-overlay.is-open .menu-link:nth-child(8) { transition-delay: 260ms; }
.menu-overlay.is-open .menu-link:nth-child(9) { transition-delay: 290ms; }
.menu-overlay.is-open .menu-link:nth-child(10) { transition-delay: 320ms; }
.menu-overlay.is-open .menu-link:nth-child(11) { transition-delay: 350ms; }
.menu-overlay.is-open .menu-link:nth-child(12) { transition-delay: 380ms; }
.menu-overlay.is-open .menu-link:nth-child(13) { transition-delay: 410ms; }
.menu-overlay.is-open .menu-link:nth-child(14) { transition-delay: 440ms; }

.menu-link:hover,
.menu-link:focus {
  background: rgba(232, 184, 48, 0.1);
  color: var(--sun-gold);
}

.menu-link.is-active {
  color: var(--sun-gold);
}

.menu-number {
  font-size: var(--font-size-xs);
  color: var(--ochre-dust);
  min-width: 24px;
}

.menu-status {
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  border: 1px solid var(--ochre-dust);
}

.menu-link.is-visited .menu-status {
  background: var(--ochre-dust);
}

.menu-link.is-active .menu-status {
  background: var(--sun-gold);
  border-color: var(--sun-gold);
}

/* ---------- Section Layout ---------- */
.section {
  position: relative;
  min-height: 100vh;
  padding: var(--space-section) var(--space-md);
  /* Content starts at 55% from top of viewport */
  padding-top: 55vh;
  padding-bottom: var(--space-2xl);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  contain: layout style paint;
  /* Dark cinematic theme - transparent to show Ken Burns bg */
  background: transparent;
  color: var(--cream-heat);
}

/* Section variants */
.section--hero {
  min-height: 100vh;
  /* Hero section centered, slightly lower */
  padding-top: 15vh;
  justify-content: center;
}

.section--dark {
  background: rgba(26, 21, 16, 0.7);
  color: var(--cream-heat);
}

.section--dark h2,
.section--dark h3,
.section--dark .section-title {
  color: var(--cream-heat);
}

.section--glass {
  background: var(--surface-glass);
  backdrop-filter: blur(10px);
}

.section--cream {
  background: rgba(245, 235, 215, 0.05);
}

.section--ochre {
  background: linear-gradient(
    180deg,
    rgba(201, 166, 107, 0.05) 0%,
    rgba(201, 166, 107, 0.1) 50%,
    rgba(201, 166, 107, 0.05) 100%
  );
}

/* Section content container */
.section-content {
  position: relative;
  z-index: var(--z-above);
  max-width: 65ch;
  margin-inline: auto;
  width: 100%;
  /* Center text by default */
  text-align: center;
  /* Reduced text shadow - darker background now provides contrast */
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), 0 0 15px rgba(0, 0, 0, 0.5);
}

.section-content--wide {
  max-width: var(--container-max);
}

/* Left-aligned text variant for long-form content */
.section-content--left {
  text-align: left;
}

/* Prose sections with optimal reading width */
.section-content p,
.section-content li {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7), 0 0 10px rgba(0, 0, 0, 0.4);
}

/* Better paragraph spacing */
.section-content p {
  margin-bottom: var(--space-md);
  line-height: var(--line-height-relaxed);
}

.section-content p:last-child {
  margin-bottom: 0;
}

/* List spacing */
.section-content ul,
.section-content ol {
  margin-bottom: var(--space-lg);
  padding-left: var(--space-lg);
  text-align: left;
}

.section-content li {
  margin-bottom: var(--space-sm);
  line-height: var(--line-height-relaxed);
}

.section-content li:last-child {
  margin-bottom: 0;
}

/* Bullet points */
.section-content ul {
  list-style: disc;
}

.section-content ul li::marker {
  color: var(--sun-gold);
}

/* Numbered lists */
.section-content ol {
  list-style: decimal;
}

.section-content ol li::marker {
  color: var(--ochre-light);
}

/* Nested list spacing */
.section-content li ul,
.section-content li ol {
  margin-top: var(--space-sm);
  margin-bottom: var(--space-sm);
}

/* Section header */
.section-header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.section-number {
  display: inline-block;
  font-family: "Times New Roman", Times, serif;
  font-size: var(--font-size-lg);
  color: var(--sun-gold);
  margin-bottom: var(--space-sm);
  letter-spacing: var(--tracking-wider);
}

.section-title {
  font-size: var(--font-size-2xl);
  color: var(--cream-heat);
  margin-bottom: var(--space-md);
  /* Reduced text shadow with subtle gold glow */
  text-shadow:
    0 2px 4px rgba(0, 0, 0, 0.9),
    0 0 20px rgba(0, 0, 0, 0.7),
    0 2px 15px rgba(232, 184, 48, 0.2);
}

.section-subtitle {
  font-size: var(--font-size-md);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* Section divider */
.section-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  margin: var(--space-xl) 0;
}

.section-divider::before,
.section-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--border-light)
  );
  max-width: 100px;
}

.section-divider::after {
  background: linear-gradient(
    90deg,
    var(--border-light),
    transparent
  );
}

.section-divider-icon {
  width: 20px;
  height: 20px;
  color: var(--ochre-dust);
}

/* ---------- Hero Section Specific ---------- */
.hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: transparent;
}

.hero-background {
  position: absolute;
  inset: 0;
  z-index: var(--z-base);
  display: none; /* Hidden - using Ken Burns instead */
}

.hero-layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  will-change: transform;
}

.hero-gradient {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at 50% 40%,
    rgba(232, 184, 48, 0.1) 0%,
    transparent 60%
  ),
  linear-gradient(
    180deg,
    transparent 0%,
    rgba(26, 21, 16, 0.3) 70%,
    rgba(26, 21, 16, 0.6) 100%
  );
  display: none; /* Hidden - using Ken Burns overlay */
}

.hero-content {
  position: relative;
  z-index: var(--z-above);
  text-align: center;
  padding: var(--space-xl);
}

.hero-intro {
  font-family: "Times New Roman", Times, serif;
  font-style: italic;
  font-size: var(--font-size-lg);
  color: rgba(245, 235, 215, 0.8);
  margin-bottom: var(--space-lg);
  opacity: 0;
  animation: fadeInUp 1s var(--ease-out) 0.5s forwards;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}

.hero-title {
  font-size: var(--font-size-hero);
  color: var(--cream-heat);
  margin-bottom: var(--space-sm);
  opacity: 0;
  animation: fadeInUp 1s var(--ease-out) 0.8s forwards;
  text-shadow: 0 4px 40px rgba(232, 184, 48, 0.3), 0 2px 20px rgba(0, 0, 0, 0.5);
}

.hero-author {
  font-family: "Times New Roman", Times, serif;
  font-size: var(--font-size-xl);
  color: var(--sun-gold);
  margin-bottom: var(--space-2xl);
  opacity: 0;
  animation: fadeInUp 1s var(--ease-out) 1.1s forwards;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}

.hero-scroll {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  color: rgba(245, 235, 215, 0.7);
  font-size: var(--font-size-sm);
  opacity: 0;
  animation: fadeInUp 1s var(--ease-out) 1.5s forwards;
}

.hero-scroll-icon {
  width: 24px;
  height: 24px;
  color: var(--sun-gold);
  animation: bounce 2s ease-in-out infinite;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(8px);
  }
  60% {
    transform: translateY(4px);
  }
}

/* ---------- Grid Layouts ---------- */
.grid {
  display: grid;
  gap: var(--space-lg);
}

.grid--2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid--4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1024px) {
  .grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .grid--2,
  .grid--3,
  .grid--4 {
    grid-template-columns: 1fr;
  }
}

/* Two column layout */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
  align-items: start;
}

@media (max-width: 768px) {
  .two-col {
    grid-template-columns: 1fr;
  }
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--earth-deep);
  color: var(--cream-heat);
  padding: var(--space-xl) var(--space-md);
  text-align: center;
}

.site-footer--slim {
  padding: var(--space-md) var(--space-md);
  background: rgba(26, 21, 16, 0.95);
}

.footer-content {
  max-width: var(--content-max);
  margin: 0 auto;
}

.footer-credits {
  font-size: var(--font-size-xs);
  color: var(--ochre-dust);
  letter-spacing: var(--tracking-wide);
}

.footer-quote {
  font-family: "Times New Roman", Times, serif;
  font-style: italic;
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-lg);
  color: var(--ochre-light);
}

.footer-credit {
  font-size: var(--font-size-sm);
  color: var(--ochre-dust);
}

/* ---------- Responsive Adjustments ---------- */
@media (max-width: 768px) {
  :root {
    --header-height: 56px;
  }

  .section {
    padding: var(--space-xl) var(--space-md);
    /* On mobile, content at 40% from top for more visible content */
    padding-top: 40vh;
    min-height: auto;
  }

  .section--hero {
    min-height: 100vh;
    min-height: 100dvh;
    padding-top: 10vh;
    justify-content: center;
  }

  .hero-title {
    font-size: var(--font-size-3xl);
  }

  .hero-author {
    font-size: var(--font-size-lg);
  }
}

/* ---------- Print Adjustments ---------- */
@media print {
  .floating-nav,
  .floating-sun,
  .floating-actions,
  .nav-dots,
  .menu-overlay,
  .hero-scroll {
    display: none !important;
  }

  .section {
    min-height: auto;
    page-break-inside: avoid;
    padding: 2rem 0;
  }
}
