/* Black Paper Album: page layout. Tokens and shared controls are in styles.css. */

.loading, .fatal { max-width: 38em; margin: 20vh auto; padding: 0 20px; text-align: center; color: var(--muted); }
.fatal .btn { margin-top: 16px; }
.muted { color: var(--muted); }
.q { color: var(--hot); font-weight: 700; }
.ink { font-family: var(--hand); font-weight: 400; letter-spacing: 0; }

.skip { position: absolute; left: 12px; top: -80px; z-index: 10; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: var(--radius); font-weight: 700; }
.skip:focus { top: 12px; }

/* a photograph mounted on a lifted album sheet on the black page */
.mount { --mat: 14px; position: relative; display: block; margin-inline: auto; max-width: 100%; padding: var(--mat); background: var(--page); border: 1px solid #4a463f; box-shadow: 0 10px 28px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(241, 239, 232, .08); }
.mount.sm { --mat: 7px; }
.mount .frame { display: block; position: relative; }
.mount .frame > img { width: 100%; height: auto; background: #0e0d0c; }
.mount.broken { min-height: 200px; display: grid; place-items: center; background: var(--page); }
.mount.broken .frame { display: none; }
.mount.broken::after { content: "This picture could not be loaded. Please try again in a moment."; max-width: 22em; padding: 24px; text-align: center; color: var(--muted); }

/* header */
.top { border-bottom: 1px solid var(--line); }
.top nav { max-width: 1180px; margin: 0 auto; padding: 14px 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 24px; }
.brand { font-family: var(--hand); font-size: 28px; line-height: 1.2; color: var(--ink); text-decoration: none; margin-right: auto; padding: 6px 0; }
.top .links { display: flex; flex-wrap: wrap; gap: 4px; }
.top .links a { display: inline-flex; align-items: center; min-height: 48px; padding: 8px 14px; font-size: 19px; text-decoration: none; border-bottom: 3px solid transparent; }
.top .links a:hover { border-bottom-color: var(--edge); }
.top .links a[aria-current=page] { border-bottom-color: var(--ink); font-weight: 700; }

main { margin: 0 auto; padding: 36px 20px 80px; }
main:focus { outline: none; }
.w1000 { max-width: 1000px; }
.w1100 { max-width: 1100px; }
.page-title { font-size: clamp(36px, 6vw, 48px); margin: 0 0 8px; }
.back-link { display: inline-flex; align-items: center; min-height: 48px; font-size: 18px; }

/* lock page */
.lock { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.lock form { width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: 26px; text-align: center; }
.lock h1 { font-family: var(--hand); font-weight: 400; font-size: clamp(44px, 10vw, 60px); line-height: 1.1; margin: 0; }
.lock .field-col { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.lock label { font-size: 19px; font-weight: 700; }
.lock .input { min-height: 58px; font-size: 21px; flex: 1; min-width: 0; }
.lock p { font-size: 17px; margin: 0; }
.error { font-size: 18px; font-weight: 700; color: var(--corner); min-height: 1.5em; }

/* home */
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding-bottom: 48px; border-bottom: 1px solid var(--line); }
.hero-photo { display: block; width: 100%; text-decoration: none; }
.hero-photo .mount { margin-bottom: 14px; }
.hero-photo .ink { display: block; font-size: 24px; line-height: 1.3; color: var(--ink); }
.hero h1 { font-family: var(--hand); font-weight: 400; font-size: clamp(42px, 8vw, 68px); line-height: 1.05; margin: 0; }
.hero .dates { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 26px; font-size: 21px; color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.sec { padding: 44px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.sec h2 { margin: 0; font-size: clamp(28px, 4.5vw, 36px); }
.sec h2 a { text-decoration: none; }
.sec h2 a:hover { text-decoration: underline; text-decoration-color: var(--edge); }
.sec .years { color: var(--muted); font-size: 19px; }
.sec .excerpt { margin: 0; max-width: 38em; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sec .strip { display: flex; flex-wrap: wrap; gap: 16px; text-decoration: none; margin-top: 6px; }
.sec .strip .mount { margin: 0; width: auto; }
.sec .strip img { height: clamp(110px, 24vw, 170px); width: auto; max-width: 100%; }
.sec .open { display: inline-flex; align-items: center; min-height: 48px; font-size: 19px; font-weight: 700; }

/* people in a section */
.story p, .story-text p { margin: 0; max-width: 38em; font-size: 20px; line-height: 1.7; }
.story-text { display: flex; flex-direction: column; gap: 12px; margin: 4px 0 18px; }
.story-text .years { color: var(--muted); font-size: 19px; }
.obit { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; }
.people-link { margin-top: 8px; }

/* section page */
.sec-head { max-width: 38em; margin: 12px 0 36px; }
.sec-head h1 { font-size: clamp(36px, 6vw, 48px); margin: 0 0 6px; }
.sec-head .years { color: var(--muted); margin-bottom: 18px; }
.sec-head p { font-size: 20px; line-height: 1.7; }
.divider { height: 1px; background: var(--line); margin-bottom: 28px; }
.count { font-size: 26px; margin: 0 0 20px; }

/* photo grid */
.grid { display: flex; flex-wrap: wrap; gap: 28px 20px; }
.grid .fill { flex: 999 1 0px; }
.thumb { display: flex; flex-direction: column; gap: 10px; color: var(--ink); text-decoration: none; min-width: 0; }
.thumb .t { font-family: var(--hand); font-size: 20px; line-height: 1.3; }
.thumb .d { font-size: 17px; color: var(--muted); }
.thumb .t + .d { margin-top: -6px; }
.thumb:hover .t { text-decoration: underline; text-decoration-color: var(--edge); }
.empty { font-style: italic; color: var(--muted); }

/* all photos */
.list-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 32px; }
.list-head .muted a { display: inline-flex; align-items: center; min-height: 44px; }

/* search */
.search { display: flex; flex-direction: column; gap: 10px; max-width: 720px; margin: 8px 0 36px; }
.search label { font-size: 19px; font-weight: 700; }
.search .row { display: flex; gap: 10px; }
.search .input { min-height: 58px; font-size: 21px; flex: 1; min-width: 0; }
.search .hint { font-size: 17px; margin: 0; }
.search-head { width: 100%; max-width: 460px; margin: 0; }
.thumb .match { font-size: 17px; line-height: 1.45; color: var(--muted); overflow-wrap: anywhere; }
.thumb .match-l { font-weight: 700; }
.thumb mark { background: transparent; color: var(--ink); font-weight: 700; text-decoration: underline; text-decoration-color: var(--edge); text-underline-offset: .2em; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* tags */
.tag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.tag-card { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 18px 20px; min-height: 64px; color: var(--ink); text-decoration: none; border: 2px solid var(--line); border-radius: var(--radius); }
.tag-card:hover { border-color: var(--ink); background: #2a2724; }
.tag-card .n { font-weight: 700; font-size: 21px; overflow-wrap: anywhere; }
.tag-card .c { font-size: 17px; color: var(--muted); white-space: nowrap; }

/* photo page */
.photo-main { max-width: 1440px; padding-top: 12px; }
.photo-main .where { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; }

.caption { max-width: 760px; margin: 44px auto 0; }
.caption h1 { font-size: clamp(28px, 5vw, 42px); line-height: 1.15; margin: 0 0 18px; }
.fields { margin: 0; border-top: 1px solid var(--line); }
.field { display: grid; grid-template-columns: 8.5em 1fr; gap: 4px 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.field dt { color: var(--muted); font-size: 18px; }
.field dd { margin: 0; min-width: 0; }
.field .items { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.pname:has(+ .pname)::after { content: ","; }
.pchip { display: inline-flex; align-items: center; min-height: 44px; padding: 4px 16px; font-size: 19px; text-decoration: none; border: 2px solid var(--edge); border-radius: 999px; }
.pchip:hover { border-color: var(--ink); background: #2a2724; }
.field .none { font-style: italic; color: var(--muted); }
.field .quote { font-family: var(--hand); font-size: 24px; line-height: 1.45; white-space: pre-line; }
.field .tagrow { display: flex; flex-wrap: wrap; gap: 8px; }
.guess-note { margin: 16px 0 0; color: var(--muted); font-size: 18px; }
.dl { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 24px; }
.filename { font-size: 16px; color: var(--muted); word-break: break-all; }

.comments { max-width: 760px; margin: 56px auto 0; }
.comments h2 { font-size: 30px; }
.rows { border-top: 1px solid var(--line); }
.comment { padding: 18px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.comment .who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.comment .who span { font-size: 17px; color: var(--muted); }
.comment p { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.no-comments { margin: 0; padding: 20px 0; color: var(--muted); border-bottom: 1px solid var(--line); }
.no-comments .btn { margin-top: 10px; }
.thanks { margin: 18px 0 0; padding: 14px 18px; border: 2px solid var(--corner); border-radius: var(--radius); font-weight: 700; }
.cform { display: flex; flex-direction: column; gap: 16px; margin-top: 30px; scroll-margin-top: 20px; }
.cform h3 { font-size: 26px; margin: 0; }
.cform .f { display: flex; flex-direction: column; gap: 6px; }
.cform label { font-size: 19px; font-weight: 700; }
.cform small { font-size: 17px; color: var(--muted); }
.cform .btn { align-self: flex-start; }

footer { border-top: 1px solid var(--line); padding: 28px 20px 40px; text-align: center; font-size: 17px; color: var(--muted); }
.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 18px; margin-top: 4px; }
footer button { font: inherit; color: var(--ink); background: none; border: 0; padding: 12px 8px; cursor: pointer; text-decoration: underline; text-decoration-color: var(--edge); text-underline-offset: .22em; min-height: 48px; }

/* one authored moment: turning the page. The photograph slides in from the side it came from. */
@keyframes turn-next { from { opacity: 0; transform: translateX(64px); } to { opacity: 1; transform: none; } }
@keyframes turn-prev { from { opacity: 0; transform: translateX(-64px); } to { opacity: 1; transform: none; } }
.stage.turn-next .mount { animation: turn-next .38s var(--ease) both; }
.stage.turn-prev .mount { animation: turn-prev .38s var(--ease) both; }
@media (prefers-reduced-motion: reduce) { .stage .mount { animation: none !important; } }

@media (max-width: 520px) {
      .grid { --th: 150px !important; gap: 24px 14px; }
  body { font-size: 18px; }
  .field { grid-template-columns: 1fr; }
  .mount { --mat: 8px; }
  .search .row .btn { padding: 12px 18px; }
  .top .links a { padding: 8px 9px; }   /* four links on one row on a phone */
}

/* balanced lines on the big handwritten headings only */
h1, h2, h3 { text-wrap: balance; }

/* faces found by matching: boxes over the photo, in fractions of its size */
.face { position: absolute; box-sizing: border-box; padding: 0; margin: 0; background: transparent; font: inherit; color: inherit; border: 2px dashed var(--ink); border-radius: 0; cursor: pointer; text-decoration: none; box-shadow: 0 0 0 2px rgba(0, 0, 0, .85), inset 0 0 0 2px rgba(0, 0, 0, .85); }
.face.sure { border-style: solid; }
.face:hover { background: rgba(241, 239, 232, .16); }
.face:focus-visible { outline: none; box-shadow: 0 0 0 2px #000, 0 0 0 5px #fff, inset 0 0 0 2px #000; }
.face-label { position: absolute; top: calc(100% + 4px); left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 16px; line-height: 1.3; padding: 2px 8px; border-radius: 4px; color: var(--ink); background: rgba(20, 19, 18, .92); pointer-events: none; }
.face-label.above { top: auto; bottom: calc(100% + 4px); }
.face-label.lstart { left: 0; transform: none; }
.face-label.lend { left: auto; right: 0; transform: none; }
.seen { margin: 0; color: var(--muted); }
.face-hint { margin-top: 6px; font-size: 17px; color: var(--muted); }
.face-note { font-size: 18px; color: var(--muted); max-width: 40em; margin-top: 14px; }

/* the simple note form */
.from { font-size: 19px; }
.linkbtn { font: inherit; color: var(--ink); background: none; border: 0; padding: 12px 6px; min-height: 44px; cursor: pointer; text-decoration: underline; text-decoration-color: var(--edge); text-underline-offset: .22em; }
.thanks:focus-visible { outline-offset: 2px; }

/* the question on a face */
.sheetwrap { position: fixed; inset: 0; z-index: 30; display: flex; align-items: flex-end; justify-content: center; background: rgba(8, 7, 6, .72); }
.sheet { width: min(100%, 520px); max-height: 92vh; overflow: auto; padding: 22px 20px 26px; background: var(--page); border: 1px solid var(--edge); border-radius: 12px 12px 0 0; display: flex; flex-direction: column; gap: 16px; }
.sheet h2 { margin: 0; font-size: 30px; }
.sheet p { margin: 0; }
.sheet .crop { display: block; height: 132px; max-width: 100%; align-self: center; border: 2px solid var(--edge); background-repeat: no-repeat; background-color: #0e0d0c; }
.sheet-actions { display: flex; gap: 12px; }
.sheet-actions .btn { flex: 1; }
.sform { display: flex; flex-direction: column; gap: 8px; }
.sform label, .sheet .f label { font-weight: 700; }
.sform .row { display: flex; gap: 8px; }
.sform .input { flex: 1; min-width: 0; }
.sheet .f { display: flex; flex-direction: column; gap: 6px; }
.sheet-link { display: inline-flex; align-items: center; min-height: 44px; }
@media (min-width: 700px) { .sheetwrap { align-items: center; } .sheet { border-radius: 12px; } }

/* the enlarged photo */

/* the print and its versions (direction 1a): the photograph on its album sheet with a tray of
   its versions underneath, and the neighbouring photos peeking in at the sides */
.where .back-link { padding: 8px 16px; font-weight: 700; text-decoration: none; border: 2px solid var(--edge); border-radius: 6px; }
.where .back-link:hover { background: var(--page); border-color: var(--ink); }
.pp { --mat: 12px; --peek: 180px; --cap: max(300px, calc(100svh - 77px - 72px - 54px - 76px - 64px - 40px)); margin-top: 12px; }
.pp-row { display: grid; grid-template-columns: var(--peek) minmax(0, 1fr) var(--peek); gap: 16px; align-items: start; }
.album-sheet { grid-column: 2; grid-row: 1; justify-self: center; width: min(100%, max(720px, calc(var(--cap) * var(--ar) + 2 * var(--mat)))); display: flex; flex-direction: column; align-items: center; padding: var(--mat) var(--mat) 0; background: var(--page); border: 1px solid #4a463f; border-radius: 4px; box-shadow: 0 10px 28px rgba(0, 0, 0, .5); }
.album-sheet .stage { width: 100%; display: flex; justify-content: center; overflow-x: clip; touch-action: pan-y; }
.album-sheet .mount { --mat: 0; padding: 0; background: none; border: 0; box-shadow: none; }
.printbar { width: 100%; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding-bottom: 12px; }
.printbar #enlarge { margin-left: auto; }
.chip { min-height: 44px; padding: 4px 16px; font: 700 17px var(--ui); }
.tray { width: 100%; min-height: 76px; padding: 12px 8px; display: flex; align-items: center; justify-content: center; }
.tray-note { color: var(--muted); }
.versions { display: flex; gap: 8px; max-width: 100%; overflow-x: auto; justify-content: center; padding: 2px; }
.ver { flex: none; min-height: 48px; padding: 8px 18px; white-space: nowrap; font: 400 18px/1.2 var(--ui); color: var(--muted); background: transparent; border: 2px solid var(--edge); border-radius: 6px; cursor: pointer; }
.ver:hover { border-color: var(--ink); }
.ver[aria-checked=true] { color: var(--ink); font-weight: 700; background: var(--bg); border-color: var(--ink); }
.peek { position: relative; align-self: stretch; overflow: hidden; padding: 0; color: var(--ink); font: inherit; background: transparent; border: 0; border-radius: 4px; cursor: pointer; }
.peek:hover { background: var(--page); }
.peek-l { grid-column: 1; grid-row: 1; }
.peek-r { grid-column: 3; grid-row: 1; }
.peek img { position: absolute; top: 6%; height: 62%; width: auto; max-width: none; opacity: .5; }
.peek-l img { right: 0; }
.peek-r img { left: 0; }
.peek-label { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; gap: 2px; padding: 10px 10px 12px; line-height: 1.3; background: rgba(20, 19, 18, .92); }
.peek-l .peek-label { align-items: flex-start; text-align: left; }
.peek-r .peek-label { align-items: flex-end; text-align: right; }
.peek-label span { color: var(--muted); }
.peek-end { display: flex; align-items: flex-end; padding: 0 8px 12px; color: var(--muted); line-height: 1.3; cursor: default; }
.peek-r.peek-end { justify-content: flex-end; text-align: right; }
.peek-end:hover { background: transparent; }
.pp-nav { display: none; gap: 8px; padding: 8px 0 0; }
.navbtn { flex: 1; min-height: 68px; padding: 8px 14px; display: flex; flex-direction: column; font: inherit; line-height: 1.3; color: var(--ink); background: transparent; border: 2px solid var(--edge); border-radius: 6px; cursor: pointer; }
.navbtn:hover:not(:disabled) { background: var(--page); border-color: var(--ink); }
.navbtn span { color: var(--muted); }
.navbtn:first-child { align-items: flex-start; text-align: left; }
.navbtn:last-child { align-items: flex-end; text-align: right; }
.navbtn:disabled { border-style: dashed; cursor: default; }

/* the enlarged photo: the same page, with the same versions and neighbours */
#viewer { --peek: 180px; position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; background: #0b0a09; }
.enl-bar { flex: none; height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 16px; }
.enl-bar .filename { margin-left: auto; }
.enl-row { flex: 1; min-height: 0; display: grid; grid-template-columns: var(--peek) minmax(0, 1fr) var(--peek); gap: 16px; padding: 0 16px; }
.v-scroll { grid-column: 2; grid-row: 1; min-height: 0; display: flex; overflow: auto; }
.v-scroll img { margin: auto; max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; }
.v-scroll.zoom img { max-width: none; max-height: none; cursor: zoom-out; }
.enl-tray { flex: none; min-height: 76px; display: flex; align-items: center; justify-content: center; padding: 8px 16px; background: #141312; border-top: 1px solid var(--line); }

@media (max-width: 1099px) {
  .pp, #viewer { --peek: 104px; }
  .album-sheet { width: min(100%, max(560px, calc(var(--cap) * var(--ar) + 2 * var(--mat)))); }
}
/* phones and small tablets: no side panels; the photo runs edge to edge with Prev / Next beneath */
@media (max-width: 819px) {
  .pp { --mat: 0; --cap: max(260px, calc(100svh - 127px - 60px - 54px - 76px - 84px - 16px)); }
  .pp-row { display: block; }
  .album-sheet { width: auto; justify-self: auto; margin-inline: -20px; border-width: 1px 0; border-radius: 0; box-shadow: none; }
  .tray { min-height: 76px; padding: 12px; }
  .printbar { padding: 10px 12px 10px; }
  .versions { justify-content: flex-start; }
  .peek { display: none; }
  .pp-nav { display: flex; }
  .enl-row { display: flex; padding: 0; }
  .v-scroll { flex: 1; min-width: 0; }
  #viewer .pp-nav { padding: 8px 12px 12px; }
}

/* the family's logo, when the admin has one, before the title in the top bar */
.brand .logo { display: inline-block; height: 1.6em; width: auto; margin-right: .5em; vertical-align: middle; }
