/* PIQUEZINHO — landing page.
 *
 * The design system, restated in CSS. It is restated rather than imported
 * because there is nothing to import from: the app's tokens live in Dart, in
 * `lib/core/constants/`, and a Flutter constant cannot be read by a browser.
 *
 * So this file is a copy, and copies drift. The rule that keeps it honest:
 * `lib/core/constants/app_colors.dart`, `app_fonts.dart`, `app_shadows.dart`
 * and `app_motion.dart` are the source of truth, and every value below is
 * annotated with the Dart name it came from. If they disagree, Dart wins and
 * this file is wrong.
 *
 * The page is the app's own split: what is drawn (the sky, the ground, the
 * runner — scene.js, two canvases) is the film's style, and everything here,
 * everything you can read or tap, is a sticker.
 */

:root {
  /* AppColors — the background gradient stops. */
  --bg-yellow: #ffe36e;
  --bg-pink: #ffb3d5;
  --bg-violet: #c4b5fd;

  /* AppColors — the hypercolour accents. Fills and highlights only. */
  --lime: #c5ff89;
  --pink: #ff52a2;
  --yellow: #ffd93d;
  --violet: #7b61ff;

  /* AppColors — the anchors. All type and all borders are --ink. --surface
   * is a card fill and never type. */
  --ink: #0f0f0a;
  --surface: #ffffff;

  /* AppFonts. Display is italic w900 and labels are uppercase. */
  --display: "Arial Black", "Arial Bold", "Helvetica Bold", Arial, sans-serif;
  --body: Arial, Helvetica, sans-serif;

  /* AppShadows: solid, blur always 0. The colour is --ink by day. While the
   * page is still night an ink shadow on a night sky is no shadow at all, so
   * it starts as AppShadows.colored(violetPop) and scene.js walks --day from
   * 0 to 1 as the sun comes up. Without the script it is simply day. */
  --day: 1;
  --shadow: var(--ink);

  /* NeoCard's geometry. */
  --radius: 14px;
  --border: 2.5px;

  /* AppMotion: press, quick, base, celebrate; settle and snapIn. */
  --press: 100ms;
  --quick: 160ms;
  --base: 240ms;
  --celebrate: 620ms;
  --settle: cubic-bezier(0.33, 1, 0.68, 1);
  --snap-in: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Where a card rests, and the header it rests under. */
  --card-top: 76px;
}

@supports (color: color-mix(in srgb, red, blue)) {
  :root {
    --shadow: color-mix(in srgb, var(--ink) calc(var(--day) * 100%), var(--violet));
  }
}

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

body {
  margin: 0;
  font-family: var(--body);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;

  /* PiquezinhoScaffold's gradient. scene.js paints the sky over it, and ends
   * on exactly this — so this is what shows before the script, and without it. */
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg-yellow) 0%, var(--bg-pink) 55%, var(--bg-violet) 100%);
  background-repeat: no-repeat;
}

/* ── The stage ─────────────────────────────────────────────────────────── */

/* The depth of the page, back to front:
 *   0  #sky    the sky, the sun, the far hills
 *   1  .orbit  a giant word going past behind him
 *   2  .card   what the page says
 *   3  #stage  the ground, the trees, the runner — so a card rises from
 *              behind the horizon, and he is never covered by one
 *   4  .orbit  the same word coming back in front of him
 *   5  header, footer, the XP toast
 * Nothing between body and these may create a stacking context, or the
 * layers stop interleaving. */
canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#sky {
  z-index: 0;
}

#stage {
  z-index: 3;
}

.orbit {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1;
  visibility: hidden;
  pointer-events: none;
  white-space: nowrap;
  font-family: var(--display);
  font-style: italic;
  font-weight: 900;
  font-size: clamp(56px, 13vw, 168px);
  line-height: 1;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  color: var(--lime);
  /* The wordmark's ZINHO!, at size: lime over a hard ink copy. */
  -webkit-text-stroke: 0.035em var(--ink);
  paint-order: stroke fill;
  text-shadow: 0.05em 0.05em 0 var(--ink);
  will-change: transform;
}

/* ── Type ──────────────────────────────────────────────────────────────── */

h1,
h2 {
  font-family: var(--display);
  font-style: italic;
  font-weight: 900;
  /* 1.02 clipped the cedilla on `você`. Display type this heavy needs the
   * extra sliver or Portuguese loses its diacritics. */
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4.2vw, 44px);
}

h2 {
  font-size: clamp(24px, 3vw, 34px);
}

p {
  margin: 0;
  font-size: clamp(15px, 1.4vw, 17px);
  max-width: 46ch;
}

