:root {
  color-scheme: light;
  --font-ui:
    "Avenir Next", "Segoe UI", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    sans-serif;
  --font-display:
    "Iowan Old Style", "Palatino Linotype", "Book Antiqua", ui-serif, Georgia, serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font: 14px/1.5 var(--font-ui);
  background:
    radial-gradient(circle at top left, #f4efe1 0, transparent 34%),
    linear-gradient(180deg, #fbf7ef 0%, #f1ebdd 100%);
  color: #2e2416;
}

body.is-modal-open {
  overflow: hidden;
}

a {
  color: #7f4f24;
}

.page {
  min-height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(46, 36, 22, 0.12);
  background: rgba(255, 250, 242, 0.78);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.masthead {
  display: grid;
  gap: 8px;
}

.title {
  margin: 0;
  font-size: 18px;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.015em;
}

.page-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.page-nav__link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  color: #55371a;
  background: rgba(255, 250, 242, 0.75);
  text-decoration: none;
}

.page-nav__link--current {
  background: #7f4f24;
  color: #fffaf5;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.language-picker {
  display: inline-grid;
  gap: 4px;
  align-items: start;
}

.language-picker__label {
  color: #70563a;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.language-picker__select {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(127, 79, 36, 0.18);
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.9);
  color: #55371a;
  font: inherit;
}

.btn {
  appearance: none;
  border: 1px solid rgba(127, 79, 36, 0.18);
  background: #7f4f24;
  color: #fffaf5;
  padding: 9px 12px;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  transition:
    transform 120ms ease,
    opacity 120ms ease,
    background 120ms ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--secondary {
  background: rgba(255, 250, 242, 0.82);
  color: #55371a;
}

.btn--danger {
  background: #aa3a2a;
  color: #fff5f2;
}

.content {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
  display: grid;
  gap: 18px;
}

.status,
.photo,
.album {
  border: 1px solid rgba(46, 36, 22, 0.12);
  border-radius: 22px;
  background: rgba(255, 252, 247, 0.84);
  box-shadow: 0 18px 40px rgba(76, 54, 29, 0.08);
}

.status {
  padding: 14px 16px;
}

.status p {
  margin: 0;
}

.status p + p {
  margin-top: 10px;
}

.status pre {
  margin: 12px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.photo {
  margin: 0;
  overflow: hidden;
}

.photo img {
  display: block;
  width: 100%;
  max-height: min(70vh, 760px);
  object-fit: contain;
  background: #ece2d1;
}

.photo__caption {
  padding: 14px 16px 18px;
  color: #634525;
  word-break: break-word;
}

#caption {
  padding: 14px 16px 18px;
  color: #634525;
  word-break: break-word;
}

.album {
  padding: 18px;
}

.card-stage {
  display: grid;
  gap: 18px;
}

.card-stage__meta {
  display: grid;
  gap: 8px;
}

.card-stage__eyebrow {
  margin: 0;
  color: #7f4f24;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-stage__title {
  margin: 0;
  font-size: clamp(26px, 4vw, 44px);
  line-height: 1.05;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.card-stage__summary,
.card-stage__caption {
  margin: 0;
  color: #634525;
}

.card-scene {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 62vh;
  perspective: 1600px;
}

.countdown-card {
  position: relative;
  z-index: 1;
  width: min(78vw, 620px);
  aspect-ratio: var(--card-ratio-number, 5 / 7);
  transform-style: preserve-3d;
  transform-origin: center center;
  filter: drop-shadow(0 20px 50px rgba(57, 37, 18, 0.22));
  will-change: transform;
}

.countdown-card__face {
  position: absolute;
  inset: 0;
  display: grid;
  border-radius: 28px;
  overflow: hidden;
  transform-style: preserve-3d;
  outline: 1px solid transparent;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
  opacity: 0;
  visibility: hidden;
}

.countdown-card__face::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transform: translateZ(1px);
}

.countdown-card__face--back {
  z-index: 1;
  transform: rotateY(0deg) translateZ(0.5px);
  padding: 0;
  background:
    radial-gradient(circle at top left, rgba(255, 225, 181, 0.9) 0, transparent 28%),
    linear-gradient(180deg, #7f4f24 0%, #55371a 100%);
  color: #fff6ec;
}

.countdown-card__mosaic {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--mosaic-columns, 4), minmax(0, 1fr));
  grid-template-rows: repeat(var(--mosaic-rows, 4), minmax(0, 1fr));
  gap: 0;
  width: 100%;
  height: 100%;
  transform: translateZ(1px);
}

.countdown-card__mosaic-tile {
  display: block;
  background-color: rgba(255, 248, 236, 0.2);
}

.countdown-card__face--front {
  z-index: 2;
  transform: rotateY(180deg) translateZ(0.5px);
  background: #120d08;
}

.countdown-card__face--front img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #120d08;
  transform: translateZ(0);
}

