/* === THE DIGITAL SANCTUARY DESIGN SYSTEM === */
@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,400&family=Montserrat:wght@300;400;500&display=swap");

:root {
  /* Earth & Stone Palette */
  --bg-color: #fdfbf7; /* Warm Rice Paper White */
  --text-main: #2c2c2c; /* Soft Charcoal */
  --text-muted: #6e6e6e; /* Stone Grey */
  --accent-gold: #d4af37; /* Muted Gold for highlights */
  --zen-green: #4a5d4f; /* Deep Sage */
  --zen-blue: #5f7a85; /* Slate Blue */

  /* Spacing & Layout */
  --container-width: 1200px;
  --section-padding: 80px 20px;

  /* Animations */
  --ease-out: cubic-bezier(0.215, 0.61, 0.355, 1);
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: "Montserrat", sans-serif;
  line-height: 1.8;
  overflow-x: hidden;
}

h1,
h2,
h3 {
  font-family: "Cormorant Garamond", serif;
  font-weight: 400;
  line-height: 1.2;
}

/* === NAVIGATION === */
.nav-wrapper {
  position: fixed;
  top: 0;
  width: 100%;
  padding: 30px 50px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  transition: all 0.4s ease;
  background: transparent;
}

.nav-wrapper.scrolled {
  background: rgba(253, 251, 247, 0.95);
  padding: 15px 50px;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.05);
}

.logo {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.8rem;
  letter-spacing: 2px;
  color: var(--text-main);
  text-decoration: none;
  font-weight: 600;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  gap: 40px;
}

.nav-link {
  text-decoration: none;
  color: var(--text-main);
  font-size: 0.9rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  position: relative;
}

.nav-link::after {
  content: "";
  position: absolute;
  width: 0;
  height: 1px;
  bottom: -5px;
  left: 0;
  background-color: var(--text-main);
  transition: width 0.3s ease;
}

.nav-link:hover::after {
  width: 100%;
}

/* === BUTTONS === */
.btn-outline {
  display: inline-block;
  padding: 12px 30px;
  border: 1px solid var(--text-main);
  color: var(--text-main);
  text-decoration: none;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 2px;
  transition: all 0.3s ease;
  background: transparent;
  cursor: pointer;
}

.btn-outline:hover {
  background: var(--text-main);
  color: var(--bg-color);
}

/* === HERO SECTION === */
.hero {
  height: 90vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 20px;
  position: relative;
}

.hero h1 {
  font-size: 5rem;
  margin-bottom: 20px;
  opacity: 0; /* JS will animate this */
  transform: translateY(30px);
}

.hero p {
  font-size: 1.2rem;
  color: var(--text-muted);
  max-width: 500px;
  margin-bottom: 40px;
  opacity: 0;
  transform: translateY(30px);
}

.scroll-indicator {
  position: absolute;
  bottom: 40px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  opacity: 0.6;
  animation: float 3s infinite ease-in-out;
}

/* === GALLERY CARDS (PORTALS) === */
.gallery-section {
  padding: var(--section-padding);
  max-width: var(--container-width);
  margin: 0 auto;
}

.section-title {
  text-align: center;
  font-size: 3rem;
  margin-bottom: 80px;
  color: var(--text-main);
}

.portals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 40px;
}

.portal-card {
  position: relative;
  height: 500px;
  overflow: hidden;
  cursor: pointer;
  /* Masking for subtle rounded corners */
  clip-path: inset(0 0 0 0 round 4px);
}

.portal-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.2s var(--ease-out);
}

.portal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.portal-card:hover .portal-img {
  transform: scale(1.1);
}

.portal-card:hover .portal-overlay {
  opacity: 1;
}

.portal-title {
  color: #fff;
  font-size: 3rem;
  font-style: italic;
  z-index: 2;
}

