/* ============================================================
   aiRef marketing site — paper-collage design system
   Palette: ivory paper, near-black ink, cyan (side A / detection),
   pink (side B / tracking), lime strictly for tiny signal accents.
   Dark mode inverts paper and ink.
   ============================================================ */

/* ---------- Self-hosted variable fonts (OFL) ---------- */
@font-face {
  font-family: "Space Grotesk";
  src: url("/fonts/space-grotesk-var-latin.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-var-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --paper: #f7f1e3;        /* ivory ground */
  --paper-raise: #fdf9f0;  /* mounted card */
  --paper-deep: #efe6d2;   /* tinted band */
  --ink: #050505;          /* near-black ink */
  --ink-soft: #55503f;     /* muted ink, AA on both papers */
  --cyan: #17cff3;         /* side A / detection */
  --pink: #ff3c8e;         /* side B / tracking */
  --lime: #d9ff3f;         /* tiny signal accents ONLY */
  --line: rgba(5, 5, 5, 0.16);
  --shadow-card: 0 1px 2px rgba(5, 5, 5, 0.14), 0 14px 34px -14px rgba(5, 5, 5, 0.32);
  --w-content: 71rem;
  --w-text: 44rem;
  --ease-settle: cubic-bezier(0.22, 0.9, 0.3, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0b0b09;
    --paper-raise: #16150f;
    --paper-deep: #12110c;
    --ink: #f7f1e3;
    --ink-soft: #c2bba7;
    --line: rgba(247, 241, 227, 0.18);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.55), 0 14px 34px -14px rgba(0, 0, 0, 0.8);
  }
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
/* Subtle paper grain — a <1 KB inline turbulence tile, no image requests. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.6 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
}
main,
header,
footer {
  position: relative;
  z-index: 1;
}
img {
  max-width: 100%;
  height: auto;
  display: block;
}
h1,
h2,
h3 {
  font-family: "Space Grotesk", "Inter", system-ui, sans-serif;
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 0.6em;
  text-wrap: balance;
}
h1 {
  font-size: clamp(2.7rem, 6.5vw, 4.9rem);
}
h2 {
  font-size: clamp(1.9rem, 3.8vw, 3rem);
}
h3 {
  font-size: clamp(1.25rem, 2vw, 1.5rem);
}
p {
  margin: 0 0 1.1em;
  max-width: var(--w-text);
}
.lede {
  font-size: clamp(1.125rem, 1.7vw, 1.3rem);
  color: var(--ink-soft);
}
::selection {
  background: var(--cyan);
  color: #050505;
}
:focus-visible {
  outline: 3px solid var(--pink);
  outline-offset: 3px;
  border-radius: 2px;
}
.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  background: var(--ink);
  color: var(--paper);
  padding: 0.6rem 1rem;
  border-radius: 4px;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 1rem;
}

/* Links: ink text carried by a structural cyan underline (AA-safe). */
a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-color: var(--cyan);
  text-decoration-thickness: 0.14em;
  text-underline-offset: 0.18em;
}
a:hover {
  text-decoration-color: var(--pink);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1;
  padding: 0.95rem 1.5rem;
  border-radius: 4px;
  text-decoration: none;
  border: 2px solid var(--ink);
  transition: transform 0.18s var(--ease-settle), box-shadow 0.18s var(--ease-settle);
}
.btn-primary {
  background: var(--ink);
  color: var(--paper);
}
.btn-primary:hover {
  transform: translate(-2px, -2px) rotate(-0.4deg);
  box-shadow: 4px 4px 0 var(--cyan), 8px 8px 0 var(--pink);
}
.btn-ghost {
  background: transparent;
  color: var(--ink);
}
.btn-ghost:hover {
  transform: translate(-1px, -1px) rotate(0.3deg);
  box-shadow: 3px 3px 0 var(--cyan);
}
.btn:active {
  transform: translate(0, 0);
  box-shadow: none;
}
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  align-items: center;
}

/* ---------- Layout ---------- */
.wrap {
  max-width: var(--w-content);
  margin-inline: auto;
  padding-inline: clamp(1.1rem, 4vw, 2.5rem);
}
.band {
  background: var(--paper);
}
.band-deep {
  background: var(--paper-deep);
}
section {
  padding-block: clamp(3rem, 7vw, 6.5rem);
}

/* Torn-paper transitions between movements.
   Fill = the colour of the band ABOVE, biting into the band below. */
