/* Photographs & Calendars — paper, ink and a little brick. */
:root {
  --paper: #f6f1e7;
  --card: #fffdf8;
  --ink: #23302a;
  --muted: #66706a;
  --line: #ddd4c4;
  --brick: #a4553a;
  --brick-dark: #7f3f2a;
  --moss: #4f6b4f;
  --shadow: 0 1px 2px rgba(35, 48, 42, .08), 0 6px 18px rgba(35, 48, 42, .08);
  --radius: 10px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 var(--sans); }
a { color: var(--brick-dark); }
a:hover { color: var(--brick); }
:focus-visible { outline: 3px solid var(--brick); outline-offset: 2px; }
img { display: block; max-width: 100%; }
h1, h2 { font-family: var(--serif); font-weight: 600; line-height: 1.2; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0; }
h2 { font-size: 1.35rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }

/* masthead */
.masthead {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px;
  padding: 14px clamp(16px, 4vw, 40px); border-bottom: 1px solid var(--line); background: var(--card);
  position: sticky; top: 0; z-index: 5;
}
.brand { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; color: var(--ink); text-decoration: none; margin-right: auto; }
.brand span { color: var(--brick); }
.masthead nav { display: flex; flex-wrap: wrap; gap: 4px; }
.masthead nav a { padding: 6px 12px; border-radius: 999px; color: var(--ink); text-decoration: none; }
.masthead nav a:hover { background: #efe7d8; }
.masthead nav a[aria-current="page"] { background: var(--ink); color: var(--paper); }

main { max-width: 1240px; margin: 0 auto; padding: clamp(16px, 4vw, 40px); }
main:focus, main:focus-visible { outline: none; }
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; margin-bottom: 24px; }
.page-head .sub { flex-basis: 100%; margin: 0; color: var(--muted); }
h2.section { margin: 40px 0 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.error { color: #9b2c1c; }
.ok { color: var(--moss); }
.loading { color: var(--muted); }
.notice { margin-top: 32px; padding: 12px 16px; background: #fbeee2; border-left: 4px solid var(--brick); border-radius: 4px; }
.empty { padding: 48px 24px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); background: rgba(255, 253, 248, .6); }
.empty h2 { margin: 0 0 8px; }
.empty p { margin: 0 auto; max-width: 46ch; color: var(--muted); }

/* buttons */
.button, button.button {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--ink); background: var(--ink); color: var(--paper); font: inherit; font-size: .95rem;
  text-decoration: none; cursor: pointer;
}
.button:hover { background: #34463d; color: var(--paper); }
.button.ghost { background: transparent; color: var(--ink); }
.button.ghost:hover { background: #efe7d8; color: var(--ink); }
.button.fav-on { background: var(--brick); border-color: var(--brick); }
button.link { background: none; border: 0; padding: 4px; color: var(--brick-dark); font: inherit; cursor: pointer; text-decoration: underline; }
button.link.danger { color: #9b2c1c; }
.masthead button.link { color: var(--muted); }
input, select { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); }

/* cards (years, albums) */
.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.card { display: block; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); color: var(--ink); text-decoration: none; transition: transform .15s ease; }
.card:hover { transform: translateY(-2px); color: var(--ink); }
.card img, .card-blank { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: repeating-linear-gradient(45deg, #ece4d4, #ece4d4 10px, #e6dccb 10px, #e6dccb 20px); display: block; }
.card-title { display: flex; gap: 8px; align-items: center; padding: 12px 14px 0; font-family: var(--serif); font-size: 1.3rem; font-weight: 600; }
.card-meta { display: block; padding: 2px 14px 14px; color: var(--muted); font-size: .9rem; }
.years .card-title { font-size: 1.6rem; }

/* photo grid */
.grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.grid li { position: relative; }
.tile { display: block; width: 100%; padding: 0; border: 0; background: #e6dccb; cursor: zoom-in; border-radius: 4px; overflow: hidden; }
.grid .tile img { width: 100%; aspect-ratio: 1; object-fit: cover; transition: opacity .2s; }
.grid .tile:hover img { opacity: .88; }
.noprev { display: flex; flex-direction: column; align-items: center; justify-content: center; aspect-ratio: 1; font-weight: 600; color: var(--muted); }
.noprev small { font-weight: 400; }
.fav-dot { position: absolute; right: 6px; bottom: 6px; color: #fff; background: var(--brick); border-radius: 999px; width: 22px; height: 22px; display: grid; place-items: center; font-size: 12px; pointer-events: none; }
.grid .pick { position: absolute; left: 6px; top: 6px; width: 22px; height: 22px; z-index: 1; accent-color: var(--brick); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font: 600 .72rem/1.6 var(--sans); text-transform: uppercase; letter-spacing: .04em; background: #efe7d8; color: var(--muted); }
.badge.draft, .badge.staged { background: #fbeee2; color: var(--brick-dark); }
.badge.damaged { background: #f6d9d3; color: #9b2c1c; }
.grid .badge { position: absolute; right: 6px; top: 6px; pointer-events: none; }

/* calendars */
.shelf { list-style: none; padding: 0; margin: 0; display: grid; gap: 28px 22px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.calendar-cover { display: block; color: var(--ink); text-decoration: none; }
.calendar-cover img, .calendar-cover .card-blank { aspect-ratio: 3 / 4; width: 100%; object-fit: cover; border-radius: 3px; box-shadow: var(--shadow), 6px 6px 0 -2px #e3d8c5; transition: transform .15s; }
.calendar-cover .card-blank { display: block; background: repeating-linear-gradient(0deg, #ece4d4, #ece4d4 12px, #e6dccb 12px, #e6dccb 13px); }
.calendar-cover:hover img { transform: rotate(-1deg) translateY(-2px); }
.cal-year { display: flex; gap: 8px; align-items: center; margin-top: 12px; font-family: var(--serif); font-size: 1.5rem; font-weight: 600; }
.calendar-cover .card-meta { padding: 0; }
/* lightbox */
dialog#lightbox {
  width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: #161b18; color: #eee8dc; display: none; grid-template-columns: 1fr 340px;
}
dialog#lightbox[open] { display: grid; }
dialog#lightbox::backdrop { background: rgba(0, 0, 0, .8); }
.lb-stage { position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; min-width: 0; }
.lb-stage figure { margin: 0; height: 100%; width: 100%; display: flex; align-items: center; justify-content: center; padding: 16px; }
.lb-stage img { max-height: 100%; max-width: 100%; object-fit: contain; }
.lb-nav, .lb-close { position: absolute; border: 0; background: rgba(255, 255, 255, .1); color: #fff; cursor: pointer; border-radius: 999px; font-size: 2rem; line-height: 1; width: 48px; height: 48px; }
.lb-nav:hover, .lb-close:hover { background: rgba(255, 255, 255, .22); }
.lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 12px; top: 50%; transform: translateY(-50%); }
.lb-close { right: 12px; top: 12px; z-index: 2; }
.lb-info { overflow-y: auto; padding: 64px 24px 24px; background: #1f2622; border-left: 1px solid #2f3a34; }
.lb-info h2 { margin: 0 0 8px; color: #fff; }
.lb-info a { color: #f0b49c; }
.lb-info .muted { color: #a9b1aa; }
.lb-info .counter { color: #a9b1aa; font-size: .85rem; margin: 0; }
.lb-info .caption { font-family: var(--serif); font-size: 1.15rem; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: .9rem; }
.facts dt { color: #a9b1aa; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.downloads, .fav { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.lb-info .button { background: #eee8dc; color: #161b18; border-color: #eee8dc; }
.lb-info .button.ghost { background: transparent; color: #eee8dc; }
.lb-info .button.fav-on { background: var(--brick); border-color: var(--brick); color: #fff; }
.lb-info select { background: #161b18; color: #eee8dc; border-color: #3a463f; }
.lb-info details { margin-top: 16px; overflow-wrap: anywhere; }

/* owner */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; }
.tabs a[aria-current="page"] { color: var(--ink); border-color: var(--brick); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0; }
.owner-panel { margin-top: 40px; padding: 16px 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.owner-panel h2 { margin-top: 0; }
table.invites { border-collapse: collapse; width: 100%; background: var(--card); }
table.invites th, table.invites td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
ul.plain { list-style: none; padding: 0; }
.upload-log p { margin: 4px 0; font-size: .9rem; overflow-wrap: anywhere; }

/* sign-in */
.signin { max-width: 520px; margin: 12vh auto 0; text-align: center; background: var(--card); padding: 40px 32px; border-radius: 16px; box-shadow: var(--shadow); }
.signin h1 span { color: var(--brick); }
.signin p { color: var(--muted); }
.gsi-slot { display: flex; justify-content: center; min-height: 44px; margin: 24px 0 8px; }

@media (max-width: 760px) {
  dialog#lightbox { grid-template-columns: 1fr; grid-template-rows: minmax(0, 62vh) auto; overflow-y: auto; }
  .lb-info { border-left: 0; border-top: 1px solid #2f3a34; padding-top: 16px; overflow: visible; }
  .lb-nav { width: 40px; height: 40px; font-size: 1.6rem; }
  .lb-stage figure { padding: 64px 8px 8px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 4px; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
  .shelf { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .brand { font-size: 1.1rem; }
  .masthead nav a { padding: 5px 9px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Calendar reader navigation. */
.shelf { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 36px; }
.calendar-cover img { object-fit: contain; background: var(--card); }
.back-link { display: inline-block; margin-bottom: 18px; }
.calendar-reader { max-width: 840px; margin: 0 auto; }
.reader-nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin-bottom: 18px; }
.reader-nav button { justify-self: start; }
.reader-nav button:last-child { justify-self: end; }
.reader-position { font-family: var(--serif); font-size: 1.35rem; text-align: center; }
button:disabled { cursor: default; opacity: .4; }
.calendar-spread { padding: 18px; border: 1px solid var(--line); border-top: 10px solid var(--ink); border-radius: 4px 4px 12px 12px; background: var(--card); box-shadow: 0 16px 36px #23302a18, 4px 5px 0 -1px #e3d8c5; touch-action: pan-y pinch-zoom; }
.eyebrow { text-transform: uppercase; letter-spacing: .16em; color: var(--muted); }
.reader-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 22px 0; }
.month-tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; padding: 14px 0; border-top: 1px solid var(--line); }
.month-tabs a { padding: 8px 12px; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: .9rem; }
.month-tabs a[aria-current="page"] { background: var(--ink); color: var(--paper); }
.month-tabs a:hover { box-shadow: inset 0 0 0 1px var(--ink); }
.calendar-manage { margin-top: 32px; }
.calendar-heroes { grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: 20px; }
.calendar-heroes .tile { background: var(--card); padding: 12px; box-shadow: var(--shadow); }
.calendar-heroes .tile img { aspect-ratio: 4 / 3; object-fit: contain; }
@media (max-width: 760px) {
  .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 16px; }
  .calendar-spread { padding: 8px; }
  .reader-nav { gap: 8px; }
  .reader-nav .button { padding: 9px 12px; font-size: .875rem; }
  .reader-position { font-size: 1.1rem; }
  .calendar-heroes { grid-template-columns: 1fr; }
}

/* Recreated calendars: original images and a real date grid, not page scans. */
.digital-cover-blank { display: flex; min-height: 240px; aspect-ratio: 3 / 4; background: var(--ink); color: var(--paper); flex-direction: column; justify-content: space-between; padding: 24px; border-radius: 4px; box-shadow: var(--shadow); }
.digital-cover-blank span { font-family: var(--serif); font-size: 1.4rem; }
.digital-cover-blank strong { font: 400 clamp(3rem, 6vw, 5rem)/1 var(--serif); }
.calendar-spread { padding: 0; border: 0; border-radius: 3px; background: transparent; box-shadow: none; }
.digital-calendar { padding: clamp(14px, 3vw, 36px); background: #fffefa; border: 1px solid #e8e0d1; border-radius: 3px; box-shadow: 0 16px 50px #23302a14; }
.digital-photo-composition { display: grid; gap: 12px; color: var(--muted); text-decoration: none; }
.digital-photo-composition.multiple { grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }
.digital-photo-composition img { width: 100%; height: 300px; object-fit: contain; background: #f5f2ec; }
.originals-pending { min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; border: 1px dashed var(--line); padding: 16px; }
.originals-pending p { margin: 4px 0; }
.digital-month-heading { display: flex; align-items: baseline; justify-content: space-between; margin: 28px 0 20px; }
.digital-month-heading h2 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 400; margin: 0; }
.digital-month-heading > span { font-family: var(--serif); font-size: clamp(1.4rem, 4vw, 2rem); color: var(--muted); }
.weekdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 2px solid var(--ink); padding-bottom: 10px; text-align: center; font-size: .875rem; color: var(--muted); }
.month-board { position: relative; }
.month-dates { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: repeat(var(--weeks), 1fr); aspect-ratio: 1.4; }
.date-cell { border-right: 1px solid #e4ded1; border-bottom: 1px solid #e4ded1; padding: 7px; text-align: right; }
.date-cell:nth-child(7n) { border-right: 0; }
.date-cell.outside { background: #f8f6f1; }
.day-number { font: 400 clamp(.9rem, 2vw, 1.35rem)/1 var(--serif); }
.weekend .day-number { color: var(--brick-dark); }
.notes-layer { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.digital-cover-title { padding: 44px 12px 28px; text-align: center; }
.digital-cover-title h2 { margin: 4px 0; font: 400 clamp(4rem, 10vw, 8rem)/1 var(--serif); }
.digital-cover-title p { color: var(--muted); font-family: var(--serif); font-size: 1.2rem; }
.reconstruction-pending { text-align: center; color: var(--muted); font-size: .9rem; }
@media (max-width: 760px) {
  .digital-photo-composition img { height: 190px; }
  .digital-photo-composition.multiple { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .date-cell { padding: 4px; }
  .weekdays { font-size: .875rem; }
  .digital-cover-blank { min-height: 195px; padding: 16px; }
}
