:root {
  --color-realm-deep: #1e3a8a;
  --color-realm-mid: #1e40af;
  --color-realm-light: #3b82f6;
  --color-realm-pale: #dbeafe;
  --color-text-primary: #1c1917;
  --color-text-secondary: #57534e;
  --color-text-muted: #78716c;
  --color-bg-primary: #fafaf9;
  --color-bg-secondary: #ffffff;
  --color-border: #e7e5e4;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Source Sans 3', -apple-system, sans-serif;
}

/* Dark Mode */
[data-theme='dark'] {
  --color-text-primary: #f5f5f4;
  --color-text-secondary: #d6d3d1;
  --color-text-muted: #a8a29e;
  --color-bg-primary: #1c1917;
  --color-bg-secondary: #292524;
  --color-border: #44403c;
  --color-realm-pale: #1e3a8a;
}

/* Figure/Image Styles */
.figure {
  margin: 3rem auto;
  max-width: 900px;
  background: var(--color-bg-secondary);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.figure img {
  width: 100%;
  height: auto;
  display: block;
}
.figure-caption {
  padding: 1.5rem;
  background: var(--color-bg-secondary);
  border-top: 1px solid var(--color-border);
}
.figure-number {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-realm-mid);
  margin-bottom: 0.5rem;
}
.figure-title {
  font-size: 0.95rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.7;
  color: var(--color-text-primary);
  background: var(--color-bg-primary);
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

.hero {
  background: linear-gradient(
    135deg,
    #1e3a8a 0%,
    #1e40af 40%,
    #2563eb 70%,
    #3b82f6 100%
  );
  color: white;
  padding: 4rem 2rem 5rem;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.03;
}
.hero-content {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
  text-align: center;
}
.hero-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.15);
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  margin-bottom: 1.5rem;
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 3.5rem);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 1rem;
}
.hero-subtitle {
  font-size: 1.25rem;
  font-weight: 300;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto;
}

.main-content {
  max-width: 1000px;
  margin: 0 auto;
  padding: 4rem 2rem;
}

/* Realm Preview Grid */
.realm-preview-section {
  margin: 4rem 0;
}
.realm-preview-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  text-align: center;
  color: var(--color-text-primary);
  margin-bottom: 1rem;
}
.realm-preview-subtitle {
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 1.05rem;
  margin-bottom: 3rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}
.realm-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  max-width: 1000px;
  margin: 0 auto;
}
.realm-preview-card {
  background: var(--color-bg-secondary);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  text-decoration: none;
  color: inherit;
  display: block;
}
.realm-preview-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}
.realm-preview-image {
  width: 100%;
  height: auto;
  display: block;
  border-bottom: 1px solid var(--color-border);
}
.realm-preview-info {
  padding: 1rem;
}
.realm-preview-number {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-realm-mid);
  margin-bottom: 0.25rem;
}
.realm-preview-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 0.5rem;
}
.realm-preview-desc {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

@media (max-width: 768px) {
  .realm-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}
@media (max-width: 480px) {
  .realm-grid {
    grid-template-columns: 1fr;
  }
}

.intro {
  max-width: 740px;
  margin: 0 auto 3rem;
  text-align: center;
}
.intro-text {
  font-size: 1.15rem;
  color: var(--color-text-secondary);
  line-height: 1.8;
}

/* Depth Visualization */
.depth-visual {
  background: linear-gradient(
    180deg,
    #0ea5e9 0%,
    #0284c7 15%,
    #0369a1 30%,
    #075985 50%,
    #0c4a6e 70%,
    #164e63 85%,
    #134e4a 100%
  );
  border-radius: 20px;
  padding: 2rem;
  margin-bottom: 3rem;
  position: relative;
}
.depth-title {
  text-align: center;
  color: white;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}
.depth-scale {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.depth-zone {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: white;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}
.depth-zone:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateX(8px);
}
.depth-marker {
  font-size: 0.8rem;
  font-weight: 600;
  min-width: 80px;
  opacity: 0.8;
}
.depth-name {
  font-weight: 600;
  flex: 1;
}
.depth-range {
  font-size: 0.85rem;
  opacity: 0.8;
}

/* Realm Cards */
.realms-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-bottom: 3rem;
}
.realms-grid.three-col {
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 2rem;
}

.section-header {
  margin-bottom: 1.5rem;
  margin-top: 2rem;
}
.section-label {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-realm-deep);
  margin-bottom: 0.25rem;
}
.section-desc {
  font-size: 0.95rem;
  color: var(--color-text-muted);
}

