/* ==========================================================================
   Prefana — design tokens & global styles
   ========================================================================== */

:root {
  /* Color */
  --bg: #050607;
  --bg-raised: #0a0c0e;
  --bg-card: #0d1013;
  --line: rgba(237, 239, 242, 0.08);
  --line-strong: rgba(237, 239, 242, 0.16);
  --ink: #edeff2;
  --ink-dim: #9aa3ab;
  --ink-faint: #5c646b;
  --accent: #5fe1ff;
  --accent-dim: rgba(95, 225, 255, 0.12);
  --accent-glow: rgba(95, 225, 255, 0.35);

  /* Type */
  --font-display: "Space Grotesk", "Inter", -apple-system, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.1875rem;
  --text-xl: 1.5rem;
  --text-2xl: clamp(1.75rem, 3.5vw, 2.75rem);
  --text-3xl: clamp(2.25rem, 5vw, 4rem);
  --text-hero: clamp(2.875rem, 9vw, 7.5rem);
  --text-stat: clamp(3rem, 7vw, 5.5rem);

  /* Space */
  --space-section: clamp(6rem, 14vh, 11rem);
  --space-gutter: clamp(1.25rem, 4vw, 3rem);
  --width-max: 82rem;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 0.9s;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0;
}

p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

img, video {
  max-width: 100%;
  display: block;
}

.container {
  max-width: var(--width-max);
  margin-inline: auto;
  padding-inline: var(--space-gutter);
}

/* --------------------------------------------------------------------------
   Reveal-on-scroll
   -------------------------------------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
  transition-delay: var(--reveal-delay, 0s);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

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

/* --------------------------------------------------------------------------
   Nav
   -------------------------------------------------------------------------- */

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

.nav.is-scrolled {
  background: rgba(5, 6, 7, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom-color: var(--line);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4.5rem;
}

.nav__logo {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.nav__logo sup {
  color: var(--accent);
  font-size: 0.6em;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 2.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav__links a {
  font-size: var(--text-sm);
  color: var(--ink-dim);
  transition: color 0.25s ease;
}

.nav__links a:hover,
.nav__links a[aria-current="page"] {
  color: var(--ink);
}

.nav__cta {
  font-size: var(--text-sm);
  padding: 0.5rem 1.1rem;
  border: 1px solid var(--line-strong);
  border-radius: 99px;
  color: var(--ink) !important;
  transition: border-color 0.25s ease, background 0.25s ease;
}

.nav__cta:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* Mobile nav */
.nav__toggle {
  display: none;
  background: none;
  border: 0;
  padding: 0.5rem;
  cursor: pointer;
}

.nav__toggle span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--ink);
  margin: 5px 0;
  transition: transform 0.3s var(--ease-out), opacity 0.3s;
}

@media (max-width: 760px) {
  .nav__toggle { display: block; }

  .nav__links {
    position: fixed;
    inset: 4.5rem 0 auto 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: rgba(5, 6, 7, 0.97);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--line);
    padding: 0.75rem var(--space-gutter) 1.5rem;
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s var(--ease-out), transform 0.3s var(--ease-out), visibility 0.3s;
  }

  .nav.is-open .nav__links {
    opacity: 1;
    transform: none;
    visibility: visible;
  }

  .nav__links li {
    width: 100%;
  }

  .nav__links a {
    display: block;
    padding: 0.85rem 0;
    font-size: var(--text-lg);
  }

  .nav__cta {
    display: inline-block;
    margin-top: 0.75rem;
    border: 1px solid var(--line-strong);
  }

  .nav.is-open .nav__toggle span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
  .nav.is-open .nav__toggle span:nth-child(2) { opacity: 0; }
  .nav.is-open .nav__toggle span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 0.9rem 1.75rem;
  border-radius: 99px;
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s var(--ease-out), box-shadow 0.25s ease;
}

.btn--primary {
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
}

.btn--primary:hover {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 32px var(--accent-glow);
  transform: translateY(-1px);
}

.btn--ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-strong);
}

.btn--ghost:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.btn .arrow {
  transition: transform 0.25s var(--ease-out);
}

.btn:hover .arrow {
  transform: translateX(3px);
}

/* --------------------------------------------------------------------------
   Shared section furniture
   -------------------------------------------------------------------------- */

.section {
  padding-block: var(--space-section);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 1.75rem;
}

.eyebrow::before {
  content: "";
  width: 1.75rem;
  height: 1px;
  background: var(--accent);
}

.section-title {
  font-size: var(--text-3xl);
  max-width: 22ch;
}

.section-lede {
  font-size: var(--text-lg);
  color: var(--ink-dim);
  max-width: 52ch;
  margin-top: 1.5rem;
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  padding-bottom: clamp(4rem, 10vh, 7rem);
  overflow: hidden;
}

