/* ============================================
   THE AI FOUNDRY — Custom Styles
   Premium Dark Luxury-Tech Aesthetic
   ============================================ */

/* --- Design Tokens --- */
:root {
  --bg-base: #030711;
  --bg-deep: #050b16;
  --bg-surface: rgba(10, 18, 31, 0.78);
  --bg-surface-solid: #0a121f;
  --text-primary: #e8ecf4;
  --text-secondary: #c8d0de;
  --text-muted: #8d9cb8;
  --accent-gold: #d6b25e;
  --accent-gold-hover: #e4c472;
  --accent-green: #3A7D44;
  --accent-green-light: #4FA85C;
  --accent-blue: #2a8cff;
  --accent-cyan: #59d0ff;
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-gold: rgba(214, 178, 94, 0.2);
  --glow-gold: rgba(214, 178, 94, 0.15);
  --glow-blue: rgba(42, 140, 255, 0.12);
}

/* --- Font Imports --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700;800&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* --- Base --- */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-base);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(42,140,255,0.07), transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(42,140,255,0.05), transparent 50%),
    radial-gradient(ellipse at 50% 100%, rgba(89,208,255,0.03), transparent 50%);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Typography --- */
.font-headline {
  font-family: 'Inter', sans-serif;
}

.font-mono {
  font-family: 'IBM Plex Mono', monospace;
}

.font-body {
  font-family: 'Inter', sans-serif;
}

