:root {
  --paper: #f5eee4;
  --paper-deep: #eadfce;
  --ink: #342a27;
  --muted: #756963;
  --berry: #7f4552;
  --rose: #bf7078;
  --sage: #74816f;
  --gold: #b68a4d;
  --white: #fffdf9;
  --line: rgba(77, 56, 49, 0.16);
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --hand: "Snell Roundhand", "Bradley Hand", "Segoe Print", cursive;
  --body: -apple-system, BlinkMacSystemFont, "Avenir Next", Avenir, "Segoe UI", sans-serif;
  --shadow: 0 18px 50px rgba(71, 49, 42, 0.13);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.lightbox-open { overflow: hidden; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
a { color: inherit; }

.paper-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: .16;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.16'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 120;
  background: transparent;
}
.reading-progress span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--rose);
  transform: scaleX(0);
  transform-origin: left center;
}

.hero {
  position: relative;
  min-height: 92svh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  background: #4d3c39;
  color: var(--white);
}
.hero-collage, .hero-shade { position: absolute; inset: 0; }
.hero-collage {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  grid-template-rows: 1fr 1fr;
  gap: 4px;
  transform: scale(1.02);
}
.hero-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(.82) contrast(.95);
  animation: quiet-arrival 1.1s both;
}
.hero-photo:first-child { grid-row: 1 / 3; }
.hero-photo:nth-child(n+4) { display: none; }
.hero-shade {
  background:
    linear-gradient(180deg, rgba(41,28,26,.12) 24%, rgba(41,28,26,.32) 55%, rgba(41,28,26,.88) 100%),
    linear-gradient(90deg, rgba(55,37,34,.18), transparent 70%);
}
.hero-copy {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 0 22px calc(34px + env(safe-area-inset-bottom));
}
.dedication {
  margin: 0 0 10px;
  color: #f4cfd1;
  font-family: var(--hand);
  font-size: clamp(1.28rem, 6vw, 2rem);
  transform: rotate(-2deg);
}
h1 {
  max-width: 720px;
  margin: 0;
  font-family: var(--display);
  font-size: clamp(3.4rem, 15vw, 8.5rem);
  font-weight: 400;
  line-height: .83;
  letter-spacing: -.055em;
  text-wrap: balance;
}
.hero-lede {
  max-width: 590px;
  margin: 22px 0 24px;
  color: rgba(255,253,249,.88);
  font-family: var(--display);
  font-size: clamp(1.04rem, 4.4vw, 1.35rem);
  line-height: 1.45;
  text-wrap: pretty;
}
.begin {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.52);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .13em;
  text-decoration: none;
  text-transform: uppercase;
}
.begin span { font-size: 1.1rem; }

.memory-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(245,238,228,.93);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--berry);
  font-size: .63rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.memory-bar p { margin: 0; color: var(--muted); font-size: .78rem; }
.order-button {
  display: inline-flex;
  min-height: 44px;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,253,249,.66);
  color: var(--ink);
  cursor: pointer;
  font-size: .75rem;
  font-weight: 650;
}
.order-button:focus-visible, .memory-card:focus-visible, .icon-button:focus-visible,
.lightbox-nav:focus-visible, .load-more:focus-visible, .ending a:focus-visible {
  outline: 3px solid rgba(127,69,82,.34);
  outline-offset: 3px;
}

.loading-state {
  display: grid;
  min-height: 45svh;
  place-content: center;
  text-align: center;
  color: var(--muted);
}
.loading-flower { color: var(--rose); font-size: 2rem; animation: pulse 1.6s ease-in-out infinite; }
.loading-state p { font-family: var(--display); font-size: 1.12rem; }
.weeks { overflow: clip; }
.week {
  padding: 58px 12px 72px;
  border-bottom: 1px solid var(--line);
  content-visibility: auto;
  contain-intrinsic-size: 1100px;
}
.week:nth-child(even) { background: rgba(255,253,249,.38); }
.week-summary { padding: 0 8px 27px; }
.week-number {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 15px;
  color: var(--berry);
  font-size: .66rem;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.week-number::after { content: ""; width: 42px; height: 1px; background: var(--rose); }
.week-range { margin: 0 0 8px; color: var(--muted); font-size: .8rem; }
.week h2 {
  max-width: 680px;
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.25rem, 10vw, 4.8rem);
  font-weight: 400;
  line-height: .96;
  letter-spacing: -.035em;
  text-wrap: balance;
}
.week-story {
  max-width: 620px;
  margin: 17px 0 0;
  color: var(--muted);
  font-family: var(--display);
  font-size: 1.04rem;
  line-height: 1.5;
}
.highlights-label {
  display: block;
  margin: 28px 0 11px;
  color: var(--sage);
  font-size: .64rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.week-highlights {
  display: grid;
  gap: 10px;
  margin: 17px 0 0;
  padding: 0;
  list-style: none;
}
.week-highlights li {
  position: relative;
  padding: 0 0 0 17px;
  color: #584b46;
  font-size: .88rem;
  line-height: 1.48;
}
.week-highlights li::before {
  content: "";
  position: absolute;
  top: .56em;
  left: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
}

.collage {
  display: grid;
  grid-auto-flow: dense;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.memory-card {
  position: relative;
  display: block;
  min-height: 132px;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: var(--paper-deep);
  cursor: zoom-in;
  aspect-ratio: 3 / 4;
}
.memory-card:nth-child(7n+1), .memory-card:nth-child(7n+6) {
  grid-column: span 2;
  aspect-ratio: 4 / 3;
}
.memory-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.002);
  transition: transform .55s cubic-bezier(.2,.72,.2,1), filter .3s ease;
}
.memory-card:hover img { transform: scale(1.035); }
.memory-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 40%;
  background: linear-gradient(transparent, rgba(40,27,25,.36));
  opacity: .74;
  pointer-events: none;
}
.photo-date {
  position: absolute;
  z-index: 2;
  right: 9px;
  bottom: 8px;
  left: 9px;
  overflow: hidden;
  color: white;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-align: left;
  text-overflow: ellipsis;
  text-shadow: 0 1px 8px rgba(0,0,0,.5);
  white-space: nowrap;
}
.image-error { opacity: .32; }

