/*
 * Khulta — One Door Opens Every Day (Boyfriend Day family).
 * Warm plaster wall, teal-green doors, a rose glow behind today's door.
 * The doors are pure CSS (borders, gradients, a radial-gradient knob) —
 * nothing rasterised. Fraunces for the numerals and titles, Inter for UI.
 */
:root {
  --wall: #F6E7D7;
  --wall-2: #EFD9C4;
  --teal: #3F7D6B;
  --teal-dark: #2F6353;
  --teal-light: #5A9885;
  --rose: #E0457B;
  --ink: #2B2118;
  --muted: #7B6A5B;
  --brass: #C9A15A;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --gutter: clamp(18px, 5vw, 40px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100svh;
  font-family: var(--sans); color: var(--ink);
  background: radial-gradient(120% 80% at 30% 0%, #FBF1E6 0%, var(--wall) 45%, var(--wall-2) 100%);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
body.kh-noscroll { overflow: hidden; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--rose); outline-offset: 3px; }

/* soft window light across the plaster */
.kh-light {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, .0) 30%, rgba(255, 250, 240, .45) 38%, rgba(255, 255, 255, 0) 46%),
    linear-gradient(115deg, rgba(255, 255, 255, .0) 50%, rgba(255, 250, 240, .3) 56%, rgba(255, 255, 255, 0) 62%);
}

.kh-wall { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; padding: clamp(40px, 9vw, 72px) var(--gutter) 48px; text-align: center; }

/* ================= head + the big heart ================= */
.kh-bigheart { position: relative; width: 58px; height: 58px; margin: 0 auto 10px; }
.kh-bigheart svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.kh-bigheart__line path { fill: rgba(255, 255, 255, .5); stroke: var(--rose); stroke-width: 1.4; }
.kh-bigheart__fill path { fill: var(--rose); }
.kh-bigheart__fill { clip-path: inset(calc((1 - var(--fill)) * 100%) 0 0 0); transition: clip-path .9s var(--ease); }
.kh-bigheart.is-full { animation: kh-throb 1.6s ease-in-out 2; }
@keyframes kh-throb { 0%, 100% { transform: scale(1); } 20% { transform: scale(1.14); } 40% { transform: scale(.98); } 60% { transform: scale(1.08); } }

.kh-title {
  margin: 0; font-family: var(--serif); font-weight: 600; font-size: clamp(3.2rem, 15vw, 5.6rem); line-height: .95;
  letter-spacing: -.02em; color: var(--ink); font-variation-settings: 'opsz' 144;
}
.kh-sub { margin: 10px 0 0; font-size: .74rem; font-weight: 600; letter-spacing: .28em; text-transform: uppercase; color: var(--muted); }
.kh-sub em { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 1.25rem; letter-spacing: 0; text-transform: none; color: var(--teal-dark); }
.kh-status { margin: 16px auto 0; max-width: 32ch; font-family: var(--serif); font-style: italic; font-size: 1.08rem; color: var(--ink); min-height: 1.5em; }

