/* =============================================
   MNJ 2026 — Styles (Figma-aligned)
   ============================================= */
/* --home-inline-pad kept for reference; not actively used post-refactor */

@font-face {
  font-family: 'ScribbleWire';
  src: url('../assets/fonts/Scribble Wire 2.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: block;
}

:root {
  --color-bg: #19f202;
  --color-text: #c600ed;
  --font-display: 'ScribbleWire', sans-serif;
  /* Default headline: modest vw so other pages stay readable; homepage hero overrides with cqw */
  --size-headline: clamp(1.75rem, 1.2rem + 1.25vw, 4rem);
  --track-headline: -0.11em;
  --gap-headline-block: clamp(1.25rem, 0.75rem + 2.5vw, 2.875rem);
  --scene-pad: 2rem;
  /* Homepage copy column: 24px inset from viewport (matches common mobile spec) */
  --home-inline-pad: 24px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-display);
  min-height: 100dvh;
  background-color: var(--color-bg);
  color: var(--color-text);
}

/* --- Shared layout (desktop + mobile) --- */
.scene {
  position: relative;
  min-height: 100dvh;
  overflow: hidden;
  isolation: isolate;
}

.scene__nav {
  position: absolute;
  top: var(--scene-pad);
  left: var(--scene-pad);
  z-index: 3;
  font-family: var(--font-display);
  color: var(--color-text);
  text-decoration: none;
  font-size: clamp(1.25rem, 3.5vw, 4rem);
  letter-spacing: var(--track-headline);
  line-height: 1;
}

.scene__nav:hover,
.scene__nav:focus-visible {
  color: #9b00b8;
}

.scene__nav:focus-visible {
  outline: 2px solid var(--color-text);
  outline-offset: 4px;
}

.scene__star {
  position: absolute;
  z-index: 0;
  top: clamp(2.5rem, 8vw, 5.125rem);
  right: clamp(-2rem, -3vw, -1.5rem);
  width: clamp(200px, 32vw, 484px);
  pointer-events: none;
  user-select: none;
}

.scene__star-img {
  display: block;
  width: 100%;
  height: auto;
}

.scene__monster {
  position: absolute;
  z-index: 0;
  left: 0;
  bottom: clamp(2rem, 4vw, 4rem);
  width: clamp(180px, 27vw, 408px);
  max-height: min(70vh, 618px);
  pointer-events: none;
  user-select: none;
}

.scene__monster-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(70vh, 618px);
  object-fit: contain;
  object-position: left bottom;
}

/* --- Typography --- */
.type-headline {
  font-family: var(--font-display);
  font-size: var(--size-headline);
  letter-spacing: var(--track-headline);
  /* ScribbleWire has tall ascenders; slightly loose line-height avoids collisions when wrapping */
  line-height: 1.12;
  font-weight: normal;
}

.btn {
  display: inline-block;
  text-decoration: none;
  color: var(--color-text);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: var(--size-headline);
  letter-spacing: var(--track-headline);
  line-height: 1;
}

.btn:hover,
.btn:focus-visible {
  color: #9b00b8;
}

.btn:focus-visible {
  outline: 2px solid var(--color-text);
  outline-offset: 4px;
}

/* ========== Shared scene scale (homepage + tickets) ==========
   Figma desktop ref: 1512 × 982.  Layered scene with absolute children.
   --home-scale = min(1vw, 1.54vh) so the composition scales with
   whichever viewport dimension is more constrained. */
.scene--home,
.scene--tickets,
.scene--thankyou {
  --home-scale: min(1vw, 1.54vh);
}

/* --- monster2 (star) — top-right, flush with viewport edge --- */
.scene--home .scene__star,
.scene--tickets .scene__star,
.scene--thankyou .scene__star {
  top: calc(2.65 * var(--home-scale));       /* 40px @ ref */
  right: 0;
  width: calc(29.17 * var(--home-scale));    /* 441px @ ref */
}

/* --- monster1 — bottom-left --- */
.scene--home .scene__monster,
.scene--tickets .scene__monster,
.scene--thankyou .scene__monster {
  left: calc(4.23 * var(--home-scale));      /* 64px @ ref */
  bottom: calc(4.23 * var(--home-scale));
  width: calc(26.98 * var(--home-scale));    /* 408px @ ref */
  max-height: none;
}

.scene--home .scene__monster-img,
.scene--tickets .scene__monster-img,
.scene--thankyou .scene__monster-img {
  max-height: none;
}

