:root {
  color-scheme: dark;
  font-family: "Helvetica Neue", "Noto Sans JP", Arial, sans-serif;
  background: #050505;
  color: #f4efe5;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  background: #050505;
  scrollbar-color: #8c6932 #050505;
}

body {
  margin: 0;
  min-width: 320px;
  background: #050505;
  overscroll-behavior-y: none;
}

img {
  display: block;
  max-width: 100%;
}

.kw-scroll-transition {
  --kw-gold: #c5a05c;
  --kw-ivory: #f4efe5;
  --kw-crimson: #6f171c;
  --kw-blue: #172844;
  --kw-black: #050505;
  --kw-progress: 0;
  --kw-blackout: 0;
  --kw-intro-opacity: 1;
  --kw-spiral-opacity: 0;
  --kw-exit-progress: 0;
  --kw-stage-height: 900vh;
  position: relative;
  height: var(--kw-stage-height);
  background: var(--kw-black);
}

.kw-viewport {
  /* 親テーマではstickyが解除されるため、JSでfixed/absoluteを切り替える。 */
  position: relative;
  top: 0;
  width: 100%;
  height: 100svh;
  min-height: 560px;
  overflow: hidden;
  background: var(--kw-black);
  isolation: isolate;
}

.kw-intro,
.kw-blackout,
.kw-spiral {
  position: absolute;
  inset: 0;
}

.kw-intro {
  opacity: var(--kw-intro-opacity);
  transform: translate3d(0, calc(var(--kw-progress) * -5vh), 0)
    scale(calc(1 + var(--kw-progress) * 0.035));
  transform-origin: 50% 42%;
  will-change: transform, opacity;
}

.kw-intro__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: saturate(0.72) contrast(1.08) brightness(0.72);
}

.kw-intro__veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(3, 4, 7, 0.16), rgba(3, 4, 7, 0.72)),
    linear-gradient(90deg, rgba(6, 7, 10, 0.68) 0%, transparent 58%);
}

.kw-intro__copy {
  position: absolute;
  left: clamp(24px, 7vw, 112px);
  bottom: clamp(64px, 11vh, 128px);
  width: min(760px, 76vw);
}

.kw-eyebrow,
.kw-intro__note,
.kw-scene-label,
.kw-guide,
.kw-progress,
.kw-status {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.kw-eyebrow {
  margin: 0 0 22px;
  color: var(--kw-gold);
}

.kw-intro h1 {
  margin: 0;
  font-family: Didot, "Bodoni 72", "Times New Roman", serif;
  font-size: clamp(64px, 10.6vw, 178px);
  font-weight: 400;
  line-height: 0.72;
  letter-spacing: -0.065em;
  text-wrap: balance;
}

.kw-intro h1 span {
  display: block;
}

.kw-intro h1 span:last-child {
  margin-left: 0.33em;
  color: transparent;
  -webkit-text-stroke: 1px rgba(244, 239, 229, 0.72);
}

.kw-intro__note {
  width: min(390px, 70vw);
  margin: 34px 0 0 0.6em;
  line-height: 1.8;
  color: rgba(244, 239, 229, 0.72);
}

.kw-blackout {
  z-index: 2;
  pointer-events: none;
  background: #050505;
  opacity: var(--kw-blackout);
  will-change: opacity;
}

.kw-spiral {
  z-index: 3;
  opacity: var(--kw-spiral-opacity);
  background: #050505;
  will-change: opacity;
}

.kw-spiral__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.kw-spiral-copy {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(68px, 7vh, 110px) clamp(24px, 8vw, 154px);
  color: #f4dfb1;
  text-align: center;
  pointer-events: none;
  text-shadow: 0 2px 18px rgb(0 0 0 / 92%);
}

.kw-spiral-copy__inner {
  width: min(100%, 1280px);
}

.kw-spiral-copy h2 {
  margin: 0;
  color: inherit;
  font-family: var(--font-family01);
  font-size: var(--font-size62);
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: .03em;
}

.kw-spiral-copy__body {
  margin-top: clamp(34px, 4.7vh, 62px);
  font-family: var(--font-family01);
  font-size: clamp(14px, 1.5vw, 22px);
  font-weight: 400;
  line-height: 1.85;
  letter-spacing: .03em;
}

.kw-spiral-copy__body p {
  margin: 0 0 1em;
  color: inherit;
  font-size: clamp(14px, 1.5vw, 22px);
}

.kw-spiral-copy__body p:last-child { margin-bottom: 0; }

.kw-chrome {
  position: absolute;
  inset: 0 0 auto;
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: clamp(22px, 4vw, 54px) clamp(22px, 5vw, 72px);
  pointer-events: none;
}

.kw-mark {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--kw-ivory);
}

