/* Clarvi Site-wide Shared Styles */

:root {
  --clarvi-bg-dark: #000000;
  --clarvi-bg-darker: #0a0a0a;
  --clarvi-accent: #FFB800;
  --clarvi-text-light: rgba(255, 255, 255, 0.9);
  --clarvi-text-muted: rgba(255, 255, 255, 0.6);
  --clarvi-border: rgba(255, 255, 255, 0.05);
}

/* Global Reset & Base */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--clarvi-bg-dark);
  color: var(--clarvi-text-light);
  line-height: 1.6;
}

/* Unified Header/Navigation - Responsive layout */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: env(safe-area-inset-top, 0) 2rem 0;
  height: 4rem;
  border-bottom: 1px solid var(--clarvi-border);
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

@media (max-width: 768px) {
  .site-header {
    grid-template-columns: 1fr auto;
    padding: env(safe-area-inset-top, 0) 1rem 0;
  }
}

/* Logo - Left section */
.site-header .logo,
.site-header .site-logo {
  font-size: 1.25rem;
  letter-spacing: 0.2em;
  color: var(--clarvi-text-light);
  text-decoration: none;
  font-weight: 600;
  transition: opacity 0.2s ease;
  justify-self: start;
}

.site-header .logo:hover,
.site-header .site-logo:hover {
  opacity: 0.9;
}

@media (max-width: 768px) {
  .site-header .logo,
  .site-header .site-logo {
    letter-spacing: 0.15em;
  }
}

/* Navigation links - Center section (desktop only) */
.site-header nav {
  justify-self: center;
}

.site-header .nav-links,
.site-header .site-nav-desktop {
  display: flex;
  align-items: center;
  gap: 2rem;
  list-style: none;
  margin: 0;
  padding: 0;
  white-space: nowrap;
  flex-wrap: nowrap;
}

.site-header .nav-links a,
.site-header .site-nav-desktop a {
  font-size: 0.875rem;
  letter-spacing: 0.05em;
  color: var(--clarvi-text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.site-header .nav-links a:hover,
.site-header .site-nav-desktop a:hover {
  color: var(--clarvi-text-light);
}

/* Mobile menu button */
.site-menu-button {
  display: none;
  background: transparent;
  border: none;
  color: var(--clarvi-text-light);
  cursor: pointer;
  padding: 0.5rem;
  min-height: 44px;
  min-width: 44px;
  align-items: center;
  justify-content: center;
  justify-self: end;
  transition: opacity 0.2s ease;
}

.site-menu-button:hover {
  opacity: 0.8;
}

@media (max-width: 768px) {
  .site-header .nav-links,
  .site-header .site-nav-desktop {
    display: none;
  }
  
  .site-menu-button {
    display: flex;
  }
}

/* Mobile menu overlay */
.site-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* Mobile menu panel */
#mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 280px;
  max-width: 80vw;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 1000;
  padding: calc(4rem + env(safe-area-inset-top, 0)) 2rem 2rem;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  border-left: 1px solid var(--clarvi-border);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
}

#mobile-menu a {
  font-size: 1rem;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  padding: 0.75rem 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  transition: color 0.2s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#mobile-menu a:hover {
  color: var(--clarvi-text-light);
}

/* Right spacer - empty but ensures center is truly centered (desktop only) */
.site-header .header-spacer {
  justify-self: end;
}

@media (max-width: 768px) {
  .site-header .header-spacer {
    display: none;
  }
}

/* Unified Footer */
.site-footer {
  position: relative;
  z-index: 20;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-top: 1px solid var(--clarvi-border);
  background: var(--clarvi-bg-dark);
}

.site-footer .footer-disclaimer {
  font-size: 0.625rem;
  letter-spacing: 0.05em;
  color: var(--clarvi-text-muted);
  text-align: center;
  margin: 0;
}

.site-footer .footer-copyright {
  font-size: 0.625rem;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.3);
  text-align: center;
  margin: 0;
}

