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

:root {
  --bg-primary: #0f1115;
  --bg-secondary: #161b22;
  --text-primary: #e9edf5;
  --text-secondary: #cfd6e5;
  --accent: #d8b25e;
  --accent-light: #f2c572;
  --overlay-light: rgba(10, 12, 18, 0.55);
  --overlay-dark: rgba(10, 12, 18, 0.35);
}

body.light-mode {
  --bg-primary: #f7f8fb;
  --bg-secondary: #ffffff;
  --text-primary: #1a1d27;
  --text-secondary: #3b4050;
  --accent: #b3880f;
  --accent-light: #c9a23a;
  --overlay-light: rgba(255, 255, 255, 0.82);
  --overlay-dark: rgba(255, 255, 255, 0.55);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Manrope", "Space Grotesk", sans-serif;
  color: var(--text-primary);
  background: var(--bg-primary);
  overflow-x: hidden;
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ========================================================================== */
/* ACCESSIBILITY */
/* ========================================================================== */

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #d4af37;
  color: #1a1a1a;
  padding: 8px;
  text-decoration: none;
  z-index: 100;
  font-weight: bold;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid #fff;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .story-section {
    background-attachment: scroll;
    background-position: center center !important;
  }
}

/* ========================================================================== */
/* FOCUS & TOOLTIPS */
/* ========================================================================== */

a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible {
  outline: 3px solid #d4af37;
  outline-offset: 2px;
  border-radius: 4px;
}

[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  top: calc(100% + 10px);
  transform: translateX(-50%);
  background: rgba(22, 25, 33, 0.95);
  color: #f5f7fb;
  padding: 0.4rem 0.65rem;
  border-radius: 10px;
  font-size: 0.8rem;
  line-height: 1.3;
  white-space: nowrap;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 50;
}

body.light-mode [data-tooltip]::after {
  background: rgba(255, 255, 255, 0.95);
  color: #1f2430;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
}

/* ========================================================================== */
/* HEADER & NAVIGATION */
/* ========================================================================== */

.header {
  padding: 1rem 2rem;
  background: rgba(18, 21, 29, 0.8);
  border-bottom: 1px solid rgba(216, 178, 94, 0.35);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  transition: background-color 0.3s ease, border-color 0.3s ease;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
  gap: 1rem;
}

body.light-mode .header {
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(179, 136, 15, 0.35);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.header h1 {
  color: var(--accent);
  font-size: 1.85rem;
  font-weight: 600;
  letter-spacing: -0.3px;
  transition: color 0.3s ease;
  flex: 1;
  min-width: 0;
  text-align: center;
}

.theme-toggle {
  background: rgba(216, 178, 94, 0.08);
  border: 1.5px solid rgba(216, 178, 94, 0.75);
  color: var(--accent);
  border-radius: 14px;
  width: 52px;
  height: 52px;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  position: relative;
  flex-shrink: 0;
  order: -1;
}

.theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

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

.sun-icon,
.moon-icon {
  position: absolute;
  transition: opacity 0.3s ease;
}

.sun-icon {
  opacity: 0;
}

.moon-icon {
  opacity: 1;
}

body.light-mode .sun-icon {
  opacity: 1;
}

body.light-mode .moon-icon {
  opacity: 0;
}

.progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-light) 100%);
  width: 0%;
  transition: width 0.2s ease;
  box-shadow: 0 0 10px rgba(216, 178, 94, 0.6);
}

.nav {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  flex-shrink: 0;
  flex-basis: 100%;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(216, 178, 94, 0.15);
}

.nav a {
  color: var(--text-primary);
  background: rgba(216, 178, 94, 0.08);
  padding: 0.6rem 0.65rem;
  text-decoration: none;
  text-align: center;
  border-radius: 10px;
  border: 1px solid rgba(216, 178, 94, 0.35);
  transition: all 0.2s ease;
  font-weight: 600;
  font-size: 0.95rem;
  backdrop-filter: blur(4px);
  cursor: pointer;
  min-width: 46px;
}

.nav a:hover {
  background: rgba(216, 178, 94, 0.2);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(216, 178, 94, 0.25);
}

.nav a.active {
  background: rgba(216, 178, 94, 0.32);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 10px 24px rgba(216, 178, 94, 0.3);
}

.nav-label-short {
  display: none;
}

.a11y-toggle-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.a11y-toggle {
  background: linear-gradient(135deg, rgba(216, 178, 94, 0.15), rgba(216, 178, 94, 0.3));
  color: var(--text-primary);
  border: 1.5px solid rgba(216, 178, 94, 0.7);
  border-radius: 14px;
  padding: 0.55rem 0.85rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

.a11y-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(216, 178, 94, 0.25);
}

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

.a11y-tip {
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: rgba(216, 178, 94, 0.08);
  border: 1px solid rgba(216, 178, 94, 0.35);
  border-radius: 10px;
  padding: 0.25rem 0.5rem;
  line-height: 1.2;
  white-space: nowrap;
}

body.light-mode .a11y-tip {
  background: rgba(216, 178, 94, 0.16);
  color: #3b4050;
}

.a11y-panel {
  position: fixed;
  right: 1rem;
  top: 90px;
  width: min(360px, 92vw);
  background: rgba(18, 21, 29, 0.9);
  color: var(--text-primary);
  border: 1px solid rgba(216, 178, 94, 0.2);
  border-radius: 16px;
  padding: 1.25rem 1.25rem 1rem;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  z-index: 15;
  line-height: 1.55;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

body.light-mode .a11y-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(179, 136, 15, 0.25);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.12);
}

