/* Our photos: cool gallery white, one cyanotype blue, the photos carry the colour. */
:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --sunken: #e8eaee;
  --line: #e1e4e9;
  --ink: #1e2128;
  --muted: #6b7180;
  --accent: #2348a8;
  --accent-ink: #ffffff;
  --accent-soft: #e4eafa;
  --warn: #a8510b;
  --warn-soft: #fbeedf;
  --danger: #b42318;
  --shadow: 0 1px 2px rgba(30, 33, 40, .06), 0 8px 24px rgba(30, 33, 40, .06);
  --viewer-bg: #101114;
  --viewer-ink: #eceef2;
  --viewer-muted: #9399a6;
  --viewer-line: #2a2d34;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 22px;
  --bar-h: 60px;
  --display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --sans: "Geist", "Helvetica Neue", Arial, sans-serif;
  box-sizing: border-box;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17191e;
    --surface: #20232a;
    --sunken: #2a2e36;
    --line: #30343d;
    --ink: #eceef2;
    --muted: #9aa0ad;
    --accent: #9db4ff;
    --accent-ink: #121722;
    --accent-soft: #263152;
    --warn: #f0b072;
    --warn-soft: #3a2a19;
    --danger: #f19a8f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: inherit; }
html { scroll-padding-top: calc(var(--bar-h) + env(safe-area-inset-top, 0px)); }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

h1, h2, h3 { font-family: var(--display); margin: 0; font-weight: 650; letter-spacing: -0.02em; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }

/* Buttons and fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; cursor: pointer; font-size: 15px; font-weight: 500; line-height: 1; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.quiet { background: transparent; border-color: transparent; padding: 0 10px; color: var(--muted); }
.btn.quiet:hover { color: var(--ink); background: var(--sunken); }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 30px; padding: 0 12px; font-size: 14px; }
.btn[disabled] { opacity: .45; cursor: default; filter: none; }
.field { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm); padding: 10px 12px; }
.field:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.field { min-height: 72px; resize: vertical; }
label.lbl { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.error { color: var(--danger); font-size: 14px; }

/* Top bar */
.top { position: sticky; top: 0; z-index: 5; padding-top: env(safe-area-inset-top, 0px); background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1240px; margin: 0 auto; height: var(--bar-h); padding: 0 20px; display: flex; align-items: center; gap: 12px; }
.brand { font-family: var(--display); font-size: 21px; font-weight: 700; letter-spacing: -0.03em; text-decoration: none; margin-right: auto; }
.who { color: var(--muted); font-size: 14px; }
@media (max-width: 600px) { .who { display: none; } .top-in { gap: 4px; padding: 0 12px; } }

/* Session countdown */
.session { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 8px; border-radius: 999px; background: var(--sunken); font-size: 14px; font-variant-numeric: tabular-nums; color: var(--muted); }
.session svg { width: 20px; height: 20px; transform: rotate(-90deg); flex: none; }
.session circle { fill: none; stroke-width: 2.5; }
.session .track { stroke: var(--line); }
.session .fill { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.session .time { color: var(--ink); min-width: 3.4ch; }
.session.warn { background: var(--warn-soft); color: var(--warn); }
.session.warn .time { color: var(--warn); font-weight: 600; }
.session.warn .fill { stroke: var(--warn); }
.session button { border: 0; background: var(--warn); color: var(--surface); border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 600; cursor: pointer; margin-right: -6px; }
@media (max-width: 600px) { .session .label { display: none; } }

/* Page */
.wrap { max-width: 1240px; margin: 0 auto; padding: 36px 20px 96px; }
.page-head { margin-bottom: 28px; display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: clamp(34px, 5vw, 56px); line-height: 1; font-weight: 700; letter-spacing: -0.035em; }
.empty-state { padding: 56px 0; display: grid; gap: 6px; }
.empty-state p:first-child { font-family: var(--display); font-size: 24px; font-weight: 600; }

/* Login */
.login { min-height: 100svh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(440px, 100%); display: grid; gap: 14px; }
.wordmark { font-size: clamp(56px, 13vw, 112px); line-height: .92; font-weight: 750; letter-spacing: -0.05em; margin-bottom: 10px; overflow-wrap: anywhere; }
.login-card .field { font-size: 18px; padding: 14px 18px; border-radius: 999px; }
.login-card .btn { min-height: 52px; font-size: 16px; }
.login-card .error { min-height: 1.4em; }

/* Album list */
.albums { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 36px 22px; }
.tile { text-decoration: none; display: grid; gap: 10px; }
.tile .cover { aspect-ratio: 4 / 3; background: var(--sunken); border-radius: var(--r-lg); overflow: hidden; }
.tile .cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.tile:hover .cover img { transform: scale(1.025); }
.tile .cover.empty { display: grid; place-items: center; color: var(--muted); font-size: 14px; }
.tile-text { display: flex; align-items: center; gap: 10px; }
.tile h2 { font-size: 22px; line-height: 1.15; }
.tile .meta { font-size: 14px; color: var(--muted); margin-top: -6px; }
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
@media (min-width: 900px) {
  .albums .tile:first-child { grid-column: 1 / -1; grid-template-columns: 2fr 1fr; align-items: end; column-gap: 28px; }
  .albums .tile:first-child .cover { aspect-ratio: 16 / 9; grid-row: 1 / span 2; }
  .albums .tile:first-child h2 { font-size: 36px; letter-spacing: -0.03em; }
  .albums .tile:first-child .tile-text { flex-direction: column; align-items: flex-start; }
  .albums .tile:first-child .meta { margin: 0 0 6px; }
}

/* Album page */
.album-head { margin-bottom: 26px; }
.back { display: inline-block; font-size: 14px; color: var(--muted); text-decoration: none; margin-bottom: 14px; }
.back:hover { color: var(--ink); }
.album-head h1 { font-size: clamp(38px, 6.5vw, 76px); line-height: .98; font-weight: 750; letter-spacing: -0.045em; max-width: 18ch; }
.album-head .desc { margin-top: 14px; font-size: 18px; color: var(--muted); max-width: 58ch; }
.album-bar { margin-top: 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--sunken); }
.seg a { padding: 7px 16px; border-radius: 999px; text-decoration: none; color: var(--muted); font-size: 15px; font-weight: 500; }
.seg a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(30, 33, 40, .1); }

