/* ---------------------------------------------------------------
   In Loving Memory of Lana Lane Marsh
   Warm, soft, unhurried. Built to read well on a phone.
   --------------------------------------------------------------- */

:root {
  --paper:      #faf7f1;
  --paper-warm: #f4eee3;
  --card:       #ffffff;
  --ink:        #35312b;
  --ink-soft:   #6b645a;
  --ink-faint:  #97907f;
  --line:       #e6ddcc;
  --sage:       #7c8f6c;
  --sage-deep:  #5e6f50;
  --rose:       #b3877f;
  --rose-soft:  #f0e3df;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --shadow:    0 1px 3px rgba(53, 49, 43, .06), 0 8px 24px rgba(53, 49, 43, .05);
  --shadow-lg: 0 4px 12px rgba(53, 49, 43, .08), 0 20px 48px rgba(53, 49, 43, .10);
  --radius: 10px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap { max-width: 720px; margin: 0 auto; padding: 0 22px; }
.wrap-wide { max-width: 1020px; margin: 0 auto; padding: 0 22px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.25; margin: 0; }

a { color: var(--sage-deep); text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* ---------------------------------------------------------- section frame */

section { padding: 62px 0; }
section + section { border-top: 1px solid var(--line); }

.section-title {
  font-size: 1.55rem;
  letter-spacing: .01em;
  text-align: center;
  margin-bottom: 8px;
}
.section-lede {
  text-align: center;
  color: var(--ink-soft);
  font-size: 1.02rem;
  max-width: 34em;
  margin: 0 auto 38px;
}
.ornament {
  display: block;
  width: 44px; height: 1px;
  margin: 20px auto 30px;
  background: var(--line);
  position: relative;
}
.ornament::after {
  content: "";
  position: absolute; top: -2px; left: 50%;
  width: 5px; height: 5px; margin-left: -2.5px;
  border-radius: 50%;
  background: var(--sage);
  opacity: .5;
}

/* ---------------------------------------------------------------- hero */

.hero {
  background: linear-gradient(178deg, var(--paper-warm) 0%, var(--paper) 78%);
  padding: 54px 0 60px;
  text-align: center;
  border-top: none;
}
.hero-portrait {
  width: 100%;
  max-width: 460px;
  margin: 0 auto 34px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background: var(--card);
}
.hero-portrait img { display: block; width: 100%; height: auto; }

.hero-eyebrow {
  font-family: var(--sans);
  font-size: .72rem;
  letter-spacing: .19em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 16px;
}
.hero h1 {
  font-size: 2.75rem;
  letter-spacing: -.005em;
  margin-bottom: 6px;
}
.hero .maiden { color: var(--ink-soft); font-style: italic; font-size: 1.6rem; display: block; margin-top: 2px; }
.hero .dates {
  font-size: 1.05rem;
  color: var(--ink-soft);
  margin-top: 18px;
  font-variant-numeric: oldstyle-nums;
}
.hero .epitaph {
  font-style: italic;
  color: var(--ink-soft);
  max-width: 30em;
  margin: 26px auto 0;
  font-size: 1.08rem;
}

/* ------------------------------------------------------------ slideshow */

.slideshow {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: #efe9dd;
  box-shadow: var(--shadow-lg);
  aspect-ratio: 4 / 3;
}
.slide {
  position: absolute; inset: 0;
  opacity: 0;
  transition: opacity 1.1s ease;
  display: flex; align-items: center; justify-content: center;
}
.slide.is-active { opacity: 1; }
.slide img { width: 100%; height: 100%; object-fit: cover; display: block; }

.slide-caption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 46px 22px 18px;
  background: linear-gradient(to top, rgba(30,27,23,.72), rgba(30,27,23,0));
  color: #fff;
  font-size: .95rem;
  font-style: italic;
  text-align: center;
}

.slide-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 42px; height: 42px;
  border: none; border-radius: 50%;
  background: rgba(255,255,255,.82);
  color: var(--ink);
  font-size: 1.1rem; line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background .2s;
}
.slide-nav:hover { background: #fff; }
.slide-nav.prev { left: 12px; }
.slide-nav.next { right: 12px; }

.slide-dots {
  display: flex; justify-content: center; gap: 8px;
  margin-top: 18px;
}
.slide-dots button {
  width: 7px; height: 7px; padding: 0;
  border: none; border-radius: 50%;
  background: var(--line);
  cursor: pointer;
  transition: background .25s, transform .25s;
}
.slide-dots button.is-active { background: var(--sage); transform: scale(1.35); }

/* ------------------------------------------------------------- her story */

.story { font-size: 1.06rem; }
.story p { margin: 0 0 1.35em; }
.story p:first-of-type::first-letter {
  float: left;
  font-size: 3.4rem;
  line-height: .84;
  padding: .06em .1em 0 0;
  color: var(--sage-deep);
}

.service-note {
  margin-top: 34px;
  padding: 22px 26px;
  background: var(--paper-warm);
  border-left: 2px solid var(--sage);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: .98rem;
  color: var(--ink-soft);
  white-space: pre-line;
}

/* ----------------------------------------------------------- share form */

.share { background: var(--paper-warm); }

.form-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: var(--shadow);
}