/* --- Content layer — grid spanning full viewport.
   Row pattern 1fr/auto/1fr vertically centres the hero.
   Single auto column + justify-content centres horizontally.
   padding-left clears monster1's right edge (~31.2 × scale) + gap. --- */
.scene--home .scene__body {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  grid-template-columns: auto;
  justify-content: center;
  padding-left: calc(34 * var(--home-scale));
  padding-right: calc(34 * var(--home-scale));
  padding-top: calc(4.23 * var(--home-scale));
  padding-bottom: calc(4.23 * var(--home-scale));
}

.scene--home .hero-lines {
  grid-row: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.scene--home .hero-lines .type-headline {
  font-size: calc(4.23 * var(--home-scale)); /* 64px @ ref */
  line-height: normal;
  white-space: nowrap;
}

/* --- Tickets CTA — bottom of row 3, left-aligned with hero --- */
.scene--home .btn--primary {
  grid-row: 3;
  align-self: end;
  z-index: 2;
  font-size: calc(4.23 * var(--home-scale));
  line-height: normal;
  white-space: nowrap;
  text-decoration: none;
}

.scene--home .btn--primary:hover,
.scene--home .btn--primary:focus-visible {
  color: #9b00b8;
}

/* ========== Thank you — shares body/back-button rules with tickets ==========
   Hero "Thank you!" uses same font scale as homepage hero. */
.scene--thankyou .scene__body {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(4.23 * var(--home-scale));
}

.scene--thankyou .btn--back {
  position: absolute;
  top: calc(4.23 * var(--home-scale));
  left: calc(4.23 * var(--home-scale));
  z-index: 2;
  font-size: calc(3.4 * var(--home-scale));
  line-height: normal;
  white-space: nowrap;
}

.scene--thankyou .hero-lines .type-headline {
  font-size: calc(4.23 * var(--home-scale));
  line-height: normal;
  white-space: nowrap;
}


.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ========== Tickets page (desktop) ==========
   Back button is absolutely positioned so it doesn't offset the
   widget's centering — the widget centres against the full viewport. */
.scene--tickets .scene__body {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(4.23 * var(--home-scale));
}

/* Back button — upper-left, floated out of flow */
.scene--tickets .btn--back {
  position: absolute;
  top: calc(4.23 * var(--home-scale));
  left: calc(4.23 * var(--home-scale));
  z-index: 2;
  font-size: calc(3.4 * var(--home-scale));
  line-height: normal;
  white-space: nowrap;
}

/* Widget wrapper — truly centred on viewport */
.scene--tickets .tickets-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 42rem;
}

.ticket-widget {
  width: 100%;
}

/* Ticket Tailor fallback text */
.tt-widget-fallback,
.tt-widget-fallback a {
  color: var(--color-text);
}

.tt-widget-powered {
  opacity: 0.85;
}

/* --- Tablet homepage (≤ 1280px) ---
   Figma ref: 916 × 1194.  Portrait layout: hero left-aligned below monster2,
   Tickets at bottom-right of monster1.
   --home-scale re-tuned: ratio 916/1194 = 0.767. */