/* --- Fluid Typography --- */
.text-fluid-hero {
  font-size: clamp(2.6rem, 6vw, 5.4rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.text-fluid-section {
  font-size: clamp(1.75rem, 3vw + 0.5rem, 3rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.text-fluid-stat {
  font-size: clamp(2rem, 4vw + 0.5rem, 3.5rem);
  line-height: 1;
}

/* --- Navigation --- */
.nav-transparent {
  background: transparent;
  backdrop-filter: none;
}

.nav-scrolled {
  background: rgba(3, 7, 17, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}

/* --- Eyebrow Component --- */
.eyebrow {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent-gold);
  border: 1px solid var(--border-gold);
  background: rgba(214, 178, 94, 0.06);
  padding: 0.375rem 1rem;
  border-radius: 999px;
}

/* --- Buttons (Polished Pill) --- */
.btn-primary {
  background: linear-gradient(180deg, #ebcf85, #caa54e);
  color: #0a121f;
  font-weight: 600;
  padding: 0.875rem 2rem;
  border-radius: 9999px;
  transition: all 200ms ease;
  display: inline-block;
  text-decoration: none;
  font-size: 0.9375rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 4px 16px rgba(214,178,94,0.2);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #f0d98f, #d4b65e);
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 8px 32px rgba(214,178,94,0.35), 0 4px 20px rgba(214,178,94,0.25);
}

.btn-outline {
  border: 1.5px solid var(--accent-gold);
  color: var(--accent-gold);
  font-weight: 600;
  padding: 0.875rem 2rem;
  border-radius: 9999px;
  transition: all 200ms ease;
  display: inline-block;
  text-decoration: none;
  font-size: 0.9375rem;
  background: transparent;
}

.btn-outline:hover {
  background-color: rgba(214, 178, 94, 0.08);
  transform: translateY(-1px);
  box-shadow: 0 0 20px var(--glow-gold);
}

/* --- Panel Card System --- */
.panel-card {
  border-radius: 22px;
  background: linear-gradient(165deg, rgba(15,24,42,0.9), rgba(8,14,27,0.95));
  border: 1px solid rgba(255,255,255,0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 8px 32px rgba(0,0,0,0.4);
  padding: 2rem;
  position: relative;
  overflow: hidden;
  transition: border-color 300ms ease, transform 300ms ease, box-shadow 300ms ease;
}

.panel-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: radial-gradient(ellipse at center, rgba(255,255,255,0.1), transparent);
  pointer-events: none;
}

.panel-card:hover {
  border-color: var(--border-gold);
  transform: translateY(-4px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 12px 40px rgba(0,0,0,0.5), 0 0 30px var(--glow-gold);
}

/* --- Background Dot Grid --- */
.bg-dots {
  position: relative;
}

.bg-dots::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse at center, rgba(0,0,0,0.3) 0%, transparent 60%);
  mask-image: radial-gradient(ellipse at center, rgba(0,0,0,0.3) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* --- Glow Orbs (CSS animated) --- */
@keyframes drift {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(15px, -20px); }
  66% { transform: translate(-10px, 15px); }
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  animation: drift 14s ease-in-out infinite;
}

.orb:nth-child(even) {
  animation-delay: -7s;
  animation-duration: 18s;
}

.orb-gold {
  background: radial-gradient(circle, rgba(214, 178, 94, 0.10) 0%, transparent 70%);
}

.orb-blue {
  background: radial-gradient(circle, rgba(42, 140, 255, 0.08) 0%, transparent 70%);
}

/* --- Section Divider --- */
.section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(214,178,94,0.3), transparent);
  border: none;
  opacity: 0.4;
}

/* --- Centered Section Headers --- */
.section-header-center {
  text-align: center;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

/* --- Testimonial Gradient Bar --- */
.testimonial-bar {
  display: block;
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent-gold), transparent);
  margin: 0 auto 2rem;
  border-radius: 2px;
}

/* --- Hero Background --- */
.hero-gradient {
  position: absolute;
  top: -20%;
  right: -10%;
  width: 60%;
  height: 80%;
  background: radial-gradient(ellipse at center, rgba(42,140,255,0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* --- Services Card Grid --- */
.service-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

@media (max-width: 1024px) {
  .service-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .service-grid {
    grid-template-columns: 1fr;
  }
}

.service-card {
  border-radius: 22px;
  background: linear-gradient(165deg, rgba(15,24,42,0.9), rgba(8,14,27,0.95));
  border: 1px solid rgba(255,255,255,0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 8px 32px rgba(0,0,0,0.4);
  padding: 0;
  position: relative;
  overflow: hidden;
  transition: border-color 300ms ease, transform 300ms ease, box-shadow 300ms ease;
  min-height: 380px;
  display: flex;
  flex-direction: column;
}

.service-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: radial-gradient(ellipse at center, rgba(255,255,255,0.1), transparent);
  pointer-events: none;
}

.service-card:hover {
  border-color: var(--border-gold);
  transform: translateY(-4px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 12px 40px rgba(0,0,0,0.5), 0 0 30px var(--glow-gold);
}

.service-card-body {
  flex: 1;
  padding: 2rem;
  position: relative;
  z-index: 1;
}

.service-card-visual {
  height: 140px;
  margin: 0;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.service-card-icon {
  width: 48px;
  height: 48px;
  background: rgba(214, 178, 94, 0.08);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.service-card-icon svg {
  width: 24px;
  height: 24px;
  stroke: var(--accent-gold);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.service-card h3 {
  position: relative;
  z-index: 1;
}

.service-card p {
  position: relative;
  z-index: 1;
}

/* --- Phase Cards --- */
.phase-card {
  border-radius: 22px;
  background: linear-gradient(165deg, rgba(15,24,42,0.9), rgba(8,14,27,0.95));
  border: 1px solid rgba(255,255,255,0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 8px 32px rgba(0,0,0,0.4);
  padding: 2rem;
  position: relative;
  overflow: hidden;
  transition: border-color 300ms ease, transform 300ms ease, box-shadow 300ms ease;
}

.phase-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: radial-gradient(ellipse at center, rgba(255,255,255,0.1), transparent);
  pointer-events: none;
}

.phase-card:hover {
  border-color: var(--border-gold);
  transform: translateY(-4px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 12px 40px rgba(0,0,0,0.5), 0 0 30px var(--glow-gold);
}

.phase-card-icon {
  width: 48px;
  height: 48px;
  background: rgba(214, 178, 94, 0.08);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.phase-card-icon svg {
  width: 24px;
  height: 24px;
  stroke: var(--accent-gold);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- Testimonial Quote Mark --- */
.quote-mark {
  font-size: 6rem;
  line-height: 1;
  color: var(--accent-gold);
  opacity: 0.3;
  font-family: Georgia, serif;
  position: absolute;
  top: -1rem;
  left: -0.5rem;
}

/* --- Value Cards --- */
.value-card {
  border-radius: 22px;
  background: linear-gradient(165deg, rgba(15,24,42,0.9), rgba(8,14,27,0.95));
  border: 1px solid rgba(255,255,255,0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 8px 32px rgba(0,0,0,0.4);
  padding: 1.75rem;
  position: relative;
  overflow: hidden;
  transition: border-color 300ms ease, transform 300ms ease, box-shadow 300ms ease;
}

.value-card::before {
  content: '';
  display: block;
  width: 2.5rem;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-gold), transparent);
  margin-bottom: 1rem;
}

.value-card:hover {
  border-color: var(--border-gold);
  transform: translateY(-4px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 12px 40px rgba(0,0,0,0.5), 0 0 30px var(--glow-gold);
}

/* --- FAQ Accordion --- */
.faq-item {
  border-bottom: 1px solid var(--border-subtle);
}

.faq-item summary {
  list-style: none;
  cursor: pointer;
  padding: 1.5rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::marker {
  display: none;
  content: '';
}

.faq-icon {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  position: relative;
  transition: transform 300ms ease;
}

.faq-icon::before,
.faq-icon::after {
  content: '';
  position: absolute;
  background: var(--text-muted);
  border-radius: 1px;
}

.faq-icon::before {
  width: 100%;
  height: 2px;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
}

.faq-icon::after {
  width: 2px;
  height: 100%;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  transition: transform 300ms ease, opacity 300ms ease;
}

.faq-item[open] .faq-icon::after {
  transform: translateX(-50%) rotate(90deg);
  opacity: 0;
}

.faq-answer {
  overflow: hidden;
  transition: max-height 300ms ease, opacity 300ms ease;
}

/* --- Scroll Animations --- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

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

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

/* --- Mobile Menu --- */
.mobile-menu {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 17, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
}

.mobile-menu.active {
  opacity: 1;
  pointer-events: auto;
}

.mobile-menu a {
  font-size: 1.5rem;
  color: var(--text-primary);
  text-decoration: none;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  transition: color 200ms ease;
}

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

/* --- Hamburger --- */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  z-index: 100;
  padding: 0.5rem;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 1px;
  transition: all 300ms 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);
}

@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }
}

/* --- Duration Badge --- */
.duration-badge {
  display: inline-block;
  background: rgba(58, 125, 68, 0.15);
  color: var(--accent-green-light);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  border: 1px solid rgba(58, 125, 68, 0.3);
}

/* --- CTA Section Background --- */
.cta-bg {
  background: linear-gradient(180deg, var(--bg-base) 0%, var(--bg-surface-solid) 50%, var(--bg-base) 100%);
  position: relative;
}

.cta-bg::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40%;
  height: 60%;
  background: radial-gradient(ellipse at center, rgba(42, 140, 255, 0.05) 0%, transparent 70%);
  pointer-events: none;
}

/* --- Footer Enhanced --- */
.footer-enhanced {
  background: var(--bg-surface-solid);
  border-top: 1px solid var(--border-subtle);
}

/* --- Decorative SVG Animations --- */
@keyframes pulse-opacity {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.5; }
}

.service-card-visual svg {
  opacity: 0.35;
}

.service-card:hover .service-card-visual svg {
  opacity: 0.5;
  transition: opacity 300ms ease;
}

/* --- Contact Modal --- */
.contact-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
}

.contact-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.contact-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 7, 17, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.contact-modal-content {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2.5rem;
  transform: translateY(16px);
  transition: transform 300ms ease;
}

.contact-modal.active .contact-modal-content {
  transform: translateY(0);
}

.contact-modal-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  transition: color 200ms ease;
}

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

/* --- Form Styles --- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 480px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.form-field {
  margin-bottom: 1rem;
}

.form-field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.9375rem;
  transition: border-color 200ms ease, box-shadow 200ms ease;
  outline: none;
}

.form-field input::placeholder,
.form-field textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
}

.form-field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238d9cb8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}

.form-field select option {
  background: var(--bg-surface-solid);
  color: var(--text-primary);
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--border-gold);
  box-shadow: 0 0 0 3px rgba(214, 178, 94, 0.1);
}

.form-field textarea {
  resize: vertical;
  min-height: 100px;
}

/* Form success state */
.form-success {
  text-align: center;
  padding: 2rem 0;
}

.form-success-icon {
  margin-bottom: 1.5rem;
}

/* --- Focus States --- */
a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --- Selection --- */
::selection {
  background: rgba(214, 178, 94, 0.3);
  color: var(--text-primary);
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .orb {
    animation: none;
    display: none;
  }
}