/* ================= preview strip ================= */
.kh-sim {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; align-items: center;
  margin: 22px auto 0; padding: 8px; border-radius: 14px; background: rgba(43, 33, 24, .06); max-width: 560px;
}
.kh-sim span { font-size: .66rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
.kh-sim button {
  appearance: none; border: 1px solid rgba(43, 33, 24, .14); background: #fff8f0; border-radius: 999px;
  padding: 6px 11px; font-size: .74rem; cursor: pointer; min-height: 32px;
}
.kh-sim button[aria-pressed="true"] { background: var(--teal); color: #fff; border-color: var(--teal); }

/* ================= the doors ================= */
.kh-doors {
  list-style: none; margin: clamp(30px, 7vw, 48px) auto 0; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(14px, 3.6vw, 26px) clamp(10px, 3vw, 22px);
  max-width: 640px;
}
.kh-cell { flex: 0 0 calc((100% - 3 * clamp(10px, 3vw, 22px)) / 4); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.kh-door {
  appearance: none; border: 0; padding: 0; background: none; cursor: pointer; width: 100%;
  -webkit-tap-highlight-color: transparent;
}
.kh-cell[data-state="locked"] .kh-door { cursor: not-allowed; }

.kh-frame {
  position: relative; display: block; width: 100%; aspect-ratio: 3 / 4;
  border-radius: 5px; perspective: 700px;
  /* the doorframe: a moulded border, the wall's shadow under it */
  background: #3B2A22;
  box-shadow:
    0 0 0 4px #E9D3BC, 0 0 0 5px rgba(43, 33, 24, .14),
    0 10px 18px -10px rgba(43, 33, 24, .45);
  transition: transform 120ms ease-out, box-shadow 120ms ease-out;
}
/* 1 · the 120ms shadow lift */
.kh-cell.is-lifting .kh-frame, .kh-cell.is-open .kh-frame {
  transform: translateY(-3px);
  box-shadow:
    0 0 0 4px #EDD8C2, 0 0 0 5px rgba(43, 33, 24, .12),
    0 18px 26px -12px rgba(43, 33, 24, .5);
}
.kh-inside {
  position: absolute; inset: 0; border-radius: 3px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(90% 80% at 40% 50%, #FF9DBC 0%, var(--rose) 45%, #9C2A5C 100%);
}
.kh-inside__heart { width: 38%; height: 38%; }
.kh-inside__heart path { fill: rgba(255, 255, 255, .9); }

/* 2 · the leaf: rotateY on its left hinge, 700ms */
.kh-leaf {
  position: absolute; inset: 0; border-radius: 3px;
  transform-origin: left center; transform-style: preserve-3d;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, .12), rgba(0, 0, 0, 0) 12%, rgba(255, 255, 255, .06) 60%, rgba(0, 0, 0, .1)),
    linear-gradient(180deg, var(--teal-light), var(--teal) 40%, var(--teal-dark));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18), inset 0 2px 0 rgba(255, 255, 255, .12);
  transition: transform 700ms cubic-bezier(.3, .7, .2, 1), filter .3s;
}
.kh-cell.is-open .kh-leaf { transform: rotateY(-106deg); }
/* hinges */
.kh-leaf::before, .kh-leaf::after {
  content: ''; position: absolute; left: -1px; width: 4px; height: 12%; border-radius: 1px;
  background: linear-gradient(90deg, #8C6E3C, var(--brass), #8C6E3C);
}
.kh-leaf::before { top: 12%; }
.kh-leaf::after { bottom: 12%; }
.kh-panel {
  position: absolute; inset: 12% 14%; border-radius: 2px;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .16), inset 2px 2px 0 2px rgba(255, 255, 255, .08), 1px 1px 0 rgba(255, 255, 255, .08);
}
.kh-numeral {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 500; font-size: clamp(1.5rem, 7vw, 2.6rem); color: #F1D9B5;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .25); font-variation-settings: 'opsz' 72;
}
.kh-knob {
  position: absolute; right: 12%; top: 50%; width: 11%; aspect-ratio: 1; border-radius: 50%; transform: translateY(-50%);
  background: radial-gradient(circle at 35% 30%, #F4DDA8 0%, var(--brass) 45%, #7A5A2A 100%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

/* the little heart on the lintel — fills once that door has been opened */
.kh-mark { position: absolute; left: 50%; top: -17px; width: 14px; height: 14px; transform: translateX(-50%); }
.kh-mark svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.kh-mark__line path { fill: none; stroke: rgba(156, 42, 92, .5); stroke-width: 2; }
.kh-mark__fill path { fill: var(--rose); }
.kh-mark__fill { opacity: 0; transform: scale(.4); transition: opacity .4s var(--ease) .6s, transform .5s var(--ease) .6s; }
.kh-cell.is-open .kh-mark__fill { opacity: 1; transform: none; }

/* today: the only glowing door */
.kh-cell[data-state="today"]:not(.is-open) .kh-frame { animation: kh-glow 2.4s ease-in-out infinite; }
@keyframes kh-glow {
  0%, 100% { box-shadow: 0 0 0 4px #E9D3BC, 0 0 0 5px rgba(43, 33, 24, .14), 0 10px 18px -10px rgba(43, 33, 24, .45), 0 0 18px 2px rgba(224, 69, 123, .35); }
  50% { box-shadow: 0 0 0 4px #F3D6D9, 0 0 0 5px rgba(224, 69, 123, .4), 0 10px 18px -10px rgba(43, 33, 24, .45), 0 0 34px 8px rgba(224, 69, 123, .5); }
}
.kh-cell[data-state="locked"] .kh-leaf { filter: saturate(.55) brightness(.94); }
.kh-cell.is-nope .kh-frame { animation: kh-nope .42s ease-in-out; }
@keyframes kh-nope { 20% { transform: translateX(-3px); } 40% { transform: translateX(3px); } 60% { transform: translateX(-2px); } 80% { transform: translateX(1px); } }

.kh-when {
  font-size: .64rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  min-height: 1.2em; line-height: 1.25;
}
.kh-cell[data-state="today"] .kh-when { color: var(--rose); }
.kh-cell.is-open .kh-when { color: var(--teal-dark); }

/* ================= the full heart ================= */
.kh-full {
  margin: 40px auto 0; max-width: 460px; padding: 28px 22px; border-radius: 20px;
  background: rgba(255, 250, 244, .75); box-shadow: 0 20px 40px -30px rgba(43, 33, 24, .5);
}
.kh-full h2 { margin: 0 0 8px; font-family: var(--serif); font-weight: 500; font-size: 1.6rem; color: var(--ink); }
.kh-full p { margin: 0 0 18px; color: var(--muted); font-family: var(--serif); font-style: italic; }
.kh-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 13px 24px;
  border-radius: 999px; border: 0; cursor: pointer; text-decoration: none;
  background: var(--teal); color: #fff; font-weight: 600; font-size: .95rem;
}
.kh-btn--rose { background: var(--rose); box-shadow: 0 14px 30px -14px rgba(224, 69, 123, .8); }

.kh-foot { margin: 48px 0 0; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.kh-foot a { color: var(--teal-dark); text-decoration: none; border-bottom: 1px solid rgba(47, 99, 83, .35); }

/* ================= the surprise sheet ================= */
.kh-sheet {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(43, 33, 24, .45); padding: 0;
  opacity: 0; transition: opacity .3s var(--ease);
}
.kh-sheet[hidden] { display: none; }
.kh-sheet.is-shown { opacity: 1; }
.kh-sheet__card {
  position: relative; width: 100%; max-width: 560px; max-height: 88vh; max-height: 88svh; overflow-y: auto;
  background: #FFFBF6; border-radius: 22px 22px 0 0; padding: 34px var(--gutter) max(34px, env(safe-area-inset-bottom));
  box-shadow: 0 -20px 50px -20px rgba(43, 33, 24, .5); text-align: left;
  transform: translateY(24px); transition: transform .4s var(--ease);
  overscroll-behavior: contain;
}
.kh-sheet.is-shown .kh-sheet__card { transform: none; }
.kh-sheet__card:focus { outline: none; }
@media (min-width: 640px) {
  .kh-sheet { align-items: center; padding: 24px; }
  .kh-sheet__card { border-radius: 22px; }
}
.kh-close {
  position: absolute; right: 12px; top: 10px; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(43, 33, 24, .06); font-size: 1.6rem; line-height: 1; color: var(--ink);
}
.kh-surprise__day { margin: 0 0 6px; font-size: .66rem; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--rose); }
.kh-surprise h2 { margin: 0 44px 18px 0; font-family: var(--serif); font-weight: 500; font-size: clamp(1.7rem, 6vw, 2.2rem); line-height: 1.12; color: var(--ink); }
.kh-letter p { margin: 0 0 1em; font-family: var(--serif); font-style: italic; font-weight: 300; font-size: 1.15rem; line-height: 1.7; color: #3A2E26; overflow-wrap: anywhere; }
.kh-sign { margin: 8px 0 0; text-align: right; font-family: var(--serif); font-style: italic; font-size: 1.25rem; color: var(--teal-dark); }

.kh-photo { margin: 0; }
.kh-photo img, .kh-photo__ph { width: 100%; border-radius: 14px; aspect-ratio: 4 / 5; object-fit: cover; }
.kh-photo__ph { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #F7D6E0, #E9A8BE); }
.kh-ph-heart { width: 56px; height: 56px; }
.kh-ph-heart path { fill: rgba(255, 255, 255, .75); }
.kh-photo figcaption { margin-top: 14px; font-family: var(--serif); font-style: italic; font-size: 1.12rem; line-height: 1.5; color: #3A2E26; }

.kh-voice {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 26px 26px 26px 8px;
  background: #DCF3E9; box-shadow: 0 1px 1px rgba(0, 0, 0, .06);
}
.kh-voice__play { flex: none; width: 0; height: 0; border-left: 13px solid var(--teal-dark); border-top: 8px solid transparent; border-bottom: 8px solid transparent; margin-left: 4px; }
.kh-voice__wave { flex: 1; display: flex; align-items: center; gap: 2px; height: 30px; }
.kh-voice__wave i { flex: 1; height: var(--h); border-radius: 2px; background: var(--teal); opacity: .75; animation: kh-wave 1.1s ease-in-out infinite; }
.kh-voice__wave i:nth-child(3n) { animation-delay: .2s; }
.kh-voice__wave i:nth-child(3n + 1) { animation-delay: .45s; }
@keyframes kh-wave { 50% { transform: scaleY(.55); } }
.kh-voice__time { flex: none; font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.kh-voice__text { margin: 16px 0 0; font-size: 1rem; line-height: 1.65; color: #3A2E26; overflow-wrap: anywhere; }
.kh-voice__text::before { content: 'Transcript'; display: block; font-size: .62rem; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }

.kh-song { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 16px; }
.kh-song__disc {
  width: 140px; height: 140px; border-radius: 50%;
  background: radial-gradient(circle, var(--rose) 0 16%, #111 17% 19%, #262626 20% 30%, #1a1a1a 31% 33%, #2b2b2b 34% 62%, #151515 63% 100%);
  box-shadow: 0 16px 30px -14px rgba(0, 0, 0, .6); animation: kh-spin 5s linear infinite;
}
@keyframes kh-spin { to { transform: rotate(360deg); } }
.kh-song p { margin: 0; font-family: var(--serif); font-style: italic; font-size: 1.15rem; line-height: 1.55; overflow-wrap: anywhere; }

/* inline song player — YouTube links play right here, never a redirect */
.kh-songplay {
  position: relative; display: flex; align-items: center; justify-content: center; width: 100%;
  aspect-ratio: 16 / 9; padding: 0; border: 0; border-radius: 12px; overflow: hidden; cursor: pointer;
  background: linear-gradient(160deg, #2E4A44 0%, #1E332E 70%);
}
.kh-songplay__frame, .kh-songplay .song-play__frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.kh-songplay__frame iframe, .kh-songplay .song-play__frame iframe { width: 100%; height: 100%; border: 0; }
.kh-songplay__cue { position: relative; z-index: 1; font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; color: #fff; }
.kh-songplay.is-playing .kh-songplay__cue, .kh-songplay.is-playing .song-play__cue { display: none; }

.kh-promise {
  margin: 0; padding: 8px 0 0; font-family: var(--serif); font-weight: 400; font-size: clamp(1.6rem, 6.5vw, 2.2rem); line-height: 1.25;
  color: var(--teal-dark); overflow-wrap: anywhere;
}
.kh-promise::before { content: '“'; display: block; font-size: 3.4rem; line-height: .6; color: var(--rose); }

/* ================= small screens ================= */
@media (max-width: 380px) {
  .kh-when { font-size: .56rem; letter-spacing: .06em; }
}

/* ================= reduced motion ================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; transition-delay: 0s !important; }
}

/* the back of an opened leaf: plain painted wood, no mirrored numeral */
.kh-numeral, .kh-knob, .kh-panel { backface-visibility: hidden; -webkit-backface-visibility: hidden; }

/* focus moved here by script (headings, the promise, the sheet) — no ring */
[tabindex="-1"]:focus { outline: none; }
.kh-photo--extra { margin-bottom: 18px; }
.kh-photo--extra img { aspect-ratio: 4 / 3; }
