/* Rengi World landing — brand tokens from output/brand-manual (03-color-system, 04-typography-system). */
:root {
  --rengi-black: #000000;
  --rengi-soft-cream: #fef5f0;
  --rengi-red: #ff0012;
  --rengi-dark-maroon: #5e0a00;
  --surface: #1b1b1b;            /* the ident's final background */
  --ink: var(--rengi-soft-cream);
  --font-display: "Hanken Grotesk", "Inter", "Helvetica Neue", sans-serif;
  --font-body: "Inter", Arial, sans-serif;
  --font-wordmark: "Lilita One", "Hanken Grotesk", sans-serif;   /* stand-in for CapCut's Memecaps */
  --gutter: 16px;
  --avatar-size: 320px;          /* set by app.js: the symbol's box at reveal scale */
  --avatar-final: 240px;         /* set by app.js: its box once the page is ready */
  --avatar-top: 50%;            /* set by app.js once the page is ready */
  --stack-half: 120px;          /* set by app.js: half the height of avatar + wordmark block */
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--surface); color: var(--ink);
  font-family: var(--font-body); font-size: 16px; line-height: 1.5;
  overflow: hidden; -webkit-font-smoothing: antialiased;
}
body[data-state="ready"] { overflow: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Reveal background: fills the viewport, cropped like the video (xMidYMid slice). */
#reveal { position: fixed; inset: 0; z-index: 0; background: var(--surface); }
#reveal svg { width: 100%; height: 100%; display: block; }

/* Live avatar, centred; transform is driven by app.js during the reveal. */
#avatar-wrap {
  position: fixed; left: 50%; top: 50%; z-index: 2;
  width: var(--avatar-size); height: var(--avatar-size);
  transform: translate(-50%, -50%) var(--logo-transform, scale(0));
  will-change: transform, top;
}
#avatar { width: 100%; height: 100%; cursor: pointer; outline: none; }
#avatar:focus-visible { filter: drop-shadow(0 0 0 2px var(--rengi-red)); }
body[data-state="ready"] #avatar-wrap {
  top: var(--avatar-top);
  transform: translate(-50%, -50%) scale(var(--avatar-final-scale, 0.8));
  transition: top 900ms cubic-bezier(.2,.8,.2,1), transform 900ms cubic-bezier(.2,.8,.2,1);
}

/* Wordmark behind the avatar: two stacked lines, heavy caps with a hard shadow like the reference. */
#wordmark {
  position: fixed; left: 50%; top: var(--avatar-top); z-index: 1 !important;
  display: flex; flex-direction: column; align-items: center;
  font-family: var(--font-wordmark); font-weight: 400; text-transform: uppercase;
  font-size: var(--wordmark-size, clamp(64px, 21vw, 230px)); line-height: 0.88; letter-spacing: 0.03em;
  color: #2a2a2a;   /* charcoal, like the field: a quiet flat mark behind Rengi, no shadow */
  white-space: nowrap; user-select: none;
}
#wordmark span { display: block; }
body[data-state="ready"] #wordmark { transform: translate(-50%, -50%); }
#wordmark { transform: translate(-50%, calc(-50% + 12px)); }

#wordmark-img {
  position: fixed; left: 50%; top: var(--avatar-top); z-index: 1 !important;
  width: min(92vw, 1100px); height: auto; transform: translate(-50%, -50%);
  filter: drop-shadow(0.03em 0.03em 0 var(--rengi-black)); user-select: none; pointer-events: none;
}
#wordmark-img[hidden] { display: none; }

/* Outro cover: above the background and the wordmark, below Rengi and the UI. */
#cover { position: fixed; inset: 0; z-index: 1; pointer-events: none; }
#cover:empty { display: none; }
body[data-state="leaving"] .ui { opacity: 0; transform: translateY(-6px); pointer-events: none; transition: opacity 320ms ease, transform 320ms ease; }
body[data-state="leaving"] #avatar-wrap {
  top: var(--avatar-top);
  transform: translate(-50%, -50%) scale(calc(var(--avatar-final-scale, 0.8) * 1.12));
  transition: transform 520ms cubic-bezier(.2,.9,.2,1.2);
}

/* Page UI: hidden during the intro, staggered in when ready. */
.ui { z-index: 3; opacity: 0; transform: translateY(12px); pointer-events: none; }
body[data-state="ready"] .ui { opacity: 1; transform: none; pointer-events: auto; transition: opacity 700ms ease, transform 700ms cubic-bezier(.2,.8,.2,1); }
body[data-state="ready"] .ui-2 { transition-delay: 350ms; }
body[data-state="ready"] .ui-3 { transition-delay: 550ms; }


main {
  position: absolute; left: 0; right: 0;
  top: calc(var(--avatar-top) + var(--stack-half) + 20px);
  padding: 0 var(--gutter); text-align: center; max-width: 720px; margin: 0 auto;
}
h1 {
  font-family: var(--font-display); font-weight: 800; letter-spacing: -0.01em;
  font-size: clamp(22px, 2.6vw + 10px, 38px); line-height: 1.08; margin: 0 0 10px;
  text-wrap: balance;            /* even lines, no orphan word on the last line */
}
.lead { margin: 0 auto 18px; max-width: 520px; font-size: clamp(14px, 0.5vw + 12px, 17px); opacity: 0.85; text-wrap: pretty; }

