/* ============================================
   DIGITAL LINCHPIN — SHARED DESIGN SYSTEM
   ============================================
   Warm cream/brown palette with Fraunces + Outfit.
   Light-first: :root = light, [data-theme="dark"] = dark.
   ============================================ */

/* Reset */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* Skip navigation — visible only on keyboard focus */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 9999;
  padding: 12px 24px;
  background: var(--text-primary);
  color: var(--bg-primary);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  border-radius: 0 0 8px 8px;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0;
}

/* Keyboard focus ring */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---- Light (warm cream) default ---- */
:root {
  --bg-primary: #F8F4EC;
  --bg-elevated: #F0EBDF;
  --bg-surface: #EFE9DD;
  --border: rgba(42, 37, 32, 0.1);
  --border-hover: rgba(42, 37, 32, 0.2);
  --text-primary: #2A2520;
  --text-secondary: #5C544A;
  --text-muted: #7A7069;
  --accent: #c9a227;
  --accent-text: #8a6e15;
  --accent-hover: #b8921f;
  --accent-glow: rgba(201, 162, 39, 0.15);
  --brand-green: #1f3328;
  --brand-green-glow: rgba(31, 51, 40, 0.3);
}

/* ---- Dark (warm brown) ---- */
[data-theme="dark"] {
  --bg-primary: #1A1712;
  --bg-elevated: #252018;
  --bg-surface: #2E2820;
  --border: rgba(255, 245, 220, 0.08);
  --border-hover: rgba(255, 245, 220, 0.15);
  --text-primary: #F0EBE0;
  --text-secondary: rgba(240, 235, 224, 0.7);
  --text-muted: rgba(240, 235, 224, 0.55);
  --accent: #c9a227;
  --accent-text: #d4b44a;
  --accent-hover: #d4ad32;
  --accent-glow: rgba(201, 162, 39, 0.18);
  --brand-green: #2d7a4a;
  --brand-green-glow: rgba(45, 122, 74, 0.3);
}

/* ---- Theme transition (applied via JS) ---- */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease !important;
}

/* ---- Base ---- */
html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-secondary);
  line-height: 1.7;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Serif headings */
h1, h2, h3 {
  font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
  font-optical-sizing: auto;
}

/* ---- Scroll-reveal animation ---- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-stagger > .reveal:nth-child(2) { transition-delay: 0.1s; }
.reveal-stagger > .reveal:nth-child(3) { transition-delay: 0.2s; }
.reveal-stagger > .reveal:nth-child(4) { transition-delay: 0.25s; }
.reveal-stagger > .reveal:nth-child(5) { transition-delay: 0.3s; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* Fallback: show content if JS fails to load */
noscript + style .reveal,
.no-js .reveal { opacity: 1; transform: none; }


/* ---- Background gradient + grain texture ---- */
.bg-gradient {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(201, 162, 39, 0.08), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(180, 140, 30, 0.05), transparent);
  pointer-events: none;
  z-index: 0;
}

.bg-gradient::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 0.3;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.5'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
  pointer-events: none;
  z-index: 0;
}

[data-theme="dark"] .bg-gradient {
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(201, 162, 39, 0.18), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(180, 140, 30, 0.12), transparent);
}

[data-theme="dark"] .bg-gradient::after {
  opacity: 0.15;
}

/* ============================================
   NAVIGATION
   ============================================ */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0 32px;
  background: rgba(248, 244, 236, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(201, 162, 39, 0.12);
}

nav.scrolled {
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] nav {
  background: transparent;
  border-bottom: 1px solid rgba(201, 162, 39, 0.12);
}

[data-theme="dark"] nav.scrolled {
  background: rgba(26, 23, 18, 0.7);
  box-shadow: 0 1px 12px rgba(0, 0, 0, 0.3);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 72px;
}

.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.logo:hover {
  opacity: 0.85;
}

.logo img {
  height: 48px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
}

