/* Poster Showcase - glass UI, Pertamina-inspired palette. No hover-dependent UI. */
:root {
  --red: #ED1C24;
  --white: #FFFFFF;
  --yellow: #FFD500;
  --blue: #0054A6;
  --navy: #031a40;
  --tap: 88px;
  --pad: 14px; /* card padding around poster (mirrored in app.js) */
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  overflow: hidden; background: var(--navy); color: var(--white);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* touch-native: no selection, no callouts, no tap flash */
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; border: 0; margin: 0; padding: 0; background: none; cursor: pointer;
  touch-action: manipulation; -webkit-appearance: none; appearance: none; }

.app {
  position: fixed; top: 0; left: 0; width: 100%;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; overflow: hidden;
  padding: 16px 20px 16px; /* outer breathing room */
  background: linear-gradient(160deg, #031a40 0%, #052a63 55%, #003a80 100%);
}

/* ---------- Background glow ---------- */
.bg { position: absolute; top: 0; left: 0; right: 0; bottom: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; will-change: transform; }
.blob-red {
  width: 70vmax; height: 70vmax; left: -22vmax; top: -26vmax;
  background: radial-gradient(circle at center, rgba(237,28,36,.65) 0%, rgba(237,28,36,.28) 40%, rgba(237,28,36,0) 70%);
  animation: driftA 38s ease-in-out infinite alternate;
}
.blob-yellow {
  width: 60vmax; height: 60vmax; right: -20vmax; bottom: -24vmax;
  background: radial-gradient(circle at center, rgba(255,213,0,.5) 0%, rgba(255,213,0,.2) 40%, rgba(255,213,0,0) 70%);
  animation: driftB 46s ease-in-out infinite alternate;
}
.blob-blue {
  width: 55vmax; height: 55vmax; right: -10vmax; top: -22vmax;
  background: radial-gradient(circle at center, rgba(0,120,230,.55) 0%, rgba(0,84,166,.25) 45%, rgba(0,84,166,0) 70%);
  animation: driftC 52s ease-in-out infinite alternate;
}
@keyframes driftA { from { transform: translate3d(0,0,0) scale(1); }   to { transform: translate3d(9vmax,7vmax,0) scale(1.15); } }
@keyframes driftB { from { transform: translate3d(0,0,0) scale(1.1); } to { transform: translate3d(-10vmax,-6vmax,0) scale(.95); } }
@keyframes driftC { from { transform: translate3d(0,0,0) scale(1); }   to { transform: translate3d(-8vmax,9vmax,0) scale(1.2); } }

/* ---------- Glass surface ---------- */
.glass {
  position: relative; z-index: 1;
  /* solid-ish fallback when backdrop-filter is unsupported */
  background: rgba(8, 40, 100, .72);
  border: 1px solid rgba(255,255,255,.22);
  box-shadow: 0 10px 40px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.25);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .glass {
    background: rgba(255,255,255,.11);
    -webkit-backdrop-filter: blur(22px) saturate(1.5);
    backdrop-filter: blur(22px) saturate(1.5);
  }
}

