:root {
  color-scheme: light;
  --paper: #f7f3f4;
  --card: #fcf9f9;
  --ink: #2d2632;
  --muted: #6b5b68;
  --line: #e5dbe1;
  --plum: #62374f;
  --plum-dark: #4d283e;
  --rose: #c89caa;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 0; }
body:has(.letter[open]) { overflow: hidden; }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 2px solid #925276;
  outline-offset: 4px;
}
h1, h2, p { margin: 0; }
h1, h2 { font-family: var(--serif); font-weight: 400; }
.svg-library { position: absolute; overflow: hidden; pointer-events: none; }

.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}

.wrap {
  width: min(100%, 72rem);
  margin-inline: auto;
  padding-inline: max(1rem, env(safe-area-inset-left)) max(1rem, env(safe-area-inset-right));
}

.site-header {
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid var(--line);
  background: #fbf7f8;
}

.header-inner {
  min-height: 4.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.brand { display: flex; align-items: center; gap: 0.65rem; }
.brand-mark, .section-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.4rem;
  aspect-ratio: 1;
  border-radius: 0.75rem;
  background: var(--plum);
  color: #f9dce4;
  font-size: 1.25rem;
}
.brand-name {
  font-family: var(--serif);
  font-size: 1.13rem;
  line-height: 1.12;
  letter-spacing: -0.03em;
}
.brand-name span {
  display: block;
  margin-top: 0.18rem;
  font-family: var(--sans);
  font-size: 0.75rem;
  letter-spacing: 0.015em;
  color: var(--muted);
}