.a11y-panel.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.a11y-panel h2 {
  margin-bottom: 0.65rem;
  font-size: 1.1rem;
  color: var(--accent);
}

.a11y-panel ul {
  list-style: disc;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.5rem;
}

.a11y-panel[hidden] {
  display: none !important;
}

/* ========================================================================== */
/* MAIN CONTENT */
/* ========================================================================== */

#story {
  scroll-snap-type: y proximity;
  scroll-padding-top: 110px;
}

.story-section {
  min-height: 100vh;
  width: 100%;
  background-size: cover;
  background-position: center;
  background-attachment: scroll;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 3.5rem 2.5rem;
  scroll-snap-align: start;
  scroll-snap-stop: normal;
  transition: opacity 0.6s ease;
}

body.light-mode .story-section {
  filter: brightness(1.4);
}

.story-section::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0.15) 55%, rgba(0, 0, 0, 0.05) 100%);
  transition: background 0.3s ease;
}

body.light-mode .story-section::before {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.65) 0%, rgba(255, 255, 255, 0.35) 55%, rgba(255, 255, 255, 0.15) 100%);
}

.content {
  position: relative;
  max-width: 1100px;
  z-index: 2;
  opacity: 0;
  display: flex;
  gap: 2.5rem;
  align-items: center;
  text-align: left;
  transition: text-shadow 0.3s ease, opacity 0.6s ease 0.2s;
  background: rgba(16, 18, 24, 0.55);
  border: 1px solid rgba(216, 178, 94, 0.15);
  border-radius: 16px;
  padding: 2.25rem;
  backdrop-filter: blur(6px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.content.visible {
  opacity: 1;
}

body.light-mode .content {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(179, 136, 15, 0.15);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

#section1 .content,
#section3 .content,
#section5 .content,
#section7 .content,
#section9 .content,
#section11 .content {
  flex-direction: row-reverse;
}

.content h2 {
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-size: 2.35rem;
  margin-bottom: 0.35rem;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: -0.6px;
  line-height: 1.15;
  transition: color 0.3s ease;
}

.content h3 {
  font-size: 1.15rem;
  margin-bottom: 1.1rem;
  font-weight: 500;
  color: var(--text-secondary);
  opacity: 0.95;
  line-height: 1.5;
  letter-spacing: -0.2px;
  transition: color 0.3s ease;
}

.content p {
  font-size: 1.03rem;
  color: var(--text-primary);
  line-height: 1.75;
  margin-bottom: 0.75rem;
  opacity: 0.94;
  transition: color 0.3s ease;
}

.content-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.content-image {
  flex: 0 0 380px;
  height: 380px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(212, 175, 55, 0.3), 0 2px 8px rgba(0,0,0,0.5);
}

.content-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.story-section:hover .content-image img {
  transform: scale(1.05);
}

.portrait {
  width: 380px;
  height: 380px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 8px 24px rgba(212, 175, 55, 0.25), 0 2px 8px rgba(0,0,0,0.4);
  transition: box-shadow 0.3s ease;
}

.video-embed {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.audio-btn {
  align-self: flex-start;
  padding: 0.55rem 0.9rem;
  border-radius: 12px;
  border: 1.5px solid rgba(216, 178, 94, 0.6);
  background: rgba(216, 178, 94, 0.12);
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.audio-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(216, 178, 94, 0.2);
}

.audio-btn.is-playing {
  background: rgba(216, 178, 94, 0.35);
  border-color: var(--accent);
  color: var(--accent);
}

.audio-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

/* ========================================================================== */
/* RESPONSIVE */
/* ========================================================================== */

@media (max-width: 768px) {
  .header {
    gap: 1rem;
    padding: 1rem;
  }

  .header h1 {
    flex-basis: 100%;
    font-size: 1.3rem;
    margin-bottom: 0;
    order: 0;
  }

  .theme-toggle {
    order: -1;
    width: 45px;
    height: 45px;
    font-size: 1.3rem;
  }

  .nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    gap: 0.25rem;
    z-index: 20;
    padding: 0.5rem;
    background: rgba(42, 40, 40, 0.95);
    border-radius: 0;
    border-top: 1px solid var(--accent);
    border-bottom: none;
    justify-content: center;
    flex-wrap: wrap;
    flex-basis: auto;
  }

  #story {
    padding-bottom: 4rem;
  }

  .nav a {
    padding: 0.35rem 0.35rem;
    font-size: 0.65rem;
  }

  .nav-label-full {
    display: none;
  }

  .nav-label-short {
    display: inline;
  }

  .content {
    flex-direction: column !important;
    gap: 2rem;
  }

  #section1 .content,
  #section3 .content,
  #section5 .content,
  #section7 .content,
  #section9 .content,
  #section11 .content {
    flex-direction: column !important;
  }

  .content-image {
    flex: 0 0 300px;
    height: 300px;
  }

  .portrait {
    width: 300px;
    height: 300px;
  }

  .content h2 {
    font-size: 1.8rem;
  }

  .content h3 {
    font-size: 1.1rem;
  }

  .content p {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .header h1 {
    font-size: 1rem;
  }

  .theme-toggle {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }

  .nav a {
    padding: 0.3rem 0.3rem;
    font-size: 0.6rem;
  }
}
