/* Shared premium experience layer */
body {
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.22s ease,
    transform 0.22s ease;
}
body.page-ready {
  opacity: 1;
  transform: none;
}
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

.theme-toggle {
  margin-left: auto;
  margin-right: 0.5rem;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero {
  min-height: calc(100vh - 72px);
  background: #171311;
  isolation: isolate;
}
.hero::before {
  opacity: 0.55;
  background-image: url("../assets/multiBG.webp");
  transform: translateY(var(--parallax, 0)) scale(1.08);
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    90deg,
    rgba(10, 8, 7, 0.9),
    rgba(10, 8, 7, 0.55) 55%,
    rgba(10, 8, 7, 0.72)
  );
}
.hero-light {
  --x: 50%;
  --y: 50%;
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(
    420px circle at var(--x) var(--y),
    rgba(200, 162, 122, 0.18),
    transparent 62%
  );
}
.btn-outline {
  display: inline-flex;
  align-items: center;
  padding: 0.9rem 2.2rem;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 8px;
  color: #fff;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 1px;
}
.btn-outline:hover {
  background: #fff;
  color: var(--primary);
}
.service-card {
  isolation: isolate;
}
.service-line {
  position: absolute;
  inset: 8px;
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  pointer-events: none;
  z-index: -1;
}
.service-line rect {
  fill: none;
  stroke: var(--accent);
  stroke-width: 0.01;
  stroke-dasharray: 390;
  stroke-dashoffset: 390;
  transition: stroke-dashoffset 0.8s ease;
}
.service-card:hover .service-line rect,
.service-card:focus-within .service-line rect {
  stroke-dashoffset: 0;
}
.testimonial-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.testimonial-avatar,
.testimonial-logo {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary);
  color: var(--accent-light);
  font-weight: 700;
  letter-spacing: 1px;
}
.testimonial-avatar {
  width: 56px;
  height: 56px;
  border: 3px solid var(--accent-light);
}
.testimonial-logo {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--primary);
  font-family: var(--font-heading);
}
.project-card:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 5px;
}
.project-link {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 1rem;
  color: var(--accent-dark);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.founder-card {
  margin-top: 4rem;
  padding: 2.5rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2rem;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--off-white);
}
.founder-mark {
  width: 120px;
  height: 120px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary);
  color: var(--accent);
  font-family: var(--font-heading);
  font-size: 1.7rem;
  border: 4px solid var(--accent-light);
}
.contact-form label {
  display: block;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.form-feedback {
  margin-top: 1rem;
  min-height: 1.5rem;
}
.form-feedback.error {
  color: #b42318;
  font-weight: 600;
}
.newsletter-feedback {
  color: #d4b896;
  font-size: 0.8rem;
  margin-top: 0.5rem;
  min-height: 1.2rem;
}

/* ==========================================
   DARK MODE SYSTEM ARCHITECTURE (SPECIFICITY FIXED)
   ========================================== */

html[data-theme="dark"] {
  --white: #171412 !important;
  --off-white: #100e0d !important;
  --text: #f1e9e1 !important;
  --text-light: #d0c2b5 !important;
  --text-muted: #ad9e91 !important;
  --border: #4a3d35 !important;
  --border-light: #342b26 !important;
  --primary: #f6eee7 !important;
  --primary-light: #2d2420 !important;
}

/* Base Backgrounds */
html[data-theme="dark"] body,
html[data-theme="dark"] #services,
html[data-theme="dark"] #testimonials,
html[data-theme="dark"] .about-section,
html[data-theme="dark"] .contact-section,
html[data-theme="dark"] .projects-section,
html[data-theme="dark"] .home-process,
html[data-theme="dark"] .brands {
  background: var(--off-white) !important;
}

/* Header & Nav */
html[data-theme="dark"] header,
html[data-theme="dark"] header.scrolled,
html[data-theme="dark"] .nav-links {
  background: #161310 !important;
  border-bottom-color: var(--border-light) !important;
}

/* Cards & Forms */
html[data-theme="dark"] .service-card,
html[data-theme="dark"] .testimonial,
html[data-theme="dark"] .project-card,
html[data-theme="dark"] .info-card,
html[data-theme="dark"] .process-step,
html[data-theme="dark"] .contact-form,
html[data-theme="dark"] .contact-info-panel,
html[data-theme="dark"] .contact-form-panel,
html[data-theme="dark"] .value-card {
  background: #1d1916 !important;
  border-color: var(--border-light) !important;
}

/* ==========================================
   DARK MODE TEXT & ICON VISIBILITY FIXES
   ========================================== */

/* Overriding high-specificity styles from reference-redesign.css */
html[data-theme="dark"] h1,
html[data-theme="dark"] .hero h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] .section-header h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] .service-card h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] .value-card h4,
html[data-theme="dark"] p,
html[data-theme="dark"] .hero-content p,
html[data-theme="dark"] span,
html[data-theme="dark"] div,
html[data-theme="dark"] label,
html[data-theme="dark"] li,
html[data-theme="dark"] blockquote {
  color: var(--text) !important;
}

