/* Clicky Group holding page.
   Sections: tokens and base, background, layout, wordmark and dot, copy,
   companies, signup (parked), footer, responsive, reduced motion. Dark for
   everyone: the page does not follow the system theme. */

@font-face {
  font-family: 'Google Sans';
  src: url('/assets/fonts/GoogleSans-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink:         #FFFFFF;
  --ink-2:       rgba(255,255,255,0.78);
  --muted:       rgba(255,255,255,0.55);
  --muted-2:     rgba(255,255,255,0.38);
  --paper:       #000000;
  --paper-2:     #0B0B0F;
  --line:        rgba(255,255,255,0.12);
  --accent:      #4285F4;
  --accent-deep: #6EA1FF;
  --green:       #34A853;
  --negative:    #FF8585;
  --sans:        'Google Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono:        ui-monospace, SFMono-Regular, 'JetBrains Mono', Menlo, Consolas, monospace;
  --ease:        cubic-bezier(0.2, 0.7, 0.2, 1);
  --wordmark-w:  min(320px, 48vw);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; overscroll-behavior: none; }
body {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- Background ----------
   Two stacked scene layers so a new scene can crossfade over the old one. */
.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; background: var(--paper); }
.bg-layer { position: absolute; inset: 0; opacity: 0; transition: opacity 1.1s ease; will-change: opacity; contain: strict; }
.bg-layer.is-on { opacity: 1; }
.bg-layer svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.bg-grain {
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.55 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 220px 220px;
  opacity: 0.09;
  mix-blend-mode: overlay;
}
.is-lite .bg-grain { display: none; } /* a blended full-screen layer is repainted every frame on WebKit */
.bg-vignette {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 80% 70% at 50% 50%, rgba(0,0,0,0) 35%, rgba(0,0,0,0.45) 100%);
}

/* ---------- Layout ----------
   main fills the viewport and the footer floats over its bottom edge, so
   the logo is centred on the screen. */
main {
  position: relative; z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 48px 24px;
  overflow-x: clip;
}
.mark {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  opacity: 0;
}
.is-ready .mark { animation: mark-in 1.1s var(--ease) both; }
.mark::before { /* halo that lifts the logo off the scene */
  content: ""; position: absolute; inset: -22% -18% -26%; z-index: -1;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0,0,0,0.55), rgba(0,0,0,0));
}
@keyframes mark-in {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Wordmark and dot ----------
   The "clicky group." artwork with the dot over the i cut out and replaced
   by a live dot. Distances are in the artwork's units (1920 wide), about
   three times the on-screen pixels. */
.wordmark {
  width: var(--wordmark-w); height: auto; display: block; margin: 0 auto;
  overflow: visible;   /* the dot travels outside the SVG box */
  touch-action: none;  /* WebKit ignores touch-action on SVG children */
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.cg-dot {
  fill: var(--ink);
  cursor: grab; pointer-events: all; touch-action: none;
  transform-box: fill-box; transform-origin: 50% 100%;
}
.cg-dot.is-held { cursor: grabbing; }
.cg-dot:focus { outline: none; }
.cg-dot:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; }
.cg-dot.is-entering { transform: translate(0, -190vh); }
.is-ready .cg-dot.is-entering { animation: cg-dot-bounce-in 2.1s linear 0.3s both; }
.cg-dot.is-hopping { animation: cg-dot-hop 0.55s cubic-bezier(0.3, 0, 0.2, 1) both; }
/* In flight the dot is drawn by .dot-fly, a fixed twin above the whole page,
   so nothing can hide it. The SVG dot stays in place, transparent, to keep
   taking the pointer. */
.cg-dot.is-mirrored { opacity: 0; }
.dot-fly {
  position: fixed; left: 0; top: 0; z-index: 10;
  width: 128px; height: 128px; border-radius: 50%;
  background: var(--ink);
  transform-origin: 50% 100%; will-change: transform;
  pointer-events: none; display: none;
}
@keyframes cg-dot-hop {
  0%   { transform: translate(0, 0) scale(1); }
  15%  { transform: translate(0, 0) scale(1.25, 0.75); }
  50%  { transform: translate(0, -86px) scale(0.95, 1.05); }
  85%  { transform: translate(0, 0) scale(1.1, 0.9); }
  100% { transform: translate(0, 0) scale(1); }
}
@keyframes cg-dot-bounce-in {
  0%   { transform: translate(0, -190vh) scale(1);         animation-timing-function: cubic-bezier(0.55, 0, 1, 1); }
  30%  { transform: translate(0, 46px) scale(1);           animation-timing-function: ease-out; }
  33%  { transform: translate(0, 46px) scale(1.34, 0.66);  animation-timing-function: ease-in; }
  37%  { transform: translate(0, 46px) scale(1, 1);        animation-timing-function: cubic-bezier(0, 0, 0.5, 1); }
  55%  { transform: translate(0, -120px) scale(1);         animation-timing-function: cubic-bezier(0.5, 0, 1, 1); }
  71%  { transform: translate(0, 46px) scale(1);           animation-timing-function: ease-out; }
  73%  { transform: translate(0, 46px) scale(1.18, 0.82);  animation-timing-function: ease-in; }
  77%  { transform: translate(0, 46px) scale(1, 1);        animation-timing-function: cubic-bezier(0, 0, 0.35, 1); }
  100% { transform: translate(0, 0) scale(1); }
}

/* ---------- Copy ---------- */
.tagline { /* tracked capitals justified to the wordmark's width, sized off it */
  margin: 22px auto 0;
  width: var(--wordmark-w);
  font-weight: 500;
  font-size: calc(var(--wordmark-w) * 0.0365);
  line-height: 1.6;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-2);
  text-align: justify;
  text-align-last: justify;
  white-space: nowrap;
  opacity: 0;
}
.is-ready .tagline { animation: mark-in 1.1s var(--ease) 0.35s both; }
.tagline .t { white-space: nowrap; }
.tagline .sep { color: var(--accent); }
.tagline-sub {
  margin: 14px auto 0;
  max-width: 64ch;
  text-wrap: balance;
  font-size: clamp(13px, 1.25vw, 15px);
  line-height: 1.5;
  letter-spacing: 0.005em;
  color: var(--muted);
  text-align: center;
  opacity: 0;
}
.is-ready .tagline-sub { animation: mark-in 1.1s var(--ease) 0.55s both; }

