:root {
  color-scheme: light;
  --paper: #fbf4e8;
  --white: #fffaf1;
  --ink: #2e1c28;
  --wine: #54243a;
  --rose: #ead0cf;
  --line: #d8bdb6;
  --muted: #634b54;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 1rem/1.55 system-ui, sans-serif; }
img { display: block; max-width: 100%; }
a { color: var(--wine); text-underline-offset: .22em; }
.mast { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: .7rem max(20px, calc((100% - 1220px)/2)); border-bottom: 1px solid var(--line); }
.wordmark { display: inline-flex; align-items: center; gap: .7rem; color: var(--ink); font: 1.3rem Georgia, serif; text-decoration: none; }
.wordmark span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: var(--paper); background: var(--wine); font-style: italic; }
.mast-link { font-size: .84rem; font-weight: 650; }
main { width: min(100%, 1280px); margin: auto; padding: clamp(18px, 3.5vw, 48px); }
.hero, .form-layout, .book-cover { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: clamp(24px, 5.4vw, 78px); }
.hero figure { margin: 0; position: relative; overflow: hidden; border-radius: 48% 48% 4px 4px / 26% 26% 4px 4px; background: var(--wine); }
.hero figure img, .form-layout aside img, .book-cover img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: center 29%; }
.gallery { position: absolute; inset: auto 12px 12px; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px; color: var(--ink); background: var(--white); border-radius: 30px; }
.gallery button { border-radius: 24px; min-width: 44px; }
h1, h2 { font-family: Georgia, serif; font-weight: 400; line-height: .98; }
h1 { margin: .22em 0; font-size: clamp(3.15rem, 7vw, 7rem); letter-spacing: -.065em; overflow-wrap: anywhere; }
h1 em { display: block; color: var(--wine); font-size: .7em; letter-spacing: -.045em; }
.kicker { margin: 0; font-size: .72rem; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; color: var(--wine); }
.bio { margin-top: clamp(24px, 4vw, 50px); padding-top: 18px; border-top: 1px solid var(--line); max-width: 56ch; }
.bio h2 { margin: 0; font-size: 1.5rem; }
.bio p { margin: .65rem 0; }
.sources, .hint { font-size: .84rem; }
.button, button { cursor: pointer; font: inherit; }
.button { display: inline-flex; gap: 1.1rem; align-items: center; justify-content: center; min-height: 46px; margin-top: .75rem; border: 1px solid var(--wine); border-radius: 32px; padding: .65rem 1.2rem; text-decoration: none; color: white; background: var(--wine); font-weight: 650; }
.button:hover { background: #70394f; }
button:disabled { opacity: .6; cursor: wait; }
.gallery button, #remove { min-height: 44px; padding: .35rem .7rem; border: 1px solid var(--line); background: var(--white); color: var(--wine); }
:focus-visible { outline: 3px solid #9d466a; outline-offset: 3px; }
.form-layout { grid-template-columns: minmax(0, .7fr) minmax(0, 1fr); align-items: start; }
.form-layout aside { background: var(--rose); padding: 14px 14px 20px; }
.back { display: inline-block; margin-top: 14px; font-size: .86rem; }
.mobile-back { display: none; }
form { background: var(--white); padding: clamp(18px, 4vw, 44px); border: 1px solid var(--line); border-top: 5px solid var(--wine); }
form h1 { font-size: clamp(2.8rem, 5.6vw, 5rem); }
form h1 em { display: inline; font-size: inherit; }
label { display: block; margin: 1rem 0 .3rem; font-weight: 650; }
input, textarea, select { width: 100%; min-width: 0; font: inherit; padding: .7rem; border: 1px solid #af8e96; background: white; color: var(--ink); border-radius: 7px; }
textarea { resize: vertical; }
details { margin: .65rem 0; padding: .65rem; background: var(--rose); }
summary { cursor: pointer; }
.hint { margin: .25rem 0; color: var(--muted); }
#preview { display: flex; align-items: center; gap: 1rem; margin: .75rem 0; }
#preview img { width: 80px; height: 80px; object-fit: cover; }
#form-status:not(:empty) { background: var(--rose); padding: .8rem; }
#form-status:empty { display: none; }
.book-cover { background: var(--wine); color: var(--white); padding: clamp(18px, 5vw, 70px); }
.book-cover img { border: 8px solid var(--white); }
.book-cover h1 em, .book-cover .kicker { color: var(--rose); }
.book-cover .button { color: var(--wine); background: var(--white); }
#messages { display: grid; gap: 1.5rem; margin: 2rem auto; max-width: 980px; }
.memory { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: clamp(16px, 4vw, 40px); align-items: center; margin: 0; padding: clamp(20px, 5vw, 54px); background: var(--white); border: 1px solid var(--line); border-left: 5px solid var(--wine); }
.memory:nth-child(even) { background: #f4e1dc; }
.memory.text-only { grid-template-columns: 1fr; }
.memory img { width: 100%; max-height: 65vh; object-fit: contain; }
.memory blockquote { margin: 0; font: clamp(1.25rem, 3vw, 2.1rem)/1.4 Georgia, serif; white-space: pre-wrap; overflow-wrap: anywhere; }
.signature { margin: 1rem 0 0; color: var(--wine); font-weight: 650; overflow-wrap: anywhere; }
.memory.reveal { animation: arrive .65s ease-out; }
@keyframes arrive { from { opacity: .25; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 720px) {
  .hero, .form-layout, .book-cover, .memory { grid-template-columns: minmax(0, 1fr); }
  .hero figure img, .book-cover img { aspect-ratio: 5 / 4; }
  .hero { gap: 20px; }
  .form-layout aside { display: none; }
  .mobile-back { display: inline-block; margin: 0 0 12px; }
}
@media (prefers-reduced-motion: reduce) { .memory.reveal { animation: none; } }

body:has(#home:not([hidden])) {
  color: #f5e8d6;
  background: radial-gradient(ellipse at 28% 32%, #382331, #151015 68%);
}
body:has(#home:not([hidden])) .mast { border-color: #594652; }
body:has(#home:not([hidden])) a:where(:not(.button)), .hero .kicker, .hero h1 em { color: #efd5b7; }
body:has(#home:not([hidden])) .wordmark span, .hero .button {
  background: #f2d6b7;
  color: #2e1924;
  border-color: transparent;
}
.hero .button:hover { background: #fff0df; color: #2e1924; }
.hero { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); column-gap: clamp(16px, 5vw, 88px); }
.hero h1 { font-size: clamp(3rem, 9.4vw, 9rem); }
.hero h1 em { font-size: .46em; margin-top: .32em; }
.hero .bio { border-color: #6c5260; }
.photo-stage { position: relative; isolation: isolate; padding: 7% 15% 8%; }
.hero .photo-stage figure { z-index: 1; border-radius: 2px; border: 6px solid #f3e4d3; box-shadow: 0 18px 44px #0e080dbb; }
.hero .photo-stage figure img { aspect-ratio: 3 / 4; object-position: center 30%; }
.photo-print {
  position: absolute;
  top: 17%;
  width: 37%;
  padding: 5px 5px 15px;
  background: #e6d6c6;
  box-shadow: 0 12px 26px #0d070bae;
  transition: transform .4s ease;
}
.photo-print img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; object-position: center 28%; }
.photo-print-left { left: 1%; transform: rotate(-12deg); }
.photo-print-right { right: 1%; top: 30%; transform: rotate(13deg); }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .photo-stage:hover .photo-print-left { transform: translateX(-8px) rotate(-16deg); }
  .photo-stage:hover .photo-print-right { transform: translateX(8px) rotate(17deg); }
}
.hero .gallery { inset: auto 8px 8px auto; padding: 0; background: transparent; }
.hero .gallery button { min-width: 38px; padding-inline: .4rem; }
.credit { border-top: 1px solid var(--line); text-align: center; padding: 1.35rem 1rem; font-size: .84rem; }
body:has(#home:not([hidden])) .credit { border-color: #594652; }
@media (max-width: 720px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .photo-stage { width: min(100%, 460px); margin: auto; }
}

body:has(#send:not([hidden])) {
  color: #f5e8d6;
  background: radial-gradient(ellipse at 18% 20%, #382331, #151015 68%);
}
body:has(#send:not([hidden])) .mast,
body:has(#send:not([hidden])) .credit { border-color: #594652; }
body:has(#send:not([hidden])) a { color: #efd5b7; }
body:has(#send:not([hidden])) .wordmark span { background: #f2d6b7; color: #2e1924; }
#send { grid-template-columns: minmax(0, .78fr) minmax(0, 1fr); }
#send aside { background: none; padding: 12px clamp(10px, 3vw, 40px) 30px; }
#send aside .back { margin: 0 0 28px; }
.letter-portrait {
  position: relative;
  isolation: isolate;
  margin: 0;
  transform: rotate(-5deg);
}
.letter-portrait::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 5% -3% -2% 9%;
  transform: rotate(11deg);
  background: #875e6d;
}
#send .letter-portrait img {
  border: 6px solid #f3e4d3;
  border-bottom-width: 19px;
  box-shadow: 0 18px 42px #0e080d99;
}
#send form { padding: 0; border: 0; background: transparent; }
#send form h1 { font-size: clamp(3rem, 7vw, 6.65rem); }
#send form h1 em { color: #efd5b7; }
#send form > p:not(#form-status) { color: #d9c2c1; }
#send label { margin-top: 1.4rem; font-size: .9rem; }
#send input, #send textarea, #send select {
  color-scheme: dark;
  border: 1px solid #856877;
  border-radius: 4px;
  background: #251b25;
  color: #fff4e7;
}
#send input::file-selector-button {
  margin-right: .75rem;
  padding: .35rem .6rem;
  border: 0;
  border-radius: 3px;
  background: #efd5b7;
  color: #2e1924;
}
#send details, #send #form-status:not(:empty) { background: #382833; }
#send .button { margin-top: 1.3rem; background: #f2d6b7; color: #2e1924; border-color: transparent; }
#send .button:hover { background: #fff0df; }
@media (max-width: 720px) {
  #send { grid-template-columns: minmax(0, 1fr); }
  #send .button { width: 100%; }
}

/* Private farewell book */
body:has(#view:not([hidden])) {
  color: #f5e8d6;
  background: radial-gradient(ellipse at 72% 10%, #382331, #151015 65%);
}
body:has(#view:not([hidden])) .mast,
body:has(#view:not([hidden])) .credit { border-color: #594652; }
body:has(#view:not([hidden])) a:where(:not(.button)) { color: #efd5b7; }
body:has(#view:not([hidden])) .wordmark span { background: #f2d6b7; color: #2e1924; }
#view .book-cover {
  grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
  gap: clamp(28px, 7vw, 100px);
  color: #f5e8d6;
  background: transparent;
  padding: clamp(18px, 5vw, 62px);
  border-bottom: 1px solid #6c5260;
}
#view .book-cover img {
  transform: rotate(-5deg);
  border: 7px solid #f3e4d3;
  border-bottom-width: 22px;
  box-shadow: 0 20px 52px #100a10b0;
}
#view .book-cover h1 { font-size: clamp(3.6rem, 9.8vw, 9rem); }
#view .book-cover h1 em, #view .book-cover .kicker { color: #efd5b7; }
#view .book-cover .button { color: #2e1924; background: #f2d6b7; border-color: transparent; }
#view .book-cover .button:hover { background: #fff0df; }
#view #messages {
  width: min(100%, 1050px);
  gap: clamp(24px, 5vw, 64px);
  margin: clamp(24px, 6vw, 76px) auto;
}
#view .memory {
  color: #2e1c28;
  background: #fbf4e8;
  border: 0;
  border-top: 4px solid #b58778;
  box-shadow: 0 12px 38px #0c080d80;
}
#view .memory:nth-child(even) { background: #f1ddd8; }
#view .memory img {
  border: 5px solid #fffaf1;
  border-bottom-width: 16px;
  background: #fffaf1;
  transform: rotate(-2deg);
}
#view .memory .signature {
  width: fit-content;
  padding-top: .7rem;
  border-top: 1px solid #b58778;
}
#view .memory.text-only { max-width: 820px; width: 100%; justify-self: center; }
@media (min-width: 721px) {
  #view .memory:nth-child(even):not(.text-only) { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
  #view .memory:nth-child(even) img { grid-column: 2; grid-row: 1; transform: rotate(2deg); }
  #view .memory:nth-child(even):not(.text-only) > div { grid-column: 1; grid-row: 1; }
}
@media (max-width: 720px) {
  #view .book-cover { grid-template-columns: minmax(0, 1fr); }
  #view .book-cover img { width: min(90%, 340px); margin-inline: auto; }
}

.starfield {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.starfield ~ .mast, .starfield ~ main, .starfield ~ .credit { position: relative; z-index: 1; }
.starfield::before, .starfield::after {
  content: '';
  position: absolute;
  inset: -12%;
  background-repeat: repeat;
  will-change: transform, opacity;
}
.starfield::before {
  background-image: radial-gradient(circle at 13% 24%, #fff1da 0 1px, transparent 1.5px),
    radial-gradient(circle at 76% 14%, #f2d6b7 0 1px, transparent 1.7px),
    radial-gradient(circle at 48% 78%, #e9ccdf 0 1px, transparent 1.6px);
  background-size: 193px 179px, 233px 211px, 283px 247px;
  opacity: .28;
  animation: star-drift 52s ease-in-out infinite alternate;
}
.starfield::after {
  background-image: radial-gradient(circle at 25% 64%, #f7debe 0 1.1px, transparent 2px),
    radial-gradient(circle at 84% 38%, #fff 0 1px, transparent 1.8px);
  background-size: 379px 293px, 461px 367px;
  opacity: .39;
  animation: star-drift 33s ease-in-out infinite alternate-reverse;
}
@keyframes star-drift {
  from { transform: translate(-1.5%, 1%); }
  to { transform: translate(2.5%, -3%); opacity: .57; }
}
@media (prefers-reduced-motion: reduce) {
  .starfield::before, .starfield::after { animation: none; }
}
