/* The Walton Family Photographs — review gallery
   Monahan Brand Guide: Aunt Betty's China ground, Lowcountry earth tones,
   Harbor Navy as the single cool anchor, Aged Brass for decorative rules.
   Georgia and EB Garamond throughout — no sans-serif primaries.

   Vertical rhythm runs ~20% tighter than the first pass. Body line-height
   sits at 1.7, the low end of the guide's 1.7–1.85, not below it. */

:root {
  /* 01 — Palette */
  --china:      #E7E0D2;   /* Aunt Betty's China — dominant ground */
  --marsh-oak:  #7A5C44;   /* warm contrast, secondary elements */
  --oyster:     #C49083;   /* warm accent, highlights */
  --navy:       #2C3E5A;   /* Harbor Navy — sparingly, the anchor */
  --brass:      #B8934E;   /* decorative rules, monograms */
  --linen:      #FAF8F5;   /* page ground */

  --ink:        #2E2A25;   /* body */
  --ink-soft:   #6B6460;   /* secondary */
  --divider:    #D4CCBB;

  --china-deep: #DDD4C2;   /* China, one step down for hover ground */
  --navy-deep:  #1B2533;   /* viewer overlay */

  /* 02 — Type */
  --display: "EB Garamond", Georgia, "Times New Roman", serif;
  --body:    Georgia, "Times New Roman", serif;

  --frame-h: 440px;        /* image ceiling — deliberately not reduced */
  --measure: 60ch;
  --gutter:  clamp(16px, 4vw, 51px);
  --pad-frame: 13px;       /* frame inset; --box-h below must match */
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--linen);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { color: var(--navy); }

.wrap {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ── Brand marker ────────────────────────────────────────────
   Five-colour accent bar, weighted toward Aunt Betty's China. */

.accent-bar {
  display: flex;
  height: 6px;
}
.accent-bar i { display: block; }
.accent-bar i:nth-child(1) { flex: 4; background: var(--china); }
.accent-bar i:nth-child(2) { flex: 1.5; background: var(--marsh-oak); }
.accent-bar i:nth-child(3) { flex: 1.5; background: var(--oyster); }
.accent-bar i:nth-child(4) { flex: 1.5; background: var(--navy); }
.accent-bar i:nth-child(5) { flex: 1.5; background: var(--brass); }

/* ── Shared type ─────────────────────────────────────────────
   Caption style: 0.8rem, uppercase, tracked. */

.kicker {
  font-family: var(--body);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--marsh-oak);
  margin: 0;
}

.wordmark {
  font-family: var(--body);
  font-size: 0.95rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--navy);
  margin: 0;
}

/* ── Masthead ────────────────────────────────────────────────
   Document header pattern: China ground, brass rule at the edge. */

.masthead {
  background: var(--china);
  border-bottom: 3px solid var(--brass);
  text-align: center;
  padding: clamp(27px, 4vw, 42px) 0 clamp(27px, 4vw, 40px);
}

.masthead h1 {
  font-family: var(--display);
  font-size: clamp(1.9rem, 4.4vw, 2.4rem);
  font-weight: 400;
  line-height: 1.18;
  color: var(--navy);
  margin: 14px 0 0;
}

.masthead .lede {
  max-width: var(--measure);
  margin: 16px auto 0;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.75;
}

.masthead .brass-rule {
  width: 76px;
  height: 2px;
  background: var(--brass);
  border: 0;
  margin: 16px auto;
}

/* Diamond monogram: frame and mark turn 45° together, as one piece. A rotated
   square overflows its 80px layout box by ~17px on each side, so the margins
   carry that plus the gap we actually want to see. */
.crest {
  width: 80px;
  height: 80px;
  margin: 33px auto 35px;
  border: 1px solid var(--brass);
  background: var(--linen);
  padding: 7px;
  transform: rotate(45deg);
}
.crest img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.tally {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}
.tally li {
  padding: 0 clamp(14px, 2.4vw, 26px);
  border-left: 1px solid var(--brass);
}
.tally li:first-child { border-left: 0; }
.tally b {
  display: block;
  font-family: var(--display);
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--navy);
  line-height: 1.25;
}
.tally span {
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--marsh-oak);
}

/* ── Legend ──────────────────────────────────────────────────
   Four stages: 4 across or 2, never a stranded cell. */

.legend { padding: clamp(32px, 4vw, 46px) 0; }

.legend-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin: 13px 0 0;
  border-top: 1px solid var(--divider);
  border-left: 1px solid var(--divider);
}
.legend-grid div {
  border-right: 1px solid var(--divider);
  border-bottom: 1px solid var(--divider);
  padding: 16px 19px 18px;
}
.legend-grid dt {
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--marsh-oak);
  margin-bottom: 6px;
}
.legend-grid dd {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

@media (max-width: 900px) { .legend-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 460px) { .legend-grid { grid-template-columns: 1fr; } }

/* ── Index of plates ─────────────────────────────────────────── */

.index { padding: 0 0 clamp(30px, 4vw, 43px); }
.index-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 0 24px;
  list-style: none;
  margin: 13px 0 0;
  padding: 0;
}
.index-list a {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 6px 0;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--divider);
}
.index-list a:hover { color: var(--navy); border-bottom-color: var(--brass); }
.index-list .num {
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  color: var(--brass);
  min-width: 34px;
  flex: none;
}

/* ── Plates ──────────────────────────────────────────────────── */

.plate {
  padding: clamp(35px, 4.8vw, 58px) 0;
  border-top: 1px solid var(--divider);
  scroll-margin-top: 16px;
}