.kw-mark__crest {
  display: grid;
  width: 34px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid rgba(197, 160, 92, 0.74);
  border-radius: 50%;
  color: var(--kw-gold);
  font-family: Didot, "Times New Roman", serif;
  font-size: 18px;
  font-style: italic;
}

.kw-mark__name {
  font-family: Didot, "Times New Roman", serif;
  font-size: 13px;
  line-height: 0.9;
  letter-spacing: -0.01em;
}

.kw-scene-label {
  display: flex;
  gap: 28px;
  margin: 6px 0 0;
  color: rgba(244, 239, 229, 0.52);
}

.kw-scene-label__number {
  color: var(--kw-gold);
}

.kw-tuner {
  position: absolute;
  z-index: 100;
  top: clamp(88px, 12vh, 124px);
  right: clamp(18px, 4vw, 58px);
  width: min(264px, calc(100vw - 36px));
  color: rgba(244, 239, 229, 0.76);
  background: rgba(8, 8, 8, 0.78);
  border: 1px solid rgba(197, 160, 92, 0.2);
  backdrop-filter: blur(18px);
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.35);
  transition: background 240ms ease;
}

.kw-tuner:focus-within {
  background: rgba(8, 8, 8, 0.94);
}

.kw-tuner button,
.kw-tuner input {
  font: inherit;
}

.kw-tuner__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  color: var(--kw-gold);
  background: transparent;
  font-size: 8px;
  letter-spacing: 0.2em;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
}

.kw-tuner__toggle i,
.kw-tuner__toggle i::after {
  display: block;
  width: 10px;
  height: 1px;
  background: currentColor;
  transition: transform 220ms ease;
}

.kw-tuner__toggle i {
  position: relative;
}

.kw-tuner__toggle i::after {
  content: "";
  position: absolute;
  transform: rotate(90deg) scaleX(0);
}

.kw-tuner__controls {
  max-height: min(72vh, 640px);
  padding: 0 14px 14px;
  overflow: auto;
  opacity: 1;
  transition: max-height 260ms ease, padding 260ms ease, opacity 180ms ease;
}

.kw-scroll-transition[data-tuner-open="false"] .kw-tuner__controls {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
  opacity: 0;
}

.kw-scroll-transition[data-tuner-open="false"] .kw-tuner__toggle i::after {
  transform: rotate(90deg) scaleX(1);
}

.kw-tuner__note {
  margin: 0 0 13px;
  color: rgba(244, 239, 229, 0.36);
  font-family: Didot, "Times New Roman", serif;
  font-size: 11px;
  font-style: italic;
  letter-spacing: 0.06em;
}

.kw-tuner label {
  display: block;
  margin-top: 10px;
}

.kw-tuner label > span {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  color: rgba(244, 239, 229, 0.56);
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.kw-tuner label > small {
  display: block;
  margin: -2px 0 4px;
  color: rgba(244, 239, 229, 0.38);
  font-size: 9px;
  letter-spacing: 0.04em;
  line-height: 1.35;
}

.kw-tuner output {
  margin-left: auto;
  color: var(--kw-gold);
  font-variant-numeric: tabular-nums;
}

.kw-tuner input[type="range"] {
  width: 100%;
  height: 12px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: ew-resize;
}

.kw-tuner input[type="range"]::-webkit-slider-runnable-track {
  height: 1px;
  background: rgba(244, 239, 229, 0.24);
}

.kw-tuner input[type="range"]::-webkit-slider-thumb {
  width: 8px;
  height: 8px;
  margin-top: -3.5px;
  appearance: none;
  border: 1px solid var(--kw-gold);
  border-radius: 50%;
  background: #0a0a0a;
}

.kw-tuner input[type="range"]::-moz-range-track {
  height: 1px;
  background: rgba(244, 239, 229, 0.24);
}

.kw-tuner input[type="range"]::-moz-range-thumb {
  width: 8px;
  height: 8px;
  border: 1px solid var(--kw-gold);
  border-radius: 50%;
  background: #0a0a0a;
}

.kw-tuner button:focus-visible,
.kw-tuner input:focus-visible {
  outline: 1px solid var(--kw-gold);
  outline-offset: 3px;
}

.kw-tuner__actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
}

