/* Tide Research — unified coarse pixel art + restrained editorial typography */
:root {
  --bg: #020508;
  --ink: #eef4f8;
  --ink-soft: #9fb0bf;
  --muted: #66798a;
  --rule: rgba(238, 244, 248, 0.11);
  --rule-strong: rgba(238, 244, 248, 0.24);
  --accent: #38bdf8;
  --font: "Familjen Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --wrap: 1200px;
  --pad: clamp(20px, 4vw, 56px);
}

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

html {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  min-height: 100svh;
  overflow-x: clip;
}

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

/* Strict coarse pixel-art rendering across every image and canvas */
.px {
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-crisp-edges;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + var(--pad) * 2);
  margin: 0 auto;
  padding: 0 var(--pad);
}

/* Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  border-bottom: 1px solid transparent;
  transition: background-color 0.3s ease, border-color 0.3s ease, backdrop-filter 0.3s ease;
}
.site-header.is-scrolled {
  background: rgba(2, 5, 8, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom-color: var(--rule);
}
.site-header .wrap {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.025em;
  color: var(--ink);
}
.brand svg.mark {
  flex-shrink: 0;
  transform: translateY(-1px);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 32px;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--ink-soft);
}
.site-nav a {
  text-decoration: none;
  position: relative;
  padding: 4px 0;
  transition: color 0.2s ease;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--ink);
}
.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.site-nav a:hover::after,
.site-nav a[aria-current="page"]::after {
  transform: scaleX(1);
}

/* Primary action */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 24px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  line-height: 1;
  letter-spacing: -0.01em;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.22s ease;
}
.button:hover {
  background: #ffffff;
  transform: translateY(-1px);
}
.button:active {
  transform: translateY(0) scale(0.985);
}

/* Quiet editorial text link */
.text-link {
  display: inline-block;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--rule-strong);
  padding-bottom: 3px;
  transition: border-color 0.25s ease, color 0.25s ease;
}
.text-link:hover {
  border-color: var(--ink);
}

/* Editorial typography */
.display {
  font-weight: 600;
  font-size: clamp(46px, 6.4vw, 92px);
  line-height: 0.96;
  letter-spacing: -0.04em;
  text-wrap: balance;
  margin: 0;
}
.heading {
  font-weight: 600;
  font-size: clamp(32px, 3.8vw, 54px);
  line-height: 1.04;
  letter-spacing: -0.035em;
  text-wrap: balance;
  margin: 0;
}
.subhead {
  font-weight: 400;
  font-size: clamp(18px, 1.55vw, 21px);
  line-height: 1.48;
  letter-spacing: -0.01em;
  color: var(--ink-soft);
  margin: 0;
}

/* Pixel plate stage — static fallback image underneath live pixelated canvas */
.px-stage {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--bg);
}
.px-stage > img,
.px-stage > canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.px-stage > canvas {
  opacity: 0;
}
.px-stage.is-live > canvas {
  opacity: 1;
}

/* Footer */
.site-footer {
  padding: clamp(56px, 8vh, 96px) 0 44px;
}
.footer-inner {
  border-top: 1px solid var(--rule);
  padding-top: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.footer-left {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  color: var(--muted);
}
.footer-links {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 14px;
  color: var(--muted);
}
.footer-links a {
  text-decoration: none;
  transition: color 0.2s ease;
}
.footer-links a:hover {
  color: var(--ink);
}

/* Single authored hero entrance */
@keyframes heroSettle {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.hero-enter {
  animation: heroSettle 0.95s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.hero-enter-2 {
  animation: heroSettle 0.95s 0.1s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.hero-enter-3 {
  animation: heroSettle 0.95s 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-enter, .hero-enter-2, .hero-enter-3 { animation: none; }
}

@media (max-width: 680px) {
  .site-header .wrap { height: 68px; }
  .site-nav { gap: 22px; font-size: 14px; }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 18px; }
}