.quiet-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 2.75rem;
  padding: 0.4rem 0.62rem;
  border: 1px solid var(--line);
  border-radius: 2rem;
  background: transparent;
  color: var(--plum-dark);
  font-size: 0.8rem;
  cursor: pointer;
}
.quiet-button:hover { background: #efe5ea; }

.preview-banner {
  margin-top: 0.65rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.76rem;
}

.hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  isolation: isolate;
  min-height: 20.5rem;
  margin-top: 1rem;
  border-radius: 1.25rem;
  padding: 1.5rem;
  color: #fff7f5;
  background-color: #222c45;
  background-image: linear-gradient(0deg, #17192bd9 0%, #20274069 60%, transparent 100%), url('/assets/winter.jpg');
  background-position: 66% center;
  background-size: cover;
  box-shadow: 0 0.5rem 1.7rem #241c3925;
}

.hero-copy { position: relative; z-index: 1; }
.hero-date {
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin-bottom: 0.75rem;
  color: #f5d5df;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.hero h1 {
  font-size: clamp(2.8rem, 10.5vw, 5.5rem);
  line-height: 0.97;
  letter-spacing: -0.067em;
}
.hero h1 em {
  display: block;
  color: #f1c6d4;
  font-weight: inherit;
  padding-right: 0.1em;
}
.hero-description { margin-top: 1rem; color: #f9eaf0; line-height: 1.5; }

.calendar { margin-top: 1.85rem; }
.section-heading { display: grid; gap: 0.85rem; margin-bottom: 1rem; }
.section-heading h2, .login h2 {
  font-size: clamp(1.85rem, 5.8vw, 2.65rem);
  line-height: 1.07;
  letter-spacing: -0.045em;
}
.section-heading p { margin-top: 0.4rem; line-height: 1.42; color: var(--muted); font-size: 0.91rem; }
.today-button {
  display: inline-flex;
  align-items: center;
  gap: 0.36rem;
  min-height: 2.75rem;
  padding: 0 0.25rem;
  border: 0;
  border-radius: 0.25rem;
  background: transparent;
  color: var(--plum-dark);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.today-button:hover span { text-decoration: underline; text-underline-offset: 0.2em; }

.progress {
  display: flex;
  align-items: center;
  gap: 0.63rem;
  color: var(--plum-dark);
  font-size: 0.8rem;
  white-space: nowrap;
}
progress {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 1 6rem;
  width: 6rem;
  height: 0.3rem;
  overflow: hidden;
  border: 0;
  border-radius: 1rem;
  background: #e8dbe2;
  color: #8b506d;
}
progress::-webkit-progress-bar { background: #e8dbe2; }
progress::-webkit-progress-value { background: #8b506d; border-radius: 1rem; transition: width 0.3s ease; }
progress::-moz-progress-bar { background: #8b506d; border-radius: 1rem; }

.doors {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.door {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  isolation: isolate;
  gap: 0.23rem;
  min-width: 0;
  min-height: 5.15rem;
  aspect-ratio: 1.06;
  border: 1px solid var(--line);
  border-radius: 0.78rem;
  padding: 0.9rem 0.15rem 0.45rem;
  background: var(--card);
  color: #746370;
  touch-action: manipulation;
  transition: background-color 0.2s, border-color 0.2s, transform 0.25s, box-shadow 0.25s;
}
.door-border {
  position: absolute;
  inset: 0.28rem;
  border: 1px solid currentColor;
  border-radius: 0.57rem;
  opacity: 0.15;
  pointer-events: none;
}
.door-icon { position: absolute; top: 0.48rem; right: 0.48rem; font-size: 0.82rem; }
.door-number { font-family: var(--serif); font-size: clamp(1.65rem, 7vw, 2.65rem); line-height: 1; letter-spacing: -0.06em; }
.door-label { font-size: 0.75rem; line-height: 1.2; letter-spacing: 0.005em; }

.door[data-state="available"] {
  color: #66334f;
  background: #f4e5ec;
  border-color: #dcbecf;
}
.door[data-state="opened"] { color: #6b4055; background: #f9edf1; border-color: #e2cbd5; }
.door[data-today="true"]:not([data-state="opened"]) {
  color: #fff1f5;
  background: linear-gradient(140deg, #78435e, #542a43);
  border-color: #63374f;
  box-shadow: 0 0.28rem 0.6rem #62374f37;
}
.door[data-today="true"] .door-border { opacity: 0.4; }
.door[aria-disabled="false"] { cursor: pointer; }
@media (hover: hover) {
  .door[aria-disabled="false"]:hover { transform: translateY(-0.16rem); box-shadow: 0 0.4rem 0.9rem #62374f21; }
}
.door[aria-disabled="false"]:active { transform: scale(0.97); }

.login {
  margin: 1.3rem auto 0;
  max-width: 30rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--card);
  padding: 1.2rem 1.2rem 1.4rem;
}
.section-mark { margin-bottom: 0.7rem; background: #f1e1e9; color: var(--plum); }
.login form { display: grid; gap: 0.65rem; margin-top: 1rem; }
.login label { font-size: 0.88rem; color: var(--muted); }
.login input {
  width: 100%;
  min-height: 2.9rem;
  padding: 0.58rem 0.8rem;
  border: 1px solid #cbb7c4;
  border-radius: 0.58rem;
  background: #fff;
  color: var(--ink);
  font-size: 1rem;
}
.button {
  min-height: 2.9rem;
  border: 1px solid transparent;
  border-radius: 0.58rem;
  padding: 0.6rem 1rem;
  background: var(--plum);
  color: white;
  cursor: pointer;
}
.button:hover { background: var(--plum-dark); }
.button:disabled { opacity: 0.66; cursor: wait; }
.feedback { color: #813950; font-size: 0.9rem; line-height: 1.45; }
main > .feedback { margin-top: 1.15rem; }
.retry { margin-top: 0.7rem; }

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem 1.2rem;
  margin-top: 1.7rem;
  padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.85rem;
}
.site-footer > span, .install-help summary { min-height: 2.75rem; display: flex; align-items: center; gap: 0.45rem; }
.site-footer .icon { color: var(--plum); }
.install-help { max-width: 22rem; }
.install-help summary { cursor: pointer; list-style: none; color: var(--plum-dark); }
.install-help summary::-webkit-details-marker { display: none; }
.install-help p { line-height: 1.55; margin-bottom: 0.65rem; }
@media (display-mode: standalone) { .install-help { display: none; } }

.letter {
  width: min(31rem, 100% - 2rem);
  max-height: calc(100% - max(2rem, env(safe-area-inset-top) + env(safe-area-inset-bottom)));
  margin: auto;
  padding: 0;
  border: 1px solid #d9c0cf;
  border-radius: 1.2rem;
  background: #fff9fa;
  color: var(--ink);
  box-shadow: 0 1.5rem 5rem #1c102e4d;
  overflow: auto;
  overscroll-behavior: contain;
}
.letter[open] { animation: letter-open 0.44s cubic-bezier(0.18, 0.8, 0.2, 1) both; }
.letter::backdrop { background: #24172cc2; animation: backdrop-in 0.25s ease both; }
.letter-interior {
  position: relative;
  margin: 0.48rem;
  padding: 2.15rem 1.1rem 1.5rem;
  border: 1px solid #ead9e2;
  border-radius: 0.85rem;
  text-align: center;
}
.close-button {
  position: absolute;
  top: 0.1rem;
  right: 0.1rem;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--plum);
  cursor: pointer;
}
.close-button:hover { background: #f0e4eb; }
.letter-decoration {
  display: grid;
  place-items: center;
  margin: 0 auto 0.95rem;
  width: 2.8rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #f1e2e9;
  color: var(--plum);
  font-size: 1.45rem;
}
.letter-date { color: var(--plum); font-size: 0.73rem; letter-spacing: 0.14em; text-transform: uppercase; }
.letter h2 { margin-top: 0.5rem; font-size: clamp(1.8rem, 7vw, 2.55rem); line-height: 1.11; letter-spacing: -0.04em; overflow-wrap: anywhere; }
.letter-body { margin: 0.9rem auto 0; max-width: 35ch; line-height: 1.65; color: #564351; white-space: pre-wrap; overflow-wrap: anywhere; }
.letter-signature { display: inline-block; margin-top: 1rem; color: var(--plum); }

@keyframes letter-open {
  from { opacity: 0; transform: translateY(1.1rem) scale(0.96) rotateX(-8deg); }
  to { opacity: 1; transform: translateY(0) scale(1) rotateX(0); }
}
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }

@media (min-width: 39rem) {
  .wrap { padding-inline: max(1.75rem, env(safe-area-inset-left)) max(1.75rem, env(safe-area-inset-right)); }
  .header-inner { min-height: 4.7rem; }
  .hero {
    align-items: center;
    min-height: 24rem;
    margin-top: 1.35rem;
    padding: 2.7rem 3rem;
    background-image: linear-gradient(90deg, #161b33b8, #181f3465 48%, transparent 82%), url('/assets/winter.jpg');
  }
  .hero-description { font-size: 1.08rem; }
  .section-heading { grid-template-columns: 1fr auto; align-items: end; }
  .progress { padding-bottom: 0.15rem; }
  .doors { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; }
  .door { aspect-ratio: 1.36; }
  .door-label { font-size: 0.75rem; }
  .door-icon { top: 0.62rem; right: 0.65rem; font-size: 0.95rem; }
  .login { padding: 1.5rem 1.8rem 1.8rem; }
  .letter-interior { padding: 2.2rem 2.3rem 1.9rem; }
}

@media (min-width: 57rem) {
  .hero { min-height: 25rem; margin-top: 1.5rem; padding-left: 3.6rem; }
  .calendar { margin-top: 2.3rem; }
  .doors { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.85rem; }
}

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