/* Sub-text muted colors */
html[data-theme="dark"] .text-muted,
html[data-theme="dark"] .project-desc,
html[data-theme="dark"] .about-desc,
html[data-theme="dark"] .stat-label,
html[data-theme="dark"] .form-sub {
  color: var(--text-light) !important;
}

/* Protect the Button Colors & Badges */
html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .btn-small,
html[data-theme="dark"] .hero-badge,
html[data-theme="dark"] .project-cat,
html[data-theme="dark"] .stat-number,
html[data-theme="dark"] .stat-percent {
  color: #ffffff !important;
}

/* Fix Icons & Nav Links */
html[data-theme="dark"] .nav-links a,
html[data-theme="dark"] .theme-toggle i,
html[data-theme="dark"] .mobile-menu-btn i {
  color: var(--text) !important;
}

html[data-theme="dark"] .social-links a i,
html[data-theme="dark"] .contact-social-links a i,
html[data-theme="dark"] .info-card i,
html[data-theme="dark"] .service-icon i,
html[data-theme="dark"] .feature-item i,
html[data-theme="dark"] .stat i {
  color: var(--accent) !important;
}

html[data-theme="dark"] .header-social-links a:hover,
html[data-theme="dark"] .header-social-links a:hover i {
  color: #ffffff !important;
}

/* Fix Input Fields */
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  color: var(--text) !important;
  background-color: #161310 !important;
  border-color: var(--border) !important;
}

/* ==========================================
   ULTIMATE LOGO UNIFICATION FIX
   ========================================== */

/* 1. Header Logo – normal colours in light mode, no grayscale */
#header .logo-img {
  width: 210px !important;
  height: 52px !important;
  object-fit: contain !important;
  /* filter removed – logo now appears as designed */
  transition: filter 0.3s ease !important;
}

/* 2. Header Logo – bright white in dark mode */
html[data-theme="dark"] #header .logo-img {
  filter: brightness(0) invert(1) !important;
}

/* 3. Footer Logo – always pure white (footer background is dark) */
#footer .footer-logo {
  width: 230px !important;
  height: 58px !important;
  object-fit: contain !important;
  filter: brightness(0) invert(1) !important;
  margin-bottom: 1.5rem !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* 4. Mobile Adjustments for Consistency */
@media (max-width: 768px) {
  #header .logo-img {
    width: 165px !important;
    height: 44px !important;
  }

  .theme-toggle {
    margin-left: auto;
  }
  .hero {
    min-height: 90svh;
  }
  .hero-light {
    display: none;
  }
  .founder-card {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .founder-mark {
    margin: auto;
  }
  html[data-theme="dark"] .nav-links {
    background: #161310 !important;
  }
}

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

/* ==========================================
   DARK MODE: FIX FOUNDER CARD & TESTIMONIAL AVATAR VISIBILITY
   ========================================== */

/* Founder card: make background dark, text white */
html[data-theme="dark"] .founder-card {
  background: #161310 !important;
  color: var(--text) !important;
}

html[data-theme="dark"] .founder-card h3,
html[data-theme="dark"] .founder-card p,
html[data-theme="dark"] .founder-card span {
  color: var(--text) !important;
}

/* Founder mark (the DMD badge): dark background with bright accent text */
html[data-theme="dark"] .founder-mark {
  background: #161310 !important;
  color: var(--accent) !important;
  border-color: var(--accent-light) !important;
}

/* Testimonial avatar: dark background, light gold letters */
html[data-theme="dark"] .testimonial-avatar {
  background: #161310 !important;
  color: var(--accent-light) !important;
  border-color: var(--accent) !important;
}

/* Testimonial logo: keep consistent */
html[data-theme="dark"] .testimonial-logo {
  background: #1d1916 !important;
  color: var(--text) !important;
  border-color: var(--border-light) !important;
}
