:root {
  --ink: #203f38;
  --paper: #faf3e6;
  --berry: #8c3656;
  --cedar: #213f37;
  --display: 'Baskerville', 'Palatino Linotype', 'Book Antiqua', Georgia, serif;
}
h1, h2, h3, .brand, .piece span { font-family: var(--display); }
header { background: #fdf6e9; padding-block: 12px; }
.brand { white-space: nowrap; }
.brand small { margin-top: 3px; }
.nav { align-items: center; gap: clamp(10px, 2vw, 28px); }
.nav a, .nav button { padding: 10px 0; }
.nav button { background: transparent; border: 0; color: var(--berry); font-size: 13px; font-weight: 650; }
.nav a:hover, .nav button:hover { text-decoration: underline; text-underline-offset: 4px; }












#gallery { padding-top: clamp(48px, 7vw, 100px); }
.filters { gap: 8px; margin-block: 26px 34px; }
.filters button { border: 1px solid #a5a190; border-radius: 30px; padding: 9px 14px; min-height: 44px; }
.filters button[aria-pressed=true] { background: var(--cedar); color: #fff8ea; border: 1px solid var(--cedar); }
.grid { row-gap: 36px; }
.piece img { background: #eee4d2; border: 6px solid #fffaf0; box-shadow: 0 0 0 1px #d6c9b4, 0 8px 18px #59422a21; }
.piece span { color: #2b443a; }
.birthday { background: #efdedc; }
dialog { overscroll-behavior: contain; }
body:has(dialog[open]) { overflow: hidden; }
#detail { padding-top: 58px; width: min(94vw, 780px); }
#detail .close-detail { position: absolute; top: 0; right: 12px; }
#detail .close-detail button { width: 40px; padding: 0; font-size: 25px; }
#detail .tools { align-items: center; justify-content: flex-start; gap: 8px 14px; }
#detail .tools button { min-height: 44px; margin: 0; }
#detail .tools a { padding-block: 9px; }
#letter {
  width: min(94vw, 1030px);
  max-width: none;
  padding: 0;
  border: 1px solid #d8ae79;
  border-radius: 5px;
  background: #fbf1e3;
}
#letter[open] { display: grid; grid-template-columns: minmax(0, 34%) minmax(0, 1fr); }
#letter::backdrop { background: #193b33f5; }
.letter-art {
  position: sticky;
  top: 0;
  height: min(93dvh, 960px);
  background: linear-gradient(155deg, #1b302417, #381c2740), url('assets/6295-1.webp') center / cover;
  border-right: 1px solid #bc9869;
}
.letter-paper {
  min-width: 0;
  padding: clamp(28px, 4.8vw, 64px);
  background:
    radial-gradient(ellipse at 5% 0%, #f5d5df, transparent 35%),
    radial-gradient(ellipse at 98% 96%, #dce9db, transparent 33%), #fbf1e3;
}
#letter .eyebrow { margin: 0 0 15px; color: #72354f; }
#letter h2 { font-family: var(--display); font-size: clamp(50px, 6.4vw, 86px); margin: 0 0 27px; color: var(--berry); }
#letter h2:after {
  content: '✦';
  display: block;
  margin-top: 16px;
  color: #9c6036;
  font: 24px Georgia, serif;
}
#letter article > p:not(.eyebrow) { font-family: var(--display); font-style: normal; line-height: 1.6; margin: 0 0 15px; }
#letter article > p:nth-last-of-type(4), #letter article > p:last-of-type { color: var(--berry); font-style: italic; }
#letter button { margin-top: 15px; border-radius: 26px; min-height: 48px; }
@media(max-width: 760px) {
  header { flex-wrap: wrap; gap: 0 12px; }
  .nav button { font-size: 12px; }
  
  
  
  #letter[open] { display: block; }
  .letter-art {
    position: static;
    height: clamp(68px, 20vw, 130px);
    background-position: center 68%;
    border: 0;
    border-bottom: 1px solid #bc9869;
  }
  #letter h2 { margin-bottom: 18px; }
}
/* Initial dialog focus is on the heading so the letter opens at the top. */
#letterTitle:focus { outline: none; }


/* The rendered room is the navigation surface. Links match visible objects. */
.studio {
  position: relative;
  background: #243e35;
  color: #fff4e4;
}
.studio-window {
  height: calc(100svh - 66px);
  min-height: 350px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  background: #4d4939;
}
.studio-window::-webkit-scrollbar { display: none; }
.studio-scene {
  position: relative;
  isolation: isolate;
  width: max(100%, calc((100svh - 66px) * 1.585));
  min-width: 555px;
}
.studio-scene picture, .studio-image { display: block; width: 100%; height: auto; }
.scene-link {
  position: absolute;
  display: block;
  z-index: 1;
  width: var(--object-width);
  height: var(--object-height);
  min-width: 44px;
  min-height: 44px;
  transform: translate(-50%, -50%);
  border-radius: var(--object-corners, 4px);
  cursor: zoom-in;
  transition: box-shadow .24s ease, background-color .24s ease;
  -webkit-tap-highlight-color: transparent;
}
.scene-link:hover { background: #ffdb9c21; box-shadow: 0 0 22px #ffcf874e, inset 0 0 18px #fff0c425; }
.scene-link:focus-visible { outline: 2px solid #fff5e5; outline-offset: 3px; box-shadow: 0 0 0 5px #30483c; }
.scene-paintings { left: var(--paint-x); top: calc(var(--paint-y) - 6%); --object-width: 20%; --object-height: 40%; }
.scene-portrait { left: 62%; top: 26.5%; --object-width: 15%; --object-height: 22%; }
.scene-leaf { left: 63.4%; top: 48%; --object-width: 10%; --object-height: 15%; }
.scene-jewelry { left: var(--jewel-x); top: calc(var(--jewel-y) - 5%); --object-width: 15%; --object-height: 31%; }
.scene-bench { left: var(--bench-x); top: calc(var(--bench-y) - 7%); --object-width: 14%; --object-height: 22%; }
.scene-envelope { left: var(--envelope-x); top: var(--envelope-y); --object-width: 7%; --object-height: 8%; --object-corners: 50%; z-index: 2; }
#studio-instructions {
  position: absolute;
  bottom: 0;
  left: 0;
  max-width: 100%;
  padding: 15px 24px 16px;
  color: #fff9ee;
  font-size: 13px;
  text-shadow: 0 1px 4px #1b231c;
  background: linear-gradient(90deg, #263b30e8, #263b307d 80%, transparent);
  pointer-events: none;
}
#studio-instructions span { display: none; }
#gallery h2:focus { outline: none; }
.sun-motes { position: absolute; inset: 8% 38% 38% 5%; pointer-events: none; }
.sun-motes i { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #ffffce; box-shadow: 0 0 5px #fffac1; opacity: 0; animation: drift 11s ease-in-out infinite; }
.sun-motes i:nth-child(1) { left: 23%; top: 40%; }
.sun-motes i:nth-child(2) { left: 35%; top: 71%; animation-delay: -3s; }
.sun-motes i:nth-child(3) { left: 52%; top: 46%; animation-delay: -7s; }
.sun-motes i:nth-child(4) { left: 67%; top: 19%; animation-delay: -4s; }
.sun-motes i:nth-child(5) { left: 79%; top: 67%; animation-delay: -9s; }
@keyframes drift { 45% { opacity: .62; } 100% { transform: translate(34px,-18px); } }
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .studio-scene { transform: translate(var(--pan-x, 0px), var(--pan-y, 0px)) scale(1.013); transition: transform .3s ease-out; }
  .sun-motes { transform: translateX(calc(var(--pan-x, 0px) * 1.5)); transition: transform .45s ease-out; }
}
.letter-art { box-shadow: inset -15px 0 30px #2a1f2a26; }
.gift-ribbon {
  position: absolute;
  inset: auto 0 16% 0;
  height: 32px;
  background: linear-gradient(0deg, #722644, #a64a67 42%, #cb7188 78%, #963851);
  border-block: 1px solid #e4a2ac;
  box-shadow: 0 4px 12px #3b142d6e;
}
.gift-ribbon::after {
  content: '✦';
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border: 2px solid #ffd0be;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 40% 34%, #bc607a, #7f2e4d);
  color: #ffebc8;
  font-size: 28px;
  box-shadow: 1px 4px 10px #3b142d6e;
}
@media (max-width: 900px) {
  #studio-instructions span { display: inline; }
}
@media (max-width: 720px) {
  .studio-window { height: calc(100svh - 102px); }
  .studio-scene { width: max(100%, calc((100svh - 102px) * 1.585)); }
  .letter-art { position: relative; }
  .gift-ribbon { height: 17px; bottom: 15%; }
  .gift-ribbon::after { width: 32px; height: 32px; font-size: 17px; }
}

/* Camera-space positions exported by the Blender scene. */
.studio-scene {
  --paint-x: 43.59%;
  --paint-y: 39.8%;
  --jewel-x: 85.96%;
  --jewel-y: 58.26%;
  --bench-x: 20.07%;
  --bench-y: 65.35%;
  --envelope-x: 9.1%;
  --envelope-y: 67.95%;
}