.kw-tuner__copy,
.kw-tuner__reset {
  padding: 0 0 3px;
  border: 0;
  border-bottom: 1px solid rgba(197, 160, 92, 0.34);
  color: rgba(244, 239, 229, 0.52);
  background: transparent;
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

.kw-tuner__copy {
  color: rgba(197, 160, 92, 0.76);
}

.kw-tuner__copy[data-copied="true"] {
  color: var(--kw-gold);
}

.kw-guide {
  position: absolute;
  z-index: 50;
  right: clamp(22px, 5vw, 72px);
  bottom: clamp(26px, 5vh, 58px);
  display: flex;
  align-items: center;
  gap: 16px;
  color: rgba(244, 239, 229, 0.62);
  pointer-events: none;
  transition: opacity 400ms ease;
}

.kw-guide__line {
  position: relative;
  display: block;
  width: 52px;
  height: 1px;
  overflow: hidden;
  background: rgba(244, 239, 229, 0.2);
}

.kw-guide__line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--kw-gold);
  transform: translateX(-100%);
  animation: kw-guide 2.2s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

.kw-progress {
  position: absolute;
  z-index: 50;
  left: clamp(22px, 5vw, 72px);
  bottom: clamp(26px, 5vh, 58px);
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(244, 239, 229, 0.5);
  opacity: var(--kw-spiral-opacity);
  pointer-events: none;
}

.kw-progress__current {
  color: var(--kw-gold);
}

.kw-progress__track {
  position: relative;
  display: block;
  width: 72px;
  height: 1px;
  overflow: hidden;
  background: rgba(244, 239, 229, 0.18);
}

.kw-progress__track i {
  position: absolute;
  inset: 0;
  background: var(--kw-gold);
  transform: scaleX(var(--kw-progress));
  transform-origin: left;
}

.kw-status {
  position: absolute;
  z-index: 8;
  left: 50%;
  bottom: 12vh;
  margin: 0;
  color: rgba(244, 239, 229, 0.7);
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 500ms ease, transform 500ms ease;
  white-space: nowrap;
}

.kw-transition-curtain {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 50%, rgba(23, 40, 68, 0.24), transparent 34%),
    #050505;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 800ms cubic-bezier(0.4, 0, 0.2, 1), visibility 800ms;
}

.kw-transition-curtain::before,
.kw-transition-curtain::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 42vw;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(197, 160, 92, 0.72));
  transform: scaleX(0);
  transition: transform 700ms 160ms cubic-bezier(0.65, 0, 0.35, 1);
}

.kw-transition-curtain::before {
  right: calc(50% + 142px);
  transform-origin: right;
}

.kw-transition-curtain::after {
  left: calc(50% + 142px);
  transform: scaleX(0) rotate(180deg);
  transform-origin: left;
}

.kw-transition-curtain span {
  color: rgba(244, 239, 229, 0.72);
  font-size: 9px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 500ms 260ms ease, transform 500ms 260ms ease;
}

.kw-scroll-transition[data-transition-state="leaving"] .kw-transition-curtain {
  opacity: 1;
  visibility: visible;
}

.kw-scroll-transition[data-transition-state="leaving"] .kw-transition-curtain::before {
  transform: scaleX(1);
}

.kw-scroll-transition[data-transition-state="leaving"] .kw-transition-curtain::after {
  transform: scaleX(1) rotate(180deg);
}

.kw-scroll-transition[data-transition-state="leaving"] .kw-transition-curtain span {
  opacity: 1;
  transform: translateY(0);
}

.kw-scroll-transition[data-transition-state="ready"] .kw-status {
  opacity: 1;
  transform: translate(-50%, 0);
}

.kw-scroll-transition[data-transition-state="complete"] .kw-status,
.kw-scroll-transition[data-transition-state="error"] .kw-status {
  opacity: 1;
  transform: translate(-50%, 0);
}

.kw-scroll-transition[data-transition-state="complete"] .kw-guide,
.kw-scroll-transition[data-transition-state="leaving"] .kw-guide,
.kw-scroll-transition[data-transition-state="leaving"] .kw-status {
  opacity: 0;
}

.kw-next-page {
  --kw-gold: #c5a05c;
  --kw-ivory: #f4efe5;
  min-height: 100svh;
  background: #050505;
}

