/* ==============================
   WSM WEB ARCHITECT: High-Craft Minimalism (Warm Edition)
   ============================== */

:root {
  /* Fluid Typography */
  --text-base: clamp(1rem, 0.34vw + 0.91rem, 1.19rem);
  --text-lg: clamp(1.13rem, 0.52vw + 1rem, 1.42rem);
  --text-xl: clamp(1.27rem, 0.77vw + 1.07rem, 1.69rem);
  --text-2xl: clamp(1.42rem, 1.1vw + 1.15rem, 2.03rem);
  --text-3xl: clamp(1.6rem, 1.56vw + 1.21rem, 2.44rem);
  --text-4xl: clamp(1.8rem, 2.18vw + 1.26rem, 2.93rem);
  --text-5xl: clamp(2.03rem, 3.01vw + 1.27rem, 3.52rem);
  --text-6xl: clamp(2.28rem, 4.1vw + 1.25rem, 4.22rem);
  --text-7xl: clamp(2.57rem, 5.54vw + 1.18rem, 5.06rem);

  /* Original Colors mapped for semantic use internally */
  --tl-teal: #2B8A8A;
  --tl-sage: #7CAE7A;
  --tl-cream: #FAF7F2;
  --tl-gold: #D4A76A;
  --tl-charcoal: #3D4449;
}

/* --- Base --- */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: var(--text-base);
  line-height: 1.6;
  overflow-x: hidden;
  background-color: var(--tl-cream);
  color: var(--tl-charcoal);
}

/* Typography Classes */
h1, h2, h3, h4, .font-display {
  font-family: 'Instrument Serif', Georgia, serif;
  font-weight: 400;
  letter-spacing: -0.02em;
  text-wrap: balance;
  line-height: 1.1;
  padding-right: 0.1em; /* Prevents italic swashes from being cut off */
  overflow: visible;
}

::selection {
  background: rgba(43, 138, 138, 0.15); /* tl-teal */
  color: #1E6B6B;
}

/* --- Grain Texture & Atmosphere --- */

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.025; /* Subtle dark grain */
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* --- Gradient Mesh & Orbs --- */

.gradient-mesh {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.gradient-mesh::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: 
    radial-gradient(ellipse at 20% 30%, rgba(43, 138, 138, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(124, 174, 122, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(212, 167, 106, 0.1) 0%, transparent 50%);
  animation: gentleDrift 25s infinite alternate ease-in-out;
}

@keyframes gentleDrift {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(2deg) scale(1.05); }
  100% { transform: rotate(-2deg) scale(0.95); }
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.3;
}

.orb-1 { width: 300px; height: 300px; background: var(--tl-teal); top: 10%; left: 10%; animation: float 10s infinite ease-in-out; }
.orb-2 { width: 400px; height: 400px; background: var(--tl-sage); bottom: 10%; right: 10%; animation: float 14s infinite ease-in-out reverse; }
.orb-3 { width: 250px; height: 250px; background: var(--tl-gold); top: 40%; left: 50%; animation: float 12s infinite ease-in-out 2s; }

@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(30px, -40px); }
  66% { transform: translate(-20px, 20px); }
}

/* --- Animated Gradient Text --- */
.gradient-text {
  background: linear-gradient(135deg, #1E6B6B, var(--tl-teal), var(--tl-sage), #1E6B6B);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 8s ease infinite;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* --- Buttons & Magnetic Effects --- */

.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.8rem;
  font-weight: 500;
  font-size: 0.9rem;
  border-radius: 9999px;
  cursor: pointer;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
  isolation: isolate;
  will-change: transform;
}

.btn-primary {
  background: var(--tl-teal);
  color: white;
  border: none;
  box-shadow: 0 4px 15px rgba(43, 138, 138, 0.25), inset 0 1px 1px rgba(255,255,255,0.2);
}

.btn-primary:hover {
  box-shadow: 0 8px 25px rgba(43, 138, 138, 0.4), inset 0 1px 1px rgba(255,255,255,0.3);
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #1E6B6B, var(--tl-teal));
  opacity: 0;
  z-index: -1;
  transition: opacity 0.4s ease;
}

.btn-primary:hover::before {
  opacity: 1;
}

.btn-secondary {
  background: transparent;
  color: var(--tl-teal);
  border: 1px solid rgba(43, 138, 138, 0.4);
}

.btn-secondary:hover {
  border-color: var(--tl-teal);
  background: rgba(43, 138, 138, 0.05);
}

.btn-primary:focus-visible, .btn-secondary:focus-visible {
  outline: 2px solid var(--tl-gold);
  outline-offset: 4px;
}

/* Hardware-accelerated micro-ripple */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transform: scale(0);
  animation: rippleAnim 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.btn-secondary .ripple {
  background: rgba(43, 138, 138, 0.15);
}

@keyframes rippleAnim {
  to { transform: scale(4); opacity: 0; }
}

/* --- Cards (Glassmorphism 2.0 Light Edition) --- */

.panel-choice-card, .circuit-card, .service-card, .learn-card {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 1.5rem;
  transition: transform 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
  overflow: hidden;
  position: relative;
}

.panel-choice-card:hover, .circuit-card:hover, .service-card:hover, .learn-card:hover {
  transform: translateY(-5px);
  border-color: white;
  box-shadow: 0 10px 40px rgba(43, 138, 138, 0.08), 0 0 20px rgba(255, 255, 255, 0.6);
}

/* Custom Sigils / Icons */
.custom-glyph {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(43, 138, 138, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(43, 138, 138, 0.15);
}

.custom-glyph svg {
  width: 24px;
  height: 24px;
  color: var(--tl-teal);
  opacity: 0.9;
}

/* --- Layout overrides & utilities --- */

/* Nav */
#navbar {
  border-bottom: 1px solid transparent;
}
#navbar.scrolled {
  background: rgba(250, 247, 242, 0.85); /* tl-cream */
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(43, 138, 138, 0.1);
}

