:root {
  --rg-ink: #173f31;
  --rg-paper: #fbf7e9;
  --rg-focus: rgba(166, 94, 112, .8);
  --rg-touch: 44px;
  --ink: #173f31;
  --paper: #fbf7e9;
  --forest: #173f31;
  --portal-gold: #d5ac57;
  --serif: 'Gowun Batang', serif;
  --sans: 'Noto Sans KR', sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  isolation: isolate;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
}

body::before {
  content: '';
  position: fixed;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  background-image: var(--rg-grain);
  opacity: .035;
}

a { color: inherit; }
img, svg { display: block; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 12px;
  min-height: var(--rg-touch);
  display: inline-flex;
  align-items: center;
  translate: 0 -150%;
  padding: 10px 14px;
  border-radius: 999px;
  color: #fff;
  background: var(--forest);
  text-decoration: none;
}
.skip-link:focus { translate: 0; }
a:focus-visible { outline: 3px solid var(--rg-focus); outline-offset: 4px; }

.foyer-conservatory {
  position: fixed;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background: #fbf7e9;
}

.foyer-conservatory picture,
.foyer-conservatory img {
  width: 100%;
  height: 100%;
}

.foyer-conservatory picture {
  display: block;
  opacity: 0;
  transition: opacity 480ms var(--rg-ease, ease);
}
.foyer-conservatory.is-loaded picture { opacity: 1; }
.foyer-conservatory img {
  object-fit: cover;
  object-position: center;
  animation: conservatoryBreath 18s var(--ease-organic, ease-in-out) infinite alternate;
}

@keyframes conservatoryBreath {
  from { transform: scale(1); }
  to { transform: scale(1.012); }
}

.foyer-light {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 680ms var(--rg-ease, ease);
}

.foyer-light-morning {
  background: radial-gradient(ellipse at 23% 52%, rgba(255, 217, 134, .38), transparent 35%);
}
.foyer-light-family {
  background: radial-gradient(ellipse at 50% 48%, rgba(255, 236, 174, .3), transparent 36%);
}
.foyer-light-night {
  background: radial-gradient(ellipse at 78% 52%, rgba(133, 153, 207, .26), transparent 37%);
}

body[data-foyer-light="morning"] .foyer-light-morning,
body[data-foyer-light="family"] .foyer-light-family,
body[data-foyer-light="night"] .foyer-light-night {
  opacity: 1;
}

.foyer-header {
  position: relative;
  z-index: 10;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px clamp(20px, 4vw, 64px);
  background: linear-gradient(to bottom, rgba(251, 247, 233, .42), transparent);
}

