:root {
  color-scheme: light;
  --paper: #f8f3ef;
  --paper-deep: #f0e5df;
  --cream: #fffdfa;
  --ink: #352a2c;
  --muted: #7b6d6d;
  --rose: #b45f70;
  --rose-deep: #884152;
  --rose-light: #ead0d2;
  --line: #e5d6d1;
  --shadow: 0 18px 55px rgb(67 42 43 / 9%);
  --serif: Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius-large: 28px;
  --radius-medium: 18px;
  --radius-small: 11px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 86px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .4; }
:focus-visible { outline: 3px solid #c9808b; outline-offset: 3px; }
::selection { background: #e9c7cc; color: #3a2529; }

.site-header {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 18px;
  padding: 15px 5vw;
  background: rgb(248 243 239 / 96%);
  border-bottom: 1px solid rgb(229 214 209 / 75%);
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  font-family: var(--serif);
  font-size: 1.08rem;
  letter-spacing: -.025em;
  white-space: nowrap;
}
.wordmark-heart { color: var(--rose); font-size: 1.6rem; line-height: 1; }
.main-nav { display: flex; gap: clamp(14px, 2.4vw, 32px); order: 3; width: 100%; }
.main-nav a, .text-button, .back-to-top {
  color: var(--muted);
  font-size: .84rem;
  text-decoration: none;
  transition: color .18s ease;
}
.main-nav a:hover, .text-button:hover, .back-to-top:hover { color: var(--rose-deep); }
.account-area { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.signed-in { color: var(--muted); font-size: .76rem; white-space: nowrap; }
.signed-in strong { color: var(--ink); font-weight: 650; }
.logout-form { display: inline; }
.text-button { padding: 0; border: 0; background: transparent; }

.hero {
  position: relative;
  display: flex;
  min-height: clamp(520px, 72vh, 760px);
  align-items: center;
  overflow: hidden;
  isolation: isolate;
  background: #4c3039;
  color: #fffaf7;
}
.hero-image, .hero-shade, .hero-empty-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-image { z-index: -2; object-fit: cover; object-position: center 48%; animation: hero-arrive 1.15s ease-out both; }
.hero-shade {
  z-index: -1;
  background: linear-gradient(90deg, rgb(40 24 31 / 82%) 0%, rgb(40 24 31 / 58%) 48%, rgb(40 24 31 / 13%) 100%),
              linear-gradient(0deg, rgb(30 19 24 / 32%) 0%, transparent 40%);
}
.hero-empty-art {
  z-index: -2;
  background: radial-gradient(ellipse at 76% 30%, #9e6570 0%, transparent 43%),
              radial-gradient(ellipse at 24% 75%, #76515d 0%, transparent 48%),
              linear-gradient(125deg, #37252e, #6c414c 62%, #9d6670);
}
.empty-heart { position: absolute; color: rgb(255 235 230 / 22%); font-family: var(--serif); font-weight: 400; }
.empty-heart-one { right: 13%; top: 10%; font-size: clamp(9rem, 21vw, 18rem); transform: rotate(9deg); }
.empty-heart-two { right: 30%; bottom: 6%; font-size: clamp(5rem, 12vw, 11rem); transform: rotate(-12deg); }
.empty-heart-three { left: 45%; top: 22%; font-size: clamp(3rem, 8vw, 7rem); transform: rotate(16deg); }
.hero-content { width: min(790px, 100%); padding: 68px 8vw 88px; }
.hero-kicker, .eyebrow {
  margin: 0 0 14px;
  color: var(--rose);
  font-size: .7rem;
  font-weight: 750;
  letter-spacing: .2em;
  line-height: 1.4;
  text-transform: uppercase;
}
.hero-kicker { color: #f1c8ca; }
.hero h1 {
  max-width: 680px;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(3.2rem, 9.8vw, 7.7rem);
  font-weight: 400;
  letter-spacing: -.065em;
  line-height: .97;
  text-wrap: balance;
}
.hero h1 em, .section-heading h2 em { color: #e6b6bd; font-weight: 400; }
.hero-message { max-width: 440px; margin: 25px 0 28px; color: rgb(255 249 246 / 88%); font-size: clamp(.98rem, 1.7vw, 1.1rem); line-height: 1.8; }
.hero-caption { position: absolute; right: 5vw; bottom: 24px; left: 5vw; display: flex; justify-content: space-between; color: rgb(255 250 247 / 74%); font-family: var(--serif); font-size: .9rem; letter-spacing: .08em; }
.hero-caption span:last-child { color: #f4cad0; font-size: 1.4rem; }

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 11px;
  padding: 12px 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: .87rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  transition: transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--rose-deep); color: #fffaf7; box-shadow: 0 7px 20px rgb(136 65 82 / 15%); }
.button-primary:hover { background: #713545; box-shadow: 0 10px 25px rgb(136 65 82 / 21%); }
.button-light { background: #fff8f3; color: #5f3942; }
.button-light:hover { background: #f4dfe0; }
.button-full { width: 100%; }

.section-wrap { width: min(1120px, calc(100% - 40px)); margin-inline: auto; }
.time-section { padding-block: 78px 86px; }
.section-heading { max-width: 660px; margin-bottom: 30px; }
.section-heading-centered { margin-inline: auto; text-align: center; }
.section-heading h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.5rem, 7vw, 4.6rem);
  font-weight: 400;
  letter-spacing: -.055em;
  line-height: 1.06;
}
.section-heading h2 em { color: var(--rose); }
.section-intro { margin: 13px 0 0; color: var(--muted); font-size: .96rem; line-height: 1.75; }
.timezone-label { display: inline-block; font-size: .8em; }
.countdown-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 880px;
  margin: 35px auto 0;
}
.countdown-unit {
  display: flex;
  min-height: 98px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 8px;
  border: 1px solid #e7d7d2;
  border-radius: 16px;
  background: rgb(255 253 250 / 68%);
  box-shadow: 0 7px 24px rgb(71 47 48 / 3%);
}
.countdown-value { font-family: var(--serif); font-size: clamp(1.8rem, 5vw, 3rem); letter-spacing: -.04em; line-height: 1.08; font-variant-numeric: tabular-nums; }
.countdown-label { margin-top: 8px; color: var(--muted); font-size: .67rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.countdown-note { margin: 22px 0 0; color: var(--rose-deep); font-family: var(--serif); font-size: 1.05rem; font-style: italic; text-align: center; }

.memories-section { padding-block: 50px 94px; }
.memories-section .section-heading { margin-bottom: 30px; }
.slideshow { overflow: hidden; border-radius: var(--radius-large); background: #dfc9c5; box-shadow: var(--shadow); }
.slides-frame { position: relative; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; background: linear-gradient(130deg, #ddbfbe, #75505a); touch-action: pan-y; }
.slide { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transform: scale(1.015); transition: opacity .7s ease, transform 1.2s ease; pointer-events: none; }
.slide.is-active { opacity: 1; transform: scale(1); pointer-events: auto; }
.slide-overlay { position: absolute; inset: 45% 0 0; pointer-events: none; background: linear-gradient(0deg, rgb(30 22 28 / 43%), transparent); }
.slide-counter { position: absolute; right: 18px; bottom: 15px; margin: 0; color: white; font-size: .78rem; font-variant-numeric: tabular-nums; letter-spacing: .08em; }
.slideshow-controls { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 18px 17px; background: var(--cream); }
.slideshow-caption { margin: 0; color: var(--muted); font-family: var(--serif); font-size: 1.02rem; font-style: italic; }
.slide-buttons { display: flex; gap: 8px; }
.icon-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--rose-deep);
  font-size: 1.1rem;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.icon-button:hover:not(:disabled) { border-color: var(--rose-deep); background: var(--rose-deep); color: white; }
.pause-button { font-size: .86rem; }
.photo-empty-state, .notes-empty-state {
  padding: 44px 22px;
  border: 1px dashed #d9c1be;
  border-radius: var(--radius-large);
  background: rgb(255 253 250 / 55%);
  text-align: center;
}
.empty-photo-icon { display: grid; width: 70px; height: 70px; place-items: center; margin: 0 auto 14px; border-radius: 50%; background: #f0dfdd; color: var(--rose-deep); font-family: var(--serif); font-size: 2.7rem; }
.empty-state-title { margin: 0 0 7px; color: var(--ink); font-family: var(--serif); font-size: 1.42rem; }
.photo-empty-state p:last-child, .notes-empty-state p:last-child { max-width: 510px; margin: 0 auto; color: var(--muted); font-size: .9rem; line-height: 1.75; }
.noscript-note { margin: 0; padding: 12px 18px; background: var(--cream); color: var(--muted); font-size: .82rem; }

.cards-section { padding-block: 84px 96px; background: #f0e6e1; border-top: 1px solid #e9dad4; border-bottom: 1px solid #e5d5cf; }
.cards-inner > .section-heading { margin-bottom: 32px; }
.card-compose { margin-bottom: 54px; padding: clamp(20px, 4vw, 34px); border: 1px solid #e5d5d0; border-radius: var(--radius-large); background: var(--cream); box-shadow: 0 13px 38px rgb(74 43 48 / 5%); }
.compose-heading { display: flex; align-items: flex-start; gap: 15px; margin-bottom: 24px; }
.compose-heart { display: grid; width: 46px; height: 46px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: #f4e0e1; color: var(--rose-deep); font-family: var(--serif); font-size: 1.8rem; }
.compose-heading h3, .cards-list-heading h3 { margin: 0; font-family: var(--serif); font-size: 1.55rem; font-weight: 400; letter-spacing: -.025em; line-height: 1.3; }
.compose-heading p { margin: 6px 0 0; color: var(--muted); font-size: .86rem; line-height: 1.7; }
.card-form { display: flex; flex-direction: column; gap: 8px; }
.card-form label, .auth-form label { margin-top: 6px; color: #5f4d50; font-size: .83rem; font-weight: 700; }
.card-form input, .card-form textarea, .auth-form input, .auth-form select {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  border: 1px solid #dfceca;
  border-radius: var(--radius-small);
  background: #fffefa;
  color: var(--ink);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.card-form textarea { min-height: 120px; resize: vertical; line-height: 1.7; }
.card-form input::placeholder, .card-form textarea::placeholder { color: #a09190; }
.card-form input:focus, .card-form textarea:focus, .auth-form input:focus, .auth-form select:focus { border-color: #bf8490; outline: 0; box-shadow: 0 0 0 3px rgb(180 95 112 / 12%); }
.form-footnote-row { display: flex; flex-direction: column; align-items: flex-start; gap: 15px; margin-top: 9px; }
.form-footnote-row p { margin: 0; color: #927f80; font-size: .73rem; }
.cards-list-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.card-count { padding: 4px 10px; border-radius: 999px; background: #e7d4d1; color: #7c4d57; font-size: .73rem; font-weight: 700; white-space: nowrap; }
.cards-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.memory-card { min-width: 0; padding: 22px 20px 17px; border: 1px solid #e6d8d3; border-radius: var(--radius-medium); background: var(--cream); box-shadow: 0 8px 25px rgb(74 43 48 / 4%); overflow-wrap: anywhere; }
.memory-card-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #928080; font-size: .7rem; }
.card-heart { color: var(--rose); font-family: var(--serif); font-size: 1.35rem; line-height: 1; }
.memory-card h3 { margin: 12px 0 9px; font-family: var(--serif); font-size: 1.48rem; font-weight: 400; letter-spacing: -.025em; line-height: 1.25; }
.memory-card-body { margin: 0; color: #665759; font-size: .91rem; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.memory-card-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 22px; padding-top: 13px; border-top: 1px solid #f0e6e2; }
.card-author { color: #927f80; font-family: var(--serif); font-size: .86rem; font-style: italic; }
.card-author strong { color: #7b4b55; font-weight: 400; }
.owner-label { color: #9b7a7f; font-size: .68rem; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.card-actions { margin-top: 14px; padding-top: 12px; border-top: 1px solid #f0e6e2; }
.card-actions summary { width: fit-content; color: var(--rose-deep); cursor: pointer; font-size: .8rem; font-weight: 700; }
.edit-card-form { margin-top: 12px; }
.edit-card-form .button { align-self: flex-start; margin-top: 8px; }
.delete-form { margin-top: 13px; }
.danger-button { color: #a3484d; font-size: .8rem; }
.notes-empty-state { padding-block: 34px; }
.notes-empty-state > span { display: inline-block; margin-bottom: 8px; color: var(--rose); font-size: 1.8rem; }

.site-footer { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 32px 20px 38px; color: var(--muted); text-align: center; }
.footer-heart { color: var(--rose); font-family: var(--serif); font-size: 1.8rem; }
.site-footer p { margin: 0; font-family: var(--serif); font-size: .98rem; font-style: italic; }
.back-to-top { margin-top: 10px; font-size: .76rem; }

.flash-stack { display: grid; gap: 8px; }
.page-flashes { width: min(1120px, calc(100% - 40px)); margin: 18px auto 0; }
.flash { margin: 0; padding: 12px 15px; border: 1px solid transparent; border-radius: 12px; font-size: .87rem; }
.flash-success { border-color: #c8ddcf; background: #edf5ef; color: #2e6341; }
.flash-error { border-color: #e4c3c4; background: #fff0f0; color: #8d363d; }
.flash-info { border-color: #d7d0e5; background: #f4f0fa; color: #5e4e81; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

/* Sign-in and optional shared-code gate */
.auth-page { display: grid; min-height: 100vh; place-items: center; padding: 24px 16px; background: radial-gradient(ellipse at 15% 12%, #f5e3df 0%, transparent 34%), radial-gradient(ellipse at 85% 90%, #ead6d8 0%, transparent 36%), var(--paper); }
.auth-shell { width: min(100%, 450px); padding: clamp(25px, 7vw, 45px); border: 1px solid rgb(224 205 199 / 85%); border-radius: var(--radius-large); background: rgb(255 253 250 / 93%); box-shadow: var(--shadow); text-align: center; }
.auth-mark { display: grid; width: 60px; height: 60px; place-items: center; margin: 0 auto 20px; border: 1px solid #e7c9cc; border-radius: 50%; color: var(--rose-deep); font-family: var(--serif); font-size: 2.4rem; text-decoration: none; }
.auth-shell .eyebrow { margin-bottom: 8px; }
.auth-shell h1 { margin: 0; font-family: var(--serif); font-size: clamp(2.4rem, 8vw, 3.4rem); font-weight: 400; letter-spacing: -.055em; line-height: 1.08; }
.auth-intro { margin: 16px 0 25px; color: var(--muted); font-size: .9rem; line-height: 1.75; }
.auth-form { display: flex; flex-direction: column; gap: 9px; text-align: left; }
.auth-form label { margin-top: 5px; }
.auth-form .button { margin-top: 13px; }
.auth-flashes { margin-top: 18px; text-align: left; }
.auth-footnote { margin: 25px 0 0; color: #9b8888; font-family: var(--serif); font-size: .84rem; font-style: italic; }
.error-code { margin: 12px 0 0; color: #b77884; font-size: .75rem; font-weight: 800; letter-spacing: .2em; }
.error-shell .button { margin-top: 12px; }

@keyframes hero-arrive { from { opacity: .6; transform: scale(1.025); } to { opacity: 1; transform: scale(1); } }

@media (min-width: 680px) {
  .site-header { flex-wrap: nowrap; min-height: 76px; padding-block: 16px; }
  .main-nav { order: 0; width: auto; margin-left: auto; }
  .account-area { margin-left: 0; }
  .countdown-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
  .countdown-unit { min-height: 125px; border-radius: 18px; }
  .slides-frame { aspect-ratio: 16 / 9; }
  .slide { object-fit: cover; }
  .card-compose { padding: 34px; }
  .form-footnote-row { flex-direction: row; align-items: center; justify-content: space-between; }
  .cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
}

@media (min-width: 1000px) {
  .site-header { padding-inline: 5.5vw; }
  .hero-content { padding-left: 10vw; }
  .hero-caption { right: 5.5vw; left: 5.5vw; }
  .time-section { padding-block: 96px 102px; }
  .memories-section { padding-block: 58px 110px; }
  .cards-section { padding-block: 104px 116px; }
  .cards-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 19px; }
  .memory-card { padding: 24px 22px 19px; }
}

@media (max-width: 410px) {
  .site-header { padding-inline: 17px; }
  .wordmark { font-size: .98rem; }
  .signed-in { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
  .account-area { gap: 8px; }
  .text-button { font-size: .75rem; }
  .hero-content { padding-inline: 24px; }
  .hero h1 { font-size: 3.2rem; }
  .section-wrap { width: calc(100% - 28px); }
  .page-flashes { width: calc(100% - 28px); }
  .slideshow-controls { padding-inline: 12px; }
  .slideshow-caption { font-size: .9rem; }
  .icon-button { width: 37px; height: 37px; }
  .card-compose { padding: 18px; }
}

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