form { max-width: 520px; margin: 0 auto; }
.field { display: flex; gap: 8px; }
input[type="email"] {
  flex: 1; min-width: 0; font: inherit; font-size: 16px; padding: 14px 18px;
  border-radius: 999px; border: 2px solid rgba(254, 245, 240, 0.18); background: #2a2a2a; color: var(--ink);
}
input[type="email"]::placeholder { color: rgba(254, 245, 240, 0.45); }
input[type="email"]:focus { outline: none; border-color: var(--rengi-red); }
button[type="submit"] {
  font: inherit; font-weight: 600; font-size: 16px; padding: 14px 22px; border-radius: 999px; border: 0;
  background: var(--rengi-red); color: var(--rengi-soft-cream); cursor: pointer; white-space: nowrap;
  transition: transform 150ms ease, background 150ms ease;
}
button[type="submit"]:hover { transform: translateY(-1px); }
button[type="submit"]:active { transform: translateY(0); }
button[type="submit"]:disabled { opacity: 0.7; cursor: default; }
form.is-done button[type="submit"] { background: var(--rengi-soft-cream); color: var(--rengi-black); }
.fineprint { margin: 8px 0 0; font-size: 12px; opacity: 0.55; }
.note { margin: 6px 0 0; font-size: 14px; opacity: 0.85; }
.note:empty { display: none; }
/* Social proof: a few follower faces and the combined count. */
.community { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 10px auto 0; font-size: 14px; opacity: 0.85; flex-wrap: wrap; }
.community[hidden] { display: none; }
.faces { display: inline-flex; }
.face { position: relative; width: 30px; height: 30px; border-radius: 50%; overflow: hidden; border: 2px solid var(--surface); background: #2a2a2a; margin-left: -9px; }
.face:first-child { margin-left: 0; }
.face img { display: block; width: 100%; height: 100%; object-fit: cover; }
.face::after { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, 0.10); }   /* 10 % black frontdrop */
.community strong { font-weight: 600; color: var(--rengi-soft-cream); }
.note.error { color: #ffb3b8; }

footer {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 0 var(--gutter) 28px; text-align: center;
}
#channels { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; }
#channels a {
  color: var(--ink); font-family: var(--font-body); font-weight: 400; font-size: clamp(14px, 0.5vw + 12px, 17px);
  padding: 8px 2px; text-decoration: underline 2px transparent; text-underline-offset: 0.18em; transition: text-decoration-color 150ms ease;
}
#channels a:hover, #channels a:focus-visible { text-decoration-color: var(--rengi-red); outline: none; }
.legal { margin: 10px 0 0; font-size: 12px; opacity: 0.45; }
.legal a { color: inherit; text-decoration: underline 1px transparent; text-underline-offset: 0.18em; transition: text-decoration-color 150ms ease; }
.legal a:hover, .legal a:focus-visible { text-decoration-color: var(--rengi-red); outline: none; }

@media (max-width: 600px) {
  #wordmark { flex-direction: row; gap: 0.18em; letter-spacing: 0; }
  .field { flex-direction: column; }
  button[type="submit"] { width: 100%; }
  footer { padding-bottom: 18px; }
}
@media (max-height: 560px) {
  .lead { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  body[data-state="ready"] #avatar-wrap, body[data-state="ready"] .ui { transition: none; }
}

/* ---------- Thank-you page (gracias.html): plain flow layout, no reveal ---------- */
body.thanks { overflow: auto; min-height: 100%; display: flex; flex-direction: column; }
/* Undo the landing's fixed/absolute placement for this page */
body.thanks main { position: static; top: auto; }
body.thanks footer { position: static; }
body.thanks #avatar { width: min(46vw, 220px); height: auto; aspect-ratio: 1; position: relative; z-index: 6; }
body.thanks #cover { z-index: 5; }
body.thanks.arriving .thanks-main > :not(#avatar), body.thanks.arriving .thanks-footer { opacity: 0; }
body.thanks .thanks-main > :not(#avatar), body.thanks .thanks-footer { transition: opacity 600ms ease 250ms; }
.thanks-main { flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 40px var(--gutter) 24px; max-width: 720px; margin: 0 auto; width: 100%; }
.thanks-avatar { width: min(46vw, 220px); aspect-ratio: 1; cursor: pointer; margin-bottom: 8px; }
.thanks-main h1 { text-wrap: balance; }
.instagram-section { width: 100%; max-width: 540px; margin-top: 16px; }
.instagram-divider { margin: 0 0 24px; border: 0; border-top: 1px solid rgba(254,245,240,0.2); }
.instagram-embed { position: relative; width: 100%; max-width: 540px; overflow: hidden; border-radius: 16px; }
.instagram-embed .instagram-media { width: 100% !important; min-width: 0 !important; margin: 0 !important; }
.instagram-embed blockquote { padding: 24px; background: #2a2a2a; border: 1px solid rgba(254,245,240,0.18); border-radius: 16px; }
.instagram-embed blockquote a { color: var(--ink); text-underline-offset: 0.18em; }
body.thanks .lead { display: block; }
.thanks-footer { padding: 0 var(--gutter) 22px; text-align: center; }
.thanks-footer #channels { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; }