.load-zone {
  min-height: 150px;
  padding: 35px 20px;
  text-align: center;
  color: var(--muted);
  font-size: .78rem;
}
#scrollSentinel { height: 2px; }
.load-more {
  min-height: 48px;
  margin-top: 12px;
  padding: 0 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
}
.ending {
  padding: 95px 25px calc(100px + env(safe-area-inset-bottom));
  text-align: center;
  background: var(--berry);
  color: var(--white);
}
.ending-mark { color: #efc3c7; font-size: 1.7rem; }
.ending p { margin: 18px 0 10px; color: #e7cfd2; font-family: var(--hand); font-size: 1.45rem; }
.ending h2 { margin: 0 auto 28px; font-family: var(--display); font-size: clamp(2.25rem, 10vw, 4rem); font-weight: 400; line-height: 1; }
.ending a { display: inline-flex; min-height: 44px; align-items: center; border-bottom: 1px solid rgba(255,255,255,.5); font-size: .72rem; font-weight: 700; letter-spacing: .11em; text-decoration: none; text-transform: uppercase; }

.lightbox[hidden] { display: none; }
.lightbox { position: fixed; inset: 0; z-index: 200; color: var(--white); }
.lightbox-backdrop { position: absolute; inset: 0; background: rgba(26,20,19,.96); }
.lightbox-panel { position: relative; display: flex; height: 100%; flex-direction: column; padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom)); }
.lightbox-topbar { display: flex; min-height: 54px; flex: 0 0 auto; align-items: center; justify-content: space-between; padding-left: 8px; }
.lightbox-topbar p { margin: 0; color: rgba(255,255,255,.66); font-size: .72rem; letter-spacing: .08em; }
.icon-button, .lightbox-nav {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  color: white;
  cursor: pointer;
  font-family: var(--body);
}
.icon-button { font-size: 2rem; font-weight: 200; }
.lightbox-stage { position: relative; display: grid; min-height: 0; flex: 1; place-items: center; }
.lightbox-stage figure { display: flex; width: 100%; height: 100%; min-height: 0; margin: 0; flex-direction: column; align-items: center; justify-content: center; }
.lightbox-stage img { display: block; max-width: 100%; max-height: calc(100svh - 215px); object-fit: contain; box-shadow: 0 12px 45px rgba(0,0,0,.28); }
.lightbox-stage figcaption { width: min(680px, 100%); padding: 16px 8px 3px; }
.lightbox-stage figcaption span { display: block; color: #f0c7cb; font-family: var(--display); font-size: 1.08rem; }
.lightbox-stage figcaption p { margin: 6px 0 0; color: rgba(255,255,255,.72); font-size: .78rem; line-height: 1.42; }
.lightbox-nav { position: absolute; z-index: 2; top: 45%; font-size: 2.15rem; }
.lightbox-nav.previous { left: 2px; }
.lightbox-nav.next { right: 2px; }

@keyframes quiet-arrival { from { opacity: 0; transform: scale(1.03); } to { opacity: 1; transform: scale(1); } }
@keyframes pulse { 0%, 100% { opacity: .35; transform: scale(.88); } 50% { opacity: 1; transform: scale(1); } }

@media (min-width: 600px) {
  .hero-copy { padding-right: 7vw; padding-left: 7vw; }
  .memory-bar { padding-right: 4vw; padding-left: 4vw; }
  .week { padding: 80px 4vw 96px; }
  .week-summary { padding-right: 4vw; padding-left: 4vw; }
  .collage { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .memory-card:nth-child(7n+1) { grid-column: span 2; grid-row: span 2; }
  .memory-card:nth-child(7n+6) { grid-column: auto; }
  .lightbox-panel { padding-right: 22px; padding-left: 22px; }
  .lightbox-nav.previous { left: 15px; }
  .lightbox-nav.next { right: 15px; }
}

@media (min-width: 980px) {
  .hero-collage { grid-template-columns: 1.25fr .75fr .75fr; grid-template-rows: 1fr 1fr; }
  .hero-photo:first-child { grid-column: 1; grid-row: 1 / 3; }
  .hero-photo:nth-child(2) { grid-column: 2; grid-row: 1 / 3; }
  .hero-photo:nth-child(3) { grid-column: 3; grid-row: 1; }
  .hero-photo:nth-child(4) { display: block; grid-column: 3; grid-row: 2; }
  .hero-shade { background: linear-gradient(90deg, rgba(32,21,20,.75), rgba(32,21,20,.1) 68%), linear-gradient(0deg, rgba(32,21,20,.42), transparent 50%); }
  .week { padding: 108px 5vw 124px; }
  .week-layout { display: grid; grid-template-columns: minmax(290px, 360px) minmax(0, 1fr); gap: 6vw; align-items: start; }
  .week-summary { position: sticky; top: 116px; padding: 0; }
  .collage { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .memory-card { min-height: 190px; }
  .week h2 { font-size: clamp(3.2rem, 4.5vw, 5.5rem); }
  .week-highlights li { font-size: .91rem; }
}

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