a {
  color: var(--ink);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 3px solid var(--violet);
  outline-offset: 3px;
}

/* ── The wordmark ──────────────────────────────────────────────────────── */

/* Not a string: `Pique` in ink beside `ZINHO!` in lime, at two rotations, the
 * same split the app draws in `login_screen.dart`. The lime half is stacked
 * over an ink copy offset by 3px, which is how it gets an outline without a
 * text-stroke nobody can rely on. */
.wordmark {
  display: inline-flex;
  align-items: center;
  font-family: var(--display);
  font-style: italic;
  font-weight: 900;
  font-size: clamp(18px, 2.2vw, 26px);
  letter-spacing: -0.03em;
  line-height: 1;
  text-decoration: none;
  user-select: none;
}

.wordmark .pique {
  color: var(--ink);
  transform: rotate(-3deg);
}

.wordmark .zinho {
  position: relative;
  z-index: 0;
  transform: rotate(2deg);
  color: var(--lime);
}

.wordmark .zinho::before {
  content: "ZINHO!";
  position: absolute;
  left: 0.055em;
  top: 0.055em;
  color: var(--ink);
  z-index: -1;
}

/* Ink type cannot sit on a night sky, so the wordmark carries its own card. */
.wordmark.pill {
  padding: 9px 14px;
  background: var(--surface);
  border: var(--border) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 2px 2px 0 var(--shadow);
}

/* ── Header ────────────────────────────────────────────────────────────── */

header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px max(16px, 3vw);
  pointer-events: none;
}

header > * {
  pointer-events: auto;
}

.header-side {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* ── Badges ────────────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 6px 12px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--yellow);
  box-shadow: 2px 2px 0 var(--shadow);
  font-family: var(--display);
  font-style: italic;
  font-weight: 900;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge.alt {
  background: var(--lime);
}

/* Rotations stay within -3° to +3°, and only on titles, badges and stickers. */
.sticker {
  transform: rotate(-2deg);
}

.badge.alt.sticker {
  transform: rotate(2deg);
}

/* ── Buttons ───────────────────────────────────────────────────────────── */

/* NeoButton's press feedback, exactly: on press the button translates by the
 * shadow offset while the shadow collapses to zero, over 100ms on ease-out.
 * The button appears to be pushed down onto the page rather than to shrink. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 15px 26px;
  border: var(--border) solid var(--ink);
  border-radius: var(--radius);
  background: var(--pink);
  color: var(--ink);
  font-family: var(--display);
  font-style: italic;
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  box-shadow: 4px 4px 0 var(--shadow);
  cursor: pointer;
  transition:
    transform var(--press) ease-out,
    box-shadow var(--press) ease-out;
}

.btn:active {
  transform: translate(4px, 4px);
  box-shadow: 0 0 0 var(--shadow);
}

.btn.lime {
  background: var(--lime);
}

.btn.ghost {
  background: var(--surface);
}

.btn.small {
  padding: 10px 14px;
  font-size: 12px;
}

/* TRI-06, the completion moment, on the button that earned it: it stamps
 * down from 135%, the shadow closes from 8, and snapIn's overshoot is the
 * squash. scene.js adds the class, and the ShapeBurst and the XP with it. */
.btn.stamp {
  animation: stamp var(--celebrate) var(--snap-in);
}

@keyframes stamp {
  from {
    transform: scale(1.35);
    box-shadow: 8px 8px 0 var(--shadow);
  }
}

/* ── Sections and cards ────────────────────────────────────────────────── */

/* A section is a stretch of road; its card sticks while he runs it. The card
 * starts below the fold and behind #stage, so it comes up from behind the
 * horizon, rests, and leaves when the section does. */
.hero,
.final {
  min-height: 100vh;
  padding: var(--card-top) 16px 0;
}

.chapter {
  min-height: 135vh;
  padding: 30vh 16px 0;
}

.card {
  position: sticky;
  top: var(--card-top);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  width: min(420px, 100%);
  margin-inline: auto;
  padding: 18px 18px 20px;
  background: var(--surface);
  border: var(--border) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--shadow);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.hint {
  font-size: 13px;
  font-weight: 700;
}

/* Beside him rather than above him, once there is room: odd cards left, even
 * cards right, and the last one centred over the finish. */
@media (min-width: 900px) {
  :root {
    --card-top: 16vh;
  }

  .card {
    width: 420px;
    margin-inline: max(24px, 7vw) auto;
    padding: 24px 24px 26px;
    gap: 14px;
  }

  main > section:nth-of-type(even) .card {
    margin-inline: auto max(24px, 7vw);
  }

  main > .final .card {
    margin-inline: auto;
    align-items: center;
    text-align: center;
  }
}

