/* Boot splash + opening title card (web/js/ui/BootSplash.js). Logical 1920x1080 stage units. */

.boot-splash {
  position: absolute; inset: 0; z-index: 100; overflow: hidden;
  background: #15110D; color: #EFE6D6;
  transition: opacity 0.9s ease;
}
.boot-splash.hidden { opacity: 0; pointer-events: none; }

/* ---- Backdrop: blurred archival photo with slow pan, crossfaded between two layers ---- */
.boot-bg { position: absolute; inset: -40px; }
.boot-bg-img {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  filter: grayscale(1) sepia(0.55) blur(14px) brightness(0.42) contrast(1.1);
  opacity: 0; transition: opacity 1.6s ease;
  will-change: transform, opacity;
}
.boot-bg-img.is-front { opacity: 1; }
.boot-bg-img.pan-a { animation: boot-pan-a 9s ease-out forwards; }
.boot-bg-img.pan-b { animation: boot-pan-b 9s ease-out forwards; }
@keyframes boot-pan-a { from { transform: scale(1.08) translate(-1.5%, 0); } to { transform: scale(1.18) translate(1.5%, -1%); } }
@keyframes boot-pan-b { from { transform: scale(1.18) translate(1.5%, 1%); } to { transform: scale(1.08) translate(-1.5%, 0); } }

.boot-vignette {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(0, 0, 0, 0) 35%, rgba(0, 0, 0, 0.72) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0) 22%, rgba(0, 0, 0, 0) 70%, rgba(0, 0, 0, 0.55));
}
.boot-grain {
  position: absolute; inset: -50%; pointer-events: none; opacity: 0.13; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: boot-grain 0.9s steps(4) infinite;
}
@keyframes boot-grain {
  0% { transform: translate(0, 0); } 25% { transform: translate(-3%, 2%); }
  50% { transform: translate(2%, -3%); } 75% { transform: translate(-2%, -1%); } 100% { transform: translate(0, 0); }
}

/* ---- Foreground layout: framed print (left) + title card (right) ---- */
.boot-layout {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 88px;
  padding: 0 120px; animation: boot-rise 1.1s ease-out both;
}
@keyframes boot-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.boot-print { margin: 0; width: 640px; flex: 0 0 auto; transform: rotate(-1.6deg); transition: opacity 0.45s ease; }
.boot-print.swapping { opacity: 0; }
.boot-print-frame {
  position: relative; padding: 18px 18px 18px; background: #EFE6D3;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.55), 0 2px 0 rgba(255, 255, 255, 0.4) inset;
}
.boot-print-frame::before { /* tape strip */
  content: ""; position: absolute; top: -14px; left: 50%; width: 140px; height: 30px; margin-left: -70px;
  background: rgba(226, 212, 178, 0.82); transform: rotate(2deg); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}
.boot-print-img {
  display: block; width: 604px; height: 400px; object-fit: cover; background: #2a241d;
  filter: grayscale(0.85) sepia(0.35) contrast(1.06);
}
.boot-print-year {
  position: absolute; right: 30px; bottom: 28px; padding: 2px 12px;
  font: 700 30px/1.2 var(--font-title); letter-spacing: 3px; color: #F4EFE6;
  border: 2px solid rgba(244, 239, 230, 0.85); background: rgba(20, 16, 12, 0.35);
}
.boot-print-caption {
  margin-top: 22px; padding: 0 6px; font: 17px/1.75 var(--font-title); color: rgba(239, 230, 214, 0.86);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7); min-height: 90px;
}

.boot-card {
  position: relative; width: 680px; flex: 0 0 auto; padding: 44px 48px 34px;
  background: linear-gradient(180deg, rgba(244, 239, 230, 0.97), rgba(232, 223, 209, 0.97));
  color: var(--ink); border: 1px solid rgba(30, 28, 26, 0.6);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6), 0 0 0 6px rgba(244, 239, 230, 0.08);
}
.boot-card::after { /* inner hairline like an archive folder */
  content: ""; position: absolute; inset: 8px; border: 1px solid rgba(107, 68, 40, 0.28); pointer-events: none;
}
.boot-stamp {
  position: absolute; top: 26px; right: 34px; padding: 4px 12px; transform: rotate(4deg);
  font: 700 15px/1.3 var(--font-title); letter-spacing: 3px; color: rgba(184, 41, 47, 0.82);
  border: 2px solid rgba(184, 41, 47, 0.7); border-radius: 3px;
}
.boot-title { font-family: var(--font-title); font-size: 58px; font-weight: 700; letter-spacing: 6px; line-height: 1.15; }
.boot-sub { margin-top: 10px; font-size: 17px; color: var(--muted); letter-spacing: 1px; }
.boot-rule {
  margin: 26px 0 22px; height: 7px;
  border-top: 2px solid rgba(30, 28, 26, 0.7); border-bottom: 1px solid rgba(30, 28, 26, 0.45);
}

