/* thejohnstonclan.com — memorial for Michael J. Johnston.
   Palette drawn from his photos: misty mountain greens and the warm red of his plaid shirts. */
:root {
  --paper: #f6f3ec;        /* warm ivory */
  --paper-2: #ece8dd;
  --card: #fffdf8;
  --ink: #26302a;          /* deep forest */
  --ink-soft: #4d5a51;
  --pine: #2f3d34;
  --sage: #7d8f7f;
  --mist: #dfe4dc;
  --plaid: #9a3b32;        /* plaid-shirt red, used sparingly */
  --plaid-dark: #7c2d26;
  --rule: #cfc8b8;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --measure: 38rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.7;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--plaid); text-underline-offset: 0.2em; }
a:hover { color: var(--plaid-dark); }
a:focus-visible, .btn:focus-visible { outline: 3px solid var(--plaid); outline-offset: 3px; border-radius: 4px; }

[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Hero ---------- */
.hero { position: relative; text-align: center; }
.hero-banner {
  height: clamp(200px, 34vw, 420px);
  background:
    linear-gradient(to bottom, rgba(246,243,236,0) 45%, var(--paper) 100%),
    url("/photos/hiking-in-the-mist.jpg") center 30% / cover no-repeat;
  filter: saturate(0.85);
}
.hero-inner {
  position: relative;
  margin-top: clamp(-130px, -12vw, -70px);
  padding: 0 1.25rem;
}
.portrait {
  width: clamp(150px, 22vw, 220px);
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center 30%;
  margin: 0 auto 1.25rem;
  border-radius: 999px 999px 18px 18px;   /* arched, like a chapel window */
  border: 6px solid var(--card);
  box-shadow: 0 10px 30px rgba(38, 48, 42, 0.25);
}
.kicker {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--sage);
}
h1 {
  margin: 0.2rem 0 0;
  font-weight: 400;
  font-size: clamp(2.3rem, 6vw, 3.6rem);
  line-height: 1.1;
  letter-spacing: 0.01em;
  color: var(--pine);
}
.nickname { margin: 0.25rem 0 0; font-style: italic; font-size: 1.3rem; color: var(--ink-soft); }
.dates {
  margin: 0.6rem 0 0;
  font-size: 1.15rem;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

.jump {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem 1.5rem;
  margin: 2rem auto 0; padding: 0.9rem 1rem;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  max-width: 46rem;
  font-family: var(--sans); font-size: 0.85rem; letter-spacing: 0.12em; text-transform: uppercase;
}
.jump a { color: var(--ink-soft); text-decoration: none; padding: 0.25rem 0; }
.jump a:hover { color: var(--plaid); }

/* ---------- Sections ---------- */
main { padding: 0 1.25rem 3rem; }
section { max-width: var(--measure); margin: 3.5rem auto 0; scroll-margin-top: 1.5rem; }
h2 {
  margin: 0 0 1.25rem;
  font-weight: 400;
  font-size: 1.7rem;
  color: var(--pine);
  text-align: center;
}
h2::after {
  content: ""; display: block; width: 3rem; height: 2px;
  margin: 0.6rem auto 0; background: var(--plaid); opacity: 0.7;
}

.obituary p { margin: 0 0 1.25em; hyphens: auto; }
.obituary .lede { font-size: 1.28rem; line-height: 1.6; }
.obituary .lede::first-letter {
  float: left; font-size: 3.6em; line-height: 0.85; padding: 0.08em 0.1em 0 0; color: var(--pine);
}
.ornament { text-align: center; color: var(--sage); letter-spacing: 1em; margin-top: 2rem !important; }

.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 2rem 1.75rem;
  text-align: center;
  box-shadow: 0 2px 10px rgba(38, 48, 42, 0.05);
}
.service { border-top: 4px solid var(--pine); }
.service .when { font-size: 1.3rem; color: var(--pine); margin: 0 0 1rem; }
.service address { font-style: normal; margin: 0 0 1rem; line-height: 1.6; }
.card p { margin: 0 0 1rem; }

.buttons { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; margin-top: 1.5rem !important; }
.btn {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  background: var(--pine);
  color: #fff;
  font-family: var(--sans); font-size: 0.95rem; font-weight: 500; letter-spacing: 0.02em;
  text-decoration: none;
  border: 2px solid var(--pine);
  transition: background 0.15s, color 0.15s;
}
.btn:hover { background: var(--plaid); border-color: var(--plaid); color: #fff; }
.btn-quiet { background: transparent; color: var(--pine); }
.btn-quiet:hover { background: var(--pine); border-color: var(--pine); }

.donations > p { text-align: center; }
.give { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.give-card {
  display: flex; flex-direction: column; gap: 0.3rem;
  padding: 1.25rem 1.25rem 1.1rem;
  background: var(--mist);
  border-radius: 12px;
  border: 1px solid transparent;
  color: var(--ink); text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}
.give-card:hover { border-color: var(--sage); color: var(--ink); transform: translateY(-2px); }
.give-name { font-size: 1.15rem; line-height: 1.35; color: var(--pine); }
.give-why { font-size: 0.95rem; color: var(--ink-soft); line-height: 1.45; }
.give-cta { margin-top: auto; padding-top: 0.5rem; font-family: var(--sans); font-size: 0.85rem; font-weight: 600; color: var(--plaid); letter-spacing: 0.04em; }
.thanks { font-style: italic; color: var(--ink-soft); }

/* ---------- Photos ---------- */
.photos { max-width: 56rem; }
.gallery { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; }
.thumb { flex: 0 1 13rem; min-width: 9rem; display: block; border-radius: 10px; overflow: hidden; background: var(--paper-2); aspect-ratio: 1; }
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: center 30%; transition: transform 0.3s; }
.thumb:hover img { transform: scale(1.04); }

.lightbox {
  display: none;
  position: fixed; inset: 0; z-index: 10; margin: 0;
  background: rgba(20, 26, 22, 0.94);
  padding: 3.5rem 1rem 1.5rem;
  flex-direction: column; align-items: center; justify-content: center; gap: 0.75rem;
}
.lightbox:target { display: flex; }
.lightbox img { max-height: calc(100vh - 8rem); width: auto; max-width: 100%; border-radius: 6px; }
.lightbox figcaption { color: #e9e6dc; font-style: italic; text-align: center; }
.lb-close {
  position: absolute; top: 0.5rem; right: 1rem;
  color: #fff; font-size: 2.5rem; line-height: 1; text-decoration: none; padding: 0.25rem 0.5rem;
}
.lb-close:hover { color: #fff; opacity: 0.8; }

/* ---------- Footer ---------- */
footer {
  margin-top: 2rem;
  padding: 2.5rem 1.25rem 3rem;
  background: var(--pine);
  color: #d9ddd5;
  text-align: center;
  font-size: 0.95rem;
}
footer p { margin: 0.25rem 0; }
.foot-name { font-size: 1.15rem; color: #fff; }

/* ---------- Small screens ---------- */
@media (max-width: 34rem) {
  body { font-size: 1.0625rem; }
  .card { padding: 1.6rem 1.1rem; }
  .jump { gap: 0.1rem 1rem; font-size: 0.75rem; }
}

/* ---------- Print: a clean one-page-ish obituary ---------- */
@media print {
  @page { margin: 0.75in; }
  body { background: #fff; color: #000; font-size: 11.5pt; line-height: 1.5; }
  .hero-banner, .jump, .photos, .buttons, .give-cta, footer { display: none !important; }
  .hero-inner { margin-top: 0; }
  .portrait { width: 1.6in; box-shadow: none; border: 0; }
  section { margin-top: 1.5rem; max-width: none; }
  .card { box-shadow: none; border: 1px solid #999; break-inside: avoid; }
  .give-card { background: none; border: 1px solid #bbb; }
  a { color: #000; text-decoration: none; }
}

/* ---------- Family photo sharing ---------- */
.share-cta { text-align: center; margin: 1.25rem 0 0; font-size: 1rem; color: var(--ink-soft); }
.share-page main { padding-top: 2.5rem; }
.share-head { text-align: center; }
.share-head h1 { font-size: clamp(2rem, 5vw, 2.8rem); margin-bottom: 0.75rem; }
.share-form { text-align: left; }
.field { display: block; margin-bottom: 1.25rem; }
.field span { display: block; font-family: var(--sans); font-size: 0.85rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 0.35rem; }
.share-page input[type="text"] {
  width: 100%; padding: 0.6rem 0.75rem; font: inherit; font-size: 1rem;
  border: 1px solid var(--rule); border-radius: 8px; background: #fff; color: var(--ink);
}
.share-page input[type="text"]:focus { outline: 2px solid var(--pine); outline-offset: 1px; }
.pick { position: relative; display: block; text-align: center; cursor: pointer; }
.pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.pick:focus-within { outline: 3px solid var(--plaid); outline-offset: 3px; }
button.btn { cursor: pointer; font-size: 1rem; }
button.btn:disabled { opacity: 0.5; cursor: wait; }

.queue { list-style: none; padding: 0; margin: 1.25rem 0 0; display: grid; gap: 0.75rem; }
.queue li { display: grid; grid-template-columns: 4.5rem 1fr auto; gap: 0.75rem; align-items: start;
  padding: 0.6rem; border: 1px solid var(--rule); border-radius: 10px; background: #fff; }
.queue img, .queue .noprev { width: 4.5rem; height: 4.5rem; object-fit: cover; border-radius: 6px; background: var(--paper-2);
  display: grid; place-items: center; font-size: 1.5rem; }
.q-body { display: grid; gap: 0.35rem; min-width: 0; }
.fname { font-family: var(--sans); font-size: 0.8rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.state { font-family: var(--sans); font-size: 0.85rem; }
.queue li.ok { border-color: var(--sage); background: #f3f6f1; }
.queue li.ok .state { color: var(--pine); font-weight: 600; }
.queue li.err { border-color: var(--plaid); }
.queue li.err .state { color: var(--plaid-dark); }
.queue li.busy .state { color: var(--ink-soft); font-style: italic; }
.linkish { background: none; border: 0; padding: 0.2rem; font: inherit; font-family: var(--sans); font-size: 0.8rem;
  color: var(--plaid); text-decoration: underline; cursor: pointer; }
.status { text-align: center; font-size: 1.05rem; color: var(--pine); margin: 0.5rem 0 0 !important; }

.uploaded { max-width: 56rem; }
.hint { text-align: center; color: var(--ink-soft); font-size: 0.95rem; }
.shared { margin: 0; flex: 0 1 11rem; }
.shared img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: var(--paper-2); }
.shared figcaption { display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem;
  font-size: 0.85rem; line-height: 1.35; color: var(--ink-soft); padding-top: 0.35rem; }