/* ---------- Header ---------- */
.header {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  min-height: var(--tap); padding: 8px 32px; border-radius: 28px; overflow: hidden;
}
.brand { display: flex; align-items: center; min-width: 0; flex: 1 1 auto; }
.brand-text { min-width: 0; }
.mark { display: flex; flex-direction: column; width: 14px; height: 52px; border-radius: 7px; overflow: hidden; margin-right: 18px; flex: 0 0 auto; }
.mark i { flex: 1; display: block; }
.mark i:nth-child(1) { background: var(--red); }
.mark i:nth-child(2) { background: var(--yellow); }
.mark i:nth-child(3) { background: #1f86e6; }
h1 { margin: 0; font-size: 40px; line-height: 1.1; font-weight: 800; letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { margin: 4px 0 0; font-size: 20px; opacity: .78; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.counter { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1; margin-left: 20px; }
.c-cur { font-size: 64px; color: var(--yellow); text-shadow: 0 2px 18px rgba(255,213,0,.35); }
.c-sep { font-size: 40px; margin: 0 12px; opacity: .55; }
.c-tot { font-size: 40px; opacity: .8; }

.progress { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: rgba(255,255,255,.14); }
.progress-bar {
  height: 100%; width: 100%; transform-origin: 0 50%; transform: scaleX(.03);
  background: linear-gradient(90deg, var(--red) 0%, var(--yellow) 50%, #1f86e6 100%);
  transition: transform .45s cubic-bezier(.22,.8,.3,1);
}

/* ---------- Stage ---------- */
.stage-row { position: relative; z-index: 1; flex: 1 1 auto; min-height: 0; display: flex; align-items: center; padding: 14px 0; }
.stage { position: relative; flex: 1 1 auto; align-self: stretch; min-width: 0; touch-action: pan-y; }

.chev {
  flex: 0 0 auto; width: 120px; height: 120px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--white); margin: 0 20px;
  transition: transform .15s ease, background-color .15s ease;
}
.chev:active { transform: scale(.92); background-color: rgba(255,213,0,.35); }

/* Poster card (a slide) - sized in px by app.js */
.slide {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0; margin: auto;
  padding: var(--pad); border-radius: 26px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.35);
  box-shadow: 0 24px 70px rgba(0,0,0,.45), 0 4px 14px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.4);
  transition: transform .5s cubic-bezier(.22,.8,.3,1), opacity .4s ease;
  will-change: transform, opacity;
}
.slide canvas { display: block; width: 100%; height: 100%; border-radius: 12px; background: #fff; }
.slide.enter-next { transform: translate3d(12%,0,0) scale(.96); opacity: 0; }
.slide.enter-prev { transform: translate3d(-12%,0,0) scale(.96); opacity: 0; }
.slide.enter-none { opacity: 0; }
.slide.leave-next { transform: translate3d(-12%,0,0) scale(.96); opacity: 0; }
.slide.leave-prev { transform: translate3d(12%,0,0) scale(.96); opacity: 0; }
.slide.leave-none { opacity: 0; }

/* Loading + error overlays */
.loading, .error {
  position: absolute; left: 50%; top: 50%; z-index: 5;
  -webkit-transform: translate(-50%,-50%); transform: translate(-50%,-50%);
  display: none; align-items: center; padding: 18px 30px; border-radius: 999px;
  background: rgba(3,26,64,.82); border: 1px solid rgba(255,255,255,.3);
  font-size: 26px; font-weight: 600; white-space: nowrap;
}
.loading.on { display: flex; }
.error.on { display: flex; flex-direction: column; border-radius: 28px; text-align: center; }
.error p { margin: 0 0 14px; }
.spinner {
  width: 34px; height: 34px; margin-right: 16px; border-radius: 50%;
  border: 5px solid rgba(255,255,255,.25); border-top-color: var(--yellow);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.retry { min-width: var(--tap); min-height: var(--tap); padding: 0 36px; border-radius: 44px; background: var(--red); font-size: 26px; font-weight: 700; }

/* ---------- Bottom rail ---------- */
.rail { flex: 0 0 auto; border-radius: 28px; padding: 10px 12px; overflow: hidden; }
.pills {
  display: flex; align-items: center; overflow-x: auto; overflow-y: hidden; white-space: nowrap;
  -webkit-overflow-scrolling: touch; touch-action: pan-x; scrollbar-width: none; -ms-overflow-style: none;
  padding: 8px 6px;
}
.pills::-webkit-scrollbar { display: none; width: 0; height: 0; }
.pill {
  flex: 0 0 auto; min-width: var(--tap); height: var(--tap); margin: 0 6px; padding: 0 12px;
  border-radius: 24px; font-size: 32px; font-weight: 800; font-variant-numeric: tabular-nums;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.28); color: var(--white);
  transition: transform .15s ease, background-color .2s ease;
}
.pill:active { transform: scale(.94); }
.pill.active {
  background: linear-gradient(180deg, #ffe44d 0%, var(--yellow) 100%);
  color: #3a0407; border-color: var(--red); border-bottom: 6px solid var(--red);
  box-shadow: 0 6px 22px rgba(255,213,0,.45);
}

/* ---------- Focus rings (D-pad / keyboard). Always on for old TV browsers. ---------- */
button:focus { outline: 5px solid var(--white); outline-offset: 4px; box-shadow: 0 0 0 10px rgba(237,28,36,.75); }
button:focus:not(:focus-visible) { outline: none; box-shadow: none; }
.glass.chev:focus { box-shadow: 0 0 0 10px rgba(237,28,36,.75), 0 10px 40px rgba(0,0,0,.28); }
.glass.chev:focus:not(:focus-visible) { box-shadow: 0 10px 40px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.25); }
.pill.active:focus { box-shadow: 0 0 0 10px rgba(237,28,36,.75); }
.pill.active:focus:not(:focus-visible) { box-shadow: 0 6px 22px rgba(255,213,0,.45); }

/* ---------- Narrow / portrait: chevrons float at bottom of stage ---------- */
@media (max-aspect-ratio: 1/1), (max-width: 700px) {
  .app { padding: 10px 12px; }
  .header { padding: 8px 20px; border-radius: 24px; }
  h1 { font-size: 28px; }
  .sub { display: none; }
  .mark { height: 44px; margin-right: 14px; }
  .c-cur { font-size: 52px; }
  .c-sep, .c-tot { font-size: 30px; }
  .c-sep { margin: 0 8px; }
  .stage-row { display: block; padding: 10px 0 112px; }
  .stage { position: absolute; top: 10px; left: 0; right: 0; bottom: 112px; }
  .chev { position: absolute; bottom: 10px; margin: 0; width: var(--tap); height: var(--tap); }
  .chev svg { width: 46px; height: 46px; }
  .chev-prev { left: 12px; }
  .chev-next { right: 12px; }
}
@media (max-width: 700px) {
  h1 { font-size: 21px; }
  .header { padding: 8px 16px; }
  .mark { margin-right: 10px; width: 10px; }
  .counter { margin-left: 10px; }
  .c-cur { font-size: 40px; }
  .c-sep, .c-tot { font-size: 24px; }
  .pill { min-width: 64px; height: 64px; font-size: 26px; border-radius: 18px; }
  .rail { padding: 6px 8px; border-radius: 22px; }
  .loading, .error { font-size: 22px; }
}
/* Short landscape screens (phone sideways): slim everything */
@media (max-height: 560px) and (min-aspect-ratio: 1/1) {
  .app { padding: 8px 12px; }
  .header { min-height: 64px; padding: 4px 22px; }
  h1 { font-size: 26px; }
  .sub { display: none; }
  .mark { height: 36px; }
  .c-cur { font-size: 40px; }
  .c-sep, .c-tot { font-size: 26px; }
  .chev { width: 88px; height: 88px; margin: 0 8px; }
  .pill { min-width: 56px; height: 56px; font-size: 24px; border-radius: 16px; }
  .pills { padding: 4px; }
  .rail { padding: 2px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .blob { animation: none; }
  .slide { transition: opacity .2s ease; }
  .slide.enter-next, .slide.enter-prev, .slide.leave-next, .slide.leave-prev { transform: none; }
  .progress-bar, .chev, .pill { transition: none; }
  .spinner { animation-duration: 2s; }
}