.field { margin-bottom: 22px; }
.field:last-child { margin-bottom: 0; }

label {
  display: block;
  font-family: var(--sans);
  font-size: .8rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
label .optional { text-transform: none; letter-spacing: 0; color: var(--ink-faint); font-size: .85em; }

input[type="text"], textarea, select {
  width: 100%;
  padding: 13px 15px;
  font-family: var(--serif);
  font-size: 1.02rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 7px;
  transition: border-color .2s, background .2s;
}
input[type="text"]:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--sage);
  background: #fff;
}
textarea { min-height: 165px; resize: vertical; line-height: 1.68; }

.row { display: flex; gap: 16px; }
.row > * { flex: 1; }

/* the honeypot — off-screen, never focusable, invisible to a real visitor */
.hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px;
  opacity: 0;
}

.attach {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--paper);
  text-align: center;
}
.attach input[type="file"] { display: none; }
.attach-btn {
  display: inline-block;
  font-family: var(--sans);
  font-size: .92rem;
  padding: 10px 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.attach-btn:hover { border-color: var(--sage); background: var(--paper-warm); }
.attach-hint {
  font-family: var(--sans);
  font-size: .82rem;
  color: var(--ink-faint);
  margin-top: 10px;
}
.attach-list {
  font-family: var(--sans);
  font-size: .88rem;
  color: var(--sage-deep);
  margin-top: 12px;
  text-align: left;
}
.attach-list div { padding: 3px 0; }

/* voice recorder */
.recorder { margin-top: 14px; }
.rec-btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--sans); font-size: .92rem;
  padding: 10px 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  color: var(--ink);
  cursor: pointer;
}
.rec-btn:hover { border-color: var(--rose); }
.rec-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--rose);
}
.rec-btn.is-recording { border-color: var(--rose); background: var(--rose-soft); }
.rec-btn.is-recording .rec-dot { animation: pulse 1.1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
.rec-status { font-family: var(--sans); font-size: .86rem; color: var(--ink-soft); margin-top: 10px; }
.rec-status audio { width: 100%; margin-top: 8px; }

.btn-primary {
  display: block;
  width: 100%;
  padding: 15px 24px;
  font-family: var(--sans);
  font-size: 1rem;
  letter-spacing: .03em;
  color: #fff;
  background: var(--sage-deep);
  border: none;
  border-radius: 7px;
  cursor: pointer;
  transition: background .2s, transform .1s;
}
.btn-primary:hover { background: #4f5f43; }
.btn-primary:active { transform: translateY(1px); }

.privacy-note {
  font-family: var(--sans);
  font-size: .82rem;
  color: var(--ink-faint);
  text-align: center;
  margin-top: 16px;
  line-height: 1.6;
}

/* -------------------------------------------------------------- memories */

.memory {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 28px 24px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
  scroll-margin-top: 24px;
}
.memory-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.memory-name { font-size: 1.16rem; }
.memory-relation { color: var(--ink-soft); font-style: italic; font-size: .96rem; }
.memory-date {
  font-family: var(--sans);
  font-size: .78rem;
  color: var(--ink-faint);
  letter-spacing: .04em;
  white-space: nowrap;
}
.memory-edit {
  font-family: var(--sans);
  font-size: .78rem;
  letter-spacing: .04em;
  color: var(--sage-deep);
  margin-left: 12px;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1px;
}
.memory-edit:hover { border-bottom-color: var(--sage); }

.memory-text { white-space: pre-line; margin: 0; }

/* the edit page */
.edit-page { padding: 54px 0 70px; }
.edit-note {
  font-family: var(--sans);
  font-size: .88rem;
  color: var(--ink-soft);
  background: var(--paper-warm);
  border-left: 2px solid var(--sage);
  padding: 14px 18px;
  border-radius: 0 7px 7px 0;
  margin-bottom: 26px;
  line-height: 1.6;
}
.edit-media {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}
.edit-media-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper);
  text-align: center;
}
.edit-media-item img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.edit-media-item .kind {
  font-family: var(--sans);
  font-size: .8rem;
  color: var(--ink-soft);
  padding: 22px 8px;
}
.edit-media-item button {
  font-family: var(--sans);
  font-size: .76rem;
  color: #a8635a;
  background: none;
  border: none;
  border-top: 1px solid var(--line);
  width: 100%;
  padding: 8px;
  cursor: pointer;
}
.edit-media-item button:hover { background: var(--rose-soft); }
.edit-actions { display: flex; gap: 12px; align-items: center; }
.edit-actions .btn-primary { flex: 1; }
.edit-cancel { font-family: var(--sans); font-size: .92rem; color: var(--ink-soft); }