/* ---------- The three operating companies ----------
   All marks rendered white: Clicky and Amplify ship dark and are flattened. */
.companies {
  margin: 30px auto 0;
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: 14px 34px;
  opacity: 0;
}
.is-ready .companies { animation: mark-in 1.1s var(--ease) 0.75s both; }
.company { display: inline-flex; align-items: center; }
.company img { height: 20px; width: auto; display: block; opacity: 0.85; transition: opacity 160ms ease, transform 160ms ease; }
a.company:hover img { opacity: 1; transform: translateY(-1px); }
.company img.flatten { filter: brightness(0) invert(1); }
/* The Amplify mark carries a tiny tagline along its bottom third: render
   taller and clip it off, giving the clipped space back with the margin. */
.company img.amplify { height: 25px; clip-path: inset(0 0 32% 0); margin-bottom: -8px; }

/* ---------- Notify-me signup (parked) ----------
   Remove the hidden attribute on .signup to bring it back. */
.signup { width: 100%; max-width: 420px; margin: 26px auto 0; opacity: 0; }
.is-ready .signup { animation: mark-in 1.1s var(--ease) 0.75s both; }
.signup-row { display: flex; gap: 10px; }
.signup input[type="email"] {
  flex: 1; min-width: 0;
  padding: 13px 18px;
  background: rgba(255,255,255,0.06); color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px;
  font-family: var(--sans); font-size: 15px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.signup input[type="email"]::placeholder { color: var(--muted-2); }
.signup input[type="email"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(66,133,244,0.18); }
.signup button {
  padding: 13px 22px;
  background: var(--ink); color: var(--paper);
  border: 1px solid var(--ink); border-radius: 999px;
  font-family: var(--sans); font-size: 15px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, transform .08s ease, opacity .15s ease;
}
.signup button:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.signup button:active { transform: translateY(1px); }
.signup button:disabled { opacity: 0.6; cursor: default; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; } /* honeypot */
.form-note { min-height: 18px; margin: 10px 4px 0; font-size: 13px; color: var(--muted); text-align: center; }
.form-note.error { color: var(--negative); }
.signup-success {
  display: flex; align-items: center; justify-content: center; gap: 11px;
  padding: 14px 20px;
  background: rgba(52,168,83,0.1);
  border: 1px solid rgba(52,168,83,0.35); border-radius: 999px;
  color: var(--ink); font-size: 15px;
}
.signup-success svg { flex: none; }

/* ---------- Footer ---------- */
footer {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
  padding: 30px 24px 36px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  text-align: center;
  color: var(--muted); font-size: 13.5px;
}
.bcorp-link { display: inline-flex; }
.bcorp { height: 40px; width: auto; display: block; opacity: 0.7; filter: brightness(0) invert(1); transition: opacity .15s ease; }
.bcorp-link:hover .bcorp { opacity: 1; }
.social { display: flex; gap: 22px; }
.social a {
  color: var(--muted); text-decoration: none; font-size: 13px; letter-spacing: 0.01em;
  border-bottom: 1px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}
.social a:hover { color: var(--ink); border-color: var(--accent); }
.legal {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  column-gap: 10px; row-gap: 4px;
  color: var(--muted-2); font-size: 12px; letter-spacing: 0.01em;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .tagline { white-space: normal; text-align: center; text-align-last: center; letter-spacing: 0.18em; font-size: 10px; line-height: 1.8; margin-top: 22px; }
  .tagline-sub { font-size: 13px; margin-top: 12px; padding: 0 8px; }
  .companies { gap: 12px 26px; margin-top: 26px; }
  .company img { height: 17px; }
  .company img.amplify { height: 21px; margin-bottom: -7px; }
  footer { gap: 16px; padding: 28px 20px calc(30px + env(safe-area-inset-bottom, 0px)); }
  .legal { line-height: 1.6; row-gap: 8px; }
}
@media (max-width: 480px) {
  .signup-row { flex-direction: column; }
  .signup button { width: 100%; }
}
@media (max-height: 640px) { /* phone landscape: footer flows under the logo */
  main { min-height: 0; flex: 1; padding-bottom: 48px; }
  footer { position: relative; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .bg-layer { transition: none; }
  .is-ready .mark, .is-ready .tagline, .is-ready .tagline-sub, .is-ready .companies, .is-ready .signup,
  .is-ready .cg-dot.is-entering, .cg-dot.is-hopping { animation: none; }
  .is-ready .mark, .is-ready .tagline, .is-ready .tagline-sub, .is-ready .companies, .is-ready .signup { opacity: 1; }
  .is-ready .cg-dot.is-entering { transform: none; }
}