/* Page Layout Wrapper */
.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-wrapper .page-content {
  flex: 1;
  padding: 2rem 0;
}

/* Reduced Motion Support */
@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;
  }
}

/* Document Shell for Legal/Support Pages (Dark Background, White Text) */
.doc-shell {
  max-width: 800px;
  margin: 0 auto;
  padding: 3rem 2rem;
  background: transparent;
  color: var(--clarvi-text-light);
}

@media (max-width: 768px) {
  .doc-shell {
    padding: 2rem 1.5rem;
    margin: 1rem;
  }
}

.doc-shell h1 {
  color: var(--clarvi-text-light);
  border-bottom: 2px solid var(--clarvi-accent);
  padding-bottom: 0.75rem;
  margin-bottom: 1.5rem;
  font-size: 2rem;
  font-weight: 600;
}

.doc-shell h2 {
  color: var(--clarvi-text-light);
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-size: 1.5rem;
  font-weight: 600;
}

.doc-shell p {
  margin: 1.25rem 0;
  color: var(--clarvi-text-light);
  opacity: 0.9;
  line-height: 1.7;
}

.doc-shell ul,
.doc-shell ol {
  margin: 1.25rem 0;
  padding-left: 1.75rem;
  color: var(--clarvi-text-light);
  opacity: 0.9;
  line-height: 1.7;
}

.doc-shell li {
  margin: 0.75rem 0;
}

.doc-shell a {
  color: var(--clarvi-accent);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.doc-shell a:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.doc-shell .contact {
  margin-top: 2.5rem;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  border-left: 3px solid var(--clarvi-accent);
  border: 1px solid var(--clarvi-border);
}

.doc-shell .faq-item {
  margin: 1.5rem 0;
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border-left: 3px solid var(--clarvi-accent);
  border: 1px solid var(--clarvi-border);
}

.doc-shell .faq-question {
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--clarvi-text-light);
  font-size: 1.1rem;
}

/* Main CTA Button Fix (for Landing page React component) */
/* This ensures the button has visible border and proper styling */
#root button[disabled],
#root a[aria-label*="Coming soon"] {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 2rem !important;
  height: 52px !important;
  min-height: 52px !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 12px !important;
  color: rgba(255, 255, 255, 0.9) !important;
  font-weight: 500 !important;
  letter-spacing: 0.05em !important;
  text-decoration: none !important;
  outline: none !important;
  box-shadow: none !important;
  transition: border-color 0.2s ease, background-color 0.2s ease !important;
}

#root button[disabled] {
  cursor: not-allowed !important;
  opacity: 0.6 !important;
}

#root a[aria-label*="Coming soon"]:hover {
  border-color: rgba(255, 255, 255, 0.3) !important;
  background: rgba(255, 255, 255, 0.06) !important;
}

#root a[aria-label*="Coming soon"]:focus {
  outline: none !important;
  ring: 2px solid rgba(255, 255, 255, 0.2) !important;
  ring-offset: 2px !important;
  ring-offset-color: #000 !important;
}

@media (prefers-reduced-motion: reduce) {
  #root button[disabled],
  #root a[aria-label*="Coming soon"] {
    transition: none !important;
  }
}

/* Hero Title - Mobile Responsive Typography */
/* Fix mobile title line breaks: "CLEAR YOUR MIND." on first line, "IN 72 SECONDS." on second line */

/* Target h1 containing title divs (structure: h1.space-y-1 > div.text-5xl + div.text-5xl) */
#root h1[class*="space-y"] {
  /* Ensure container allows block layout */
  display: flex;
  flex-direction: column;
}