.foyer-brand {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.foyer-brand > svg {
  width: 42px;
  height: 42px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.foyer-brand .brand-flower { fill: #c37a89; stroke: #173f31; }
.foyer-brand > span { display: grid; gap: 1px; }
.foyer-brand strong { font: 700 23px/1.15 var(--serif); letter-spacing: -.055em; }
.foyer-brand small {
  color: rgba(23, 63, 49, .72);
  font: 600 11px/1.25 var(--sans);
  letter-spacing: .1em;
}

.foyer-header-actions { display: flex; align-items: center; gap: 10px; }
.books-link {
  min-height: var(--rg-touch);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  border: 1px solid rgba(90, 76, 39, .24);
  border-radius: 999px;
  background: rgba(255, 253, 245, .72);
  box-shadow: 0 8px 24px rgba(63, 58, 39, .08);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transition: background-color .25s ease, translate .25s ease, box-shadow .25s ease;
}
.books-link svg {
  width: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.books-link:hover,
.books-link:focus-visible {
  translate: 0 -2px;
  background: rgba(255, 253, 245, .92);
  box-shadow: 0 12px 30px rgba(63, 58, 39, .13);
}

.foyer-main {
  position: relative;
  z-index: 3;
  min-height: calc(100svh - 76px);
  display: grid;
  grid-template-rows: auto minmax(450px, 1fr) auto;
  gap: clamp(12px, 1.8vh, 20px);
  padding: clamp(4px, 1vh, 12px) clamp(14px, 3vw, 46px) clamp(14px, 2vh, 24px);
}

.foyer-intro { text-align: center; }
.foyer-book-overline {
  margin: 0 0 6px;
  color: #756746;
  font: 500 clamp(11px, .95vw, 14px)/1.4 var(--serif);
  letter-spacing: .32em;
}
.foyer-intro h1 {
  margin: 0;
  font: 700 clamp(34px, 4.4vw, 62px)/1.22 var(--serif);
  letter-spacing: -.075em;
  text-wrap: balance;
  text-shadow: 0 2px 24px rgba(255, 253, 238, .78);
}
.foyer-intro > p:last-child {
  margin: 7px 0 0;
  color: #52685c;
  font: 400 clamp(14px, 1.25vw, 18px)/1.6 var(--serif);
}

.garden-doors {
  width: min(1216px, calc(100% - clamp(28px, 10vw, 144px)));
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(14px, 2vw, 30px);
  margin: 0 auto;
}

.garden-door {
  --door-radius: 49% 49% 24px 24px / 23% 23% 24px 24px;
  position: relative;
  min-width: 0;
  min-height: 450px;
  border-radius: var(--door-radius);
  text-decoration: none;
  transform: translateZ(0);
  transition: transform .5s cubic-bezier(.2, .75, .2, 1);
}

.garden-door::before {
  content: '';
  position: absolute;
  z-index: 6;
  top: -4px;
  left: 50%;
  width: 11px;
  height: 11px;
  border: 1px solid rgba(129, 96, 38, .72);
  background: rgba(255, 248, 218, .92);
  box-shadow: 0 0 0 3px rgba(255, 251, 229, .42);
  transform: translateX(-50%) rotate(45deg);
}

.door-halo {
  position: absolute;
  z-index: 0;
  inset: -1px;
  border-radius: var(--door-radius);
  box-shadow: 0 24px 68px rgba(57, 53, 37, .2), 0 0 0 1px rgba(255, 241, 193, .38);
}
.door-halo::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 32px 88px rgba(55, 48, 28, .28), 0 0 42px rgba(255, 224, 149, .4);
  opacity: 0;
  transition: opacity .5s ease;
}
.garden-door:hover .door-halo::after,
.garden-door:focus-visible .door-halo::after { opacity: 1; }

.door-body {
  position: absolute;
  z-index: 1;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid var(--portal-gold);
  border-radius: var(--door-radius);
  background: rgba(255, 250, 233, .76);
  box-shadow: inset 0 0 0 2px rgba(255, 253, 238, .66);
  transition: border-color .35s ease, box-shadow .35s ease;
}
.door-body::before {
  content: '';
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent 43%, rgba(17, 39, 30, .08) 56%, rgba(12, 31, 24, .88) 100%);
}
.door-body::after {
  content: '';
  position: absolute;
  z-index: 5;
  inset: 8px;
  pointer-events: none;
  border: 1px solid rgba(255, 232, 177, .68);
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .24);
}

.door-frame { position: absolute; inset: 0; }
.door-frame::after {
  content: '';
  position: absolute;
  inset: auto 0 0;
  height: 22%;
  pointer-events: none;
  background: linear-gradient(to top, rgba(255, 249, 229, .13), transparent);
}
.door-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.2s cubic-bezier(.2, .75, .2, 1), filter .6s ease;
}
.door-together .door-frame img { object-position: center 45%; }
.door-family .door-frame img { object-position: center 48%; }
.door-mom .door-frame img { object-position: center 50%; }

.door-copy {
  position: absolute;
  z-index: 3;
  inset: auto 0 0;
  min-width: 0;
  display: grid;
  justify-items: center;
  padding: clamp(24px, 3vh, 38px) 18px clamp(20px, 2.7vh, 32px);
  color: #fffdf3;
  text-align: center;
  text-shadow: 0 2px 18px rgba(8, 22, 17, .72);
}
.door-copy > strong {
  max-width: 100%;
  font: 700 clamp(27px, 2.25vw, 32px)/40px var(--serif);
  letter-spacing: -1px;
  text-wrap: balance;
}
.door-copy > small {
  max-width: 100%;
  margin-top: 4px;
  font: 400 clamp(12px, 1.05vw, 15px)/1.55 var(--serif);
  opacity: .92;
}
.door-order {
  display: block;
  margin-bottom: 6px;
  color: rgba(255, 244, 214, .94);
  font: 600 12px/1.2 var(--sans);
  font-style: normal;
  letter-spacing: .2em;
}
.door-action {
  max-width: 100%;
  min-height: var(--rg-touch-comfortable, 48px);
  display: inline-flex;
  align-items: center;
  gap: var(--rg-space-2, 8px);
  margin-top: 14px;
  padding: 0 var(--rg-action-inline, 20px);
  border: 1px solid #e7c26f;
  border-radius: var(--rg-radius-pill, 999px);
  color: var(--rg-paper-soft, #fffaf1);
  background: rgba(31, 67, 52, .94);
  box-shadow: 0 10px 30px rgba(7, 25, 18, .26);
  font-size: 13px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  text-shadow: none;
  white-space: nowrap;
}
.door-action svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: translate .25s ease;
}