.portal-link {
  color: #fff;
  margin-top: 20px;
  text-decoration: none;
  border-bottom: 1px solid #fff;
  padding-bottom: 5px;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* === ZEN APP CTA SECTION === */
.zen-cta {
  background-color: #e8e6e1; /* Slightly darker stone color */
  padding: 100px 20px;
  text-align: center;
  margin-top: 50px;
}

.zen-cta h2 {
  font-size: 4rem;
  margin-bottom: 20px;
}

.zen-cta p {
  margin-bottom: 40px;
  color: var(--text-muted);
}

/* === FOOTER === */
footer {
  padding: 50px;
  text-align: center;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-credit {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.footer-credit a {
  color: var(--text-main);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.footer-credit a:hover {
  color: var(--accent-gold);
}

/* === ANIMATIONS === */
@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(10px);
  }
}

/* === GALLERY PAGE SPECIFIC STYLES === */

/* Header Styling */
.gallery-header {
  padding-top: 150px; /* Clear the fixed nav */
  padding-bottom: 60px;
  text-align: center;
  background: linear-gradient(to bottom, var(--bg-color), #f4f1ea);
}

.gallery-header h1 {
  font-size: 3.5rem;
  color: var(--text-main);
  margin-bottom: 15px;
}

.gallery-header p {
  font-family: "Montserrat", sans-serif;
  color: var(--text-muted);
  font-size: 1.1rem;
  letter-spacing: 1px;
}

/* Container Utility */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Organic Masonry Grid */
.masonry-grid {
  column-count: 3;
  column-gap: 30px;
}

.masonry-item {
  break-inside: avoid;
  margin-bottom: 30px;
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  transition: transform 0.5s ease;
}

.masonry-item img {
  width: 100%;
  height: auto;
  display: block;
  /* Filter: slightly desaturated initially for a calmer look */
  filter: grayscale(10%) contrast(95%);
  transition: all 0.5s ease;
}

/* Hover Effect: Gentle Float */
.masonry-item:hover {
  transform: translateY(-5px);
}

.masonry-item:hover img {
  filter: grayscale(0%) contrast(100%);
  transform: scale(1.02);
}

/* Gallery Footer Nav */
.gallery-footer {
  padding: 80px 0;
  text-align: center;
}

.next-link {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.5rem;
  color: var(--text-main);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.3s ease;
}

.next-link:hover {
  border-bottom: 1px solid var(--text-main);
  padding-bottom: 5px;
}

/* Mobile Responsiveness for Gallery */
@media (max-width: 900px) {
  .masonry-grid {
    column-count: 2;
  }
}

@media (max-width: 600px) {
  .masonry-grid {
    column-count: 1;
  }
  .gallery-header h1 {
    font-size: 2.5rem;
  }
}

/* Mobile Tweak */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 3rem;
  }
  .portals-grid {
    grid-template-columns: 1fr;
  }
  .nav-wrapper {
    padding: 20px;
  }
  .nav-links {
    display: none;
  }
}

/* === THEME: GARDEN OVERRIDES === */

/* When the body has the class "theme-garden" */
.theme-garden {
  /* Pale Sage Green Background */
  background-color: #f0f4f1;
  color: #2f3e33; /* Darker forest green text for contrast */
}

/* Adjust the header gradient for this theme */
.theme-garden .gallery-header {
  background: linear-gradient(to bottom, #f0f4f1, #e2e8e4);
}

/* Adjust the Nav Bar when scrolling on this theme */
.theme-garden .nav-wrapper.scrolled {
  background: rgba(240, 244, 241, 0.95);
}

/* Make links match the earthy theme */
.theme-garden .logo,
.theme-garden .nav-link,
.theme-garden .next-link,
.theme-garden .gallery-header h1 {
  color: #2f3e33;
}

.theme-garden .nav-link::after {
  background-color: #2f3e33;
}

.theme-garden .btn-outline {
  border-color: #2f3e33;
  color: #2f3e33;
}

.theme-garden .btn-outline:hover {
  background: #2f3e33;
  color: #f0f4f1;
}

/* Subtle border adjustment for images in this theme to blend better */
.theme-garden .masonry-item img {
  filter: sepia(10%) grayscale(5%); /* Adds a tiny bit of warmth/earthiness */
}

.theme-garden .masonry-item:hover img {
  filter: sepia(0%) grayscale(0%);
}

/* === THEME: WATER OVERRIDES === */

/* When the body has the class "theme-water" */
.theme-water {
  /* Mist Blue Background */
  background-color: #ebf2f5;
  /* Deep Slate Text */
  color: #34495e;
}

/* Adjust the header gradient for this theme */
.theme-water .gallery-header {
  background: linear-gradient(to bottom, #ebf2f5, #dce6eb);
}

/* Adjust the Nav Bar background on scroll */
.theme-water .nav-wrapper.scrolled {
  background: rgba(235, 242, 245, 0.95);
}

/* Link Colors: Deep Slate */
.theme-water .logo,
.theme-water .nav-link,
.theme-water .next-link,
.theme-water .gallery-header h1 {
  color: #34495e;
}

.theme-water .nav-link::after {
  background-color: #34495e;
}

/* Button Styling: Blue tint on hover */
.theme-water .btn-outline {
  border-color: #34495e;
  color: #34495e;
}

.theme-water .btn-outline:hover {
  background: #34495e;
  color: #ebf2f5;
}

/* Image Filter: Cooling Effect */
.theme-water .masonry-item img {
  /* Slightly increase blue tones and lower contrast for a "misty" look */
  filter: contrast(95%) brightness(105%);
}

.theme-water .masonry-item:hover img {
  filter: contrast(100%) brightness(100%);
}

/* === ZEN APP INTERFACE (THE SANCTUARY) === */

/* The Canvas */
#immersive-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  transition: background-color 2s ease-in-out; /* Super slow color transition */
}

/* UI Overlay */
.zen-interface {
  position: relative;
  z-index: 10;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 40px 20px;
  pointer-events: none; /* Let clicks pass through to background */
}

/* Exit Button */
.zen-exit {
  position: absolute;
  top: 30px;
  left: 40px;
  text-decoration: none;
  color: var(--text-main);
  font-family: "Montserrat", sans-serif;
  font-size: 0.9rem;
  opacity: 0.6;
  pointer-events: auto;
  transition: opacity 0.3s;
}

.zen-exit:hover {
  opacity: 1;
}

/* Breathing Light (The Centerpiece) */
.breathing-center {
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: auto;
  cursor: pointer;
  z-index: 15;
}

.breath-light {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.8) 0%,
    rgba(255, 255, 255, 0) 70%
  );
  opacity: 0.5;
  animation: breathe-anim 8s infinite cubic-bezier(0.4, 0, 0.2, 1);
  transition: all 0.5s ease;
}