.countdown-card--show-back .countdown-card__face--back,
.countdown-card--show-front .countdown-card__face--front {
  opacity: 1;
  visibility: visible;
}

.countdown-card__label {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.82;
}

.countdown-card__countdown {
  margin: 0;
  font-size: clamp(26px, 4vw, 42px);
  font-weight: 700;
}

.viewport-timer {
  position: fixed;
  right: 24px;
  bottom: 40px;
  z-index: 30;
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(34, 23, 12, 0.84);
  color: #fff8f1;
  box-shadow: 0 18px 40px rgba(32, 20, 8, 0.28);
  backdrop-filter: blur(12px);
}

.viewport-timer__label {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.8;
}

.viewport-timer__title {
  display: none;
  margin: 0 0 4px;
  font-size: clamp(18px, 2.6vw, 34px);
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 0.98;
  text-wrap: balance;
}

.viewport-timer__title:empty {
  display: none;
}

.viewport-timer__value {
  margin: 0;
  font-size: clamp(24px, 4vw, 42px);
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
}

.viewport-anniversary {
  position: fixed;
  left: 24px;
  bottom: 40px;
  z-index: 30;
  display: none;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(34, 23, 12, 0.84);
  color: #fff8f1;
  box-shadow: 0 18px 40px rgba(32, 20, 8, 0.28);
  backdrop-filter: blur(12px);
}

.viewport-anniversary__value {
  margin: 0;
  font-size: clamp(13px, 1.7vw, 20px);
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.015em;
}

.viewport-progress {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 29;
  height: 12px;
  background: rgba(34, 23, 12, 0.18);
}

.viewport-progress__fill {
  width: 100%;
  height: 100%;
  transform-origin: left center;
  background: var(--viewport-progress-color, #d08b52);
  box-shadow: 0 0 24px var(--viewport-progress-glow, rgba(208, 139, 82, 0.35));
}

.spotlight {
  display: grid;
  gap: 18px;
}

.spotlight__meta {
  padding: 22px 22px 0;
}

.spotlight__eyebrow {
  margin: 0 0 8px;
  color: #7f4f24;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.spotlight__title {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}

.spotlight__summary {
  margin: 10px 0 0;
  max-width: 70ch;
  color: #634525;
}

.spotlight__countdown-label {
  margin: 18px 0 0;
  color: #7f4f24;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.spotlight__countdown {
  margin: 6px 0 0;
  font-size: clamp(24px, 5vw, 42px);
  font-weight: 700;
  line-height: 1;
}

.photo--spotlight {
  margin-top: 0;
  position: relative;
}

.photo--spotlight .photo__caption {
  font-size: 14px;
  font-weight: 600;
}

.album__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.album__title {
  margin: 0;
  font-size: 16px;
}

.album__hint {
  margin: 0;
  color: #70563a;
  font-size: 12px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.gallery-empty {
  margin: 0;
  padding: 18px;
  border-radius: 16px;
  background: rgba(236, 226, 209, 0.6);
  color: #634525;
}

.album-card {
  display: grid;
  gap: 10px;
  padding: 10px;
  border-radius: 18px;
  border: 1px solid rgba(46, 36, 22, 0.1);
  background: #fffdfa;
}

.album-card--active {
  border-color: rgba(170, 58, 42, 0.45);
  box-shadow: 0 14px 30px rgba(170, 58, 42, 0.16);
}

.album-card__image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 260px;
  object-fit: contain;
  border-radius: 14px;
  background: #ece2d1;
}

.album-card__meta {
  display: grid;
  gap: 8px;
}

.album-card__title {
  font-weight: 600;
  word-break: break-word;
}

.album-card__badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(170, 58, 42, 0.12);
  color: #8b2f22;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}

.album-card__details {
  color: #70563a;
  font-size: 12px;
}

.album-card__countdown {
  color: #7f4f24;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.album-card__title-input {
  width: 100%;
  border: 1px solid rgba(127, 79, 36, 0.18);
  border-radius: 10px;
  background: rgba(255, 250, 242, 0.9);
  color: #2e2416;
  padding: 8px 10px;
  font: inherit;
}

.album-card__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.photo-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
}

.photo-modal[hidden] {
  display: none;
}

.photo-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 16, 8, 0.76);
  backdrop-filter: blur(10px);
}

