:root {
  --bg: #fbfdff;
  --panel-bg: #ffffff;
  --card: #e9ecef;
  --text: #06121a;
  --muted: #526b7a;
  --accent: #007bff;
  --glass: rgba(255, 255, 255, 0.6);
  --radius: 14px;
  --container: 1100px;
  --icon: #000;
  --header-bg: rgba(255, 255, 255, 0.9);
  --progress: 50%;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.dark {
  --bg: #0b141d;
  --panel-bg: #101923;
  --card: #15222b;
  --text: #e7f0f8;
  --muted: #7f98ab;
  --accent: #5d9dff;
  --icon: #fff;
  --glass: rgba(255, 255, 255, 0.05);
  --header-bg: rgba(7, 16, 26, 0.8);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background 0.4s ease, color 0.4s ease;
}

a:focus, button:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: clamp(18px, 2.8vw, 36px);
}

.muted {
  color: var(--muted);
}
.accent {
  color: var(--accent);
}

/* Typography */
h2, h3, h4 {
  line-height: 1.3;
  letter-spacing: -0.02em;
}
h2 {
  font-size: clamp(28px, 3.5vw, 40px);
  margin-bottom: 18px;
}
h3 {
  font-size: clamp(22px, 2.5vw, 28px);
  margin-bottom: 12px;
  font-weight: 700;
}
h4 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(20px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--glass);
  box-shadow: 0 1px 12px rgba(0, 0, 0, 0.05);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  min-height: 80px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.brand h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}
.brand .tagline {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}
.nav-container {
  display: flex;
  align-items: center;
  gap: 16px;
}
.nav {
  display: flex;
  align-items: center;
  gap: 12px;
}
.nav a {
  color: var(--text);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 15px;
  transition: all 0.2s ease-in-out;
}
.nav a:hover {
  background: var(--card);
  transform: translateY(-2px);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 50px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s, opacity 0.2s ease;
}
.btn:hover {
  opacity: 0.8;
}
.btn-outline {
  background: none;
  border: 2px solid var(--accent, #0077ff);
  color: var(--accent, #0077ff);
}
.btn-outline:hover {
  background: var(--accent, #0077ff);
  color: #fff;
}
.btn.primary {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  border: 0;
}
.btn.primary:hover {
  transform: translateY(-2px);
}
.btn.ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

/* Menu + Theme Buttons */
.menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  padding: 10px;
  color: var(--text);
  font-size: 32px;
  line-height: 1;
  display: none;
}
.theme-btn {
  background: none;
  border: 0;
  padding: 6px;
  cursor: pointer;
  width: 48px;
  height: 48px;
  display: inline-grid;
  place-items: center;
  color: var(--icon);
  position: relative;
  overflow: visible;
  transition: transform 0.2s ease;
}
.theme-btn:hover {
  transform: scale(1.1);
}
.theme-btn .sun, .theme-btn .moon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.theme-btn .sun {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(0deg) scale(1);
}
.theme-btn .moon {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(-20deg) scale(0.85);
}
body.dark .theme-btn .sun {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(180deg) scale(0.8);
}
body.dark .theme-btn .moon {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(0deg) scale(1);
}

/* Hero */
.hero {
  padding: clamp(80px, 10vw, 120px) 0;
  border-bottom: 1px solid var(--glass);
  position: relative;
  z-index: 0;
  background: var(--bg);
}
.hero-grid {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 28px;
  align-items: center;
  grid-auto-rows: min-content;
}
.hero-copy h2 {
  margin: 0;
}
.hero-copy .lead {
  color: var(--muted);
  margin: 12px 0 14px;
  font-weight: 500;
  font-size: 18px;
}
.hero-image {
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
  max-width: 100%;
  margin: 0 auto;
}
.hero-image img {
  width: 100%;
  height: auto;
  object-fit: cover;
  display: block;
  aspect-ratio: 4/3;
}
.hero-image figcaption {
  padding: 12px 16px;
  font-size: 14px;
  color: var(--muted);
}

/* Panels */
.panel {
  background: var(--panel-bg);
  margin: 60px 0;
  padding: clamp(60px, 8vw, 120px) 0;
  border-radius: 18px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.04);
}

/* Facts */
.facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 32px;
}
.facts article {
  background: var(--card);
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}
.facts article:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), 0 0 0 4px var(--accent);
}

