/* Japanese Village chrome: washi paper, sumi ink, shu vermilion.
   Quiet by default: the village leads; controls visit when called. */
@font-face {
  font-family: "Zen Kurenaido";
  src: url("/fonts/ZenKurenaido-latin.woff2") format("woff2");
  font-display: swap;
}
:root {
  --washi: #f6f1e2;
  --washi-soft: #efe7d2;
  --sumi: #29241d;
  --sumi-soft: #4a4234;
  --shu: #c73e2c;
  --indigo: #33556b;
  --shadow-ink: rgba(24, 20, 12, 0.32);
  --bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* chrome retire/wake: only engages once chrome.js has set data-chrome */
.tools,
.places {
  transition:
    opacity 0.25s ease,
    transform 0.25s ease,
    visibility 0.25s;
}
body[data-chrome="off"] .tools {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-10px);
}
body[data-chrome="off"] .places {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(10px);
}

/* the chochin lantern: where the controls live when they rest */
.chrome-hint {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 7;
  display: none;
  place-items: center;
  min-width: 52px;
  min-height: 66px;
  padding: 0 14px 8px;
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--sumi);
  filter: drop-shadow(0 2px 2px var(--shadow-ink));
  transform-origin: 50% 0;
}
body[data-chrome="off"] .chrome-hint {
  display: grid;
  
}
.chrome-hint .ink-chochin {
  width: 30px;
  height: 54px;
}
@keyframes hint-sway {
  0%,
  100% {
    transform: translateX(-50%) rotate(-2.6deg);
  }
  50% {
    transform: translateX(-50%) rotate(2.6deg);
  }
}
.chrome-hint:focus-visible {
  outline: 3px solid var(--washi);
  outline-offset: 3px;
}

/* the story card: a washi register that never retires */
.hud {
  background: var(--washi);
  color: var(--sumi);
  border: 2.5px solid var(--sumi);
  border-radius: 16px 24px 14px 22px / 22px 14px 24px 16px;
  box-shadow: 4px 5px 0 var(--shadow-ink);
  backdrop-filter: none;
  max-width: 400px;
  padding: 16px 20px 14px;
}
.hud .eyebrow {
  display: none;
}
.hud b {
  font:
    400 1.05rem/1.2 "Zen Kurenaido",
    Georgia,
    serif;
  color: var(--sumi-soft);
  text-shadow: none;
  letter-spacing: 0.02em;
}
.hud span {
  font:
    400 clamp(1.6rem, 3vw, 2.1rem)/1.15 "Zen Kurenaido",
    Georgia,
    serif;
  color: var(--sumi);
  margin: 6px 0 4px;
}
.hud em {
  font-family: Georgia, serif;
  color: var(--indigo);
  font-size: 15px;
  margin-bottom: 0;
}
.zen .hud {
  opacity: 0.18;
  transform: translateY(-10px);
}

/* tools: hanko-round chips top-right, plus the on-demand meta line */
.tools {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 6;
  display: flex;
  gap: 8px;
  align-items: start;
}
.ink-chip {
  display: grid;
  place-items: center;
  min-width: 46px;
  min-height: 46px;
  padding: 0 10px;
  background: var(--washi);
  color: var(--sumi);
  border: 2.5px solid var(--sumi);
  border-radius: 46% 54% 50% 50% / 52% 48% 54% 46%;
  box-shadow: 3px 4px 0 var(--shadow-ink);
  font:
    600 14px/1.2 Inter,
    system-ui,
    sans-serif;
  cursor: pointer;
  transition:
    transform 0.18s var(--bounce),
    box-shadow 0.18s ease,
    background 0.18s ease;
}
.ink-chip:hover {
  background: var(--washi-soft);
}
.ink-chip:active {
  transform: translate(2.5px, 3.5px);
  box-shadow: 0 1px 0 var(--shadow-ink);
}
.ink-chip[aria-pressed="true"] {
  background: #f3d9ce;
  border-color: var(--shu);
  color: var(--shu);
}
.ink-chip:focus-visible {
  outline: 3px solid var(--washi);
  outline-offset: 3px;
}
.ink-icon {
  width: 23px;
  height: 23px;
}
.meta-line {
  position: fixed;
  top: 78px;
  right: 24px;
  z-index: 6;
  max-width: 300px;
  text-align: right;
  font-size: 14px;
  line-height: 1.5;
  color: var(--washi);
  text-shadow: 0 1px 2px rgba(10, 12, 10, 0.6);
}
body[data-chrome="off"] .meta-line {
  opacity: 0;
  visibility: hidden;
}