/* In light mode, swap to dark-text variant of logo */
[data-theme="light"] .logo img {
  content: url('/logo-light.png');
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.25s ease;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--brand-green);
  transition: width 0.25s ease;
}

.nav-links a:hover {
  color: var(--text-primary);
}

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

/* Active nav link */
.nav-links a.active {
  color: var(--text-primary);
}

.nav-links a.active::after {
  width: 100%;
  background: var(--accent);
}

.nav-social {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.nav-social:hover {
  color: var(--text-primary);
}

.nav-cta {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  padding: 8px 20px;
  border: 1px solid var(--border-hover);
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.25s ease;
}

.nav-cta:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

[data-theme="dark"] .nav-cta:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

/* ============================================
   THEME TOGGLE
   ============================================ */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: color 0.2s ease;
  border-radius: 6px;
}

.theme-toggle:hover {
  color: var(--text-primary);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

/* Default: show moon (click to go dark) */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

/* In dark mode: show sun (click to go light) */
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* Mobile theme toggle */
.mobile-theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.2s ease;
}

.mobile-theme-toggle:hover {
  border-color: var(--border-hover);
}

.mobile-theme-toggle svg {
  width: 18px;
  height: 18px;
}

/* Default: show moon */
.mobile-theme-toggle .icon-sun { display: none; }
.mobile-theme-toggle .icon-moon { display: flex; }

/* In dark mode: show sun */
[data-theme="dark"] .mobile-theme-toggle .icon-sun { display: flex; }
[data-theme="dark"] .mobile-theme-toggle .icon-moon { display: none; }

/* Label text */
.mobile-theme-toggle .label-dark { display: inline; }
.mobile-theme-toggle .label-light { display: none; }

[data-theme="dark"] .mobile-theme-toggle .label-dark { display: none; }
[data-theme="dark"] .mobile-theme-toggle .label-light { display: inline; }

/* ============================================
   MAIN CONTENT
   ============================================ */
main {
  position: relative;
  z-index: 1;
}

/* ============================================
   PAGE HEADER (shared across services, about, etc.)
   ============================================ */
.page-header {
  padding: 140px 24px 80px;
  max-width: 900px;
  margin: 0 auto;
}

.page-header h1 {
  font-size: clamp(36px, 6vw, 52px);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}

.page-header p {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 600px;
  line-height: 1.7;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  color: var(--bg-primary);
  background: var(--text-primary);
  padding: 14px 28px;
  border-radius: 10px;
  border: none;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .btn-primary:hover {
  box-shadow: 0 4px 20px rgba(255, 255, 255, 0.15);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-primary);
  background: transparent;
  padding: 14px 28px;
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: var(--border-hover);
}

[data-theme="dark"] .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* ============================================
   CTA SECTION (shared across pages)
   ============================================ */
.cta-section {
  padding: 80px 24px;
  text-align: center;
}

.cta-card {
  max-width: 600px;
  margin: 0 auto;
  padding: 64px 48px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  position: relative;
  overflow: hidden;
}

