/* ============================================================
   Memorial site styles — editorial / keepsake-book feel
   Display:  Fraunces   ·   Text:  Newsreader
   ============================================================ */

:root {
  --paper:     #edf0f5;   /* soft cool paper */
  --paper-2:   #e4eaf2;   /* slightly deeper, for the hero wash */
  --card:      #fbfcfe;
  --ink:       #18293d;   /* deep navy ink */
  --ink-soft:  #50637a;
  --blue:      #36648f;   /* dusty ocean blue accent */
  --blue-deep: #1d3c5b;
  --rule:      #cad5e2;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --body:    "Newsreader", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }

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

/* ---------- Password gate ---------- */
.gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(120% 90% at 50% 0%, #dde6f2, #c6d4e6);
}
.gate-card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 4px;
  box-shadow: 0 24px 70px rgba(20, 45, 80, 0.20);
  padding: 52px 44px;
  max-width: 430px;
  width: 100%;
  text-align: center;
}
.gate-card h1 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 2rem;
  line-height: 1.1;
  margin: 0 0 14px;
  color: var(--blue-deep);
}
.gate-sub { color: var(--ink-soft); margin: 0 0 28px; font-size: 1rem; }
#gate-form { display: flex; flex-direction: column; gap: 12px; }
#gate-input {
  padding: 13px 16px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  font-size: 1rem;
  font-family: var(--body);
  text-align: center;
  background: #fff;
}
#gate-input:focus { outline: 2px solid var(--blue); border-color: var(--blue); }
#gate-form button {
  padding: 13px 16px;
  border: none;
  border-radius: 3px;
  background: var(--blue-deep);
  color: #fff;
  font-family: var(--body);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  cursor: pointer;
  transition: background 0.2s;
}
#gate-form button:hover { background: var(--blue); }
.gate-error { color: #b0463c; font-size: 0.9rem; margin: 16px 0 0; }

/* ---------- Hero ---------- */
.hero {
  padding: 96px 24px 64px;
  text-align: center;
  background: linear-gradient(180deg, var(--paper-2), var(--paper));
}
.hero-inner { max-width: 820px; margin: 0 auto; }
.hero-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.34em;
  font-size: 0.72rem;
  color: var(--blue);
  margin: 0 0 22px;
  padding-left: 0.34em;
}
.hero-name {
  font-family: var(--display);
  font-optical-sizing: auto;
  font-weight: 500;
  font-size: clamp(2.8rem, 7.5vw, 5rem);
  line-height: 1.02;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--ink);
}
.hero-dates {
  font-family: var(--body);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.92rem;
  color: var(--ink-soft);
  margin: 22px 0 0;
}
.hero-tagline {
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
  color: var(--blue-deep);
  margin: 18px 0 0;
  font-size: 1.4rem;
}
.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 34px;
  color: var(--blue);
}
.ornament span { font-size: 1rem; opacity: 0.9; }
.ornament::before, .ornament::after {
  content: "";
  width: clamp(44px, 14vw, 110px);
  height: 1px;
  background: var(--rule);
}

/* ---------- Tabs (editorial underline) ---------- */
.tabs {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: clamp(14px, 4vw, 44px);
  padding: 0 16px;
  background: rgba(237, 240, 245, 0.93);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.tab {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--body);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  padding: 20px 4px 18px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.tab:hover { color: var(--blue); }
.tab.active { color: var(--ink); border-bottom-color: var(--blue); }

/* ---------- Sections ---------- */
.section {
  max-width: 880px;
  margin: 0 auto;
  padding: 72px 24px 88px;
}
.section-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2rem, 5vw, 2.8rem);
  text-align: center;
  margin: 0 0 12px;
  color: var(--blue-deep);
}
.section-title + * { margin-top: 0; }
.section > .section-title { margin-bottom: 48px; }
.empty-note { text-align: center; color: var(--ink-soft); font-style: italic; }

/* ---------- About ---------- */
.about-intro {
  text-align: center;
  font-family: var(--display);
  font-style: italic;
  font-size: 1.5rem;
  line-height: 1.5;
  color: var(--blue-deep);
  max-width: 680px;
  margin: 0 auto 52px;
}
.about-body {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 48px;
  align-items: start;
}
.about-portrait { margin: 0; }
.about-portrait img {
  width: 100%;
  border-radius: 3px;
  border: 1px solid var(--rule);
  box-shadow: 0 16px 40px rgba(20, 45, 80, 0.16);
  display: block;
}
.about-portrait figcaption {
  margin-top: 12px;
  text-align: center;
  font-style: italic;
  color: var(--ink-soft);
  font-size: 0.95rem;
}
.prose { font-size: 1.16rem; }
.obituary p { margin: 0 0 1.2em; }
.obituary p:first-of-type::first-letter {
  font-family: var(--display);
  font-weight: 500;
  font-size: 3.4em;
  line-height: 0.78;
  float: left;
  margin: 0.04em 0.1em 0 0;
  color: var(--blue-deep);
}
.service-card {
  margin-top: 52px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 30px 32px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 1.08rem;
}
.service-card .service-label {
  display: block;
  font-family: var(--body);
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 0.72rem;
  color: var(--blue);
  margin-bottom: 12px;
}

