@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&family=Playfair+Display:wght@400;500;600&display=swap');

:root {
  color-scheme: light;
  --paper: #fffaf7;
  --ink: #49353a;
  --muted: #9a7f82;
  --rose: #b95f70;
  --rose-dark: #9d4c5c;
  --line: #ead8d5;
  font-family: "DM Sans", "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 12% 18%, rgba(233, 190, 186, 0.3), transparent 34%),
    radial-gradient(ellipse at 87% 82%, rgba(226, 190, 176, 0.25), transparent 32%),
    #f9eeeb;
}

button,
input,
textarea {
  font: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(185, 95, 112, 0.35);
  outline-offset: 3px;
}

.page {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 38px 20px 24px;
}

.topline,
.footer-note {
  color: var(--muted);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-align: center;
}

.topline {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.topline-heart,
.footer-note span {
  color: var(--rose);
}

.card {
  position: relative;
  width: min(100%, 550px);
  overflow: hidden;
  padding: 64px clamp(25px, 8vw, 66px) 38px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 4px;
  background: var(--paper);
  box-shadow: 0 24px 70px rgba(104, 68, 65, 0.12);
  text-align: center;
  animation: arrive 700ms ease-out both;
}

.card::before,
.card::after {
  position: absolute;
  width: 100px;
  height: 100px;
  border: 1px solid rgba(185, 95, 112, 0.12);
  border-radius: 50%;
  content: "";
}

.card::before {
  top: -66px;
  left: -66px;
}

.card::after {
  right: -66px;
  bottom: -66px;
}

.card-ornament {
  position: absolute;
  color: #d7a4a0;
  font-size: 1.15rem;
}

.ornament-left {
  top: 24px;
  left: 25px;
}

.ornament-right {
  right: 25px;
  bottom: 23px;
}

.eyebrow {
  margin: 0 0 13px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

h1,
h2 {
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 500;
}

h1 {
  margin: 0;
  color: #704650;
  font-size: clamp(2.25rem, 8vw, 3.65rem);
  line-height: 1.14;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(190px, 60%);
  margin: 23px auto 18px;
  color: var(--rose);
  font-size: 0.72rem;
}

.divider::before,
.divider::after {
  height: 1px;
  flex: 1;
  background: var(--line);
  content: "";
}

.intro {
  max-width: 340px;
  margin: 0 auto;
  color: #745a5d;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.14rem;
  line-height: 1.8;
}

.year-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 25px;
  border-bottom: 1px solid var(--line);
}

.year-tabs[hidden],
.letter[hidden] {
  display: none;
}


.year-tab {
  position: relative;
  padding: 9px 11px 12px;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 160ms ease;
}

.year-tab::after {
  position: absolute;
  right: 8px;
  bottom: -1px;
  left: 8px;
  height: 2px;
  background: transparent;
  content: "";
  transition: background-color 160ms ease;
}

.year-tab:hover,
.year-tab.is-active {
  color: var(--rose-dark);
}

.year-tab.is-active::after {
  background: var(--rose);
}

.button {
  min-height: 46px;
  padding: 0 24px;
  border: 0;
  border-radius: 3px;
  cursor: pointer;
  transition: background-color 160ms ease, transform 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  margin-top: 27px;
  color: white;
  background: var(--rose);
  box-shadow: 0 8px 18px rgba(157, 76, 92, 0.18);
}

.button-primary:hover {
  background: var(--rose-dark);
}

.button-primary span {
  margin-left: 8px;
}

.letter {
  margin-top: 24px;
  padding-top: 23px;
  border-top: 1px solid var(--line);
  animation: reveal 400ms ease-out both;
  text-align: left;
}

.year-label {
  margin-bottom: 14px !important;
  color: var(--rose-dark) !important;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.35rem !important;
  line-height: 1.2 !important;
}

.letter p {
  margin: 0;
  color: #6a5356;
  font-size: 0.95rem;
  line-height: 1.9;
  white-space: pre-wrap;
}

.letter .signoff {
  margin-top: 22px;
  color: var(--muted);
  font-family: "Playfair Display", Georgia, serif;
  line-height: 1.8;
}

.signoff span {
  color: var(--rose-dark);
  font-size: 1.05rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 20px;
  margin-top: 18px;
}

.text-button {
  padding: 6px 2px;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 0.76rem;
  text-decoration: underline;
  text-decoration-color: #ddc5c1;
  text-underline-offset: 4px;
}

.text-button:hover {
  color: var(--rose-dark);
}

.wish {
  margin: 29px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-style: italic;
}

.footer-note {
  margin: 18px 0 0;
  font-size: 0.63rem;
}

.customize-dialog {
  width: min(460px, calc(100% - 32px));
  max-height: min(90vh, 700px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 24px 80px rgba(55, 33, 39, 0.22);
}

.customize-dialog::backdrop {
  background: rgba(57, 39, 42, 0.42);
  backdrop-filter: blur(3px);
}

.customize-dialog form {
  display: grid;
  gap: 10px;
  padding: 28px;
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
}

.dialog-heading .eyebrow {
  font-size: 0.62rem;
}

.dialog-heading h2 {
  margin: 0;
  font-size: 1.55rem;
}

.close-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 1.35rem;
}

.customize-dialog label {
  margin-top: 7px;
  color: #745a5d;
  font-size: 0.8rem;
}

.customize-dialog input,
.customize-dialog textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--ink);
  background: #fffdfb;
}

.customize-dialog textarea {
  resize: vertical;
  line-height: 1.6;
}

.save-button {
  width: 100%;
}

.toast {
  position: fixed;
  z-index: 2;
  right: 20px;
  bottom: 20px;
  max-width: calc(100% - 40px);
  padding: 12px 17px;
  border-radius: 3px;
  color: white;
  background: #67434c;
  box-shadow: 0 8px 26px rgba(55, 33, 39, 0.18);
  font-size: 0.86rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes arrive {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes reveal {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
  .page {
    padding-right: 14px;
    padding-left: 14px;
  }

  .card {
    padding: 53px 23px 31px;
  }

    .topline {
    gap: 9px;
    font-size: 0.56rem;
  }

  .year-tab {
    padding-right: 7px;
    padding-left: 7px;
    font-size: 0.65rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
