/*
  画面：WebGL の canvas が奥にあり、その上に、ごく少ない文字を置く。
  主役は縦組みの明朝。ほかは四隅に小さく。
*/
@font-face { font-family: "Shippori Mincho B1"; src: url("/fonts/shippori-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Shippori Mincho B1"; src: url("/fonts/shippori-800.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("/fonts/garamond-400.woff2") format("woff2"); font-weight: 400 500; font-display: swap; }

:root {
  --mincho: "Shippori Mincho B1", "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
  --latin: "EB Garamond", Georgia, serif;

  --kinari: #f4eee0;
  --sumi: #1d1b19;
  --shu: #cf3a22;
  --ink: var(--sumi);
  --pad: clamp(22px, 3.4vw, 48px);

  /* 札在画面里的位置和大小，和 scene.js 的 frame() 对应 */
  --sign-x: 50%;
  --sign-half: 7.4svh;
}
:root[data-tone="night"] { --ink: #e9e4d8; }

* { box-sizing: border-box; }
html { background: #16161c; }
body {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--mincho);
  font-weight: 500;
  font-size: 12.5px;
  line-height: 1.8;
  letter-spacing: 0.16em;
  -webkit-font-smoothing: antialiased;
}
p, h1 { margin: 0; font-weight: inherit; }
button { font: inherit; letter-spacing: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-y; outline: none; }

/* 文字の層。canvas の操作を邪魔しないよう、ボタン以外は素通しにする */
.ui { position: fixed; inset: 0; pointer-events: none; transition: color 1.4s ease; }
.ui button { pointer-events: auto; }
[data-view="inside"] #door { display: none; }

.ui > * { transition: opacity 1.4s ease; }
html:not(.ready) #door > * { opacity: 0; }

/* ---------- 四隅の小さな文字 ---------- */
.koyomi { position: absolute; top: var(--pad); left: var(--pad); opacity: 0.7; }
.info { position: absolute; left: var(--pad); bottom: var(--pad); font-variant-numeric: tabular-nums; }
.credit { margin-top: 4px; font-family: var(--latin); font-size: 10.5px; letter-spacing: 0.06em; opacity: 0.4; }
.next { position: absolute; right: var(--pad); bottom: var(--pad); text-align: right; font-variant-numeric: tabular-nums; }
#count { font-size: 14px; }
#zone { font-size: 10.5px; opacity: 0.55; }
#zone:empty { display: none; }

/* ---------- 主文：縦組み ---------- */
.copy {
  position: absolute;
  top: 22svh;
  left: calc(var(--sign-x) + var(--sign-half) + 6svh);
  max-height: 56svh;
  writing-mode: vertical-rl;
}
.copy h1 {
  font-size: clamp(24px, 4.3svh, 44px);
  line-height: 1.62;
  letter-spacing: 0.2em;
}
.copy h1 span { display: block; white-space: nowrap; animation: unroll 1.1s cubic-bezier(.2,.7,.2,1) both; }
.copy h1 span:nth-child(2) { animation-delay: 0.14s; }
@keyframes unroll { from { clip-path: inset(0 0 100% 0); opacity: 0.2; } to { clip-path: inset(0 0 -10% 0); } }

/* ---------- 入店の判子 ---------- */
.seal {
  position: absolute;
  top: 65svh;
  left: calc(var(--sign-x) + var(--sign-half) + 4.6svh);
  width: clamp(64px, 9.6svh, 88px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--shu);
  color: #f6f0e2;
  box-shadow: inset 0 0 0 2px var(--shu), inset 0 0 0 3.5px rgb(246 240 226 / 0.85), 0 10px 24px -12px rgb(110 25 8 / 0.75);
  transform: rotate(-6deg);
  transition: transform 0.35s cubic-bezier(.2,.8,.2,1), opacity 1.4s ease;
}
.seal span {
  writing-mode: vertical-rl;
  font-weight: 800;
  font-size: clamp(17px, 2.7svh, 24px);
  line-height: 1;
  letter-spacing: 0.12em;
  margin-top: 0.12em;
}
.seal:hover { transform: rotate(0deg) scale(1.06); }
.seal:active { transform: rotate(0deg) scale(0.96); }
.seal:focus-visible, .leave:focus-visible, .sr:focus-visible, .flat:focus-visible { outline: 2px solid var(--shu); outline-offset: 5px; }

.sr { position: absolute; top: 40svh; left: var(--sign-x); width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); border: 0; padding: 0; }
.sr:focus-visible { clip-path: none; width: auto; height: auto; padding: 4px 10px; background: var(--kinari); color: var(--sumi); transform: translateX(-50%); }

/* ---------- 店内 ---------- */
#inside { color: #f1ece0; }
/* 四周压暗一点，像一张照片 */
#inside::before { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 90% at 60% 55%, transparent 40%, rgb(8 7 6 / 0.5)); transition: opacity 1.4s ease; }
.leave { position: absolute; top: calc(var(--pad) - 6px); left: var(--pad); padding: 6px 0; border: 0; background: none; opacity: 0.75; }
.leave:hover { opacity: 1; }
.closing { position: absolute; right: var(--pad); bottom: var(--pad); opacity: 0.6; font-variant-numeric: tabular-nums; }
.closing.soon { opacity: 1; }
#inside .copy { left: max(var(--pad), 9vw); top: 20svh; }
#inside .copy h1 { font-size: clamp(22px, 3.6svh, 36px); }
.stay { position: absolute; left: var(--pad); bottom: var(--pad); opacity: 0.6; font-variant-numeric: tabular-nums; }

.kick {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  writing-mode: vertical-rl;
  font-size: clamp(22px, 3.6svh, 34px);
  letter-spacing: 0.3em;
  opacity: 0;
}
.kick span { display: block; }
#inside.off > :not(.kick) { opacity: 0; }
#inside.off .kick { opacity: 1; transition-delay: 1.8s; }

.veil { position: fixed; inset: 0; z-index: 50; pointer-events: none; }

/* ---------- WebGL が無いとき ---------- */
.flat { display: none; }
.no-gl body { background: color-mix(in oklab, #e7e1d3, #16161c calc(var(--dark, 1) * 100%)); }
.no-gl #gl { display: none; }
.no-gl .flat {
  display: grid;
  place-items: center;
  position: absolute;
  top: 26svh;
  left: var(--sign-x);
  width: calc(var(--sign-half) * 2);
  height: 38svh;
  transform: translateX(-50%);
  border: 0;
  border-radius: 6px;
  background: var(--kinari);
  color: var(--sumi);
  box-shadow: inset 0 0 0 5px var(--kinari), inset 0 0 0 6px var(--sumi), 0 18px 30px -14px rgb(0 0 0 / 0.5);
  writing-mode: vertical-rl;
  font-weight: 800;
  font-size: 5.4svh;
  letter-spacing: 0.14em;
}
.no-gl .flat.open { background: var(--shu); color: #f6f0e2; box-shadow: inset 0 0 0 5px var(--shu), inset 0 0 0 6px #f6f0e2, 0 18px 30px -14px rgb(0 0 0 / 0.5); }
.no-gl #inside { background: #2a2622; }

.noscript { position: fixed; inset: auto 0 0; z-index: 60; padding: 14px 24px; background: #101117; color: #e9e4d8; text-align: center; }

/* ---------- 縦長の画面（スマートフォン） ---------- */
@media (max-aspect-ratio: 85 / 100) {
  :root { --sign-x: 38%; --sign-half: 6.25svh; --pad: 22px; }
  body { font-size: 11.5px; }
  .copy { top: 22svh; left: calc(var(--sign-x) + var(--sign-half) + 4svh); max-height: 46svh; }
  .copy h1 { font-size: clamp(21px, 3.3svh, 30px); letter-spacing: 0.16em; }
  #count { font-size: 12.5px; }
  .seal { top: auto; left: auto; right: var(--pad); bottom: calc(var(--pad) + 56px); }
  #inside .copy { left: 26px; top: 16svh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0.01s !important; }
}