/* The header's button is the hero's button again on a phone: one is enough. */
@media (max-width: 899px) {
  header .btn {
    display: none;
  }
}

/* ── What the app looks like, in each card ─────────────────────────────── */

.week,
.friends {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* config_treino: one chip per weekday. */
.week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  width: 100%;
}

.week li {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 6px 0;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--lime);
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 17px;
  line-height: 1.2;
}

.week li.rest {
  background: var(--surface);
}

.week b,
.friends b,
.streak,
.level,
.paid,
.node i {
  font-family: var(--display);
  font-style: italic;
  font-weight: 900;
  text-transform: uppercase;
}

.week b {
  font-size: 10px;
}

/* The photo, and the trail's own words for a day that is done. */
.proof {
  display: flex;
  align-items: center;
  gap: 14px;
}

.snap {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: var(--border) solid var(--ink);
  border-radius: 10px;
  background: var(--yellow);
  box-shadow: 4px 4px 0 var(--ink);
  font-size: 28px;
  transform: rotate(-3deg);
}

.paid {
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--lime);
  font-size: 11px;
  letter-spacing: 0.08em;
}

/* Sua Trilha: the pink panel and its nodes, as trilha_screen draws them. */
.trail {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 18px 12px 12px;
  border: var(--border) solid var(--ink);
  border-radius: var(--radius);
  background: var(--pink);
  box-shadow: 4px 4px 0 var(--violet);
}

.node {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: var(--border) solid var(--ink);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 19px;
}

.node.done {
  background: var(--lime);
}

.node.today {
  width: 54px;
  height: 54px;
  background: var(--yellow);
  box-shadow: 4px 4px 0 var(--ink);
  font-size: 24px;
}

.node.today i {
  position: absolute;
  top: -14px;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--lime);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.node.locked {
  background: var(--violet);
  filter: grayscale(0.35);
}

/* StreakBadge and the profile's LevelPill. */
.score {
  display: flex;
  align-items: center;
  gap: 14px;
}

.streak {
  display: grid;
  justify-items: center;
  padding: 6px 12px;
  border: var(--border) solid var(--ink);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 9px;
  letter-spacing: 0.08em;
  transform: rotate(3deg);
}

.streak b {
  font-size: 20px;
  line-height: 1.1;
}

.level {
  padding: 8px 14px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--lime);
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.friends {
  display: grid;
  gap: 6px;
  width: 100%;
}

.friends li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px 5px 6px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
}

.friends span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  font-size: 15px;
}

.friends b {
  margin-left: auto;
  font-size: 13px;
}

/* ── Footer ────────────────────────────────────────────────────────────── */

/* The last thing on the road: it lies on the ground he has just woken. */
footer {
  position: relative;
  z-index: 5;
  display: flex;
  justify-content: center;
  padding: 0 16px 16px;
}

footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 16px;
  padding: 8px 16px;
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 13px;
  font-weight: 700;
}

/* ── The points ────────────────────────────────────────────────────────── */

/* ShapeBurst: the app's own shapes — hard-edged, ink-bordered, tilted inside
 * the design system's 3°, and pulled back in rather than falling. scene.js
 * places and moves them; this is only what one looks like. */
.burst {
  position: fixed;
  z-index: 7;
  pointer-events: none;
}

.burst i {
  position: absolute;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
}

.xp {
  position: fixed;
  z-index: 6;
  display: grid;
  gap: 4px;
  width: max-content;
  max-width: min(320px, 100vw - 32px);
  padding: 12px 16px;
  background: var(--yellow);
  border: var(--border) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--shadow);
  font-size: 14px;
  font-weight: 700;
  transform: rotate(-2deg);
  transition: opacity var(--base) var(--settle);
}

.xp[hidden] {
  display: none;
}

.xp.in {
  animation: xp-in var(--base) var(--snap-in);
}

.xp.out {
  opacity: 0;
}

.xp strong {
  font-family: var(--display);
  font-style: italic;
  font-weight: 900;
  font-size: 26px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

/* The ✓ enters after everything else has stopped, as on the node. */
.xp i {
  display: inline-block;
  font-style: normal;
  animation: xp-in var(--base) var(--snap-in) var(--celebrate) backwards;
}

@keyframes xp-in {
  from {
    transform: rotate(-2deg) scale(0.6);
    opacity: 0;
  }
}

/* ── Reduced motion ────────────────────────────────────────────────────── */

/* The same hard rule the app has: stop moving things, do not show nothing.
 * scene.js draws the day once and holds it; the cards still stick, because
 * sticking is scrolling, not animation. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
