:root {
  --background: #050505;
  --text: #e8e2d8;
  --subtext: #9a9188;
  --red: #7d1f1f;
  --line: rgba(255, 255, 255, 0.16);
  --panel: rgba(0, 0, 0, 0.42);
  --panel-strong: rgba(0, 0, 0, 0.7);
  --bg-shift-x: 0px;
  --bg-shift-y: 0px;
  --hero-shift-x: 0px;
  --hero-shift-y: 0px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--background);
}

body {
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--background);
  color: var(--text);
  font-family: "Yu Mincho", "Hiragino Mincho ProN", Georgia, "Times New Roman", serif;
}

button,
a {
  color: inherit;
  font: inherit;
}

button {
  border: 0;
}

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

::selection {
  background: var(--red);
  color: var(--text);
}

.manor-home {
  position: relative;
  display: grid;
  min-height: 100svh;
  isolation: isolate;
  overflow: hidden;
}

.background,
.overlay {
  position: fixed;
  inset: 0;
  z-index: -3;
}

.background {
  background-image: url("./assets/images/manor-bg.jpg");
  background-position: center;
  background-size: cover;
  animation: manor-breath 28s ease-in-out infinite alternate;
  transform: translate3d(var(--bg-shift-x), var(--bg-shift-y), 0) scale(1.025);
  transition: transform 900ms ease-out;
  will-change: transform;
}

.overlay {
  z-index: -2;
  background:
    radial-gradient(circle at 50% 45%, rgba(125, 31, 31, 0.1), transparent 28%),
    linear-gradient(180deg, rgba(5, 5, 5, 0.54), rgba(5, 5, 5, 0.82)),
    rgba(5, 5, 5, 0.36);
}

.map-toggle {
  position: fixed;
  z-index: 20;
  top: clamp(16px, 3vw, 32px);
  right: clamp(16px, 3vw, 36px);
  padding: 10px 0;
  border-bottom: 1px solid rgba(232, 226, 216, 0.32);
  background: transparent;
  color: rgba(232, 226, 216, 0.74);
  cursor: pointer;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: border-color 180ms ease, color 180ms ease;
}

.map-toggle:hover,
.map-toggle:focus-visible {
  border-color: rgba(125, 31, 31, 0.9);
  color: var(--text);
  outline: none;
}

.hero {
  display: grid;
  align-content: center;
  justify-items: center;
  width: min(1080px, calc(100vw - 36px));
  min-height: 100svh;
  margin: 0 auto;
  padding: clamp(74px, 10vh, 110px) 0 clamp(28px, 6vh, 72px);
  opacity: 0;
  text-align: center;
  transform: translate3d(var(--hero-shift-x), calc(10px + var(--hero-shift-y)), 0);
  transition: opacity 1200ms ease, transform 1200ms ease;
  will-change: transform;
}

body.is-ready .hero {
  opacity: 1;
  transform: translate3d(var(--hero-shift-x), var(--hero-shift-y), 0);
}

.emblem {
  width: clamp(94px, 14vw, 168px);
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  box-shadow: 0 0 44px rgba(0, 0, 0, 0.72);
  animation: emblem-breath 9s ease-in-out infinite;
  object-fit: cover;
  object-position: center 46%;
}

.eyebrow,
.hero h1,
.room-number,
.room-title,
.map-title,
.map-link {
  font-family: Georgia, "Times New Roman", serif;
}

.eyebrow {
  margin: clamp(24px, 4vh, 34px) 0 0;
  color: var(--subtext);
  font-size: clamp(1.05rem, 2vw, 1.42rem);
  letter-spacing: 0.42em;
  line-height: 1.1;
  text-indent: 0.42em;
}

.hero h1 {
  margin: 8px 0 0;
  font-size: clamp(3.7rem, 10vw, 8rem);
  font-weight: 400;
  letter-spacing: 0.16em;
  line-height: 0.92;
  text-indent: 0.16em;
  text-transform: uppercase;
}

.room-doors {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(14px, 2.5vw, 28px);
  width: min(980px, 100%);
  margin-top: clamp(46px, 8vh, 78px);
}

.room-door {
  position: relative;
  display: grid;
  min-height: 132px;
  padding: 22px 24px 20px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
    var(--panel);
  opacity: 0;
  text-align: left;
  text-decoration: none;
  transform: translateY(8px);
  transition:
    background 220ms ease,
    border-color 220ms ease,
    opacity 800ms ease,
    transform 800ms ease;
}

body.is-ready .room-door {
  opacity: 1;
  transform: translateY(0);
}

body.is-ready .room-door:nth-child(2) {
  transition-delay: 120ms;
}

body.is-ready .room-door:nth-child(3) {
  transition-delay: 240ms;
}

.room-door::before,
.room-door::after {
  position: absolute;
  content: "";
  pointer-events: none;
}