.torn {
  height: clamp(26px, 3.5vw, 52px);
  margin-bottom: -1px;
}
.torn svg {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleY(-1);
}
.torn-paper svg path {
  fill: var(--paper);
}
.torn-deep svg path {
  fill: var(--paper-deep);
}

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: var(--w-content);
  margin-inline: auto;
  padding: 0.7rem clamp(1.1rem, 4vw, 2.5rem);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.nav-brand {
  display: inline-flex;
  text-decoration: none;
  margin-right: auto;
}
.nav-brand img {
  width: 118px;
  height: auto;
}
.nav-links {
  display: flex;
  gap: 1.4rem;
  align-items: center;
}
.nav-links a {
  text-decoration: none;
  font-weight: 550;
  font-size: 0.98rem;
  padding: 0.35rem 0.1rem;
  border-bottom: 3px solid transparent;
}
.nav-links a:hover {
  border-bottom-color: var(--cyan);
}
.nav-cta {
  font-size: 0.95rem;
  padding: 0.7rem 1.1rem;
}
.nav-burger {
  display: none;
  background: none;
  border: 2px solid var(--ink);
  border-radius: 4px;
  width: 44px;
  height: 40px;
  padding: 7px 9px;
  cursor: pointer;
  flex-direction: column;
  justify-content: space-between;
}
.nav-burger span {
  display: block;
  height: 3px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.25s var(--ease-settle), opacity 0.2s;
}
.nav-panel {
  display: none;
}
@media (max-width: 860px) {
  .nav-links,
  .nav-cta {
    display: none;
  }
  .nav-burger {
    display: flex;
  }
  .nav-panel {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-card);
    padding: 0.8rem clamp(1.1rem, 4vw, 2.5rem) 1.4rem;
  }
  .menu-open .nav-panel {
    display: block;
  }
  .menu-open .nav-burger span:nth-child(1) {
    transform: translateY(10px) rotate(45deg);
  }
  .menu-open .nav-burger span:nth-child(2) {
    opacity: 0;
  }
  .menu-open .nav-burger span:nth-child(3) {
    transform: translateY(-10px) rotate(-45deg);
  }
  .nav-panel a {
    display: block;
    text-decoration: none;
    font-family: "Space Grotesk", sans-serif;
    font-weight: 600;
    font-size: 1.2rem;
    padding: 0.75rem 0.2rem;
    border-bottom: 1px solid var(--line);
  }
  .nav-panel a:last-child {
    border-bottom: 0;
  }
  .nav-panel .btn {
    margin-top: 1rem;
    text-align: center;
    display: block;
  }
}

/* ---------- Kickers (section labels on paper tape) ---------- */
.kicker {
  display: inline-block;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: 0.06em;
  color: #050505;
  padding: 0.32rem 0.85rem;
  margin-bottom: 1.3rem;
  transform: rotate(-1.2deg);
  box-shadow: 0 1px 2px rgba(5, 5, 5, 0.2);
}
.kicker-cyan {
  background: var(--cyan);
}
.kicker-pink {
  background: var(--pink);
}
.kicker .tick {
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  border-radius: 50%;
  background: var(--lime);
  margin-right: 0.5em;
  vertical-align: 0.02em;
  border: 1px solid rgba(5, 5, 5, 0.35);
}

/* ---------- Hero ---------- */
.hero {
  padding-block: clamp(3rem, 6vw, 5.5rem) clamp(3.5rem, 7vw, 6.5rem);
  overflow: hidden;
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}
.hero-copy .tagline {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 550;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
  margin-bottom: 1.2rem;
}
@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Mounted collage figures ---------- */
.mount {
  margin: 0;
  position: relative;
  background: var(--paper-raise);
  padding: clamp(8px, 1.2vw, 14px);
  box-shadow: var(--shadow-card);
  transform: rotate(var(--tilt, -1deg));
}
.mount img {
  width: 100%;
}
/* Tape corners */
.mount::before,
.mount::after {
  content: "";
  position: absolute;
  width: clamp(54px, 7vw, 88px);
  height: clamp(18px, 2.2vw, 26px);
  opacity: 0.85;
  box-shadow: 0 1px 2px rgba(5, 5, 5, 0.18);
}
.mount::before {
  top: calc(clamp(18px, 2.2vw, 26px) / -2.4);
  left: 6%;
  transform: rotate(-5deg);
}
.mount::after {
  bottom: calc(clamp(18px, 2.2vw, 26px) / -2.4);
  right: 6%;
  transform: rotate(4deg);
}
.tape-cyan::before,
.tape-cyan::after {
  background: var(--cyan);
}
.tape-pink::before,
.tape-pink::after {
  background: var(--pink);
}
.tape-mix::before {
  background: var(--cyan);
}
.tape-mix::after {
  background: var(--pink);
}

/* ---------- Feature rows ---------- */
.feature {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 5.5rem);
  align-items: center;
}
.feature + .feature {
  margin-top: clamp(3.5rem, 8vw, 7rem);
}
.feature.flip .feature-media {
  order: 2;
}
.feature.flip .feature-copy {
  order: 1;
}
.feature-media.portrait {
  max-width: 26rem;
  justify-self: center;
}
.feature-media.square {
  max-width: 30rem;
  justify-self: center;
}
@media (max-width: 820px) {
  .feature,
  .feature.flip {
    grid-template-columns: 1fr;
  }
  .feature.flip .feature-media {
    order: 0;
  }
  .feature-media,
  .feature-media.portrait,
  .feature-media.square {
    max-width: 30rem;
    justify-self: start;
  }
}