.cta-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.cta-card h2 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.cta-card p {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.cta-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================
   FOOTER (3-column with contact info)
   ============================================ */
footer {
  padding: 56px 24px 40px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  align-items: start;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-brand-name {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.footer-brand p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 280px;
}

.footer-col h4 {
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.footer-col a,
.footer-col span {
  display: block;
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  line-height: 2;
  transition: color 0.2s ease;
}

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

.footer-bottom {
  max-width: 1100px;
  margin: 32px auto 0;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
}

.footer-bottom a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-bottom a:hover {
  color: var(--text-secondary);
}

/* ============================================
   HAMBURGER & MOBILE MENU
   ============================================ */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
  z-index: 1001;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

.mobile-menu {
  display: none;
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(248, 244, 236, 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 60px;
  gap: 32px;
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

[data-theme="dark"] .mobile-menu {
  background: rgba(26, 23, 18, 0.97);
}

.mobile-menu.active {
  opacity: 1;
  visibility: visible;
}

.mobile-menu a {
  font-size: 20px;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.mobile-menu a:hover {
  color: var(--accent);
}

.mobile-menu .mobile-cta {
  margin-top: 16px;
  padding: 14px 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

/* ============================================
   EMAIL POPUP (shared across pages)
   ============================================ */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.popup-overlay.active {
  opacity: 1;
  visibility: visible;
}

.popup-card {
  background: var(--bg-surface);
  border: 1px solid var(--accent);
  border-radius: 16px;
  padding: 48px;
  max-width: 420px;
  width: 90%;
  position: relative;
  transform: translateY(20px);
  transition: transform 0.3s ease;
  box-shadow: 0 0 60px rgba(201, 162, 39, 0.15);
}

.popup-overlay.active .popup-card {
  transform: translateY(0);
}

.popup-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  padding: 8px 12px;
  transition: color 0.2s ease;
}

.popup-close:hover {
  color: var(--text-primary);
}

.popup-content {
  text-align: center;
}

.popup-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent-text);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 6px 12px;
  border: 1px solid rgba(201, 162, 39, 0.3);
  border-radius: 100px;
  margin-bottom: 20px;
}

.popup-content h3 {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.popup-content > p {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
}

#popup-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#popup-form input[type="email"] {
  width: 100%;
  padding: 14px 18px;
  font-size: 16px;
  font-family: inherit;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s ease;
}

#popup-form input[type="email"]:focus {
  border-color: var(--accent);
}

#popup-form input[type="email"]::placeholder {
  color: var(--text-muted);
}

#popup-form button {
  width: 100%;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 500;
  font-family: inherit;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#popup-form button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(201, 162, 39, 0.3);
}

.popup-disclaimer {
  font-size: 13px !important;
  color: var(--text-muted) !important;
  margin-top: 16px !important;
  margin-bottom: 0 !important;
}

/* ============================================
   CHAT CALLOUT (scroll-triggered)
   ============================================ */
#chat-callout {
  position: fixed;
  top: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--accent);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  line-height: 1.3;
  cursor: pointer;
  z-index: 99;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.5s ease, transform 0.5s ease, right 0.1s ease;
  pointer-events: none;
  text-decoration: none;
}

#chat-callout.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#chat-callout:hover {
  border-color: var(--accent-hover);
}

#chat-callout svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.nav-cta.glow {
  box-shadow: 0 0 12px var(--accent), 0 0 24px rgba(201, 162, 39, 0.4);
  border-color: var(--accent);
}

/* ---- Floating phone pill (appears on scroll) ---- */
.phone-float {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--bg-primary);
  border: 1px solid var(--accent);
  border-radius: 100px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: all 0.3s ease;
}

.phone-float.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.phone-float:hover {
  border-color: var(--accent-hover);
  box-shadow: 0 4px 24px rgba(201, 162, 39, 0.2);
}

.phone-float svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
  flex-shrink: 0;
}

[data-theme="dark"] .phone-float {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* ============================================
   RESPONSIVE — SHARED COMPONENTS
   ============================================ */
@media (max-width: 768px) {
  .phone-float {
    bottom: 0;
    right: 0;
    left: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    justify-content: center;
    font-size: 16px;
    padding: 14px 20px;
  }

  .nav-links {
    display: none;
  }

  .hamburger {
    display: flex;
  }

  .mobile-menu {
    display: flex;
  }

  .page-header {
    padding: 100px 20px 60px;
  }

  .btn-primary, .btn-secondary {
    width: 100%;
    justify-content: center;
  }

  .cta-card {
    padding: 48px 24px;
  }

  .cta-buttons {
    flex-direction: column;
  }

  .footer-inner {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  #chat-callout {
    display: none;
  }
}

@media (max-width: 480px) {
  .popup-card {
    padding: 32px 24px;
  }

  .popup-content h3 {
    font-size: 26px;
  }
}