.breath-text {
  position: absolute;
  color: var(--text-main);
  font-family: "Cormorant Garamond", serif;
  font-size: 1.5rem;
  letter-spacing: 2px;
  opacity: 0.8;
}

@keyframes breathe-anim {
  0%,
  100% {
    transform: scale(0.8);
    opacity: 0.3;
  }
  50% {
    transform: scale(1.5);
    opacity: 0.6;
  }
}

/* Paused State for Breathing */
.breathing-center.paused .breath-light {
  animation-play-state: paused;
  opacity: 0.2;
}

/* The Quote */
.quote-display {
  margin-top: auto;
  margin-bottom: 40px;
  text-align: center;
  max-width: 800px;
  padding: 0 20px;
  position: relative;
  z-index: 20;
  pointer-events: none;
}

#zen-quote-text {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.8rem;
  color: var(--text-main);
  opacity: 0; /* JS handles fade in */
  transition: opacity 2s ease;
}

/* The Dock (Control Stone) */
.zen-dock {
  background: rgba(255, 255, 255, 0.9);
  padding: 15px 30px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  pointer-events: auto;
  margin-bottom: 30px;
  backdrop-filter: blur(10px);
  z-index: 30;
}

.dock-divider {
  width: 1px;
  height: 25px;
  background: rgba(0, 0, 0, 0.1);
}

.dock-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 10px;
  border-radius: 50%;
  transition: all 0.3s ease;
  font-size: 1.2rem;
  opacity: 0.5;
}

.dock-btn:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.05);
  transform: translateY(-2px);
}

.dock-btn.active {
  opacity: 1;
  background: var(--text-main);
}
.dock-btn.active .icon {
  filter: invert(1);
} /* Invert icon color when active */

/* === MODE COLORS === */
/* Applied by JS to body */
body.mode-water #immersive-container {
  background-color: #ebf2f5;
}
body.mode-sky #immersive-container {
  background-color: #e6e6fa;
} /* Soft Lavender */
body.mode-earth #immersive-container {
  background-color: #f0f4f1;
}

/* Interactive Elements */
.zen-particle {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
}