@media (max-width: 80rem) {
  .scene--home {
    --home-scale: min(1vw, 0.767vh);
  }

  /* monster2 — top-right, larger proportion */
  .scene--home .scene__star {
    top: calc(4.37 * var(--home-scale));       /* 40px @ ref */
    width: calc(41.16 * var(--home-scale));    /* 377px @ ref */
  }

  /* monster1 — bottom-left, larger proportion */
  .scene--home .scene__monster {
    left: calc(4.37 * var(--home-scale));      /* 40px @ ref */
    bottom: calc(4.37 * var(--home-scale));
    width: calc(38.54 * var(--home-scale));    /* 353px @ ref */
  }

  /* Content layer — spans viewport, children positioned absolutely */
  .scene--home .scene__body {
    display: block;
    padding: 0;
  }

  /* Hero — left-aligned, vertically in upper half (below monster2) */
  .scene--home .hero-lines {
    position: absolute;
    left: calc(11.90 * var(--home-scale));     /* 109px @ ref */
    top: calc(50% - 13.43 * var(--home-scale));
    transform: translateY(-50%);
    margin: 0;
  }

  .scene--home .hero-lines .type-headline {
    font-size: calc(7.5 * var(--home-scale));
  }

  /* Tickets — bottom-right (mirrors monster1 margin from right edge) */
  .scene--home .btn--primary {
    position: absolute;
    right: calc(4.37 * var(--home-scale));     /* 40px @ ref */
    bottom: calc(6.99 * var(--home-scale));    /* 64px @ ref */
    left: auto;
    align-self: auto;
    font-size: calc(7.5 * var(--home-scale));
  }

  /* --- Tickets + Thank you tablet --- */
  .scene--tickets,
  .scene--thankyou {
    --home-scale: min(1vw, 0.767vh);
  }

  .scene--tickets .scene__star,
  .scene--thankyou .scene__star {
    top: calc(4.37 * var(--home-scale));
    width: calc(41.16 * var(--home-scale));
  }

  .scene--tickets .scene__monster,
  .scene--thankyou .scene__monster {
    left: calc(4.37 * var(--home-scale));
    bottom: calc(4.37 * var(--home-scale));
    width: calc(38.54 * var(--home-scale));
  }

  /* Back button — bottom-right; hero stays centred */
  .scene--tickets .scene__body,
  .scene--thankyou .scene__body {
    padding: calc(4.37 * var(--home-scale));
  }

  .scene--tickets .btn--back,
  .scene--thankyou .btn--back {
    position: absolute;
    top: auto;
    left: auto;
    right: calc(4.37 * var(--home-scale));
    bottom: calc(6.99 * var(--home-scale));
    font-size: calc(5.5 * var(--home-scale));
  }

  /* Thank you hero — left-aligned below monster2, same as homepage */
  .scene--thankyou .hero-lines {
    position: absolute;
    left: calc(11.90 * var(--home-scale));
    top: calc(50% - 13.43 * var(--home-scale));
    transform: translateY(-50%);
  }

  .scene--thankyou .hero-lines .type-headline {
    font-size: calc(7.5 * var(--home-scale));
  }
}

/* --- Mobile layout (Figma ~393px) --- */
@media (max-width: 40rem) {
  :root {
    /* Inherit fluid --size-headline; slightly tighter outer gaps on small screens */
    --gap-headline-block: clamp(1rem, 0.5rem + 2.2vw, 1.75rem);
    --scene-pad: 1.5rem;
  }

  .scene__star {
    top: 1.25rem;
    right: -0.75rem;
    width: clamp(160px, 55vw, 250px);
  }

  /* ---- Tickets + Thank you mobile ---- */
  .scene--tickets,
  .scene--thankyou {
    --home-scale: min(1vw, 0.461vh);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 24px;
    overflow: visible;
    container-type: inline-size;
  }

  .scene--tickets .scene__star,
  .scene--thankyou .scene__star {
    position: relative;
    top: auto;
    right: auto;
    align-self: auto;
    margin-left: auto;
    margin-right: -24px;
    width: calc(67.94 * var(--home-scale));
  }

  .scene--tickets .scene__body,
  .scene--thankyou .scene__body {
    display: contents;
  }

  .scene--tickets .tickets-wrap {
    max-width: none;
    align-self: stretch;
    order: 0;
  }

  .scene--tickets .scene__monster,
  .scene--thankyou .scene__monster {
    position: relative;
    left: auto;
    bottom: auto;
    align-self: flex-start;
    width: calc(51.65 * var(--home-scale));
  }

  .scene--tickets .btn--back,
  .scene--thankyou .btn--back {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    align-self: auto;
    margin-left: auto;
    order: 2;
    font-size: min(calc(7.5 * var(--home-scale)), 6.5cqw);
    white-space: nowrap;
  }

  /* Thank you hero — same rules as homepage mobile hero */
  .scene--thankyou .hero-lines {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    margin: 0;
    order: 0;
  }

  .scene--thankyou .hero-lines .type-headline {
    font-size: min(calc(10 * var(--home-scale)), 8.6cqw);
    white-space: nowrap;
  }

  /* ---- Homepage mobile — vertical stack ----
     Figma ref: 393 × 852.  Flex column, 16px padding, space-between.
     Order: monster2 → hero → monster1 → tickets.
     display:contents on scene__body dissolves it so hero + button
     participate directly in the parent flex. */
  .scene--home {
    --home-scale: min(1vw, 0.461vh);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 24px;
    overflow: visible;
    container-type: inline-size;
  }

  /* monster2 — top, right-aligned, bleeds to viewport edge */
  .scene--home .scene__star {
    position: relative;
    top: auto;
    right: auto;
    align-self: auto;
    margin-left: auto;
    margin-right: -24px;
    width: calc(67.94 * var(--home-scale));    /* 267px @ ref */
  }

  /* Dissolve body so hero + button are direct flex children */
  .scene--home .scene__body {
    display: contents;
  }

  /* Hero — left-aligned, flows after monster2.
     font-size: the smaller of the desired vw/vh size and the
     max that fits the padded container (≈ 8.6cqw). */
  .scene--home .hero-lines {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    margin: 0;
  }

  .scene--home .hero-lines .type-headline {
    font-size: min(calc(10 * var(--home-scale)), 8.6cqw);
    white-space: nowrap;
  }

  /* monster1 — left-aligned, flows after hero */
  .scene--home .scene__monster {
    position: relative;
    left: auto;
    bottom: auto;
    align-self: flex-start;
    width: calc(51.65 * var(--home-scale));    /* 203px @ ref */
  }

  /* Tickets — right-aligned, after monster1 (order pushes past monster) */
  .scene--home .btn--primary {
    position: relative;
    right: auto;
    bottom: auto;
    left: auto;
    align-self: auto;
    margin-left: auto;
    order: 1;
    font-size: min(calc(10 * var(--home-scale)), 8.6cqw);
    white-space: nowrap;
  }
}