.nav-link {
  color: var(--tl-charcoal);
  position: relative;
  text-decoration: none;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--tl-teal);
  transition: width 0.3s ease;
}

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

.nav-link:hover,
.nav-link.active { color: var(--tl-teal); }

/* Transparent/White Nav Mode (for dark hero sections) */
#navbar.nav-transparent .nav-link {
  color: rgba(255, 255, 255, 0.9);
}

#navbar.nav-transparent .nav-link:hover,
#navbar.nav-transparent .nav-link.active {
  color: white;
}

#navbar.nav-transparent .nav-link::after {
  background: white;
}

/* Revert to standard colors when scrolled */
#navbar.nav-transparent.scrolled .nav-link {
  color: var(--tl-charcoal);
}

#navbar.nav-transparent.scrolled .nav-link:hover,
#navbar.nav-transparent.scrolled .nav-link.active {
  color: var(--tl-teal);
}

#navbar.nav-transparent.scrolled .nav-link::after {
  background: var(--tl-teal);
}

/* Parallax image wrappers */
.parallax-img-wrap {
  border-radius: 1.5rem;
  overflow: hidden;
  position: relative;
}

/* Remove old JS animation classes, they will be handled by GSAP */
.fade-in, .slide-left, .slide-right, .scale-up {
  opacity: 1; /* reset for GSAP */
  transform: none;
}

/* --- Footer --- */
footer {
  background-color: var(--tl-charcoal);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

footer a {
  color: rgba(255, 255, 255, 0.6);
  transition: color 0.3s ease;
}

footer a:hover {
  color: white;
}

/* Section pizzazz (soft glowing background spots) */
.section-pizzazz {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.section-pizzazz > div {
  position: relative;
  z-index: 2;
}

.section-pizzazz::before,
.section-pizzazz::after {
  content: '';
  position: absolute;
  pointer-events: none;
  z-index: 1;
}

.section-pizzazz::before {
  width: 360px;
  height: 360px;
  right: -120px;
  bottom: -120px;
  border-radius: 50%;
  opacity: 0.15;
  background: radial-gradient(circle at 40% 35%, var(--tl-teal), transparent 60%);
}

.section-pizzazz::after {
  width: 320px;
  height: 320px;
  left: -140px;
  top: -100px;
  border-radius: 50%;
  opacity: 0.1;
  background: radial-gradient(circle at 65% 45%, var(--tl-gold), transparent 65%);
}

.section-pizzazz-warm::before {
  opacity: 0.2;
  background: radial-gradient(circle at 48% 30%, var(--tl-gold), transparent 60%);
}

.section-pizzazz-soft::after {
  opacity: 0.08;
}

/* Skip to content */
.skip-to-content {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: 9999;
}

.skip-to-content:focus {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  height: auto;
  overflow: visible;
  padding: 0.75rem 1.5rem;
  background: var(--tl-teal);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 9999px;
  box-shadow: 0 4px 16px rgba(43, 138, 138, 0.4);
  text-decoration: none;
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Testimonial Cards */
.testimonial-card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 1.5rem;
  padding: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: all 0.3s ease;
}

.testimonial-card:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.nav-link:focus-visible {
  outline: 2px solid var(--tl-gold);
  outline-offset: 4px;
}

footer a:focus-visible {
  outline: 2px solid var(--tl-gold);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  body::after, .gradient-mesh, .orb, .cursor-glow, #navbar, .chatbot-toggle,
  .wave-divider, #scroll-progress, .skip-to-content { display: none !important; }
  body { background: white !important; color: black !important; }
  a { color: inherit; text-decoration: underline; }
}