.room-door::before {
  inset: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.room-door::after {
  right: 20px;
  bottom: 18px;
  width: 34px;
  height: 1px;
  background: rgba(125, 31, 31, 0.6);
  transform-origin: right;
  transition: background 220ms ease, transform 220ms ease;
}

.room-door:hover,
.room-door:focus-visible {
  border-color: rgba(125, 31, 31, 0.78);
  background:
    linear-gradient(180deg, rgba(125, 31, 31, 0.08), transparent),
    rgba(0, 0, 0, 0.54);
  outline: none;
  transform: translateY(-2px);
  transition-delay: 0ms;
}

.room-door:hover::after,
.room-door:focus-visible::after {
  background: rgba(125, 31, 31, 0.95);
  transform: scaleX(1.25);
}

.room-number {
  color: var(--subtext);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
}

.room-title {
  align-self: end;
  margin-top: 28px;
  font-size: clamp(0.94rem, 1.7vw, 1.18rem);
  letter-spacing: 0.1em;
  line-height: 1.2;
  text-transform: uppercase;
}

.room-jp {
  margin-top: 7px;
  color: var(--subtext);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
}

.map-scrim {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.46);
  opacity: 0;
  pointer-events: none;
  transition: opacity 260ms ease;
}

.manor-map {
  position: fixed;
  z-index: 40;
  top: 0;
  right: 0;
  display: grid;
  align-content: start;
  width: min(360px, 88vw);
  height: 100svh;
  padding: clamp(28px, 5vw, 48px);
  border-left: 1px solid var(--line);
  background: rgba(5, 5, 5, 0.9);
  box-shadow: -24px 0 58px rgba(0, 0, 0, 0.44);
  opacity: 0;
  pointer-events: none;
  transform: translateX(18px);
  transition: opacity 260ms ease, transform 260ms ease;
}

body.is-map-open .map-scrim,
body.is-map-open .manor-map {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.map-close {
  justify-self: end;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--subtext);
  cursor: pointer;
  font-family: Arial, sans-serif;
  font-size: 1.35rem;
  line-height: 1;
  transition: border-color 180ms ease, color 180ms ease;
}

.map-close:hover,
.map-close:focus-visible {
  border-color: rgba(125, 31, 31, 0.78);
  color: var(--text);
  outline: none;
}

.map-title {
  margin: clamp(46px, 8vh, 72px) 0 26px;
  color: var(--text);
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.map-links {
  display: grid;
  border-top: 1px solid var(--line);
}

.map-link {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  color: rgba(232, 226, 216, 0.82);
  font-size: 0.82rem;
  letter-spacing: 0.09em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 180ms ease, padding-left 180ms ease;
}

.map-link span:first-child {
  color: var(--subtext);
}

.map-link:hover,
.map-link:focus-visible {
  color: var(--text);
  outline: none;
  padding-left: 8px;
}

.site-credit {
  position: fixed;
  z-index: 12;
  bottom: clamp(14px, 3vw, 26px);
  left: clamp(16px, 3vw, 36px);
  max-width: min(420px, calc(100vw - 32px));
  margin: 0;
  color: rgba(154, 145, 136, 0.72);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  line-height: 1.6;
}

@media (max-width: 920px) {
  .room-doors {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: min(680px, 100%);
  }
}

@media (max-width: 700px) {
  .background {
    background-position: center center;
  }

  .map-toggle {
    top: 14px;
    right: 16px;
    font-size: 0.62rem;
  }

  .hero {
    width: min(420px, calc(100vw - 32px));
    padding-top: 78px;
    padding-bottom: 28px;
  }

  .emblem {
    width: clamp(82px, 27vw, 112px);
  }

  .eyebrow {
    font-size: clamp(0.92rem, 4vw, 1.12rem);
    letter-spacing: 0.3em;
    text-indent: 0.3em;
  }

  .hero h1 {
    font-size: clamp(3rem, 16vw, 4.8rem);
    letter-spacing: 0.12em;
    text-indent: 0.12em;
  }

  .room-doors {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: clamp(34px, 7vh, 56px);
  }

  .room-door {
    min-height: 112px;
    padding: 18px 20px;
  }

  .room-title {
    margin-top: 22px;
  }

  .manor-map {
    width: 100vw;
    border-left: 0;
  }

  .site-credit {
    bottom: 12px;
    color: rgba(154, 145, 136, 0.62);
    font-size: 0.54rem;
    letter-spacing: 0.08em;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }

  .background,
  .hero {
    transform: none !important;
  }
}

@keyframes manor-breath {
  from {
    filter: brightness(0.92) saturate(0.96);
  }

  to {
    filter: brightness(1) saturate(1.04);
  }
}

@keyframes emblem-breath {
  0%,
  100% {
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.72);
    filter: brightness(0.96);
  }

  50% {
    box-shadow: 0 0 52px rgba(125, 31, 31, 0.14), 0 0 44px rgba(0, 0, 0, 0.76);
    filter: brightness(1.04);
  }
}