.kw-next-hero {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  background: #050505;
  animation: kw-next-enter 1.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.kw-next-hero__image,
.kw-next-hero__veil {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.kw-next-hero__image {
  object-fit: cover;
  filter: saturate(0.65) contrast(1.04) brightness(0.78);
  animation: kw-next-image 1.8s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.kw-next-hero__veil {
  background:
    linear-gradient(90deg, rgba(5, 5, 5, 0.78), rgba(5, 5, 5, 0.06) 72%),
    linear-gradient(180deg, rgba(5, 5, 5, 0.1), rgba(5, 5, 5, 0.52));
}

.kw-next-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(22px, 4vw, 54px) clamp(22px, 5vw, 72px);
}

.kw-next-header a {
  color: rgba(244, 239, 229, 0.78);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-decoration: none;
  text-transform: uppercase;
}

.kw-next-header a::after {
  content: "";
  display: block;
  width: 100%;
  height: 1px;
  margin-top: 8px;
  background: var(--kw-gold, #c5a05c);
  transform: scaleX(0.28);
  transform-origin: left;
  transition: transform 300ms ease;
}

.kw-next-header a:hover::after,
.kw-next-header a:focus-visible::after {
  transform: scaleX(1);
}

.kw-next-header a:focus-visible {
  outline: 1px solid #c5a05c;
  outline-offset: 8px;
}

.kw-next-hero__copy {
  position: absolute;
  z-index: 2;
  left: clamp(24px, 8vw, 128px);
  bottom: clamp(56px, 12vh, 132px);
  color: #f4efe5;
}

.kw-next-hero__copy h1 {
  margin: 0;
  font-family: Didot, "Bodoni 72", "Times New Roman", serif;
  font-size: clamp(72px, 11vw, 176px);
  font-weight: 400;
  line-height: 0.78;
  letter-spacing: -0.065em;
}

.kw-next-hero__copy > p:last-child {
  margin: 32px 0 0 4px;
  font-size: 12px;
  letter-spacing: 0.16em;
}

@keyframes kw-guide {
  0% {
    transform: translateX(-100%);
  }
  48%,
  52% {
    transform: translateX(0%);
  }
  100% {
    transform: translateX(100%);
  }
}

@keyframes kw-next-enter {
  from {
    opacity: 0;
    filter: blur(8px);
  }
  to {
    opacity: 1;
    filter: blur(0);
  }
}

@keyframes kw-next-image {
  from {
    transform: scale(1.045);
  }
  to {
    transform: scale(1);
  }
}

@media (max-width: 720px) {
  .kw-scroll-transition {
    --kw-stage-height: 780vh;
  }

  .kw-viewport {
    min-height: 500px;
  }

  .kw-spiral-copy {
    align-items: center;
    padding: 80px 22px 64px;
  }

  .kw-spiral-copy h2 {
    font-size: var(--font-size40);
  }

  .kw-spiral-copy__body {
    max-height: 58svh;
    margin-top: 26px;
    overflow: hidden;
    font-size: 11px;
    line-height: 1.75;
    letter-spacing: .035em;
  }

  .kw-spiral-copy__body p { margin-bottom: 12px; }

  .kw-intro__image {
    object-position: 56% center;
  }

  .kw-intro__copy {
    bottom: 16vh;
    width: calc(100vw - 48px);
  }

  .kw-intro h1 {
    font-size: clamp(58px, 20vw, 92px);
    line-height: 0.78;
  }

  .kw-intro h1 span:last-child {
    margin-left: 0.12em;
  }

  .kw-intro__note {
    margin-top: 26px;
  }

  .kw-scene-label {
    display: none;
  }

  .kw-tuner {
    top: 82px;
    right: 18px;
    width: min(244px, calc(100vw - 36px));
  }

  .kw-tuner__controls {
    max-height: min(62vh, 520px);
  }

  .kw-guide__label {
    display: none;
  }

  .kw-status {
    bottom: 16vh;
    max-width: calc(100vw - 48px);
    text-align: center;
    white-space: normal;
  }

  .kw-transition-curtain::before {
    right: calc(50% + 92px);
  }

  .kw-transition-curtain::after {
    left: calc(50% + 92px);
  }

  .kw-next-hero__image {
    object-position: 58% center;
  }

  .kw-next-hero__copy {
    bottom: 14vh;
  }

  .kw-next-hero__copy h1 {
    font-size: clamp(62px, 20vw, 92px);
  }

  .kw-next-hero__copy > p:last-child {
    max-width: 260px;
    line-height: 1.8;
  }
}

/* 添付版のMuseum離脱演出。既存のスクロール本文レイヤーは維持する。 */
.museum-departure {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s linear;
}

@media (prefers-reduced-motion: reduce) {
  .kw-guide__line::after {
    animation: none;
    transform: none;
  }

  .kw-intro,
  .kw-status,
  .kw-transition-curtain,
  .kw-next-hero,
  .kw-next-hero__image {
    transition: none;
    animation-duration: 1ms;
  }

  .museum-departure { transition: none; }
}