.hero__media {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero__media video,
.hero__media img,
.hero__media canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Static fallback behind the live canvas (no-JS, slow devices, reduced motion) */
.hero__media {
  background: url("../assets/hero-mesh.png") center / cover no-repeat;
}

.hero__media.is-live {
  background: none;
}

.hero__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, var(--bg) 0%, rgba(5, 6, 7, 0.35) 45%, rgba(5, 6, 7, 0.55) 100%);
}

.hero__content {
  position: relative;
  z-index: 1;
  width: 100%;
}

.hero__title {
  font-size: var(--text-hero);
  font-weight: 500;
  letter-spacing: -0.04em;
  max-width: 10ch;
}

.hero__title .accent {
  color: var(--accent);
}

.hero__sub {
  font-size: var(--text-lg);
  color: var(--ink-dim);
  max-width: 46ch;
  margin-top: 1.75rem;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2.5rem;
}

.hero__scroll {
  position: absolute;
  right: var(--space-gutter);
  bottom: clamp(4rem, 10vh, 7rem);
  z-index: 1;
  font-size: var(--text-xs);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  writing-mode: vertical-rl;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.hero__scroll::after {
  content: "";
  width: 1px;
  height: 3rem;
  background: linear-gradient(to bottom, var(--ink-faint), transparent);
  animation: scroll-pulse 2.2s ease-in-out infinite;
}

@keyframes scroll-pulse {
  0%, 100% { opacity: 0.3; transform: scaleY(0.6); transform-origin: top; }
  50% { opacity: 1; transform: scaleY(1); }
}

@media (max-width: 760px) {
  .hero__scroll { display: none; }
}

/* --------------------------------------------------------------------------
   Pillars
   -------------------------------------------------------------------------- */

.pillars__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1px;
  background: var(--line);
  border-block: 1px solid var(--line);
  margin-top: 4rem;
}

.pillar {
  background: var(--bg);
  padding: 2.5rem 2rem 3rem;
  transition: background 0.35s ease;
}

.pillar:hover {
  background: var(--bg-raised);
}

.pillar__index {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  color: var(--accent);
  letter-spacing: 0.15em;
}

.pillar h3 {
  font-size: var(--text-xl);
  margin-top: 1.25rem;
  letter-spacing: -0.02em;
}

.pillar p {
  font-size: var(--text-sm);
  color: var(--ink-dim);
  margin-top: 0.9rem;
  line-height: 1.7;
}

/* --------------------------------------------------------------------------
   Stats
   -------------------------------------------------------------------------- */

.stats {
  border-block: 1px solid var(--line);
  background: var(--bg-raised);
}

.stats__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 3rem 2rem;
}

.stat__value {
  font-family: var(--font-display);
  font-size: var(--text-stat);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.stat__value .unit {
  color: var(--accent);
  font-size: 0.55em;
  margin-left: 0.05em;
}

.stat__label {
  font-size: var(--text-sm);
  color: var(--ink-dim);
  margin-top: 0.9rem;
  max-width: 20ch;
}

/* --------------------------------------------------------------------------
   Case / validation band
   -------------------------------------------------------------------------- */

.case {
  position: relative;
  overflow: hidden;
}

.case__grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: clamp(2.5rem, 6vw, 6rem);
  align-items: center;
}

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

.case__quote {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.25;
  max-width: 24ch;
}

.case__quote em {
  font-style: normal;
  color: var(--accent);
}

.case__attribution {
  margin-top: 2rem;
  font-size: var(--text-sm);
  color: var(--ink-dim);
}

.case__media {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  aspect-ratio: 16 / 10;
}

.case__media video,
.case__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --------------------------------------------------------------------------
   Product teaser
   -------------------------------------------------------------------------- */

.teaser {
  border-top: 1px solid var(--line);
}

.teaser__card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-card);
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 26rem;
}

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

.teaser__body {
  padding: clamp(2rem, 5vw, 4rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.teaser__body h3 {
  font-size: var(--text-2xl);
}

.teaser__body p {
  color: var(--ink-dim);
  margin-top: 1.25rem;
  max-width: 44ch;
}

.teaser__body .btn {
  margin-top: 2.25rem;
  align-self: flex-start;
}

.teaser__media {
  position: relative;
  min-height: 16rem;
}

.teaser__media img,
.teaser__media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.teaser__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, var(--bg-card) 0%, transparent 35%);
}

@media (max-width: 900px) {
  .teaser__media::after {
    background: linear-gradient(to bottom, var(--bg-card) 0%, transparent 40%);
  }
}

/* --------------------------------------------------------------------------
   CTA band
   -------------------------------------------------------------------------- */

.cta-band {
  text-align: center;
  border-top: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}

