/* Browser-owned PWA splash icons are intentionally unchanged. */
:root {
  /* One image box for every loading surface. Intrinsic transparent margins stay
     identical because every surface uses the same unmodified 640px original. */
  --ttori-loader-size:min(240px,44vw,34svh);
  --ttori-loader-logo-width:calc(var(--ttori-loader-size) * .88);
  --ttori-loader-logo-height:calc(var(--ttori-loader-logo-width) * 270 / 768);
  --ttori-loader-gap:8px;
  --ttori-loader-stack-height:calc(var(--ttori-loader-size) + var(--ttori-loader-gap) + var(--ttori-loader-logo-height));
}
html[data-ttori-loading="true"] { background:#fbf8f1; }
html[data-ttori-loading="true"] body { visibility:hidden; }
html[data-ttori-loading="true"]::before {
  content:"화면을 준비하고 있어요."; position:fixed; inset:0; z-index:2147483000;
  display:grid; place-items:center; background:#fbf8f1; pointer-events:auto;
  color:#174d41; font:400 16px/1.6 'Ttobak Home','Noto Sans CJK KR',sans-serif;
}
html[data-ttori-loading="true"]::after {
  content:""; position:fixed; left:50%; top:50%; z-index:2147483001;
  width:var(--ttori-loader-size); height:var(--ttori-loader-stack-height);
  transform:translate(-50%,-50%);
  background:var(--ttori-loading-face,url('./assets/ttori-loading-welcome.webp')) center top/100% auto no-repeat,
    var(--ttori-loading-logo,url('./assets/ttobak-loading-logo.webp')) center bottom/88% auto no-repeat;
  pointer-events:none; visibility:hidden;
}
html[data-ttori-loading="true"][data-ttori-face-ready="true"]::before { content:""; }
html[data-ttori-loading="true"][data-ttori-face-ready="true"]::after { visibility:visible; }
.ttobak-entry-status :is(.ttobak-entry-mascot,.ttobak-entry-logo) { visibility:hidden; }
.ttobak-entry-status[data-artwork-ready="true"] :is(.ttobak-entry-mascot,.ttobak-entry-logo) { visibility:visible; }
.ttobak-entry-status:not([data-artwork-ready="true"]) .ttobak-entry-message {
  position:absolute; left:24px; right:24px; top:50%; width:auto; height:auto;
  margin:0; transform:translateY(-50%); overflow:visible; clip:auto;
  clip-path:none; white-space:normal;
  /* November 25: 로딩 중에는 또리 그림과 로고만 보인다. 그림이 6초 넘게 안 올 때만 이 글자가 뜬다. */
  animation-delay:6s;
}

/* November 7/8: quick page changes show no loading face. The cover stays plain
   cream and the mascot/message fade in only after 1.2s of real waiting. */
@keyframes ttori-loader-late { from { opacity:0; } to { opacity:1; } }
html[data-ttori-loading="true"]::before, html[data-ttori-loading="true"]::after { animation:ttori-loader-late .25s ease-out 1.2s both; }
.ttobak-entry-status :is(.ttobak-entry-mascot,.ttobak-entry-logo,.ttobak-entry-message) { animation:ttori-loader-late .25s ease-out 1.2s both; }
/* November 25: 페이지를 옮길 때의 로딩 화면도 같다. 그림이 준비되기 전에는 글자를 숨기고, 6초 넘게 안 올 때만 띄운다. */
@keyframes ttori-loader-text { from { color:transparent; } to { color:#174d41; } }
html[data-ttori-loading="true"]:not([data-ttori-face-ready="true"])::before { animation:ttori-loader-late .25s ease-out 1.2s both, ttori-loader-text .25s ease-out 6s both; }
@media(prefers-reduced-motion:reduce) { html[data-ttori-loading="true"]::before, html[data-ttori-loading="true"]::after, .ttobak-entry-status :is(.ttobak-entry-mascot,.ttobak-entry-logo,.ttobak-entry-message) { animation-duration:.01s; } }