/* Composer: a message and photos are posted separately */
.composer { max-width: 760px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 14px 12px; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; }
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.composer.over { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.composer textarea { width: 100%; border: 0; background: transparent; resize: none; min-height: 52px; padding: 4px 6px; font-size: 17px; line-height: 1.5; outline: none; }
.composer-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 8px; }
.composer textarea + .composer-bar { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }
.composer .hint { color: var(--muted); font-size: 14px; flex: 1 1 200px; }
.composer .btn.primary { margin-left: auto; }
.uploads { display: grid; gap: 8px; }
.uploads:not(:empty) { margin-top: 12px; }
.up { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; font-size: 14px; }
.up .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up .bar { grid-column: 1 / -1; height: 4px; background: var(--sunken); border-radius: 2px; overflow: hidden; }
.up .bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.up.failed .name { color: var(--danger); }

/* Timeline */
.timeline { list-style: none; margin: 44px 0 0; padding: 0; max-width: 900px; }
.day { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 0 28px; }
.day + .day { margin-top: 44px; }
.day-label { position: sticky; top: calc(var(--bar-h) + env(safe-area-inset-top, 0px) + 18px); align-self: start; text-align: right; font-size: 18px; line-height: 1.15; font-weight: 650; }
.day-label small { display: block; margin-top: 3px; font-family: var(--sans); font-size: 13px; font-weight: 400; letter-spacing: 0; color: var(--muted); }
.entries { list-style: none; margin: 0; padding: 2px 0 0 28px; border-left: 2px solid var(--line); display: grid; gap: 30px; min-width: 0; }
.entry { position: relative; min-width: 0; }
.entry::before { content: ""; position: absolute; left: -36px; top: 5px; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--bg); }
.entry.note::before { background: var(--bg); border: 2px solid var(--muted); }
.entry-meta { display: flex; align-items: baseline; gap: 4px 8px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.entry-meta b { color: var(--ink); font-weight: 600; font-size: 15px; }
.entry-meta .tools { margin-left: auto; display: flex; gap: 2px; }
.bubble { margin-top: 8px; display: inline-block; max-width: min(62ch, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 4px var(--r-md) var(--r-md) var(--r-md); padding: 11px 16px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 16px; }
.entry .caption { margin-top: 8px; color: var(--ink); max-width: 62ch; }
.mosaic { margin-top: 10px; display: grid; gap: 4px; border-radius: var(--r-md); overflow: hidden; max-width: 640px; }
.mosaic .ph { position: relative; display: block; background: var(--sunken); overflow: hidden; }
.mosaic img { width: 100%; height: 100%; object-fit: cover; }
.mosaic.m1 .ph { max-height: 560px; }
.mosaic.m1.portrait { max-width: 400px; }
.mosaic.m2 { grid-template-columns: 1fr 1fr; }
.mosaic.m2 .ph { aspect-ratio: 1; }
.mosaic.m3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 3 / 2; }
.mosaic.m3 .ph:first-child { grid-row: 1 / span 2; }
.mosaic.m4 { grid-template-columns: 1fr 1fr; }
.mosaic.m4 .ph { aspect-ratio: 4 / 3; }
.more-n { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(16, 17, 20, .5); color: #fff; font-family: var(--display); font-size: 30px; font-weight: 650; }
.count { position: absolute; right: 8px; bottom: 8px; background: rgba(16, 17, 20, .62); color: #fff; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
@media (max-width: 640px) {
  .day { grid-template-columns: 1fr; }
  .day-label { position: static; text-align: left; margin-bottom: 14px; display: flex; gap: 8px; align-items: baseline; }
  .day-label small { margin: 0; }
  .entries { padding-left: 20px; }
  .entry::before { left: -28px; width: 12px; height: 12px; }
}

/* Photo grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; margin-top: 28px; }
@media (max-width: 480px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 3px; } }
.grid a { display: block; aspect-ratio: 1; background: var(--sunken); overflow: hidden; position: relative; border-radius: 6px; }
.grid img { width: 100%; height: 100%; object-fit: cover; }
.more { display: flex; justify-content: center; margin: 32px 0; }

/* Viewer */
.viewer { position: fixed; inset: 0; background: var(--viewer-bg); color: var(--viewer-ink); display: grid; grid-template-columns: minmax(0, 1fr) 380px; z-index: 10; }
.viewer .stage { position: relative; display: grid; place-items: center; min-height: 0; padding: 16px; }
.viewer .stage img { max-width: 100%; max-height: calc(100svh - 32px); object-fit: contain; border-radius: 4px; }
.viewer .nav { position: absolute; top: 0; bottom: 0; width: 18%; min-width: 56px; background: transparent; border: 0; color: var(--viewer-ink); font-size: 34px; cursor: pointer; opacity: 0; transition: opacity .15s; }
.viewer .nav:hover, .viewer .nav:focus-visible { opacity: .9; }
.viewer .nav[disabled] { display: none; }
.viewer .nav.prev { left: 0; } .viewer .nav.next { right: 0; }
.viewer .close { position: absolute; top: calc(14px + env(safe-area-inset-top, 0px)); left: 14px; z-index: 1; background: rgba(255, 255, 255, .12); border-color: transparent; color: var(--viewer-ink); backdrop-filter: blur(8px); }
.viewer .side { border-left: 1px solid var(--viewer-line); padding: 22px 20px calc(22px + env(safe-area-inset-bottom, 0px)); overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.viewer .side .field { background: #1b1d22; border-color: #343842; color: var(--viewer-ink); }
.viewer .side .btn { background: transparent; border-color: #3a3e48; color: var(--viewer-ink); }
.viewer .side .btn.danger { color: #f19a8f; }
.viewer .side .btn.primary { background: var(--viewer-ink); color: var(--viewer-bg); border-color: var(--viewer-ink); }
.viewer .caption { font-family: var(--display); font-size: 22px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; }
.viewer .caption:empty { display: none; }
.viewer .meta { color: var(--viewer-muted); font-size: 14px; }
.viewer .compose { display: grid; gap: 8px; }
.viewer .compose .row { justify-content: flex-end; }
.viewer .msg { padding: 12px 0; border-top: 1px solid var(--viewer-line); }
.viewer .msg .who { font-size: 14px; color: var(--viewer-muted); display: flex; gap: 8px; align-items: baseline; }
.viewer .msg .who b { color: var(--viewer-ink); font-weight: 600; }
.viewer .msg .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.viewer .msg .tools { display: flex; gap: 2px; margin-left: auto; }
.viewer .msg .btn.quiet { color: var(--viewer-muted); }
.viewer .muted { color: var(--viewer-muted); }
@media (max-width: 820px) {
  .viewer { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .viewer .stage img { max-height: 58svh; }
  .viewer .side { border-left: 0; border-top: 1px solid var(--viewer-line); max-height: 42svh; }
}

/* Admin */
.admin { display: grid; gap: 20px; max-width: 960px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px 24px; }
.panel h2 { font-size: 22px; margin-bottom: 14px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th { font-weight: 500; color: var(--muted); font-size: 13.5px; }
td .field { padding: 6px 10px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; align-items: end; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.meter { height: 8px; background: var(--sunken); border-radius: 4px; overflow: hidden; margin: 10px 0 8px; max-width: 460px; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }

#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%) translateY(16px); background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 999px; font-size: 14px; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; max-width: 90vw; z-index: 20; box-shadow: var(--shadow); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
