/*
 * Noko homepage.
 * Dark-locked (the brand mockup is dark and the mascot glows on it).
 * Surface system borrowed from Resend's DESIGN.md (awesome-design-md): near-black canvas,
 * translucent hairlines, low-opacity glows. Accent = Ecto Lime (Figma "Noko / Color").
 * Radius rule: interactive = full pill, containers = 20px.
 */
@font-face { font-family: "Raveo Display"; src: local("Raveo Display Medium"), url(fonts/raveo-display-medium.otf) format("opentype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Raveo Display"; src: local("Raveo Display Regular"), url(fonts/raveo-display-regular.otf) format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Raveo"; src: local("Raveo Regular"), url(fonts/raveo-regular.otf) format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Raveo"; src: local("Raveo Medium"), url(fonts/raveo-medium.otf) format("opentype"); font-weight: 500; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #151515;
  --bg-raise: #1b1c1a;
  --ink: #f0ffe0;
  --mute: rgba(240, 255, 224, 0.62);
  --line: rgba(240, 255, 224, 0.08);
  --line-2: rgba(240, 255, 224, 0.16);
  --lime: #8ef54a;
  --lime-deep: #4cc923;
  --on-lime: #0a1f07;
  --r-card: 20px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --display: "Raveo Display", "Raveo", ui-sans-serif, system-ui, sans-serif;
  --text: "Raveo", ui-sans-serif, system-ui, sans-serif;
  --gutter: clamp(16px, 4vw, 56px);
  --field: #a6dd63;      /* muted Ecto Lime for full-bleed color fields */
  --field-ink: #10200a;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --dots: radial-gradient(circle, rgba(240, 255, 224, 0.1) 1px, transparent 1.4px);
}

*, *::before, *::after { box-sizing: border-box; }
html { scrollbar-width: thin; scrollbar-color: rgba(240, 255, 224, 0.22) var(--bg); -webkit-tap-highlight-color: transparent; }
@media (pointer: fine) { html { overscroll-behavior: none; } }
::selection { background: var(--lime); color: var(--on-lime); }
a, button { touch-action: manipulation; }
[id] { scroll-margin-top: 68px; }
.skip {
  position: fixed; left: 16px; top: 12px; z-index: 70;
  padding: 10px 16px; border-radius: 999px; background: var(--lime); color: var(--on-lime); font-weight: 500;
  translate: 0 -200%;
}
.skip:focus-visible { translate: none; }
/* Smooth scrolling is Lenis (home.js); native smooth-scroll is only the no-JS / reduced-motion fallback. */
@media (prefers-reduced-motion: no-preference) { html:not(.lenis) { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.55 var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  /* Dot grid is pinned to the viewport (content scrolls over it, like buzz.xyz). */
  background-image: var(--dots);
  background-size: 22px 22px;
  background-attachment: fixed;
}
/* Gentle film grain over everything (fixed + pointer-events none, so it never repaints on scroll). */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 60; pointer-events: none;
  background-image: var(--grain); background-size: 180px 180px;
  opacity: 0.045; mix-blend-mode: overlay;
}
/* Small labels: the brand face, not a code font. */
.mono {
  font: 500 13px/1.4 var(--text); letter-spacing: 0.06em; text-transform: uppercase;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; border-radius: 999px; }

.wrap { width: 100%; max-width: 1240px; margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 48px; padding: 0 22px; border-radius: 999px;
  font: 500 16px/1 var(--text); white-space: nowrap;
  transition: transform 0.35s var(--ease), background-color 0.2s ease, border-color 0.2s ease;
}
.btn:active { transform: translateY(1px) scale(0.98); }
.btn .ph { font-size: 0.95em; transition: translate 0.35s var(--ease); }
.btn:hover .ph { translate: 2px -2px; }
.btn-sm { height: 40px; padding: 0 18px; font-size: 15px; }
.btn-primary { background: var(--lime); color: var(--on-lime); }
.btn-primary:hover { background: #a6f86e; }
.btn-ghost { border: 1px solid var(--line-2); color: var(--ink); }
.btn-ghost:hover { border-color: rgba(240, 255, 224, 0.4); }

/* ---------- Nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 50;
  height: 68px; padding-inline: var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
/* No bar behind the nav. Each item flips to dark ink while it sits over the lime field. */
.nav-mark { font: 500 26px/1 var(--display); letter-spacing: -0.02em; transition: color 0.25s ease; }
.nav .btn { transition: transform 0.35s var(--ease), background-color 0.25s ease, color 0.25s ease; }
.nav-mark.on-field { color: var(--field-ink); }
.nav .btn.on-field { background: var(--field-ink); color: var(--field); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100dvh;
  display: grid; place-items: center;
  padding: 68px var(--gutter) clamp(28px, 5vh, 48px);
  isolation: isolate;
}
/* Sits at the optical centre (a little above true centre); the tagline reads as the mark's caption. */
.hero-center { display: grid; justify-items: center; gap: clamp(18px, 2.2vw, 32px); margin-top: -6vh; }
.hero-mark {
  font: 500 clamp(130px, 29vw, 440px)/0.82 var(--display);
  letter-spacing: -0.055em; white-space: nowrap;
  margin-inline-start: -0.04em; /* optical: centre the glyphs, not the advance */
}
/* "meet" sits small, centred above the wordmark. */
.hero-meet {
  display: block; margin: 0 0 -0.04em; text-align: center;
  font-size: max(0.075em, 17px); /* never smaller than the tagline */
  line-height: 1; letter-spacing: -0.01em; font-weight: 400;
  color: var(--mute);
}
/* The first "o" keeps its width but is drawn by the live mascot instead. */
.o-slot { position: relative; color: transparent; }
.o-slot i {
  position: absolute; left: 50%; bottom: 0.25em; /* glyph centre = 0.5em above the span box bottom (measured) */
  width: 0.5em; height: 0.5em; translate: -50% 0;
}
/* Arrival: "meet" → the letters rise in turn → the tagline; Noko lands in its "o" last. */
@media (prefers-reduced-motion: no-preference) {
  .js .hero-meet, .js .hero-mark > span:not(.o-slot):not(.hero-meet), .js .hero-tag {
    animation: hero-rise 1s var(--ease) both;
  }
  .js .hero-meet { animation-delay: 0.05s; }
  .js .hero-mark > span:nth-child(2) { animation-delay: 0.15s; }
  .js .hero-mark > span:nth-child(4) { animation-delay: 0.27s; }
  .js .hero-tag { animation-delay: 0.45s; }
  .js .hero-down { animation: hero-fade 1s ease 1.2s both; }
}
@keyframes hero-rise { from { opacity: 0; translate: 0 0.35em; filter: blur(6px); } }
@keyframes hero-fade { from { opacity: 0; } }
.hero-mark > span:not(.o-slot):not(.hero-meet) { display: inline-block; }
/* As in the Figma mockup: lowercase Raveo Display under the wordmark. */
.hero-tag {
  color: var(--mute); text-transform: none;
  font: 400 clamp(18px, 1.7vw, 24px)/1.1 var(--display); letter-spacing: -0.01em;
}
.hero-down {
  position: absolute; left: 50%; bottom: clamp(20px, 4vh, 36px); translate: -50% 0;
  display: grid; place-items: center; padding: 8px;
  color: var(--ink); font-size: 26px; opacity: 0.7;
  transition: opacity 0.2s ease;
}
.hero-down:hover { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .hero-down i { animation: down-bob 2.4s cubic-bezier(0.45, 0, 0.55, 1) infinite; }
}
@keyframes down-bob { 0%, 100% { translate: 0 -2px; } 50% { translate: 0 3px; } }

/* ---------- Sections ---------- */
section:not(.hero) { padding-block: clamp(80px, 12vw, 144px); }
.h2 {
  font: 500 clamp(44px, 6.4vw, 96px)/0.92 var(--display);
  letter-spacing: -0.045em; max-width: 14ch; text-wrap: balance;
}
.lede { margin-top: 20px; max-width: 52ch; color: var(--mute); font-size: 18px; text-wrap: pretty; }

/* Headline reveal: each word slides up out of its own mask (home.js splits [data-split]).
   The mask is padded below so descenders (g, y, p) are never clipped. */
.h2 .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.12em; margin-bottom: -0.12em; }
.h2 .w > span { display: inline-block; }
@media (prefers-reduced-motion: no-preference) {
  .js .h2 .w > span { translate: 0 110%; transition: translate 1s var(--ease) calc(var(--i) * 55ms); }
  .js .h2.in .w > span { translate: none; }
}

/* Demo: the one color-field section. Smooth gradient in and out of the dark page.
   Both dot layers are viewport-fixed on the same 22px grid, so the pattern stays put
   and only changes color: light dots fade out at the edges as the dark ones take over. */
.demo {
  --fade: clamp(160px, 22vw, 320px);
  position: relative; isolation: isolate;
  color: var(--field-ink);
  padding-block: calc(var(--fade) * 0.9) calc(var(--fade) * 0.8) !important;
  background:
    radial-gradient(circle, rgba(16, 32, 10, 0.16) 1px, transparent 1.4px) 0 0 / 22px 22px fixed,
    linear-gradient(var(--bg), var(--field) var(--fade), var(--field) calc(100% - var(--fade)), var(--bg));
}
.demo::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: var(--dots) 0 0 / 22px 22px fixed;
  -webkit-mask-image: linear-gradient(#000, transparent var(--fade), transparent calc(100% - var(--fade)), #000);
  mask-image: linear-gradient(#000, transparent var(--fade), transparent calc(100% - var(--fade)), #000);
}
.demo .lede { color: rgba(16, 32, 10, 0.72); }
.demo .mono { display: block; margin-bottom: 20px; color: rgba(16, 32, 10, 0.72); }
.frame {
  margin-top: 56px; padding: 0 clamp(10px, 2.4vw, 28px) clamp(10px, 2.4vw, 28px);
  border-radius: 28px; background: var(--bg);
  box-shadow: 0 50px 100px -40px rgba(16, 32, 10, 0.55);
}
.frame iframe { border-radius: 14px; }
/* The demo plays itself once it scrolls into view: the frame is for watching (wheel and clicks stay on the page). */
.frame iframe { pointer-events: none; }

/* As the frame scrolls in it tilts up into place, like a screen being raised. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .frame {
      transform-origin: 50% 0;
      animation: frame-rise linear both;
      animation-timeline: view(); animation-range: entry 0% cover 38%;
    }
  }
}
@keyframes frame-rise {
  from { transform: perspective(1600px) rotateX(16deg) scale(0.9); }
  to { transform: none; }
}
.frame-bar {
  height: 52px; display: flex; align-items: center; justify-content: center;
}
.frame-url {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px; border-radius: 999px; background: rgba(240, 255, 224, 0.05);
  font-size: 13px; color: var(--mute);
}
.frame iframe { display: block; width: 100%; height: clamp(520px, 72vh, 680px); border: 0; background: #fff; }

/* Bento: two fixed-height rows, asymmetric (7/5 then 5/7 of 12), so nothing stretches. */
.bento {
  margin-top: 48px;
  display: grid; gap: 16px;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: 340px;
}
.cell {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; gap: 28px;
  padding: 28px; border-radius: var(--r-card);
  background: var(--bg-raise); border: 1px solid var(--line);
}
.cell h3 { font: 500 clamp(24px, 2.2vw, 30px)/1.05 var(--display); letter-spacing: -0.03em; }
.cell p { margin-top: 8px; color: var(--mute); font-size: 16px; max-width: 36ch; text-wrap: pretty; }

/* Spotlight border: a lime highlight on the card edge follows the pointer (--mx/--my from home.js). */
.cell::before, .cell::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  opacity: 0; transition: opacity 0.4s ease;
}
.cell::before {
  padding: 1px;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), rgba(142, 245, 74, 0.7), transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.cell::after { background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(142, 245, 74, 0.06), transparent 70%); }
