/* =============================
   DESIGN TOKENS
   ============================= */

:root {
  --bg: #0A0A0A;
  --bg-card: #111111;
  --bg-elevated: #161616;
  --text: #FAFAFA;
  --text-secondary: #999999;
  --text-muted: #777777;
  --accent: #FAFAFA;
  --accent-hover: #CCCCCC;
  --border: #222222;
  --border-hover: #333333;
  --radius: 12px;
  --transition: 200ms ease;
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --max-width: 1080px;
}


/* =============================
   RESET & BASE
   ============================= */

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

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
  .hero-line .word {
    transform: none !important;
    opacity: 1 !important;
  }
  .hero-subtitle {
    opacity: 1 !important;
  }
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scrollbar-width: thin;
  scrollbar-color: var(--border-hover) transparent;
}

/* Webkit scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

::selection {
  background: rgba(250, 250, 250, 0.15);
  color: var(--text);
}


/* =============================
   LAYOUT
   ============================= */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

@media (min-width: 744px) {
  .container { padding: 0 40px; }
}


/* =============================
   NAVIGATION
   ============================= */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: transparent;
  transition: background 0.4s ease, backdrop-filter 0.4s ease, border-color 0.4s ease;
  border-bottom: 1px solid transparent;
}

.nav.scrolled {
  background: rgba(10, 10, 10, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom-color: var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
  transition: opacity var(--transition);
}

.wordmark:hover {
  opacity: 0.7;
}

.wordmark-icon {
  flex-shrink: 0;
}

.nav-link {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.3s ease;
}

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


/* =============================
   HERO
   ============================= */

.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(3rem, 9vw, 7.5rem);
  line-height: 1.0;
  letter-spacing: -0.03em;
  color: var(--text);
}

.hero-line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.1em;
}

.hero-line .word {
  display: inline-block;
  transform: translateY(110%);
  opacity: 0;
  animation: revealUp 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hero-line-1 .word { animation-delay: 0.15s; }
.hero-line-2 .word { animation-delay: 0.3s; }
.hero-line-3 .word:first-child { animation-delay: 0.45s; }
.hero-line-3 .word:last-child { animation-delay: 0.6s; }

.hero-emphasis {
  font-style: italic;
}

.hero-subtitle {
  font-family: var(--font-body);
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 300;
  color: var(--text-secondary);
  max-width: 480px;
  margin-top: 36px;
  line-height: 1.7;
  opacity: 0;
  animation: fadeIn 0.8s ease 0.8s forwards;
}

/* Hero SVG background */
.hero-art-wrapper {
  position: absolute;
  top: 50%;
  right: -10%;
  transform: translateY(-50%);
  width: 55%;
  max-width: 700px;
  opacity: 0.12;
  pointer-events: none;
  z-index: 0;
  filter: invert(1);
}

.hero-art {
  width: 100%;
  height: auto;
  display: block;
}

@media (max-width: 743px) {
  .hero-art-wrapper {
    width: 90%;
    right: -20%;
    opacity: 0.08;
  }
}


/* =============================
   FLICKER EFFECT
   ============================= */

.flicker-word {
  display: inline;
}

.flicker-letter {
  display: inline;
  animation: letterFlicker 4s ease-in-out infinite;
}

@keyframes letterFlicker {
  0%, 100% { opacity: 1; }
  47% { opacity: 1; }
  48% { opacity: 0.2; }
  49% { opacity: 0.7; }
  50% { opacity: 0.15; }
  51% { opacity: 0.85; }
  52% { opacity: 1; }
}


/* =============================
   PRODUCTS
   ============================= */

.products {
  padding: 40px 0 120px;
}

.section-label {
  display: block;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 64px;
}

.product-item {
  border-top: 1px solid var(--border);
  padding: 48px 0 64px;
}

.product-item:last-child {
  border-bottom: 1px solid var(--border);
}

.product-item-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.product-item-index {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.product-item-tag {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.product-item-name {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--text);
  margin-bottom: 24px;
}

.product-item-body {
  max-width: 480px;
  margin-left: auto;
}

@media (max-width: 743px) {
  .product-item-body {
    margin-left: 0;
  }
}

.product-item-desc {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 300;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 24px;
}

.product-item-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: transparent;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  border: 1px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.product-item-cta:hover {
  background: var(--bg-elevated);
  border-color: var(--border-hover);
}

.product-item-cta svg {
  width: 14px;
  height: 14px;
  transition: transform 0.3s ease;
}

.product-item-cta:hover svg {
  transform: translateX(3px);
}


/* =============================
   MODAL
   ============================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

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

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 90%;
  max-width: 400px;
  transform: translateY(8px);
  transition: transform var(--transition);
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
}

.modal-header h3 {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  transition: background var(--transition), color var(--transition);
}

.modal-close:hover {
  background: var(--bg-elevated);
  color: var(--text);
}

.modal-body {
  padding: 0 24px 20px;
}

.institution-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 400;
  transition: background 0.3s ease, border-color 0.3s ease;
  margin-bottom: 8px;
}

.institution-link:last-child {
  margin-bottom: 0;
}

.institution-link:hover {
  background: var(--bg-elevated);
  border-color: var(--border-hover);
}

.institution-link svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}


/* =============================
   FOOTER
   ============================= */

.footer {
  border-top: 1px solid var(--border);
  padding: 48px 0 48px;
  margin-top: 0;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  padding-bottom: 0;
}

@media (min-width: 744px) {
  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr 1fr 1.5fr;
    gap: 48px;
  }
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
}

.footer-desc {
  margin-top: 12px;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 300;
  color: var(--text-muted);
  line-height: 1.6;
}

.footer-heading {
  font-family: var(--font-body);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.3s ease;
}

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

.footer-links svg {
  flex-shrink: 0;
  color: var(--text-muted);
}

.footer-copyright {
  margin-top: 32px;
  font-size: 0.75rem;
  font-weight: 300;
  color: var(--text-muted);
}

@media (min-width: 744px) {
  .footer-copyright {
    grid-column: 1 / -1;
    margin-top: 16px;
  }
}


/* =============================
   LEGAL PAGES
   ============================= */

main {
  flex: 1;
}

.legal-page {
  padding: 120px 0 80px;
}

@media (min-width: 744px) {
  .legal-page { padding: 140px 0 120px; }
}

.legal-page .container {
  max-width: 720px;
}

.legal-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 8px;
}

@media (min-width: 744px) {
  .legal-title { font-size: 2.5rem; }
}

.legal-updated {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 48px;
}

.legal-content {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.legal-content h2 {
  font-family: var(--font-body);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 12px;
}

.legal-content p {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.legal-content ul {
  list-style: disc;
  padding-left: 24px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legal-content li {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.legal-content a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--transition);
}

.legal-content a:hover {
  color: var(--text-secondary);
}


/* =============================
   BLOG
   ============================= */

.blog-empty {
  font-size: 0.9375rem;
  color: var(--text-muted);
  padding: 48px 0;
}


/* =============================
   FOCUS STYLES
   ============================= */

:focus-visible {
  outline: 1px solid var(--text-muted);
  outline-offset: 3px;
}

button:focus-visible,
a:focus-visible {
  outline: 1px solid var(--text-muted);
  outline-offset: 3px;
}


/* =============================
   ANIMATIONS
   ============================= */

@keyframes revealUp {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.reveal:nth-child(2) { transition-delay: 0.1s; }
.reveal:nth-child(3) { transition-delay: 0.2s; }
