/* ============================================================
   LG x Abans — Living Just Right
   Responsive at any screen shape (phone / tablet, either way up)
   ============================================================ */

:root {
  --red:    #ef4136;   /* the script red from the artwork */
  --ink:    #1d1d1f;
  --muted:  #6b6b73;
  --paper:  #dbdbdb;   /* sampled from the plate's flat field */

  /* height of the two pinned strips of bg.png.
     bg.png is 1600x1066, so at full width its displayed height is
     100vw/1.5 = 66.7vw. The logo band is the top ~16% of that and
     the halftone wave the bottom ~45%.                            */
  --band-top:    clamp(46px, 11vw, 132px);
  --band-bottom: clamp(90px, 30vw, 360px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
}

/* ------------------------------------------------------------
   THE PLATE
   ------------------------------------------------------------
   One 3:2 image can't fill a tall phone screen: `cover` crops the
   logos away, `contain` shrinks it to a strip. So bg.png is drawn
   twice and each copy is cropped by its container to just the part
   that matters — logos pinned to the top edge, wave pinned to the
   bottom edge. The flat field (--paper) covers everything between,
   and the joins are invisible because that field is a solid
   #dbdbdb right across the plate.
*/
.plate {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: var(--paper);
  pointer-events: none;
}

.plate-top,
.plate-bottom {
  position: absolute;
  left: 0;
  right: 0;
  background-image: url('bg.png');
  background-repeat: no-repeat;
  /* full width, natural height -> logos and wave keep their shape */
  background-size: 100% auto;
}

.plate-top {
  top: 0;
  height: var(--band-top);
  background-position: center top;
}

.plate-bottom {
  bottom: 0;
  height: var(--band-bottom);
  background-position: center bottom;
}

/* ------------------------------------------------------------
   page shell — content is centred between the two strips
   ------------------------------------------------------------ */
.page {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  /* never let content sit on top of the logos or the wave */
  padding: calc(var(--band-top) + 8px) 12px calc(var(--band-bottom) * .45 + 8px);
  overflow: hidden;
}

.stack {
  width: 100%;
  max-width: 1200px;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2.4vh, 30px);
  animation: fadeUp .6s ease both;
}

/* the welcome lockup — always scales to whatever room is left */
.welcome-note {
  display: block;
  width: auto;
  max-width: min(88%, 620px);
  max-height: 42vh;
  height: auto;
  object-fit: contain;
  flex: 0 1 auto;
  min-height: 0;
}

.welcome-note-sm { max-height: 26vh; max-width: min(72%, 460px); }

/* ============================================================
   PAGE 1 — continue
   ============================================================ */
.btn-continue {
  flex: none;
  font-family: inherit;
  font-size: clamp(15px, 2.2vw, 21px);
  font-weight: 600;
  letter-spacing: .5px;
  padding: clamp(12px, 1.6vh, 16px) clamp(38px, 9vw, 60px);
  border: none;
  border-radius: 40px;
  background: var(--red);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(239,65,54,.3);
  transition: transform .12s ease, background .2s ease;
}