.boot-tip { min-height: 108px; transition: opacity 0.4s ease; }
.boot-tip.swapping { opacity: 0; }
.boot-tip-label { font: 700 14px/1 var(--font-title); letter-spacing: 4px; color: var(--blue); }
.boot-tip p { margin: 10px 0 0; font: 17px/1.8 var(--font-title); color: #3a332c; }

.boot-progress { margin-top: 22px; }
.boot-progress-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 8px; }
.boot-status { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.boot-progress-pct { font: 600 14px/1 var(--font-mono); color: var(--ink); }
.boot-progress-track {
  position: relative; height: 6px; background: rgba(30, 28, 26, 0.12); border: 1px solid rgba(30, 28, 26, 0.35); overflow: hidden;
}
.boot-progress-bar {
  position: relative; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--blue), var(--amber));
}
.boot-progress-bar::after { /* moving sheen so the bar feels alive during slow phases */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.55) 50%, rgba(255, 255, 255, 0) 100%);
  background-size: 120px 100%; background-repeat: no-repeat;
  animation: boot-sheen 1.6s linear infinite;
}
@keyframes boot-sheen { from { background-position: -120px 0; } to { background-position: calc(100% + 120px) 0; } }

.boot-start {
  margin-top: 22px; height: 0; overflow: hidden; opacity: 0; text-align: center;
  font: 700 22px/1.4 var(--font-title); letter-spacing: 4px; color: var(--ink);
  transition: opacity 0.6s ease, height 0.4s ease;
}
.boot-splash.is-ready { cursor: pointer; }
.boot-splash.is-ready .boot-start { height: 32px; opacity: 1; animation: boot-breathe 2.2s ease-in-out 0.6s infinite; }
.boot-splash.is-ready .boot-progress-bar::after { animation: none; }
@keyframes boot-breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.38; } }

.boot-hint { margin: 16px 0 0; font-size: 12px; color: var(--muted); }
.boot-splash.is-ready .boot-hint { display: none; }

/* Raw log: hidden for players; shown on error or with the ` / ~ key. */
#boot-log {
  display: none; margin: 14px 0 0; padding: 8px 10px; font: 12px/1.55 var(--font-mono);
  white-space: pre-wrap; word-break: break-all; max-height: 160px; overflow-y: auto;
  background: rgba(30, 28, 26, 0.05); border: 1px solid rgba(30, 28, 26, 0.2);
}
.boot-splash.show-log #boot-log { display: block; }
.boot-splash.has-error { cursor: default; }
.boot-splash.has-error #boot-log {
  max-height: 320px; background: rgba(184, 41, 47, 0.05); border-color: rgba(184, 41, 47, 0.35);
}
.boot-splash.has-error .boot-status { color: var(--red); white-space: normal; }
.boot-splash.has-error .boot-tip, .boot-splash.has-error .boot-hint { display: none; }
.boot-splash.has-error .boot-progress-bar { background: var(--red); }
.boot-splash.has-error .boot-progress-bar::after { animation: none; }
.boot-error-actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.boot-error-actions[hidden] { display: none !important; }

/* ---- Opening title card ---- */
.boot-intro {
  position: absolute; inset: 0; z-index: 110; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  background: #0E0B08; color: #EFE6D6; opacity: 0; transition: opacity 0.7s ease; cursor: pointer;
}
.boot-intro[hidden] { display: none; }
.boot-intro.is-on { opacity: 1; }
.boot-intro.is-out { opacity: 0; transition-duration: 0.9s; pointer-events: none; }
.boot-intro > div { opacity: 0; transform: translateY(8px); }
.boot-intro.is-on > div { animation: boot-intro-in 1s ease-out forwards; }
.boot-intro.is-on .boot-intro-place { animation-delay: 0.45s; }
.boot-intro.is-on .boot-intro-line { animation-delay: 1.1s; }
@keyframes boot-intro-in { to { opacity: 1; transform: none; } }
.boot-intro-date { font: 700 64px/1.2 var(--font-title); letter-spacing: 10px; }
.boot-intro-place { margin-top: 14px; font: 26px/1.4 var(--font-title); letter-spacing: 14px; color: #C9B48E; }
.boot-intro-line { margin-top: 44px; font: 20px/1.9 var(--font-title); color: rgba(239, 230, 214, 0.75); letter-spacing: 2px; }

/* ---- Narrow / portrait screens: the stage is unscaled, so pin to the viewport and stack ---- */
html.layout-compact .boot-splash, html.layout-compact .boot-intro { position: fixed; }
html.layout-compact .boot-layout {
  flex-direction: column; justify-content: flex-start; gap: 24px; padding: 28px 16px; overflow-y: auto;
}
html.layout-compact .boot-print { width: min(92vw, 520px); transform: none; order: 2; }
html.layout-compact .boot-print-img { width: 100%; height: auto; aspect-ratio: 3 / 2; }
html.layout-compact .boot-print-caption { font-size: 14px; min-height: 0; }
html.layout-compact .boot-card { width: min(92vw, 560px); padding: 28px 22px 22px; order: 1; }
html.layout-compact .boot-title { font-size: 36px; letter-spacing: 3px; }
html.layout-compact .boot-start { font-size: 17px; letter-spacing: 2px; }
html.layout-compact .boot-splash.is-ready .boot-start { height: auto; }
html.layout-compact .boot-stamp { position: static; display: inline-block; margin-bottom: 12px; transform: rotate(-2deg); }
html.layout-compact .boot-intro-date { font-size: 34px; letter-spacing: 4px; }
html.layout-compact .boot-intro-place { font-size: 18px; letter-spacing: 8px; }
html.layout-compact .boot-intro-line { font-size: 15px; padding: 0 20px; }

@media (prefers-reduced-motion: reduce) {
  .boot-bg-img.pan-a, .boot-bg-img.pan-b, .boot-grain, .boot-progress-bar::after,
  .boot-splash.is-ready .boot-start { animation: none; }
}