.plate-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 19px;
  flex-wrap: wrap;
  margin-bottom: clamp(21px, 3.2vw, 32px);
}
.plate-head h2 {
  font-family: var(--display);
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--navy);
  margin: 4px 0 0;
}
.plate-head .meta {
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.row {
  display: grid;
  gap: clamp(14px, 1.9vw, 26px);
  align-items: end;
}

.card { margin: 0; cursor: zoom-in; min-width: 0; }

/* The frame hugs its shot, so a wide plate carries no dead ground above.
   --frame-h is the ceiling: it caps how tall a portrait may grow. */
.frame {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: var(--china);
  border-bottom: 2px solid var(--brass);
  padding: var(--pad-frame) var(--pad-frame) 0;
  transition: background 0.25s ease;
}
.card:hover .frame { background: var(--china-deep); }

/* Every version of a plate gets an identical box, sized from the original's
   aspect ratio, so a row of versions lines up exactly. Versions whose ratio
   drifted during processing letterbox rather than break the row. */
.shot {
  --box-h: calc(var(--frame-h) - var(--pad-frame));
  width: min(100%, calc(var(--box-h) * var(--plate-ratio, 1)));
  aspect-ratio: var(--plate-ratio, 1);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.shot img {
  max-height: 100%;
  max-width: 100%;
  width: auto;
  object-fit: contain;
  box-shadow: 0 1px 2px rgba(46, 42, 37, 0.14), 0 10px 26px -12px rgba(46, 42, 37, 0.38);
  transition: transform 0.3s cubic-bezier(.2,.7,.3,1);
}
.card:hover .shot img { transform: translateY(-5px); }

.caption { padding: 11px 2px 0; }
.caption .name {
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--marsh-oak);
}
.caption .blurb {
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin-top: 2px;
  line-height: 1.5;
}
.caption .dims {
  font-size: 0.8rem;
  color: var(--ink-soft);
  opacity: 0.75;
  margin-top: 3px;
}

/* ── Source scans ────────────────────────────────────────────── */

.scans { padding: clamp(42px, 5.6vw, 69px) 0 0; border-top: 2px solid var(--brass); }
.scans h2 {
  font-family: var(--display);
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--navy);
  margin: 4px 0 0;
}
.scans-intro { max-width: var(--measure); color: var(--ink-soft); margin: 11px 0 0; }
.scan-grid {
  --frame-h: 320px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
  gap: clamp(16px, 2.1vw, 27px);
  align-items: end;
  margin-top: clamp(24px, 3.2vw, 35px);
}

/* ── Footer ──────────────────────────────────────────────────── */

.foot {
  margin-top: clamp(48px, 6.4vw, 83px);
  background: var(--china);
  border-top: 3px solid var(--brass);
  padding: 30px 0 37px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.95rem;
}
.foot p { margin: 0.5em 0; }
.foot .wordmark { margin-bottom: 10px; }
.foot .sig { font-style: italic; color: var(--ink-soft); }

/* ── Viewer ──────────────────────────────────────────────────── */

.lb {
  position: fixed;
  inset: 0;
  background: rgba(27, 37, 51, 0.97);
  display: none;
  flex-direction: column;
  z-index: 50;
}
.lb[open] { display: flex; }

.lb-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(13px, 2.4vw, 32px) clamp(16px, 6vw, 90px) 6px;
}
.lb-stage img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  box-shadow: 0 24px 70px -20px rgba(0, 0, 0, 0.75);
}

.lb-bar {
  flex: none;
  padding: 11px clamp(16px, 4vw, 40px) clamp(16px, 2.4vw, 22px);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 21px;
  flex-wrap: wrap;
  border-top: 1px solid var(--brass);
}
.lb-title {
  font-family: var(--display);
  color: var(--china);
  font-size: 1.15rem;
  line-height: 1.3;
}
.lb-sub {
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--brass);
  margin-top: 5px;
}
.lb-file {
  font-size: 0.8rem;
  color: rgba(231, 224, 210, 0.45);
  margin-top: 4px;
  word-break: break-all;
}

.lb-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.lb-tabs button {
  font-family: var(--body);
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--china);
  background: transparent;
  border: 1px solid rgba(184, 147, 78, 0.55);
  border-radius: 0;
  padding: 7px 14px;
  cursor: pointer;
  transition: all 0.18s ease;
}
.lb-tabs button:hover { border-color: var(--brass); background: rgba(184, 147, 78, 0.16); }
.lb-tabs button[aria-current="true"] {
  background: var(--brass);
  border-color: var(--brass);
  color: var(--navy-deep);
}

.lb-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  font-family: var(--body);
  font-size: 1.6rem;
  line-height: 1;
  color: var(--brass);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0;
  cursor: pointer;
}
.lb-close:hover { color: var(--china); border-color: var(--brass); }

.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: clamp(38px, 4.5vw, 56px);
  height: 88px;
  background: transparent;
  border: 0;
  color: var(--brass);
  font-size: 2rem;
  cursor: pointer;
  transition: color 0.18s ease;
}
.lb-nav:hover { color: var(--china); }
.lb-prev { left: 4px; }
.lb-next { right: 4px; }

.lb-hint {
  text-align: center;
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(231, 224, 210, 0.4);
  padding-bottom: 10px;
}

body.locked { overflow: hidden; }

/* ── Responsive ──────────────────────────────────────────────── */

@media (max-width: 1080px) {
  :root { --frame-h: 340px; }
  .row { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (max-width: 560px) {
  :root { --frame-h: 300px; }
  .row { grid-template-columns: 1fr !important; }
  .plate-head { margin-bottom: 18px; }
  .tally li { padding: 0 12px; }
  .lb-bar { flex-direction: column; align-items: flex-start; }
  .lb-nav { height: 66px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .card:hover .shot img { transform: none; }
}

@media print {
  .lb, .index, .legend, .lb-close, .accent-bar { display: none !important; }
  body { background: #fff; }
  .plate { break-inside: avoid; }
}