.btn-continue:hover  { background: #ff5449; }
.btn-continue:active { transform: scale(.96); }

/* ============================================================
   PAGE 2 — three image buttons
   ============================================================ */
.instruction {
  flex: none;
  margin: 0;
  color: var(--muted);
  font-size: clamp(11px, 1.7vw, 16px);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.btn-row {
  width: 100%;
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  gap: clamp(4px, 1.5vw, 20px);
  flex: 0 1 auto;
  min-height: 0;
}

.btn-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1 1 0;
  min-width: 0;
}

/* the button IS the supplied artwork */
.press-btn {
  width: 100%;
  max-width: 290px;
  padding: 0;
  border: 3px solid transparent;
  border-radius: 16px;
  background: none;
  overflow: hidden;
  cursor: pointer;
  display: block;
  transition: transform .12s ease, border-color .2s ease;
}

.press-btn img {
  width: 100%;
  height: auto;
  display: block;
  transition: filter .2s ease;
}

/* simple press — just push in */
.press-btn:active:not(:disabled) { transform: scale(.95); }
.press-btn:disabled { cursor: default; }

.press-btn.is-pressed {
  border-color: var(--red);
  transform: scale(.97);
}

.press-btn.is-pressed img { filter: brightness(1.08) saturate(1.25); }

.status {
  font-size: clamp(9px, 1.4vw, 13px);
  letter-spacing: 1.5px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

.status.on { color: var(--red); }

.btn-reset {
  flex: none;
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 1px;
  padding: 8px 26px;
  border: 1px solid rgba(0,0,0,.25);
  border-radius: 30px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.btn-reset:hover { color: var(--ink); border-color: var(--ink); }

/* ============================================================
   CINEMATIC COUNTDOWN
   ============================================================ */
.countdown {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  animation: cdIn .5s ease both;
}

@keyframes cdIn { from { opacity: 0; } to { opacity: 1; } }

/* the plate, pushed right out of focus — cropping is irrelevant
   here because it is blurred beyond recognition anyway          */
.cd-bg {
  position: absolute;
  inset: -40px;
  background: url('bg.png') center center / cover no-repeat var(--paper);
  filter: blur(18px) saturate(1.1) brightness(.55);
  transform: scale(1.06);
  animation: slowPush 6s linear both;
}

@keyframes slowPush {
  from { transform: scale(1.06); }
  to   { transform: scale(1.16); }
}

.cd-scrim {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(0,0,0,.18) 0%, rgba(0,0,0,.86) 72%),
    rgba(10,10,14,.35);
}

/* letterbox bars — the cinematic tell */
.bar {
  position: absolute;
  left: 0;
  right: 0;
  height: 9vh;
  background: #000;
  z-index: 3;
}

.bar-top    { top: 0;    animation: barTop .7s cubic-bezier(.2,.8,.2,1) both; }
.bar-bottom { bottom: 0; animation: barBot .7s cubic-bezier(.2,.8,.2,1) both; }

@keyframes barTop { from { transform: translateY(-100%); } to { transform: none; } }
@keyframes barBot { from { transform: translateY(100%);  } to { transform: none; } }

.cd-stage {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* the sweeping ring — starts at 12 o'clock, travels clockwise,
   closing the full circle in exactly one second                */
.cd-arc {
  position: absolute;
  width: min(42vw, 42vh, 420px);
  height: min(42vw, 42vh, 420px);
  /* -90deg puts the start of the stroke at the top of the circle */
  transform: rotate(-90deg);
  overflow: visible;
}

.arc-track,
.arc-fill {
  fill: none;
  stroke-linecap: round;
}

.arc-track {
  stroke: rgba(255,255,255,.14);
  stroke-width: 2;
}

.arc-fill {
  stroke: #fff;
  stroke-width: 3;
  /* the circle declares pathLength="100", so the stroke can be
     driven in plain percent and always closes exactly           */
  stroke-dasharray: 100;
  filter: drop-shadow(0 0 10px rgba(255,255,255,.65));
  animation: arcSweep 1s linear both, arcFade 1s ease-out both;
}

@keyframes arcSweep {
  from { stroke-dashoffset: 100; }   /* nothing drawn */
  to   { stroke-dashoffset: 0; }     /* full circle    */
}

@keyframes arcFade {
  0%   { opacity: 0; }
  12%  { opacity: 1; }
  88%  { opacity: 1; }
  100% { opacity: 0; }
}

/* the number: rushes in huge and blurred, locks, then recedes */
.cd-num {
  font-size: min(28vw, 30vh, 300px);
  font-weight: 200;
  line-height: 1;
  color: #fff;
  letter-spacing: -4px;
  text-shadow: 0 0 60px rgba(255,255,255,.35);
  animation: cdNum 1s cubic-bezier(.15,.85,.25,1) both;
}

@keyframes cdNum {
  0%   { opacity: 0; transform: scale(2.6); filter: blur(22px); letter-spacing: 40px; }
  22%  { opacity: 1; transform: scale(1);   filter: blur(0);    letter-spacing: -4px; }
  70%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(.86); filter: blur(6px); }
}

/* ============================================================
   FINALE — Living Just Right
   ============================================================ */
.finale {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--band-top) + 8px) 16px calc(var(--band-bottom) * .45 + 8px);
  text-align: center;
  overflow: hidden;
}

/* one quick white bloom as the lights come up */
.flash {
  position: absolute;
  inset: 0;
  background: #fff;
  pointer-events: none;
  animation: flashOut 1.1s ease-out both;
}

@keyframes flashOut {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

.finale-text {
  position: relative;
  z-index: 2;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.05;
  /* the script has long descenders and an italic overhang — give
     the block room so nothing meets an edge                      */
  padding: .1em .12em .16em;
  max-width: 100%;
}

.fin-living {
  font-size: min(9vw, 9vh, 92px);
  font-weight: 400;
  color: var(--ink);
  letter-spacing: .5px;
  animation: fadeUp .9s ease both;
}

/* the script red, with a slow shine sweeping across it */
.fin-just {
  font-family: "Segoe Script", "Brush Script MT", "Snell Roundhand", cursive;
  /* "Just Right" measures ~5.8em wide plus .48em of padding, so the
     scale is capped where that still fits a narrow screen on ONE
     line — it must never break into two                          */
  font-size: min(13.5vw, 16vh, 168px);
  white-space: nowrap;
  font-weight: 700;
  font-style: italic;
  /* background-clip:text only paints inside the element's own box,
     so the box has to be tall and wide enough to hold the whole
     glyph — the J tail and the g descender live well below the
     baseline, and the italic lean pushes past the right edge.
     A tight line-height was slicing them off.                    */
  line-height: 1.34;
  /* measured: at this size the ink runs 28px below the baseline and
     leans ~21px past the advance width, so the box needs real
     padding on the bottom and both sides or the tails get sliced */
  padding: 0 .24em .24em;
  margin-top: -.12em;
  background: linear-gradient(
    100deg,
    var(--red) 0%,
    var(--red) 42%,
    #ffd2cd  50%,
    var(--red) 58%,
    var(--red) 100%
  );
  background-size: 260% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: fadeUp 1s ease .18s both, shine 3.6s ease-in-out 1s infinite;
}

@keyframes shine {
  0%   { background-position: 160% 0; }
  100% { background-position: -60% 0; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: none; }
}

/* ============================================================
   RESPONSIVE TWEAKS
   ============================================================ */

/* short and wide (tablet / laptop in landscape): the strips are
   sized off viewport WIDTH, so cap them against height too      */
@media (orientation: landscape) {
  :root {
    --band-top:    clamp(40px, 9vw, 110px);
    --band-bottom: clamp(70px, 22vw, 300px);
  }
  .welcome-note    { max-height: 34vh; }
  .welcome-note-sm { max-height: 22vh; }
}

/* narrow phones — buttons still in one row, just tighter */
@media (max-width: 560px) {
  .status { letter-spacing: .5px; font-size: 9px; }
  .bar { height: 7vh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