.cta-band::before {
  content: "";
  position: absolute;
  inset: auto 0 -50% 0;
  height: 100%;
  background: radial-gradient(ellipse at bottom, var(--accent-dim), transparent 65%);
  pointer-events: none;
}

.cta-band h2 {
  font-size: var(--text-3xl);
  max-width: 18ch;
  margin-inline: auto;
}

.cta-band p {
  color: var(--ink-dim);
  margin-top: 1.25rem;
}

.cta-band .btn {
  margin-top: 2.5rem;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.footer {
  border-top: 1px solid var(--line);
  padding: 4.5rem 0 2.5rem;
  font-size: var(--text-sm);
  color: var(--ink-dim);
}

.footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.5fr;
  gap: 3rem;
}

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

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

.footer__brand .nav__logo {
  color: var(--ink);
}

.footer__brand p {
  margin-top: 1rem;
  max-width: 30ch;
  line-height: 1.7;
}

.footer h4 {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 1.25rem;
}

.footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.7rem;
}

.footer a {
  transition: color 0.25s ease;
}

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

.footer__signup p {
  margin-bottom: 1rem;
  line-height: 1.7;
}

.footer__signup form {
  display: flex;
  border: 1px solid var(--line-strong);
  border-radius: 99px;
  overflow: hidden;
  transition: border-color 0.25s ease;
}

.footer__signup form:focus-within {
  border-color: var(--accent);
}

.footer__signup input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--ink);
  font-family: inherit;
  font-size: var(--text-sm);
  padding: 0.7rem 1.1rem;
}

.footer__signup button {
  background: var(--ink);
  color: var(--bg);
  border: 0;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 0 1.25rem;
  cursor: pointer;
  transition: background 0.25s ease;
}

.footer__signup button:hover {
  background: var(--accent);
}

.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: var(--text-xs);
}

/* --------------------------------------------------------------------------
   Subpage hero (Products / About / Contact)
   -------------------------------------------------------------------------- */

.page-hero {
  padding-top: clamp(9rem, 22vh, 14rem);
  padding-bottom: clamp(3rem, 8vh, 6rem);
}

.page-hero h1 {
  font-size: var(--text-3xl);
  max-width: 16ch;
}

.page-hero p {
  font-size: var(--text-lg);
  color: var(--ink-dim);
  max-width: 50ch;
  margin-top: 1.5rem;
}

/* --------------------------------------------------------------------------
   Products page
   -------------------------------------------------------------------------- */

.product-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-card);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 2.5rem;
}

@media (max-width: 900px) {
  .product-card { grid-template-columns: 1fr; }
}

.product-card--flip .product-card__media { order: 2; }

@media (max-width: 900px) {
  .product-card--flip .product-card__media { order: 0; }
}

.product-card__media {
  position: relative;
  min-height: 20rem;
}

.product-card__media img,
.product-card__media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-card__body {
  padding: clamp(2rem, 4.5vw, 3.75rem);
}

.product-card__tag {
  font-size: var(--text-xs);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}

.product-card__body h2 {
  font-size: var(--text-2xl);
  margin-top: 1rem;
}

.product-card__body > p {
  color: var(--ink-dim);
  margin-top: 1.25rem;
  line-height: 1.7;
}

.product-card__questions {
  margin-top: 2rem;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.75rem;
}

.product-card__questions li {
  font-size: var(--text-sm);
  color: var(--ink-dim);
  padding-left: 1.5rem;
  position: relative;
  line-height: 1.6;
}

.product-card__questions li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   About page
   -------------------------------------------------------------------------- */

.about-mission {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.02em;
  max-width: 26ch;
}

.about-mission em {
  font-style: normal;
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   Contact page
   -------------------------------------------------------------------------- */

.contact-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: clamp(3rem, 7vw, 7rem);
}

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

.contact-form {
  display: grid;
  gap: 1.5rem;
}

.contact-form label {
  display: grid;
  gap: 0.5rem;
  font-size: var(--text-sm);
  color: var(--ink-dim);
}

.contact-form input,
.contact-form textarea {
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  font-family: inherit;
  font-size: var(--text-base);
  padding: 0.85rem 1rem;
  outline: 0;
  transition: border-color 0.25s ease;
  resize: vertical;
}

.contact-form input:focus,
.contact-form textarea:focus {
  border-color: var(--accent);
}

.contact-form .btn {
  justify-self: start;
  border: 0;
}

.contact-aside h3 {
  font-size: var(--text-xl);
  letter-spacing: -0.02em;
}

.contact-aside p {
  color: var(--ink-dim);
  margin-top: 0.75rem;
  line-height: 1.7;
}

.contact-aside .block + .block {
  margin-top: 2.5rem;
}

.contact-aside a {
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   Utility
   -------------------------------------------------------------------------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