.bento:hover .cell::before, .bento:hover .cell::after { opacity: 1; }

.cell-a {
  grid-column: span 7;
  background:
    radial-gradient(120% 80% at 20% 0%, rgba(142, 245, 74, 0.22), transparent 60%),
    linear-gradient(180deg, #1d2a17, #161a14);
  border-color: rgba(142, 245, 74, 0.18);
}
/* Photo fills the card; the copy sits on a scrim at the bottom. */
.cell-b { grid-column: span 5; justify-content: flex-end; background: #111; }
.cell-b img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  filter: grayscale(1) contrast(1.1) brightness(0.85); transition: scale 1.2s var(--ease);
}
.cell-b:hover img { scale: 1.04; }
.cell-b::after { opacity: 1; background: linear-gradient(transparent 35%, rgba(21, 21, 21, 0.92)); }
.cell-b .cell-copy { position: relative; z-index: 1; }
.cell-c { grid-column: span 5; }
.cell-d { grid-column: span 7; }

.asks { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; max-width: 520px; }
.ask {
  padding: 10px 16px; border-radius: 16px 16px 16px 4px;
  background: rgba(240, 255, 224, 0.07); border: 1px solid var(--line);
  font-size: 15px;
}
.ask:nth-child(2) { margin-inline-start: 28px; }
.ask-done {
  display: inline-flex; align-items: center; gap: 6px; margin-inline-start: auto;
  border-radius: 16px 16px 4px 16px;
  background: var(--lime); color: var(--on-lime); border-color: transparent; font-weight: 500;
}
.cell-visual { flex: 1; display: grid; place-items: center; }
.publish-pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: 999px;
  background: var(--lime); color: var(--on-lime); font-weight: 500; font-size: 15px;
  box-shadow: 0 0 0 6px rgba(142, 245, 74, 0.1);
}
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.history li {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 12px;
  background: rgba(240, 255, 224, 0.04); border: 1px solid var(--line); font-size: 15px;
}
.history li .ph { color: var(--lime); font-size: 17px; }
.history li span { flex: 1; min-width: 0; }
.history time { color: var(--mute); font-size: 13px; }
.history b {
  padding: 4px 12px; border-radius: 999px; font-weight: 500; font-size: 13px;
  background: var(--lime); color: var(--on-lime);
}
.history li:last-child { border-color: rgba(142, 245, 74, 0.35); background: rgba(142, 245, 74, 0.06); }