.garden-door:hover,
.garden-door:focus-visible {
  z-index: 5;
  transform: translateY(-8px) scale(1.012);
}
.garden-door:focus-visible { outline: 4px solid var(--rg-focus); outline-offset: 5px; }
.garden-door:hover .door-body,
.garden-door:focus-visible .door-body {
  border-color: #f1ce7f;
  box-shadow: inset 0 0 0 2px rgba(255, 253, 238, .78), inset 0 0 36px rgba(255, 229, 165, .12);
}
.garden-door:hover .door-frame img,
.garden-door:focus-visible .door-frame img {
  transform: scale(1.045);
  filter: saturate(1.05) brightness(1.025);
}
.garden-door:hover .door-action svg,
.garden-door:focus-visible .door-action svg { translate: 4px 0; }

@media (min-width: 901px) {
  .garden-door.door-family { transform: translateY(-9px) translateZ(0); }
  .garden-door.door-family .door-halo { box-shadow: 0 30px 78px rgba(57, 53, 37, .24), 0 0 0 1px rgba(255, 241, 193, .46); }
  .garden-door.door-family:hover,
  .garden-door.door-family:focus-visible { transform: translateY(-17px) scale(1.012); }
}

.foyer-note {
  margin: 0;
  color: #58695f;
  text-align: center;
  font: 400 14px/1.6 var(--serif);
}

.foyer-ambient {
  position: fixed;
  z-index: 8;
  inset: 0;
  pointer-events: none;
}

@media (max-width: 1080px) and (min-width: 701px) {
  .garden-doors { width: min(930px, calc(100% - 48px)); gap: 16px; }
  .garden-door { min-height: 420px; }
  .door-copy { padding-inline: 14px; }
  .door-action { gap: 7px; padding-inline: 15px; }
}

@media (max-width: 900px) and (min-width: 701px) {
  .foyer-header { min-height: 68px; }
  .foyer-main { min-height: calc(100svh - 68px); }
  .garden-door {
    --door-radius: 46% 46% 22px 22px / 21% 21% 22px 22px;
    min-height: 390px;
  }
}

@media (max-width: 950px) and (max-height: 520px) and (orientation: landscape) and (min-width: 701px) {
  .foyer-header {
    min-height: 54px;
    padding-block: 5px;
  }
  .foyer-brand > svg {
    width: 34px;
    height: 34px;
  }
  .foyer-brand strong { font-size: 20px; }
  .foyer-brand small { display: none; }
  .foyer-main {
    min-height: calc(100svh - 54px);
    grid-template-rows: auto minmax(230px, 1fr);
    gap: 8px;
    padding: 0 28px 10px;
  }
  .foyer-book-overline,
  .foyer-intro > p:last-child,
  .foyer-note,
  .foyer-journey { display: none; }
  .foyer-intro h1 {
    font-size: 28px;
    line-height: 1.15;
    letter-spacing: -.04em;
  }
  .garden-doors {
    width: min(920px, 100%);
    min-height: 230px;
    gap: 12px;
  }
  .garden-door { min-height: 230px; }
  .door-copy { padding: 14px 10px 12px; }
  .door-copy > strong {
    font-size: 21px;
    line-height: 27px;
  }
  .door-copy > small {
    margin-top: 2px;
    font-size: 11px;
    line-height: 15px;
  }
  .door-order {
    margin-bottom: 2px;
    font-size: 9px;
  }
  .door-action {
    gap: 5px;
    min-height: 44px;
    margin-top: 8px;
    padding-inline: 11px;
    font-size: 11.5px;
  }
  .door-action svg { width: 15px; }
}

@media (max-width: 700px) {
  .foyer-conservatory img { animation: none; }
}

@media (prefers-reduced-data: reduce) {
  .foyer-conservatory { display: none; }
  body {
    background:
      radial-gradient(circle at 48% 10%, rgba(255, 249, 221, .94), transparent 38%),
      linear-gradient(145deg, #e5eff0 0%, #fbf5e5 54%, #d7dced 100%);
  }
}

html[data-foyer-data="reduced"] .foyer-conservatory { display: none; }

@media (forced-colors: active) {
  .foyer-conservatory { display: none; }
  .garden-door,
  .books-link,
  .door-action { border: 2px solid ButtonText; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .foyer-conservatory img { animation: none; }
  .foyer-light { transition: none; }
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