/* ========== Homepage overlay ==========
   Full-screen "MinIJOB" tiles on top of the homepage content (no bg).
   Font size is min(vw, vh)-based so text fills both dimensions.
   Row count per breakpoint: mobile 7, tablet 4, desktop 4 (×2 cols). */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  overflow: hidden;
  pointer-events: none;
  animation: strobe 4.5s step-end infinite;
}

/*  Strobe burst in the first ~1.5s, then ~4s pause.
    Total cycle = 5.5s. Percentages are fractions of that.
    ─────────────────────────────────────────────────
    Flash 1:  0%–1.5%    ON   (≈  80ms — subliminal)
              1.5%–3.3%  OFF  (≈ 100ms)
    Flash 2:  3.3%–7.8%  ON   (≈ 250ms — readable)
              7.8%–10.0% OFF  (≈ 120ms)
    Flash 3:  10.0%–10.9% ON  (≈  50ms — ultra-quick)
              10.9%–12.4% OFF (≈  80ms)
    Flash 4:  12.4%–15.6% ON  (≈ 180ms — semi-readable)
              15.6%–17.5% OFF (≈ 100ms)
    Flash 5:  17.5%–18.5% ON  (≈  60ms — quick)
    Rest:     18.5%–100%  OFF  (≈ 4s pause)
    ───────────────────────────────────────────────── */
@keyframes strobe {
  0%     { opacity: 1; }
  1.5%   { opacity: 0; }
  3.3%   { opacity: 1; }
  7.8%   { opacity: 0; }
  10.0%  { opacity: 1; }
  10.9%  { opacity: 0; }
  12.4%  { opacity: 1; }
  15.6%  { opacity: 0; }
  17.5%  { opacity: 1; }
  18.5%  { opacity: 0; }
  100%   { opacity: 0; }
}

.overlay__word {
  font-family: var(--font-display);
  letter-spacing: var(--track-headline);
  line-height: 1;
  white-space: nowrap;
  display: flex;
  align-items: center;
}

/* Color cycle */
.overlay__word:nth-child(4n+1) { color: #2044e8; }
.overlay__word:nth-child(4n+2) { color: #f10d1b; }
.overlay__word:nth-child(4n+3) { color: #f6eb02; }
.overlay__word:nth-child(4n+4) { color: #02f7de; }

/* --- Mobile (< 40rem): 1 per row, 7 rows ---
   font ≈ width / 5.5 chars ≈ 18vw; height-capped so 7 rows fit. */
.overlay__word {
  width: 100%;
  font-size: min(18vw, 12vh);
  height: calc(100dvh / 7);
}

/* --- Tablet (40rem – 80rem): 1 per row, 4 rows --- */
@media (min-width: 40rem) {
  .overlay__word {
    font-size: min(18vw, 20vh);
    height: calc(100dvh / 4);
  }
}

/* --- Desktop (> 80rem): 2 per row, 4 rows --- */
@media (min-width: 80rem) {
  .overlay__word {
    width: 50%;
    font-size: min(9vw, 20vh);
    height: calc(100dvh / 4);
  }
}