/* the ema rail: votive plaques strung on a cord */
.places {
  position: fixed;
  z-index: 5;
  bottom: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 12px;
}
.places::before {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: 0;
  border-top: 3px dotted var(--sumi);
  opacity: 0.7;
}
.places button {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--sumi);
  background: var(--washi);
  border: 2.5px solid var(--sumi);
  border-radius: 14px 20px 12px 18px / 18px 12px 20px 14px;
  box-shadow: 3px 4px 0 var(--shadow-ink);
  font:
    400 15px/1.2 "Zen Kurenaido",
    Georgia,
    serif;
  padding: 9px 12px 8px;
  min-width: 62px;
  min-height: 58px;
  cursor: pointer;
  transition:
    transform 0.18s var(--bounce),
    box-shadow 0.18s ease,
    background 0.18s ease;
}
.places button:nth-child(even) {
  border-radius: 18px 12px 20px 14px / 12px 20px 14px 18px;
}
.places button::before,
.places button::after {
  content: "";
  position: absolute;
  top: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--sumi);
  opacity: 0.65;
}
.places button::before {
  left: 8px;
}
.places button::after {
  right: 8px;
}
.places button:hover {
  background: var(--washi-soft);
}
.places button:active {
  transform: translate(2.5px, 3.5px);
  box-shadow: 0 1px 0 var(--shadow-ink);
}
.places button[data-active="true"] {
  background: #f3d9ce;
  border-color: var(--shu);
}
.places button[data-active="true"] .ink-icon {
  color: var(--shu);
}
.places button:focus-visible {
  outline: 3px solid var(--washi);
  outline-offset: 3px;
}
.places button .ink-icon {
  width: 24px;
  height: 24px;
}

@media (max-width: 640px) {
  .hud {
    left: 12px;
    right: 76px;
    top: 12px;
    max-width: none;
    padding: 12px 16px 10px;
  }
  .chrome-hint {
    left: auto;
    right: 2px;
    transform: none;
    padding: 0 8px 8px;
  }
  body[data-chrome="off"] .chrome-hint {
    animation-name: hint-sway-r;
  }
  @keyframes hint-sway-r {
    0%,
    100% {
      transform: rotate(-2.6deg);
    }
    50% {
      transform: rotate(2.6deg);
    }
  }
  .hud span {
    font-size: 1.5rem;
  }
  .tools {
    top: auto;
    bottom: 158px;
    right: 12px;
    flex-direction: column;
    gap: 6px;
  }
  .meta-line {
    display: none;
  }
  .places {
    bottom: max(12px, env(safe-area-inset-bottom));
    gap: 6px;
  }
  .places button {
    padding: 8px 9px 7px;
    min-width: 56px;
    min-height: 56px;
    flex: 1 1 28%;
  }
}
@media (prefers-reduced-motion: reduce) {
  .tools,
  .places {
    transition: none;
  }
  body[data-chrome="off"] .chrome-hint {
    animation: none;
  }
}

/* compact story card on short or narrow screens: never more than a corner chip */
.hud b { display: none; }
@media (max-height: 480px), (max-width: 640px) {
  .hud { max-width: 15rem; right: auto; padding: 8px 12px 8px; box-shadow: 3px 4px 0 var(--shadow-ink); }
  .hud span { font-size: 1.15rem; margin: 0 0 2px; }
  .hud em { font-size: 14px; line-height: 1.3; }
}
@media (min-width: 641px) and (min-height: 481px) {
  .hud b { display: block; font-size: 1rem; }
  .hud span { font-size: 1.6rem; }
}

/* short landscape: one slim row of place plaques so the view stays open */
@media (max-height: 480px) {
  .places { flex-wrap: nowrap; gap: 4px; left: 10px; right: 10px; bottom: 8px; }
  .places button { flex: 1 1 0; min-width: 44px; min-height: 44px; padding: 4px 6px; flex-direction: row; gap: 4px; font-size: 14px; }
  .places button .ink-icon { width: 20px; height: 20px; flex: none; }
}

#stick { position: fixed; z-index: 4; width: 112px; height: 112px; margin: -56px 0 0 -56px; border: 2.5px solid rgba(255,248,231,.7); border-radius: 50%; background: rgba(22,44,37,.35); pointer-events: none; display: none; }
#stick i { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: rgba(255,248,231,.88); border: 2.5px solid #162c25; }
#walkhint { position: fixed; left: 16px; top: 30%; transform: none; z-index: 4; max-width: min(52vw, 220px); text-align: left; padding: 10px 16px; border-radius: 22px; background: #162c25; color: #fff8e7; font: 600 14px/1.35 Inter, system-ui, sans-serif; pointer-events: none; }
#walkhint[hidden] { display: none; }