.memory-media {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 20px;
}
.memory-media.single { grid-template-columns: 1fr; max-width: 460px; }
.memory-media img {
  width: 100%; height: 100%; object-fit: cover;
  aspect-ratio: 1;
  border-radius: 7px;
  cursor: zoom-in;
  display: block;
  background: var(--paper-warm);
}
.memory-media.single img { aspect-ratio: auto; cursor: zoom-in; }
.memory-media video { width: 100%; border-radius: 7px; display: block; background: #000; }
.memory-media .full { grid-column: 1 / -1; }
.memory-media audio { width: 100%; }

.empty-note {
  text-align: center;
  color: var(--ink-soft);
  font-style: italic;
  padding: 30px 0 10px;
}

/* --------------------------------------------------------------- gallery */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.gallery-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 7px;
  cursor: zoom-in;
  display: block;
  background: var(--paper-warm);
  transition: transform .3s, box-shadow .3s;
}
.gallery-grid img:hover { transform: scale(1.015); box-shadow: var(--shadow); }

/* -------------------------------------------------------------- lightbox */

.lightbox {
  position: fixed; inset: 0;
  background: rgba(26, 23, 19, .93);
  display: none;
  align-items: center; justify-content: center;
  z-index: 100;
  padding: 26px;
}
.lightbox.is-open { display: flex; }
.lightbox img { max-width: 100%; max-height: 88vh; border-radius: 5px; }
.lightbox-close {
  position: absolute; top: 18px; right: 22px;
  background: none; border: none;
  color: #fff; font-size: 2rem; line-height: 1;
  cursor: pointer; opacity: .75;
}
.lightbox-close:hover { opacity: 1; }
.lightbox-cap {
  position: absolute; bottom: 24px; left: 0; right: 0;
  text-align: center; color: rgba(255,255,255,.8);
  font-style: italic; font-size: .94rem; padding: 0 26px;
}
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: none; border: none;
  color: #fff; font-size: 2.1rem; line-height: 1;
  cursor: pointer; opacity: .6; padding: 20px;
}
.lightbox-nav:hover { opacity: 1; }
.lightbox-nav.prev { left: 4px; }
.lightbox-nav.next { right: 4px; }

/* --------------------------------------------------------------- flashes */

.flash {
  max-width: 720px;
  margin: 22px auto 0;
  padding: 15px 20px;
  border-radius: 8px;
  font-family: var(--sans);
  font-size: .95rem;
  text-align: center;
}
.flash.success { background: #eef2e8; color: var(--sage-deep); border: 1px solid #d8e2cc; }
.flash.error   { background: var(--rose-soft); color: #8a5b53; border: 1px solid #e4cdc8; }

/* ---------------------------------------------------------------- footer */

footer {
  padding: 46px 0 60px;
  text-align: center;
  color: var(--ink-faint);
  font-size: .88rem;
  font-family: var(--sans);
  border-top: 1px solid var(--line);
}
footer a { color: var(--ink-faint); }

/* ----------------------------------------------------------------- phone */

@media (max-width: 620px) {
  body { font-size: 17px; }
  section { padding: 46px 0; }
  .hero h1 { font-size: 2.15rem; }
  .hero .maiden { font-size: 1.3rem; }
  .form-card { padding: 24px 20px; }
  .memory { padding: 22px 20px 20px; }
  .row { flex-direction: column; gap: 22px; }
  .slide-nav { width: 36px; height: 36px; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
}

@media print {
  .share, .slide-nav, .slide-dots, footer { display: none; }
}