/* Simulator */
.simulator .sim-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  margin-top: 32px;
}
.sim-preview {
  background: var(--card);
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.sim-preview img {
  width: 100%;
  height: auto;
  border-radius: 8px;
}
.sim-caption {
  text-align: center;
  margin-top: 12px;
  font-size: 16px;
  color: var(--muted);
}
.sim-controls {
  background: var(--card);
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
}
.sim-controls label {
  font-weight: 600;
  margin-bottom: 8px;
  display: inline-block;
}
.shutter-speed-display {
  text-align: center;
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 12px;
}
.aperture-scale {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-top: 10px;
  color: var(--muted);
}

/* Slider */
input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  border-radius: 10px;
  transition: background-color 0.2s ease;
  /* Use a linear gradient with the --progress variable */
  background: linear-gradient(to right, var(--accent) var(--progress), var(--card) var(--progress));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transform: scale(1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
input[type="range"]:focus {
  outline: none;
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Gallery */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 32px;
}
.gallery-grid figure {
  margin: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--card);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
}
.gallery-grid figure img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  transition: transform 0.4s ease;
  display: block;
}
.gallery-grid figure:hover {
  transform: translateY(-4px);
  box-shadow: 0 0 0 4px var(--accent);
}
.gallery-grid figure:hover img {
  transform: scale(1.08);
}
.gallery-grid figcaption {
  padding: 12px 14px;
  font-size: 14px;
  color: var(--muted);
}

/* Learn Section */
.learn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin-top: 32px;
}
.learn-grid article {
  background: var(--card);
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
  transition: transform 0.2s ease;
}
.learn-grid article:hover {
  transform: translateY(-4px);
  box-shadow: 0 0 0 3px var(--accent);
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 23, 0.95);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 2000;
  padding: 30px;
}
.lightbox.open {
  opacity: 1;
  pointer-events: auto;
}
.lightbox img {
  max-width: 90vw;
  max-height: 75vh;
  border-radius: 12px;
  object-fit: contain;
}
.lb-close {
  position: absolute;
  right: 28px;
  top: 28px;
  background: none;
  border: 0;
  font-size: 24px;
  cursor: pointer;
  color: white;
}

/* Footer */
.site-footer {
  padding: 32px 0;
  background: var(--panel-bg);
  border-top: 1px solid var(--glass);
  text-align: center;
}
.site-footer p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

/* Mobile Menu */
.mobile-menu {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--panel-bg);
  backdrop-filter: blur(0px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, backdrop-filter 0.3s ease;
  z-index: 200;
}
.mobile-menu.open {
  opacity: 1;
  pointer-events: auto;
  backdrop-filter: blur(12px);
}
.mobile-menu ul {
  list-style: none;
  padding: 0;
  margin: 0;
  text-align: center;
}
.mobile-menu li {
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
}
.mobile-menu.open li:nth-child(1) { transition-delay: 0.1s; }
.mobile-menu.open li:nth-child(2) { transition-delay: 0.15s; }
.mobile-menu.open li:nth-child(3) { transition-delay: 0.2s; }
.mobile-menu.open li:nth-child(4) { transition-delay: 0.25s; }
.mobile-menu.open li {
  transform: translateY(0);
  opacity: 1;
}
.mobile-menu a {
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 22px;
  transition: color 0.2s ease, transform 0.2s ease;
  display: block;
  padding: 5px 0;
}
.mobile-menu a:hover {
  color: var(--accent);
}
.close-btn {
  position: absolute;
  top: 20px;
  right: 24px;
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--text);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.mobile-menu.open .close-btn {
  transform: rotate(90deg);
}

/* Responsive */
@media(max-width: 767px) {
  .nav, .nav-container .theme-btn {
    display: none;
  }
  .menu-btn {
    display: block;
  }
  .hero-grid, .simulator .sim-grid, .facts, .gallery-grid {
    grid-template-columns: 1fr;
  }
}
@media(min-width: 768px) and (max-width: 1024px) {
  .nav {
    display: flex !important;
  }
  .menu-btn {
    display: none !important;
  }
  .hero-grid, .simulator .sim-grid {
    grid-template-columns: 1fr 320px;
  }
  .facts {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media(min-width: 1025px) {
  .nav {
    display: flex !important;
  }
  .menu-btn {
    display: none !important;
  }
  .hero-grid {
    grid-template-columns: 1fr 480px;
  }
  .simulator .sim-grid {
    grid-template-columns: 1fr 420px;
  }
  .facts {
    grid-template-columns: repeat(3, 1fr);
  }
}