/* Agencies */
.agencies-grid { display: grid; grid-template-columns: 1.1fr 1fr; align-items: center; gap: 48px; }
.agencies-copy .btn { margin-top: 32px; }
.agencies-slot { width: min(100%, 420px); aspect-ratio: 1; justify-self: center; }

/* Footer: links + legal in one row, then the wordmark full-bleed, cropped by the page edge. */
.foot { padding-top: 56px; border-top: 1px solid var(--line); overflow: hidden; }
.foot-top { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.foot-links { display: flex; flex-wrap: wrap; gap: 28px; color: var(--mute); }
.foot-links a { transition: color 0.2s ease; }
.foot-links a:hover { color: var(--ink); }
.foot-legal { color: var(--mute); font-size: 14px; }
.foot-mark {
  margin: clamp(48px, 8vw, 96px) 0 -0.075em; /* the page edge trims the bottom of the letters */
  font: 500 47vw/0.74 var(--display);
  letter-spacing: -0.06em; text-align: center; white-space: nowrap; user-select: none;
  margin-inline-start: -0.04em;
  /* Lime at the top, fading to nothing at the bottom. */
  background: linear-gradient(var(--lime) 10%, rgba(142, 245, 74, 0) 92%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .foot-mark { animation: mark-rise linear both; animation-timeline: view(); animation-range: entry 0% entry 100%; }
  }
}
@keyframes mark-rise { from { translate: 0 45%; opacity: 0.2; } to { translate: none; opacity: 1; } }

/* ---------- Reveal (only when motion is welcome) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
  .js .reveal.in { opacity: 1; transform: none; }
  .js .bento .reveal:nth-child(2) { transition-delay: 0.08s; }
  .js .bento .reveal:nth-child(3) { transition-delay: 0.16s; }
  .js .bento .reveal:nth-child(4) { transition-delay: 0.24s; }
  .js .bento .cell.reveal { transition-property: opacity, transform; }
}

/* Noko's bubble: the page's off-white (no pure white) and the brand face. */
.noki-bubble {
  --bg: var(--ink);
  font: 500 14px/1.3 var(--text); color: var(--on-lime);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* ---------- Tablet ---------- */
@media (max-width: 1023px) {
  .bento { grid-template-columns: 1fr 1fr; grid-auto-rows: 320px; }
  .cell-a, .cell-d { grid-column: span 2; }
  .cell-b, .cell-c { grid-column: span 1; }
}

/* ---------- Mobile ---------- */
@media (max-width: 767px) {
  .hero-tag { text-align: center; font-size: 17px; }
  .frame iframe { height: 570px; } /* the sample site + Noko's chat bar; the site's photo takes the height that's left */
  .bento { grid-template-columns: 1fr; grid-auto-rows: auto; }
  .bento .cell { grid-column: auto; min-height: 300px; }
  .cell-b { min-height: 340px; }
  .agencies-grid { grid-template-columns: 1fr; }
  .agencies-slot { width: min(70vw, 300px); }
  .foot-links { gap: 4px 24px; }
  .foot-links a { padding-block: 9px; } /* finger-sized targets */
}

@media (max-width: 360px) {
  .frame iframe { height: 600px; } /* narrow phones: the sample site's text wraps more */
}

/* ---------- Mascot on the homepage ---------- */
/* Below the nav (50) and the grain (60); the overlay's default z-index is for client sites. */
.noki, .noki-shadow { z-index: 40; }
.noki-bubble { z-index: 45; }

/* Entrance: a quiet fade and focus-in where Noko appears. Animates the canvas (scaled
   around Noko's own centre), never .noki, which is positioned by its transform. */
@media (prefers-reduced-motion: no-preference) {
  .noki.noko-enter canvas { animation: noko-enter 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both; }
  .noki-shadow.noko-enter { animation: noko-shadow-enter 0.9s ease 0.35s both; }
}
@keyframes noko-enter {
  from { opacity: 0; scale: 0.86; filter: blur(10px); }
  to { opacity: 1; scale: 1; filter: blur(0); }
}
@keyframes noko-shadow-enter { from { opacity: 0; } }
