/* =============================================
   OnticaLab — Design System & Styles
   ============================================= */

/* --- Custom Properties --- */
:root {
  --bg-primary: #0A0E1A;
  --bg-card: #111827;
  --bg-hover: #1A2035;
  --text-primary: #E8ECF1;
  --text-secondary: #8B95A8;
  --text-muted: #4B5568;
  --accent: #3B82F6;
  --accent-muted: #6366F1;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --border-subtle: rgba(255, 255, 255, 0.06);
  --glow: 0 0 20px rgba(59, 130, 246, 0.15);
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --header-h: 72px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }

/* --- Typography --- */
h1, h2, h3 { font-weight: 600; line-height: 1.2; }

/* --- Header --- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease);
}

.header--scrolled {
  border-bottom-color: var(--border-subtle);
}

.header__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* --- Logo --- */
.logo {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  transition: opacity 0.2s;
}
.logo:hover { opacity: 0.8; }
.logo__accent { color: var(--accent); }

/* --- Nav --- */
.nav { display: flex; gap: 32px; }

.nav__link {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.2s;
  position: relative;
}
.nav__link:hover { color: var(--text-primary); }
.nav__link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.3s var(--ease);
}
.nav__link:hover::after { width: 100%; }

/* --- Hero --- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: var(--header-h) 24px 0;
  max-width: 1200px;
  margin: 0 auto;
  gap: 48px;
}

.hero__content {
  flex: 1;
  max-width: 600px;
}

.hero__tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 24px;
}

.hero__title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
  line-height: 1.1;
}

.hero__subtitle {
  font-size: clamp(1rem, 2vw, 1.125rem);
  color: var(--text-secondary);
  max-width: 480px;
  margin-bottom: 36px;
  line-height: 1.7;
}

.hero__cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 500;
  color: var(--accent);
  padding: 12px 0;
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, gap 0.3s;
}
.hero__cta:hover {
  border-bottom-color: var(--accent);
  gap: 12px;
}

/* --- Hero Visual --- */
.hero__visual {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 400px;
}

#heroCanvas {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}

.hero__fallback {
  display: none;
  width: 280px;
  height: 280px;
}

/* --- Section Shared --- */
.section-number {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 0.1em;
}

.section-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* --- Research --- */
.research {
  padding: 120px 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.research__header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 64px;
}

.research__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

/* --- Card --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 32px;
  transition: transform 0.3s var(--ease), border-color 0.3s, box-shadow 0.3s;
}
.card:hover {
  transform: translateY(-4px);
  border-color: rgba(59, 130, 246, 0.25);
  box-shadow: var(--glow);
}

.card__icon {
  width: 48px;
  height: 48px;
  margin-bottom: 20px;
}
.card__icon svg {
  width: 48px;
  height: 48px;
}

.card__title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
}

.card__desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* --- Contact --- */
.contact {
  padding: 120px 24px 80px;
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

.contact__title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 32px;
}

.contact__details {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.contact__email {
  font-size: 18px;
  color: var(--accent);
  transition: opacity 0.2s;
}
.contact__email:hover { opacity: 0.8; }

.contact__address {
  font-size: 14px;
  color: var(--text-muted);
}

/* --- Footer --- */
.footer {
  border-top: 1px solid var(--border-subtle);
  padding: 24px;
}

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

.footer__copy {
  font-size: 13px;
  color: var(--text-muted);
}

.footer__links {
  display: flex;
  gap: 24px;
}

.footer__link {
  font-size: 13px;
  color: var(--text-secondary);
  transition: color 0.2s;
}
.footer__link:hover { color: var(--text-primary); }

/* --- Fade In Animation --- */
.fade-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

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

/* --- Responsive: Tablet --- */
@media (max-width: 1023px) {
  .hero {
    flex-direction: column;
    text-align: center;
    padding-top: calc(var(--header-h) + 48px);
    gap: 32px;
    min-height: auto;
    padding-bottom: 80px;
  }
  .hero__content { max-width: 100%; }
  .hero__subtitle { max-width: 100%; margin-left: auto; margin-right: auto; }
  .hero__visual { min-height: 300px; width: 100%; }
  .research__grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

/* --- Responsive: Mobile --- */
@media (max-width: 767px) {
  :root { --header-h: 60px; }

  .nav { gap: 20px; }
  .nav__link { font-size: 13px; }

  .hero { padding-top: calc(var(--header-h) + 32px); padding-bottom: 60px; }
  .hero__visual { min-height: 240px; }

  .research { padding: 80px 20px; }
  .research__header { margin-bottom: 40px; }
  .research__grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .card { padding: 24px; }
  .contact { padding: 80px 20px 60px; }
  .footer__inner { flex-direction: column; gap: 12px; text-align: center; }

  #heroCanvas { display: none; }
  .hero__fallback { display: block; }
}
