/* ============================================
   Homepage polish (loaded only by index.html, after style.css)
   Selectors that must beat style.css's [data-theme="light"] overrides
   are prefixed with [data-theme] to win on specificity.
   ============================================ */

/* ---------- Hero: cinematic and dark in both themes ---------- */
.hero {
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --border-subtle: rgba(248, 250, 252, 0.22);
  --bg-elevated: rgba(248, 250, 252, 0.08);
  color-scheme: dark;
  color: var(--text-primary);
  background: #0a0e14;
}

/* Video at full strength; legibility comes from a soft scrim behind the text, not a wash over everything */
.hero .hero-video {
  opacity: 1;
  /* Anti-glare: pull down the welding-arc highlights without flattening the footage */
  filter: brightness(0.78) contrast(0.95) saturate(1.05);
}

[data-theme] .hero .hero-overlay {
  background:
    radial-gradient(ellipse at 50% 50%, rgba(10, 14, 20, 0) 55%, rgba(10, 14, 20, 0.45) 100%),
    linear-gradient(rgba(10, 14, 20, 0.22), rgba(10, 14, 20, 0.22)),
    radial-gradient(ellipse 60% 50% at 50% 50%, rgba(10, 14, 20, 0.55) 0%, rgba(10, 14, 20, 0.2) 60%, rgba(10, 14, 20, 0) 100%),
    linear-gradient(180deg, rgba(10, 14, 20, 0.45) 0%, rgba(10, 14, 20, 0) 22%, rgba(10, 14, 20, 0) 70%, rgba(10, 14, 20, 0.75) 100%);
}

/* The amber grid and glow haze the footage, so hide them in the hero */
.hero .hero-grid,
.hero .hero-glow {
  display: none;
}

[data-theme] .hero .hero-title {
  font-size: clamp(2.25rem, 5vw, 4.25rem);
  line-height: 1.12;
  color: #f8fafc;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.55);
}

/* keep "Additive Manufacturing" on one line where it fits: two clean lines instead of three */
@media (min-width: 900px) {
  .hero .hero-title .accent {
    white-space: nowrap;
  }
}

.hero .hero-title .accent::after {
  display: none;
}

[data-theme] .hero .hero-subtitle {
  margin-bottom: 0;
  color: #e2e8f0;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.7);
}

.hero /* ---------- Navigation: scrolled state (toggled by index.html) ---------- */
.nav.nav--scrolled {
  background: rgba(10, 14, 20, 0.95);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}

[data-theme="light"] .nav.nav--scrolled {
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.08);
}

/* ---------- Stats: one bar overlapping the hero's bottom edge ---------- */
.home-stats {
  position: relative;
  z-index: 3;
  padding-top: clamp(2.5rem, 5vw, 4rem);
}

.home-stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  max-width: 1000px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

[data-theme="light"] .home-stats-bar {
  border-color: #e2e8f0;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
}

.home-stat {
  position: relative;
  padding: 2rem 1.5rem;
  text-align: center;
}

.home-stat + .home-stat::before {
  content: '';
  position: absolute;
  left: 0;
  top: 25%;
  bottom: 25%;
  width: 1px;
  background: var(--border-subtle);
}

[data-theme="light"] .home-stat + .home-stat::before {
  background: #e2e8f0;
}

[data-theme] .home-stat .stat-value {
  margin-bottom: 0.5rem;
  font-size: clamp(2rem, 4vw, 2.75rem);
  color: var(--accent-primary);
  text-shadow: none;
  font-variant-numeric: tabular-nums;
}

.home-stat-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

/* ---------- Research focus: four even columns, numbered ---------- */
.home-research-grid {
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

.home-research-grid .research-card {
  padding: 2rem 1.75rem;
}

.home-research-grid .research-card:hover {
  transform: translateY(-6px);
}

.home-research-grid .research-title {
  font-size: 1.15rem;
  margin-bottom: 0.75rem;
}

.home-research-grid .research-description {
  font-size: 0.92rem;
  line-height: 1.65;
}

.research-num {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  transition: var(--transition-fast);
}

.research-card:hover .research-num {
  color: var(--accent-primary);
}

/* ---------- Collaborators: logos on white tiles, faded edges ---------- */
.collaborators-marquee {
  overflow: hidden;
  padding: 0.5rem 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}

.collaborators-marquee .collaborators-track {
  gap: 1.25rem;
  width: max-content;
}

[data-theme] .collaborators-marquee .collaborator-item {
  height: 76px;
  width: auto;
  padding: 12px 22px;
  object-fit: contain;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  filter: none;
  opacity: 1;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

[data-theme] .collaborators-marquee .collaborator-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

/* ---------- Contact: profile link fills the card ---------- */
#contact-section .contact-card {
  display: flex;
  flex-direction: column;
}

.contact-profile-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  align-self: flex-start;
  margin-top: auto;
  padding-top: 2rem;
  font-weight: 600;
  color: var(--accent-primary);
  text-decoration: none;
}

.contact-profile-link i {
  transition: transform var(--transition-fast);
}

.contact-profile-link:hover i {
  transform: translateX(4px);
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .home-research-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  /* Portrait footage is brighter behind the text block: deepen the scrim a little */
  [data-theme] .hero .hero-overlay {
    background:
      radial-gradient(ellipse at 50% 50%, rgba(10, 14, 20, 0) 55%, rgba(10, 14, 20, 0.45) 100%),
      linear-gradient(rgba(10, 14, 20, 0.22), rgba(10, 14, 20, 0.22)),
      radial-gradient(ellipse 90% 45% at 50% 50%, rgba(10, 14, 20, 0.65) 0%, rgba(10, 14, 20, 0.3) 65%, rgba(10, 14, 20, 0) 100%),
      linear-gradient(180deg, rgba(10, 14, 20, 0.4) 0%, rgba(10, 14, 20, 0) 25%, rgba(10, 14, 20, 0) 70%, rgba(10, 14, 20, 0.75) 100%);
  }

  .home-stats-bar {
    grid-template-columns: repeat(2, 1fr);
  }

  .home-stat {
    padding: 1.5rem 1rem;
  }

  /* 2x2 grid: vertical rule only between columns, horizontal rule between rows */
  .home-stat + .home-stat::before {
    display: none;
  }

  .home-stat:nth-child(even) {
    border-left: 1px solid var(--border-subtle);
  }

  .home-stat:nth-child(n + 3) {
    border-top: 1px solid var(--border-subtle);
  }

  [data-theme] .collaborators-marquee .collaborator-item {
    height: 60px;
    padding: 10px 16px;
  }
}

@media (max-width: 600px) {
  .home-research-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .collaborators-marquee .collaborators-track {
    animation-play-state: paused;
  }
}