@media (max-width: 768px) {
  /* Mobile: Force 2-line layout with optimized typography */
  /* Title container (h1) - ensure vertical stacking */
  #root h1[class*="space-y"] {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.5rem !important;
    align-items: flex-start !important;
  }
  
  /* First line: "CLEAR YOUR MIND." */
  #root h1[class*="space-y"] > div:first-child,
  #root h1[class*="space-y"] > div[class*="text-5xl"]:first-child,
  #root h1[class*="space-y"] > div[class*="text-7xl"]:first-child {
    font-size: clamp(1.875rem, 8vw, 2.75rem) !important;
    line-height: 1.15 !important;
    letter-spacing: -0.015em !important;
    display: block !important;
    width: 100% !important;
    word-break: keep-all !important;
    white-space: nowrap !important;
    overflow-wrap: normal !important;
  }
  
  /* Second line: "IN 72 SECONDS." */
  #root h1[class*="space-y"] > div:last-child,
  #root h1[class*="space-y"] > div[class*="text-5xl"]:last-child,
  #root h1[class*="space-y"] > div[class*="text-7xl"]:last-child,
  #root h1[class*="space-y"] > div[class*="text-white"] {
    font-size: clamp(1.875rem, 8vw, 2.75rem) !important;
    line-height: 1.15 !important;
    letter-spacing: -0.015em !important;
    display: block !important;
    width: 100% !important;
    word-break: keep-all !important;
    white-space: nowrap !important;
    overflow-wrap: normal !important;
  }
  
  /* Ensure all title divs are block-level */
  #root h1[class*="space-y"] > div {
    display: block !important;
  }
}

/* Desktop: Keep larger sizes and balanced layout */
@media (min-width: 769px) {
  #root h1[class*="space-y"] > div {
    /* Desktop can keep original text-5xl lg:text-7xl sizes */
    /* Just ensure proper line-height for balance */
    line-height: 1.1 !important;
  }
}

/* Fix: Remove black box around glowing orb on mobile */
/* The black box appears when orb moves - caused by container overflow/border/background */
/* Strategy: Target containers that might show a box, but preserve orb visibility */

@media (max-width: 768px) {
  /* Main page container - ensure no visible boundaries */
  #root > div[class*="overflow-hidden"][class*="min-h-screen"] {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background-clip: border-box !important;
    background-origin: border-box !important;
  }
  
  /* Remove backgrounds from wrapper containers only (not orb elements) */
  /* Target direct children and nested divs, but exclude elements with blur/filter */
  #root > div[class*="overflow-hidden"] > div:not([class*="blur"]):not([style*="blur"]):not([style*="filter"]),
  #root > div[class*="overflow-hidden"] > div > div:not([class*="blur"]):not([style*="blur"]):not([style*="filter"]),
  #root > div[class*="overflow-hidden"] > div > div > div:not([class*="blur"]):not([style*="blur"]):not([style*="filter"]) {
    background-color: transparent !important;
    background-image: none !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
  }
  
  /* Remove borders/outlines from positioned containers (but preserve orb) */
  #root div[class*="absolute"]:not([class*="blur"]):not([style*="blur"]):not([style*="filter"]):not([class*="opacity"]),
  #root div[class*="relative"]:not([class*="blur"]):not([style*="blur"]):not([style*="filter"]):not([class*="opacity"]) {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    /* Only make transparent if it's likely a container, not the orb */
    background-color: transparent !important;
  }
  
  /* Remove any inline background styles from containers (but preserve orb) */
  #root div[style*="background"]:not([class*="blur"]):not([style*="blur"]):not([style*="filter"]):not([class*="absolute"]):not([class*="relative"]) {
    background-color: transparent !important;
    background-image: none !important;
  }
}

/* Fallback for non-iOS mobile browsers */
@media (max-width: 768px) {
  /* Main page container - ensure no visible boundaries */
  #root > div[class*="overflow-hidden"][class*="min-h-screen"] {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background-clip: border-box !important;
    background-origin: border-box !important;
  }
  
  /* Remove backgrounds from wrapper containers only (not orb elements) */
  #root > div[class*="overflow-hidden"] > div:not([class*="blur"]):not([style*="blur"]):not([style*="filter"]),
  #root > div[class*="overflow-hidden"] > div > div:not([class*="blur"]):not([style*="blur"]):not([style*="filter"]) {
    background-color: transparent !important;
    background-image: none !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
  }
}