.photo-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 980px);
  max-height: calc(100vh - 48px);
  display: grid;
  gap: 12px;
}

.photo-modal__close {
  justify-self: end;
}

.photo-modal__figure {
  margin: 0;
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(255, 245, 232, 0.14);
  border-radius: 28px;
  background: rgba(39, 25, 12, 0.88);
  box-shadow: 0 24px 60px rgba(24, 14, 7, 0.36);
}

.photo-modal__figure img {
  display: block;
  width: 100%;
  max-height: calc(100vh - 180px);
  object-fit: contain;
  border-radius: 18px;
  background: #1a120b;
}

.photo-modal__caption {
  display: grid;
  gap: 6px;
  color: #fff6ec;
}

.photo-modal__title,
.photo-modal__details {
  margin: 0;
}

.photo-modal__title {
  font-family: var(--font-display);
  font-size: clamp(24px, 3vw, 38px);
  font-weight: 600;
  line-height: 1.02;
}

.photo-modal__details {
  color: rgba(255, 246, 236, 0.82);
}

.footer {
  padding: 14px 20px 18px;
  border-top: 1px solid rgba(46, 36, 22, 0.12);
}

.footnote {
  margin: 0;
  color: #70563a;
  font-size: 12px;
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .masthead {
    width: 100%;
  }

  .actions {
    justify-content: flex-start;
  }

  .content {
    width: min(100%, calc(100% - 24px));
    padding-top: 16px;
  }

  .album__header {
    align-items: flex-start;
    flex-direction: column;
  }

  .photo-modal {
    padding: 14px;
  }

  .photo-modal__dialog {
    max-height: calc(100vh - 28px);
  }

  .photo-modal__figure {
    padding: 12px;
    border-radius: 20px;
  }

  .photo-modal__figure img {
    max-height: calc(100vh - 150px);
    border-radius: 14px;
  }

  .spotlight__meta {
    padding: 18px 18px 0;
  }

  .spotlight__title {
    font-size: 22px;
  }

  .card-scene {
    min-height: 46vh;
  }

  .countdown-card {
    width: min(92vw, 420px);
  }

  .viewport-timer {
    right: 16px;
    bottom: 30px;
    padding: 12px 14px;
  }

  .viewport-anniversary {
    left: 16px;
    bottom: 30px;
    padding: 12px 14px;
  }
}

body.is-fullscreen .card-stage__meta,
body.is-fullscreen .card-stage__caption,
body.card-page .card-stage__meta,
body.card-page .card-stage__caption {
  display: none;
}

body.is-fullscreen .card-stage {
  width: 100%;
  min-height: 100dvh;
  align-content: center;
}

body.card-page .card-stage {
  width: 100%;
  min-height: calc(100dvh - var(--card-topbar-height, 84px));
  align-content: center;
}

body.is-fullscreen .card-scene {
  min-height: 100dvh;
  width: 100%;
  padding: 24px;
}

body.card-page .card-scene {
  min-height: calc(100dvh - var(--card-topbar-height, 84px));
  width: 100%;
  padding: 24px;
}