/* Wide panorama feature (multi-sport) — image above, centred copy below. */
.feature-wide {
  margin-top: clamp(3.5rem, 8vw, 7rem);
}
.feature-wide .mount {
  max-width: 60rem;
  margin-inline: auto;
}
.feature-wide .feature-copy {
  margin-top: clamp(2rem, 4vw, 3rem);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.feature-wide + .feature {
  margin-top: clamp(3.5rem, 8vw, 7rem);
}
.cta-final {
  margin-top: clamp(3.5rem, 8vw, 7rem);
}

/* ---------- Closing CTA ---------- */
.cta-final {
  text-align: center;
}
.cta-final .mount {
  max-width: 56rem;
  margin-inline: auto;
  --tilt: -0.6deg;
}
.cta-final h2 {
  margin-top: 2.6rem;
}
.cta-final p {
  margin-inline: auto;
}
.cta-final .btn-row {
  justify-content: center;
  margin-top: 1.8rem;
}

/* ---------- Footer ---------- */
footer {
  background: var(--paper-deep);
  border-top: 1px solid var(--line);
  padding: clamp(2.5rem, 5vw, 4rem) 0 2.5rem;
}
.foot-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: flex-start;
  justify-content: space-between;
}
.foot-brand img {
  width: 132px;
  height: auto;
}
.foot-brand p {
  color: var(--ink-soft);
  font-size: 0.95rem;
  margin-top: 0.9rem;
}
.foot-links {
  display: flex;
  gap: 2.5rem;
  flex-wrap: wrap;
}
.foot-links nav {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.foot-links a {
  text-decoration: none;
  font-size: 0.95rem;
}
.foot-links a:hover {
  text-decoration: underline;
  text-decoration-color: var(--cyan);
  text-decoration-thickness: 0.14em;
}
.foot-links h3 {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.4rem;
}
.foot-legal {
  margin-top: 2.5rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
  align-items: center;
}
.foot-legal .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--lime);
  border: 1px solid rgba(5, 5, 5, 0.35);
  display: inline-block;
}

/* ---------- Sub-pages (privacy / terms / 404) ---------- */
.page {
  padding-block: clamp(2.5rem, 6vw, 5rem);
}
.page-narrow {
  max-width: 46rem;
}
.draft-flag {
  display: inline-block;
  background: var(--pink);
  color: #050505;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  padding: 0.35rem 0.9rem;
  transform: rotate(-1deg);
  margin-bottom: 1.4rem;
  box-shadow: 0 1px 2px rgba(5, 5, 5, 0.2);
}
.page h2 {
  font-size: clamp(1.4rem, 2.4vw, 1.8rem);
  margin-top: 2.2rem;
}
.page ul {
  padding-left: 1.2rem;
}
.page li {
  margin-bottom: 0.4rem;
}
.notfound {
  min-height: 55vh;
  display: grid;
  place-content: center;
  text-align: center;
  padding-block: clamp(3rem, 8vw, 7rem);
}
.notfound .corners {
  position: relative;
  width: 200px;
  height: 140px;
  margin: 0 auto 2rem;
}
.notfound .corners i {
  position: absolute;
  width: 34px;
  height: 34px;
  border: 4px solid var(--cyan);
}
.notfound .corners i:nth-child(1) {
  top: 0;
  left: 0;
  border-right: 0;
  border-bottom: 0;
}
.notfound .corners i:nth-child(2) {
  top: 0;
  right: 0;
  border-left: 0;
  border-bottom: 0;
}
.notfound .corners i:nth-child(3) {
  bottom: 0;
  left: 0;
  border-right: 0;
  border-top: 0;
}
.notfound .corners i:nth-child(4) {
  bottom: 0;
  right: 0;
  border-left: 0;
  border-top: 0;
  border-color: var(--pink);
}
.notfound p {
  margin-inline: auto;
}

/* ---------- Reveal on scroll (paper settle) ----------
   The hidden state only applies once the inline head script has stamped
   html.js — content is never invisible without JavaScript. */
html.js .reveal {
  opacity: 0;
  transform: translateY(18px) rotate(0.5deg);
  transition: opacity 0.7s var(--ease-settle), transform 0.7s var(--ease-settle);
  will-change: opacity, transform;
}
html.js .reveal.in {
  opacity: 1;
  transform: none;
}
@media print {
  html.js .reveal {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  html.js .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .btn,
  .nav-burger span {
    transition: none;
  }
}
