:root {
  color-scheme: light;
  font-family: Georgia, "KaiTi", "Noto Serif CJK SC", serif;
  background: #152a1e;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  display: grid;
  place-items: center;
  background: #14291d;
}

body[data-scene="cups"] { background: #263d2c; }
body[data-scene="cakes"] { background: #567686; }
body[data-scene$="-detail"] { background: #f1e8d6; }

#site {
  position: relative;
  width: min(100vw, 181.9253vh);
  width: min(100vw, 181.9253dvh);
}

.sound-toggle {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  z-index: 10;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 3px double #bca58e;
  border-radius: 50%;
  background: #fff;
  color: #713e33;
  box-shadow: 0 2px 6px #32180f40;
  cursor: pointer;
}

.sound-toggle svg { width: 22px; height: 22px; }
.sound-toggle:hover { color: #9a4034; }
.sound-toggle:focus-visible { outline: 2px solid #924c41; outline-offset: 2px; }
.sound-toggle[aria-pressed="true"] .sound-cross,
.sound-toggle[aria-pressed="false"] .sound-waves { display: none; }

.scene {
  position: relative;
  aspect-ratio: 926 / 509;
  container-type: inline-size;
  isolation: isolate;
  overflow: clip;
  background: #f4ead6 center / 100% 100% no-repeat;
  outline: none;
}

.scene.scene-outgoing {
  position: absolute;
  inset: 0 0 auto;
  pointer-events: none;
}

.scene-movers {
  position: absolute;
  inset: 0;
  z-index: 6;
  overflow: hidden;
  container-type: inline-size;
  pointer-events: none;
}

.scene-mover { position: absolute; transform-origin: 0 0; }
.scene-mover > [data-shared] {
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  filter: none;
}
.scene-shared-hidden { visibility: hidden; }

.placed { position: absolute; }

.cutout {
  position: absolute;
  display: block;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}

.cutout.placed { right: auto; bottom: auto; }
.cutout img { position: absolute; display: block; max-width: none; }

.hotspot {
  display: block;
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.hotspot:focus-visible, .project-link:focus-visible {
  outline: 2px solid #fff9e9;
  outline-offset: 3px;
  box-shadow: 0 0 0 5px #87473a;
  border-radius: 12px;
  z-index: 5;
}

.home-dessert-plate {
  top: 29%;
  height: 71%;
}

.home .hotspot, .cakes .hotspot, .cup {
  transition: filter 160ms ease;
}

.home .hotspot:hover, .cakes .hotspot:hover, .cup:hover {
  filter: brightness(1.06) drop-shadow(0 0 0.65cqw #fff5d171);
}

.home-title {
  margin: 0;
  display: grid;
  place-items: center;
  color: #941c15;
  font: italic 10.3cqw/.92 "Monotype Corsiva", "Palatino Linotype", Georgia, serif;
  letter-spacing: -0.046em;
  paint-order: stroke fill;
  -webkit-text-stroke: .32cqw #fff0ce;
  text-shadow: .12cqw .17cqw #b85a3c;
  user-select: none;
}

.home-subtitle, .home-byline {
  margin: 0;
  text-align: center;
  font: 0.83cqw/1.4 Arial, sans-serif;
  color: #8d5042;
  padding-top: .4cqw;
  pointer-events: none;
}

.tea-year {
  display: grid;
  place-content: center;
  text-align: center;
  white-space: pre-line;
  color: #aa342a;
  font: 700 1.13cqw/.95 Georgia, serif;
  pointer-events: none;
}

.title-letter { position: relative; }
.title-letter.replaced > .title-glyph { visibility: hidden; }
.title-letter > .hover-dessert {
  inset: auto;
  left: 50%;
  top: 53%;
  width: clamp(4.3cqw, 125%, 6.1cqw);
  height: 6.4cqw;
  translate: -50% -50%;
  visibility: hidden;
  z-index: 4;
  filter: drop-shadow(0 .22cqw .16cqw #68351b52);
}
.title-letter.replaced > .hover-dessert { visibility: visible; }

.script {
  font-family: "Monotype Corsiva", "Palatino Linotype", Georgia, serif;
  font-weight: 400;
  font-style: italic;
  color: #8a2718;
  line-height: .88;
  text-align: center;
  white-space: pre-line;
  pointer-events: none;
}

.cup-heading {
  display: grid;
  place-content: center;
  margin: 0;
  font-size: 4.65cqw;
}

.pot-label {
  position: absolute;
  left: 55.1%;
  top: 60.5%;
  width: 31%;
  font-size: 1.9cqw;
  translate: -50% -50%;
  rotate: -8deg;
  display: block;
}

.cup > .cutout:nth-child(2) {
  clip-path: ellipse(0% 0% at 40% 43%);
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .cup > .cutout { transition: translate .23s ease-out; }
  .cups:not(.pouring) .cup:hover > .cutout {
    translate: 0 -1.3cqw;
    transition-timing-function: cubic-bezier(.22, 1.45, .48, 1);
  }
}

.pouring .cup { pointer-events: none; }
.pour-pot {
  z-index: 3;
  pointer-events: none;
}

.cups:not(.pouring) > .pour-pot::before {
  content: "";
  position: absolute;
  inset: 0;
  /* Leave the transparent corner below the spout open to the cup handle. */
  clip-path: polygon(0 0, 100% 0, 100% 100%, 29% 100%, 21% 68%, 0 56%);
  pointer-events: auto;
}

.stream {
  clip-path: inset(0% 0% 100% 0%);
  filter: drop-shadow(.10cqw 0 0 #78945185);
  z-index: 2;
}

.tea-wipe {
  display: block;
  z-index: 6;
  background: #dbe2bf;
  border-radius: 50%;
  pointer-events: none;
}

.cake-label {
  position: absolute;
  left: 50%;
  top: 54%;
  width: 56%;
  translate: -50% -50%;
  font-size: 2.82cqw;
}

.cakes { background-repeat: repeat; background-size: 61% 61%; }
.cake-fork {
  clip-path: inset(var(--fork-depth, 0%) 0 0);
  z-index: 4;
}
.cake-fork-tip { clip-path: inset(0 0 calc(100% - var(--fork-depth, 0%)) 0); }
.tasting .cake-slice { pointer-events: none; }

.detail-pattern { background: center / auto 100% repeat-x; }
.cup-detail { color: #9a5953; }
.cake-detail { color: #2d4d3d; }
.cup-detail .detail-pattern { background-size: 179% 100%; }
.cake-detail .detail-pattern { background-size: 204% 100%; }

.detail-back {
  display: flex;
  align-items: center;
  gap: .38cqw;
  font-size: 2.35cqw;
  font-weight: 600;
  z-index: 4;
}

.detail-back .cutout { position: relative; width: 3.7cqw; height: 3.85cqw; }
.detail-back:hover, .project-link:hover { text-decoration: underline; }

.project-info { z-index: 2; overflow: auto; padding: .4cqw .5cqw .4cqw 0; }
.project-info h1 { margin: 0 0 2.35cqw; font-size: 3.55cqw; line-height: 1.2; font-weight: 600; }
.project-info h1 .cutout { position: relative; display: inline-block; width: 3.3cqw; height: 3.1cqw; margin-left: .7cqw; vertical-align: middle; }
.project-info p { margin: 0 0 2.25cqw; font-size: 1.9cqw; line-height: 1.5; white-space: pre-line; }
.project-info-english { font-family: "Times New Roman", Times, serif; }
.project-info-english h1 { margin-bottom: 1.05cqw; font-size: 2.8cqw; line-height: 1.08; font-weight: 700; }
.project-info-english h1 .cutout { width: 2.6cqw; height: 2.5cqw; margin-left: .45cqw; }
.project-info-english p { margin-bottom: 1.2cqw; font-size: 1.5cqw; line-height: 1.36; }
.project-info-english .project-subtitle { margin-bottom: 1.65cqw; font-size: 1.4cqw; line-height: 1.3; font-style: italic; }
.project-info-english strong { font-weight: 700; }
.project-info-english strong .emphasis-s {
  font-family: inherit;
  font-weight: 700;
  -webkit-text-stroke: .02em currentColor;
  paint-order: stroke fill;
}
.project-info-english p:last-child { margin-bottom: 0; }
.project-link { font-size: 1.9cqw; color: inherit; text-underline-offset: 0.3em; }
.project-display { margin: 0; }

.project-media {
  position: absolute;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(ellipse at 45% 28%, #503955, #281e39 80%);
  color: #f8eacb;
  inset: 9% 13.5% 10.1%;
}

.cake-detail .project-media {
  inset: 8.25% 3.25% 16.25%;
  color: #6b5039;
  background: radial-gradient(ellipse at 50% 25%, #f1dfb5, #cbab85 96%);
}

.project-media :is(video, img) { width: 100%; height: 100%; object-fit: cover; }
.project-media video { object-fit: contain; background: #181611; }
.project-media-bilibili { background: #181611; }
.project-media-bilibili iframe {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border: 0;
}
.preview-placeholder { font-size: 2.2cqw; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 620px) and (orientation: portrait) {
  body[data-scene$="-detail"] { display: block; }
  .scene:is(.cup-detail, .cake-detail) { min-height: 100dvh; aspect-ratio: auto; padding: 5vw; overflow: visible; }
  .scene:is(.cup-detail, .cake-detail) > .cutout { display: none; }
  .detail-pattern.placed { width: 100% !important; height: 47vw !important; left: 0 !important; top: 17vw !important; }
  .detail-back.placed, .project-info.placed, .project-display.placed {
    position: relative;
    inset: auto !important;
    width: 100% !important;
    height: auto !important;
    rotate: 0deg !important;
  }
  .detail-back { font-size: 21px; }
  .detail-back .cutout { width: 29px; height: 27px; }
  .project-display.placed { aspect-ratio: 1.73; margin-top: 7vw; }
  .cake-detail .project-display.placed { aspect-ratio: 1.43; }
  .project-info.placed { margin-top: 6vw; padding: 4vw 1vw; overflow: visible; }
  .project-info h1 { font-size: 28px; }
  .project-info h1 .cutout { width: 24px; height: 22px; }
  .project-info p, .project-link, .preview-placeholder { font-size: 16px; }
  .project-info-english h1 { margin-bottom: 12px; line-height: 1.15; }
  .project-info-english p { margin-bottom: 16px; line-height: 1.5; }
  .project-info-english .project-subtitle { margin-bottom: 20px; font-size: 15px; }
  .scene:is(.cup-detail, .cake-detail) { display: flex; flex-direction: column; }
  .project-display { order: 1; }
  .project-info { order: 2; }
}

body:has(> #site > .cake-detail-portrait:not(.scene-outgoing)) { display: grid; }

.scene.cake-detail-portrait {
  display: grid;
  grid-template-columns: 52% 48%;
  grid-template-rows: minmax(0, 1fr);
  width: 100%;
  min-height: 0;
  max-height: 100dvh;
  padding: 0;
  aspect-ratio: 4 / 3;
  overflow: clip;
}

.cake-detail-portrait .detail-back {
  position: absolute;
  top: min(2.5cqw, 2.2dvh, 26px);
  left: 2.5cqw;
  min-height: 32px;
  font-size: clamp(14px, 2.35cqw, 35px);
  gap: clamp(4px, .6cqw, 8px);
}

.cake-detail-portrait .detail-back .cutout {
  width: clamp(18px, 3.7cqw, 53px);
  height: clamp(18px, 3.85cqw, 55px);
}

.portrait-stage {
  display: grid;
  place-items: center;
}

.portrait-display {
  --portrait-tilt: -5deg;
  position: relative;
  width: min(30cqw, 42dvh);
  rotate: var(--portrait-tilt);
  isolation: isolate;
}

.portrait-lace {
  position: absolute;
  inset: -7% -15% -7.5% -18%;
  container-type: size;
  z-index: -1;
}

.portrait-lace .cutout {
  inset: 50% auto auto 50%;
  width: 100cqh;
  height: 100cqw;
  transform: translate(-50%, -50%) rotate(88deg);
}

.portrait-card {
  /* Straighten only the card and video within the tilted collage. */
  rotate: calc(0deg - var(--portrait-tilt));
  padding: 6% 6% 16.5%;
  border-radius: 2px;
  background: linear-gradient(145deg, #94703d22, transparent 46%, #f9e5bf4d), var(--portrait-paper) center / cover #f5e9ce;
  box-shadow: 0 5px 12px #56372132, inset 0 0 0 1px #9c7d4d35, inset 0 0 12px #b5915933;
}

.cake-detail-portrait .project-media {
  position: relative;
  inset: auto;
  aspect-ratio: 9 / 16;
  box-shadow: 0 1px 0 #fff8e4, inset 0 1px 6px #63462d35;
}

.cake-detail-portrait .project-media > :is(video, img, iframe) {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  aspect-ratio: 9 / 16;
}

.cake-detail-portrait .preview-placeholder {
  position: relative;
  padding: .32em;
  text-align: center;
  font-size: clamp(11px, 2cqw, 21px);
  pointer-events: none;
}

.cake-detail-portrait .project-media:has(> :is(video, iframe):not([hidden])) .preview-placeholder {
  background: #f1dfb5;
  border-radius: 2px;
}

.portrait-display > .cutout { width: 28%; }

.portrait-display .portrait-seal-sage {
  inset: -11.5% -12% auto auto;
  width: 27%;
  aspect-ratio: 819 / 836;
  rotate: 10deg;
}

.portrait-display .portrait-seal-pink {
  inset: auto auto -8% -10%;
  aspect-ratio: 868 / 851;
  rotate: -2deg;
}

.portrait-sidebar {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  isolation: isolate;
  padding: min(10cqw, 13dvh, 145px) 11% min(13cqw, 17dvh, 165px) 13%;
}

.cake-detail-portrait .portrait-sidebar .detail-pattern {
  position: absolute;
  inset: 0;
  z-index: -1;
  /* Start in the paper after the first double line, at the original stripe scale. */
  background-size: 178% 100%;
  background-position: 63.5% center;
  background-repeat: no-repeat;
  mask-image: linear-gradient(to right, transparent, #000 2cqw);
}

.portrait-sidebar .project-info { min-width: 0; overflow-wrap: anywhere; }
.portrait-sidebar .project-info h1 { font-size: clamp(16px, 3.55cqw, 56px); }
.portrait-sidebar :is(p, .project-link) { font-size: clamp(13px, 1.9cqw, 28px); }
.portrait-stars { position: absolute; inset: 0; pointer-events: none; }
.portrait-stars .cutout { aspect-ratio: 782 / 761; }
.portrait-stars .cutout:nth-child(1) { inset: 7% 12% auto auto; width: 11%; rotate: -14deg; }
.portrait-stars .cutout:nth-child(2) { inset: 17% 10% auto auto; width: 5%; rotate: 7deg; }
.portrait-stars .cutout:nth-child(3) { inset: auto auto 13% 12%; width: 8%; rotate: 14deg; }
.portrait-stars .cutout:nth-child(4) { inset: auto auto 10% 24%; width: 4%; rotate: -9deg; }
.portrait-stars .cutout:nth-child(5) { inset: auto 10% 10% auto; width: 16%; rotate: 12deg; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