.realm-card {
  background: white;
  border: 1px solid #e7e5e4;
  border-radius: 16px;
  overflow: hidden;
  text-decoration: none;
  transition: all 0.3s ease;
}
.realm-card:hover {
  border-color: var(--color-realm-mid);
  box-shadow: 0 12px 40px rgba(30, 64, 175, 0.15);
  transform: translateY(-4px);
}
.realm-card.featured {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.realm-visual {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 160px;
}
.realm-visual.sunlit {
  background: linear-gradient(135deg, #0ea5e9 0%, #38bdf8 100%);
}
.realm-visual.twilight {
  background: linear-gradient(135deg, #0369a1 0%, #0c4a6e 100%);
}
.realm-visual.midnight {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}
.realm-visual.coral {
  background: linear-gradient(135deg, #f472b6 0%, #fb7185 100%);
}
.realm-visual.kelp {
  background: linear-gradient(135deg, #059669 0%, #34d399 100%);
}
.realm-visual.open {
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
}
.realm-visual.deep {
  background: linear-gradient(135deg, #164e63 0%, #0f172a 100%);
}
.realm-visual.polar {
  background: linear-gradient(135deg, #e0f2fe 0%, #7dd3fc 100%);
}
.realm-visual.polar .realm-icon,
.realm-visual.polar .realm-depth {
  color: #0c4a6e;
}
.realm-visual.coastal {
  background: linear-gradient(135deg, #a3e635 0%, #22d3ee 100%);
}

.realm-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}
.realm-depth {
  color: white;
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0.9;
}

.realm-content {
  padding: 1.5rem;
}
.realm-category {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 0.35rem;
}
.realm-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 0.5rem;
}
.realm-description {
  font-size: 0.95rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
}
.realm-features {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}
.realm-feature {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.3rem 0.6rem;
  border-radius: 2rem;
  background: var(--color-realm-pale);
  color: var(--color-realm-deep);
}

/* Path Section */
.path-section {
  background: linear-gradient(135deg, var(--color-realm-pale) 0%, white 100%);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
}
.path-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--color-text-primary);
}
.path-description {
  color: var(--color-text-secondary);
  margin-bottom: 1.5rem;
}
.path-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.path-step {
  background: white;
  border: 1px solid #e7e5e4;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-primary);
}
.path-arrow {
  color: var(--color-realm-mid);
  font-size: 1.25rem;
}

/* Footer Navigation */
.footer-nav {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #e7e5e4;
}
.footer-nav-link {
  flex: 1;
  background: white;
  border: 1px solid #e7e5e4;
  border-radius: 16px;
  padding: 1.5rem;
  text-decoration: none;
  transition: all 0.3s ease;
}
.footer-nav-link:hover {
  border-color: var(--color-realm-mid);
  box-shadow: 0 8px 30px rgba(30, 64, 175, 0.15);
  transform: translateY(-2px);
}
.footer-nav-link.prev {
  text-align: left;
}
.footer-nav-link.next {
  text-align: right;
}
.footer-nav-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 0.25rem;
}
.footer-nav-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

@media (max-width: 768px) {
  .hero {
    padding: 3rem 1.5rem 4rem;
  }
  .main-content {
    padding: 3rem 1.5rem;
  }
  .realms-grid {
    grid-template-columns: 1fr;
  }
  .realms-grid.three-col {
    grid-template-columns: 1fr;
  }
  .realm-card.featured {
    grid-template-columns: 1fr;
  }
  .depth-zone {
    flex-wrap: wrap;
  }
  .path-flow {
    flex-direction: column;
  }
  .path-arrow {
    transform: rotate(90deg);
  }
  .footer-nav {
    flex-direction: column;
  }
  .footer-nav-link.prev,
  .footer-nav-link.next {
    text-align: center;
  }
}

/* Framework Figure */
.framework-section {
  margin: 3rem 0 4rem;
}
.framework-figure {
  max-width: 900px;
  margin: 0 auto 4rem;
  background: var(--color-bg-secondary);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.framework-figure img {
  width: 100%;
  height: auto;
  display: block;
}
.framework-caption {
  padding: 1.5rem;
  background: var(--color-bg-secondary);
  border-top: 1px solid var(--color-border);
}
.framework-caption-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-realm-mid);
  margin-bottom: 0.5rem;
}
.framework-caption-text {
  font-size: 0.95rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

/* Detailed Realm Sections */
.detailed-realms-section {
  margin-top: 4rem;
  padding-top: 3rem;
  border-top: 2px solid var(--color-border);
}
.detailed-realms-intro {
  text-align: center;
  margin-bottom: 3rem;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}
.detailed-realms-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 0.75rem;
}
.detailed-realms-subtitle {
  font-size: 1.05rem;
  color: var(--color-text-secondary);
  line-height: 1.7;
}

.realm-detailed {
  background: var(--color-bg-secondary);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 2.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}
.realm-detailed:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.realm-detailed-content {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 2rem;
  padding: 2rem;
}
.realm-detailed-image {
  width: 100%;
  height: auto;
  border-radius: 8px;
  object-fit: cover;
}
.realm-detailed-info {
  display: flex;
  flex-direction: column;
}
.realm-detailed-header {
  margin-bottom: 1rem;
}
.realm-detailed-category {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-realm-mid);
  margin-bottom: 0.25rem;
}
.realm-detailed-name {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 0.5rem;
}
.realm-detailed-location {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  font-style: italic;
}
.realm-detailed-description {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-text-secondary);
  margin-bottom: 1.5rem;
}
.realm-topics {
  margin-bottom: 1.5rem;
}
.realm-topics-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-primary);
  margin-bottom: 0.75rem;
}
.realm-topics-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.realm-topic {
  background: var(--color-realm-pale);
  /* color: var(--color-realm-deep); */
  padding: 0.4rem 0.9rem;
  border-radius: 1rem;
  font-size: 0.85rem;
  font-weight: 500;
}
.realm-detailed-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-realm-mid);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 2rem;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  align-self: flex-start;
}
.realm-detailed-button:hover {
  background: var(--color-realm-deep);
  transform: translateX(4px);
}

@media (max-width: 768px) {
  .realm-detailed-content {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .detailed-realms-section {
    padding-top: 2rem;
  }
}