body.is-fullscreen .countdown-card {
  width: min(
    calc(100dvw - 48px),
    calc((100dvh - 48px) * var(--card-ratio-number, 0.7142857))
  );
  max-width: none;
}

body.card-page .countdown-card {
  width: min(
    calc(100dvw - 48px),
    calc((100dvh - var(--card-topbar-height, 84px) - 48px) * var(--card-ratio-number, 0.7142857))
  );
  max-width: none;
}

body.is-fullscreen .countdown-card__face--front img,
body.card-page .countdown-card__face--front img {
  object-fit: contain;
  background: #000;
}

body.is-fullscreen .viewport-timer,
body.card-page .viewport-timer {
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
}

body.is-fullscreen .viewport-timer__title,
body.card-page .viewport-timer__title {
  display: block;
}

body.is-fullscreen .viewport-anniversary,
body.card-page .viewport-anniversary {
  display: block;
}

body.is-fullscreen .viewport-progress,
body.card-page .viewport-progress {
  background: rgba(255, 255, 255, 0.12);
}

@media (max-width: 720px) {
  body.is-fullscreen .card-scene,
  body.card-page .card-scene {
    padding: 16px;
  }

  body.is-fullscreen .countdown-card {
    width: min(
      calc(100dvw - 32px),
      calc((100dvh - 32px) * var(--card-ratio-number, 0.7142857))
    );
  }

  body.card-page .countdown-card {
    width: min(
      calc(100dvw - 32px),
      calc((100dvh - var(--card-topbar-height, 84px) - 32px) * var(--card-ratio-number, 0.7142857))
    );
  }
}

body.is-fullscreen {
  background: #000;
  color: #fff;
}

body.card-page {
  background: #000;
  color: #fff;
}

body.card-page .topbar {
  border-bottom-color: rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.82);
}

body.card-page .title {
  color: #fff;
}

body.card-page .page-nav__link {
  color: #f3e6d3;
  background: rgba(255, 255, 255, 0.08);
}

body.card-page .page-nav__link--current {
  background: #f3e6d3;
  color: #1b1208;
}

body.card-page .btn {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

body.card-page .btn--secondary {
  background: rgba(255, 255, 255, 0.12);
}

body.is-fullscreen .topbar,
body.is-fullscreen .status,
body.is-fullscreen .footer,
body.card-page .status,
body.card-page .footer {
  display: none;
}

body.is-fullscreen .page,
body.card-page .page {
  min-height: 100dvh;
}

body.is-fullscreen .page {
  grid-template-rows: 1fr;
}

body.card-page .page {
  grid-template-rows: auto 1fr;
}

body.is-fullscreen .content,
body.card-page .content {
  width: 100%;
  margin: 0;
  padding: 0;
}

body.is-fullscreen .spotlight {
  position: relative;
  min-height: 100dvh;
  gap: 0;
}

body.is-fullscreen .photo--spotlight {
  height: 100vh;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: #000;
}

body.is-fullscreen .photo--spotlight img {
  width: 100vw;
  height: 100vh;
  max-height: none;
  object-fit: contain;
  background: #000;
}

body.is-fullscreen .spotlight__meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 24px;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.78) 38%, rgba(0, 0, 0, 0.94) 100%);
}

body.is-fullscreen .spotlight__eyebrow,
body.is-fullscreen .spotlight__summary,
body.is-fullscreen .spotlight__countdown-label {
  display: none;
}

body.is-fullscreen .spotlight__title {
  display: block;
  margin: 0 0 12px;
  color: #fff;
  font-size: clamp(36px, 8vw, 88px);
  line-height: 0.95;
  text-wrap: balance;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
}

body.is-fullscreen .spotlight__countdown {
  margin-top: 0;
  color: #fff;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
}

body.is-fullscreen .photo--spotlight .photo__caption {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 96px;
  z-index: 2;
  padding: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: clamp(16px, 2.2vw, 24px);
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
}

@media (max-width: 720px) {
  body.is-fullscreen .spotlight__meta {
    padding: 18px;
  }

  body.is-fullscreen .photo--spotlight .photo__caption {
    left: 18px;
    right: 18px;
    bottom: 78px;
  }
}
