:root {
  color-scheme: light;
  --coffee: #4b3023;
  font-family: "Casella Serif", Georgia, serif;
  color: var(--coffee);
  background: #ccaa87;
}

* { box-sizing: border-box; }
body { margin: 0; }

.welcome {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100svh;
  min-height: 320px;
  overflow: hidden;
  isolation: isolate;
}

/* Share the video's 16:9 canvas so the lettering stays on the blank wall,
   even when a portrait or ultrawide viewport crops the scene. */
.welcome-scene {
  position: absolute;
  top: 50%;
  left: 50%;
  width: max(100vw, 177.777778vh);
  height: max(100vh, 56.25vw);
  width: max(100vw, 177.777778svh);
  height: max(100svh, 56.25vw);
  transform: translate(-50%, -50%);
  container-type: inline-size;
  background: url("casella-room.jpg") center / cover no-repeat;
}

.welcome-video { display: block; width: 100%; height: 100%; object-fit: cover; }

.welcome-copy {
  position: absolute;
  top: 10.5%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: max-content;
  max-width: 94vw;
  text-align: center;
}

h1 {
  margin: 0;
  font-size: min(9.4cqw, 20vw);
  font-weight: 500;
  font-optical-sizing: none;
  font-variation-settings: "opsz" 32;
  line-height: 1.08;
  letter-spacing: -.035em;
}

.welcome-enter {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: clamp(8px, 1cqw, 20px);
  width: clamp(120px, 12cqw, 240px);
  min-height: 44px;
  padding: 0 24px 3px;
  border: 2px solid currentColor;
  border-radius: 999px;
  color: inherit;
  background: transparent;
  font-size: clamp(19px, 1.7cqw, 30px);
  font-weight: 600;
  line-height: 1.15;
  text-decoration: none;
  transition: color 160ms ease, background 160ms ease;
}

.welcome-enter:hover { background: var(--coffee); color: #fff4e4; border-color: var(--coffee); }
:focus-visible { outline: 3px solid var(--coffee); outline-offset: 6px; }

.welcome-error {
  position: absolute;
  bottom: max(76px, calc(env(safe-area-inset-bottom) + 60px));
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: min(90vw, 520px);
  margin: 0;
  padding: 14px 20px;
  border-radius: 12px;
  background: #fff4e4;
  font: 15px/1.5 system-ui, sans-serif;
  text-align: center;
}

.welcome-motion {
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 1px solid #fff4e460;
  border-radius: 50%;
  background: #4b3023c9;
  color: #fff4e4;
  cursor: pointer;
}

.welcome-motion[hidden] { display: none; }
.welcome-motion:focus-visible { outline-color: #fff4e4; }
.welcome-motion svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.motion-play, .welcome-motion[data-paused="true"] .motion-pause { display: none; }
.welcome-motion[data-paused="true"] .motion-play { display: block; }

/* Wider screens crop the top of a cover image: pin the copy to the viewport
   there instead, retaining the same centered wall placement. */
@media (min-aspect-ratio: 16/9) {
  .welcome-copy { top: calc((100% - 100svh) / 2 + 10.5svh); }
  h1 { font-size: min(9.4cqw, 18svh); }
}

@media (max-width: 600px) {
  .welcome-copy { top: 14%; }
  .welcome-enter { width: 136px; font-size: 21px; margin-top: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .welcome-enter, .home-area { transition: none; }
}

.home-account {
  position: absolute;
  z-index: 2;
  inset: 16px 24px auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font: 14px/1.4 "DM Sans", system-ui, sans-serif;
}
.home-account > span, .home-account nav {
  background: #fff4e4eb;
  border: 1px solid #4b302320;
  border-radius: 999px;
}
.home-account > span { padding: 12px 18px; }
.home-account nav { display: flex; padding: 0 6px; }
.home-account a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 999px;
  color: inherit;
  text-decoration: none;
}
.home-account a:hover { background: #4b302311; }
.home-areas {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  width: min(560px, 88vw);
  margin-top: 18px;
}
.home-area {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  min-height: 84px;
  padding: 10px 8px;
  border: 1px solid #4b30238c;
  border-radius: 12px;
  background: #fff0db7a;
  color: var(--coffee);
  font: 700 15px/1.2 "DM Sans", system-ui, sans-serif;
  text-decoration: none;
  transition: background 160ms ease, transform 160ms ease;
}
.home-area svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.home-area-active { color: #fff4e4; background: var(--coffee); border-color: var(--coffee); }
.home-area-active:hover { background: #372217; transform: translateY(-2px); }
.home-area-active:active { transform: translateY(0); }
.home-area:disabled { opacity: 1; cursor: default; }
.area-caption { font-size: 11px; font-weight: 400; letter-spacing: .02em; }

@media (max-width: 600px) {
  .home-account { inset: 12px 12px auto; font-size: 12px; gap: 8px; }
  .home-account > span { padding: 12px; }
  .home-account a { padding: 0 10px; }
  .is-home .welcome-copy { top: 12%; }
  .is-home h1 { font-size: 18vw; }
  .home-areas { grid-template-columns: repeat(2, minmax(0, 1fr)); width: min(280px, 86vw); gap: 8px; margin-top: 12px; }
  .home-area { min-height: 64px; padding: 8px; gap: 5px; font-size: 14px; }
  .home-area svg { display: none; }
}
@media (max-height: 500px) and (min-width: 601px) {
  .is-home .welcome-copy { top: calc((100% - 100svh) / 2 + 16svh); }
  .is-home h1 { font-size: 13svh; }
  .home-areas { margin-top: 8px; }
  .home-area { min-height: 54px; padding: 8px; gap: 4px; }
  .home-area svg { display: none; }
}
@media (max-width: 600px) and (max-height: 700px) {
  .is-home h1 { font-size: min(17vw, 76px); }
  .home-areas { margin-top: 8px; gap: 6px; }
  .home-area { min-height: 54px; padding: 6px; gap: 4px; font-size: 13px; }
  .area-caption { font-size: 10px; }
}