/* ---------- Gallery ---------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}
.gallery-item {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 3px;
  cursor: pointer;
  background: #dde6f1;
  border: 1px solid var(--rule);
}
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}
.gallery-item:hover img { transform: scale(1.05); }
.gallery-item .cap {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 26px 13px 11px;
  font-family: var(--body);
  font-size: 0.85rem;
  line-height: 1.35;
  color: #fff;
  background: linear-gradient(transparent, rgba(10, 25, 45, 0.78));
  opacity: 0;
  transition: opacity 0.3s;
}
.gallery-item:hover .cap { opacity: 1; }

/* ---------- Memories (carousel) ---------- */
.story-viewer { display: flex; align-items: center; gap: 18px; }
.story-arrow {
  flex: 0 0 auto;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--card);
  color: var(--blue);
  font-family: var(--body);
  font-size: 1.9rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.story-arrow:hover { background: var(--blue); color: #fff; border-color: var(--blue); }
.story {
  position: relative;
  flex: 1 1 auto;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 46px 48px 38px;
  box-shadow: 0 10px 34px rgba(20, 45, 80, 0.08);
  min-height: 280px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  transition: opacity 0.2s ease;
}
.story::before {
  content: "\201C";
  position: absolute;
  top: 2px;
  left: 24px;
  font-family: var(--display);
  font-weight: 500;
  font-size: 7rem;
  line-height: 1;
  color: var(--blue);
  opacity: 0.14;
  pointer-events: none;
}
.story-text { position: relative; margin: 0 0 22px; font-size: 1.2rem; line-height: 1.7; }
.story-text p { margin: 0 0 1em; }
.story-text p:last-child { margin-bottom: 0; }
.story-meta {
  position: relative;
  font-family: var(--display);
  font-style: italic;
  font-size: 1.3rem;
  color: var(--blue-deep);
}
.story-meta .date {
  font-family: var(--body);
  font-style: normal;
  color: var(--ink-soft);
  font-size: 0.95rem;
}
.story-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 26px;
}
.story-counter {
  font-family: var(--body);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.78rem;
  color: var(--blue-deep);
}
.story-hint { font-size: 0.9rem; color: var(--ink-soft); font-style: italic; }

/* ---------- Share ---------- */
.share { text-align: center; }
.share-intro { max-width: 580px; margin: 0 auto 36px; color: var(--ink-soft); font-size: 1.12rem; }
#form-container iframe { width: 100%; max-width: 680px; border: none; border-radius: 4px; }
.form-fallback {
  display: inline-block;
  margin-top: 8px;
  padding: 14px 32px;
  background: var(--blue-deep);
  color: #fff;
  text-decoration: none;
  border-radius: 3px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  transition: background 0.2s;
}
.form-fallback:hover { background: var(--blue); }

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  padding: 56px 24px;
  color: var(--ink-soft);
  font-family: var(--display);
  font-style: italic;
  font-size: 1.2rem;
  border-top: 1px solid var(--rule);
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(9, 20, 36, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 40px;
}
.lightbox img {
  max-width: 90vw;
  max-height: 78vh;
  border-radius: 3px;
  box-shadow: 0 16px 50px rgba(0,0,0,0.55);
}
.lightbox-caption {
  color: #e8eef6;
  margin: 20px 0 0;
  font-family: var(--display);
  font-style: italic;
  font-size: 1.05rem;
  text-align: center;
}
.lightbox button {
  position: absolute;
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: none;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.2s;
}
.lightbox button:hover { background: rgba(255,255,255,0.28); }
.lightbox-close { top: 24px; right: 28px; width: 46px; height: 46px; font-size: 1.8rem; line-height: 1; }
.lightbox-prev, .lightbox-next {
  top: 50%; transform: translateY(-50%);
  width: 56px; height: 56px; font-size: 2.2rem; line-height: 1;
}
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .about-body { grid-template-columns: 1fr; gap: 32px; }
  .about-portrait { max-width: 280px; margin: 0 auto; }
  .obituary { text-align: left; }
}
@media (max-width: 600px) {
  body { font-size: 17px; }
  .hero { padding: 64px 20px 48px; }
  .section { padding: 52px 18px 68px; }
  .story { padding: 34px 24px 30px; min-height: 320px; }
  .story::before { font-size: 5rem; left: 14px; }
  .story-text { font-size: 1.12rem; }
  .story-arrow { width: 44px; height: 44px; font-size: 1.6rem; }
  .story-viewer { gap: 8px; }
  .about-intro { font-size: 1.3rem; }
  .lightbox-prev, .lightbox-next { width: 44px; height: 44px; font-size: 1.7rem; }
}
