:root {
  color-scheme: only light;
  --paper: #FAF9F6;
  --ink: #252B29;
  --muted: #585F5B;
  --line: #CED2CA;
  --accent: #A84A28;
  --danger: #A33B2B;
  --viewer-bg: #141311;
  --viewer-ink: #F2EFE9;
  --viewer-muted: #B8B2A7;
  --viewer-line: #6E675E;
  --viewer-focus: #F0A27C;
  --viewer-danger: #F2917E;
  --serif: "Songti SC", "Noto Serif CJK SC", "Noto Serif SC", "STSong", SimSun, serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --pad: 16px;
  --gut: 6px;
  --photo-gap: 6px;
  --photo-target: 230px;
  --bar-h: 48px;
  --tabbar-h: calc(var(--bar-h) + env(safe-area-inset-bottom, 0px));
  --header-h: 57px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --ease-out: var(--ease);
  --ease-open: cubic-bezier(.22, .61, .36, 1);
  --ease-close: cubic-bezier(.4, 0, 1, 1);
  --text-s: 0.9375rem;
  --text-m: 1.0625rem;
  --text-l: 1.25rem;
  --text-xl: 1.875rem;
  --text-2xl: 2.25rem;
  --leading-s: 1.5;
  --leading-m: 1.6;
  --leading-l: 1.4;
  --leading-xl: 1.3;
  --leading-2xl: 1.25;
  --motion-fast: 120ms;
  --motion: 160ms;
  --motion-page: 180ms;
  --motion-open: 240ms;
  --motion-close: 180ms;
  --motion-press: 90ms;
  --motion-fade: 140ms;
  --shift-xs: 4px;
  --shift-sm: 8px;
  --shift-bar: 12px;
}


@media (min-width: 760px) {
  :root { --pad: 32px; --gut: 8px; --photo-gap: 8px; --photo-target: 210px; }
}

@media (min-width: 1200px) {
  :root { --pad: 48px; --photo-target: 260px; }
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  scroll-padding-bottom: calc(var(--tabbar-h) + 24px);
}

body {
  margin: 0;
  min-height: 100dvh;
  padding-bottom: calc(var(--tabbar-h) + 24px);
  background: var(--paper);
  color: var(--ink);
  font: var(--text-m)/var(--leading-m) var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html.scroll-locked { overflow-y: scroll; }

html.scroll-locked:has(dialog#lightbox[open]) {
  background: var(--viewer-bg);
  scrollbar-color: var(--viewer-line) var(--viewer-bg);
}

html.scroll-locked body {
  position: fixed;
  inset-inline: 0;
  top: calc(-1 * var(--lock-y, 0px));
}

[hidden] { display: none !important; }

img { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }

button, input, select { font: inherit; color: inherit; }

button { cursor: pointer; }

svg { display: block; }

h1, h2, h3, p, figure, blockquote { margin: 0; }

::selection { background: color-mix(in srgb, var(--accent) 18%, var(--paper)); color: var(--ink); }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

:is(h1, h2)[tabindex="-1"]:focus, #main:focus { outline: none; }

.skip-link {
  position: fixed;
  left: 12px;
  top: -96px;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--paper);
  font-size: var(--text-m);
}

.skip-link:focus { top: 12px; }

.page-width {
  width: 100%;
  max-width: 1400px;
  margin-inline: auto;
  padding-inline: var(--pad);
}

.grid-bleed { margin-inline: calc(var(--pad) * -1); }

.site-header { border-bottom: 1px solid var(--line); }

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  min-height: 56px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  color: var(--ink);
  font: 600 var(--text-s)/1 var(--serif);
}

.brand-name { font: 600 var(--text-l)/1.2 var(--serif); }

.top-nav { display: none; }

.tabbar {
  position: fixed;
  inset: auto 0 0;
  z-index: 40;
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.tabbar-inner {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-width: 680px;
  margin-inline: auto;
}

.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--bar-h);
  padding-block: 4px;
  line-height: 1.2;
  color: var(--muted);
  font-size: var(--text-s);
  -webkit-tap-highlight-color: transparent;
}

.tab svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab span { white-space: nowrap; }

.tab[aria-current="page"] { color: var(--ink); font-weight: 600; }

.tab[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 32px;
  border-top: 2px solid var(--accent);
  transform: translateX(-50%);
}

.undo-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(var(--tabbar-h) + 12px);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 680px;
  min-height: 52px;
  margin-inline: auto;
  padding: 6px 6px 6px 16px;
  background: var(--accent);
  color: var(--paper);
  border-top: 1px solid var(--line);
}

.undo-text {
  flex: 1;
  min-width: 0;
  font-size: var(--text-s);
  line-height: var(--leading-s);
}

.undo-button {
  flex: none;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--paper);
  font-size: var(--text-m);
  font-weight: 600;
}

.undo-button:hover { text-decoration: underline; text-underline-offset: 4px; }
.undo-button:disabled { opacity: .6; cursor: default; }

.undo-close {
  flex: none;
  width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--paper);
  font-size: var(--text-l);
  line-height: 1;
}

.undo-close:hover { background: transparent; }

@media (min-width: 760px) {
  .undo-bar { bottom: 20px; }
}

.select-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(var(--tabbar-h) + 12px);
  z-index: 45;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  max-width: 680px;
  min-height: 52px;
  margin-inline: auto;
  padding: 8px 8px 8px 16px;
  background: var(--accent);
  color: var(--paper);
  border-top: 1px solid var(--line);
}

/* The selection bar takes the bottom slot while selecting; the undo bar keeps
   its state and returns when selection ends. */
body.is-selecting .undo-bar { display: none; }

.select-bar .text-button {
  border: 0;
  background: transparent;
  color: var(--paper);
}

.select-bar .text-button:hover { text-decoration: underline; text-underline-offset: 4px; }

.select-bar .primary-button { flex: none; }

.select-bar .primary-button.is-danger { background: var(--danger); }

.select-bar :focus-visible, .undo-bar :focus-visible { outline-color: var(--paper); }

.select-bar:not([hidden]),
.undo-bar:not([hidden]) { animation: bar-in var(--motion) var(--ease-out) both; }

.select-bar.is-closing,
.undo-bar.is-closing { animation: bar-out var(--motion-fast) var(--ease-close) both; }

@keyframes bar-in {
  from { opacity: 0; transform: translateY(var(--shift-bar)); }
  to { opacity: 1; transform: none; }
}

@keyframes bar-out {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translateY(var(--shift-xs)); }
}

.select-count {
  flex: 1 1 10rem;
  min-width: 0;
  font-size: var(--text-s);
  line-height: var(--leading-s);
}

.select-note {
  flex-basis: 100%;
  order: 3;
  color: var(--paper);
  font-size: var(--text-s);
  line-height: var(--leading-s);
}

@media (max-width: 479px) {
  .select-count,
  .select-note { flex-basis: 100%; }
}

@media (min-width: 760px) {
  .select-bar { bottom: 20px; }
}

@media (max-width: 759px) {
  body.is-selecting {
    padding-bottom: calc(var(--tabbar-h) + var(--selectbar-h, 52px) + 24px);
  }
}

@media (min-width: 760px) {
  body.is-selecting {
    padding-bottom: calc(var(--selectbar-h, 52px) + 40px);
  }
}

#home:not([hidden]),
.inner-view:not([hidden]) { animation: view-in var(--motion-fade) var(--ease-out) both; }

@keyframes view-in {
  from { opacity: .4; }
  to { opacity: 1; }
}

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(var(--shift-sm)); }
  to { opacity: 1; transform: none; }
}

@keyframes dialog-in-sm {
  from { opacity: 0; transform: translateY(var(--shift-xs)); }
  to { opacity: 1; transform: none; }
}

.inner-view { min-height: 55vh; }

.page-head {
  padding-block: clamp(28px, 4vw, 60px) 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}

.kicker {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: var(--text-s);
  letter-spacing: .16em;
}

.page-head h1 { font: 600 var(--text-xl)/var(--leading-xl) var(--serif); }

.login-view h1 {
  font: 600 var(--text-xl)/var(--leading-xl) var(--serif);
  letter-spacing: 0;
}

.lede {
  max-width: 40em;
  margin-top: 10px;
  color: var(--muted);
  font-size: var(--text-m);
  line-height: var(--leading-m);
}

.view-summary {
  margin-top: 8px;
  color: var(--muted);
  font-size: var(--text-s);
}

.status-line {
  margin-block: 14px;
  color: var(--muted);
  font-size: var(--text-s);
}

.login-hint {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-s);
  line-height: var(--leading-m);
}

.load-more-status { margin: 0 0 10px; text-align: center; }

.boot-loading { padding-block: 4px 24px; }

.boot-copy { margin-top: 0; }

.load-error { margin-inline: auto; }

.head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-top: 10px;
}

.head-row .view-summary { margin-top: 0; }

#year-filter { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: var(--text-s); white-space: nowrap; }

select {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 0;
}

.hero {
  position: relative;
  isolation: isolate;
  margin-inline: calc(50% - 50vw);
  background: var(--paper);
}
.hero-copy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
  padding: 14px var(--pad);
  border-bottom: 1px solid var(--line);
}

.hero h1 {
  margin: 0;
  font: 600 var(--text-2xl)/var(--leading-2xl) var(--serif);
}
#hero-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  pointer-events: auto;
  font-size: var(--text-s);
  font-variant-numeric: tabular-nums;
}
#hero-controls button {
  min-width: 44px;
  min-height: 44px;
  padding-inline: 6px;
  border: 0;
  background: transparent;
  color: inherit;
}
#hero-controls button:hover { text-decoration: underline; }
.hero-date {
  display: block;
  margin-bottom: .4em;
  font: 500 var(--text-s)/1.2 var(--sans);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.period { color: var(--line); }


.quiet-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-top: 4px;
  border: 0;
  border-radius: 8px;
  color: var(--ink);
  font-size: var(--text-m);
  text-decoration: underline;
  text-underline-offset: 4px;
  line-height: 1.5;
}

.quiet-link:hover { color: var(--muted); }

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--paper);
  font-size: var(--text-m);
  font-weight: 600;
  line-height: 1.2;
}

.primary-button:hover { background: color-mix(in srgb, var(--accent), var(--ink) 18%); }

.primary-button:disabled {
  background: var(--line);
  color: var(--muted);
  opacity: 1;
  cursor: default;
}

.primary-button:disabled:hover { background: var(--line); }





.album-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.album-resume-clear {
  min-width: 44px;
  padding: 0;
}

.album-actions:not(:has(button:not([hidden]))) { display: none; }

.album-manage {
  margin-top: 24px;
  border-top: 1px solid var(--line);
}

.album-manage:not(:has(button:not([hidden]))) { display: none; }

.album-manage summary {
  display: flex;
  align-items: center;
  min-height: 48px;
  color: var(--muted);
  font-size: var(--text-m);
  cursor: pointer;
}

.album-manage[open] summary { color: var(--ink); }

.album-manage .album-actions { margin-top: 0; padding-bottom: 8px; }

.albums-upload { margin-top: 24px; justify-content: center; }

dialog#upload-dialog {
  width: min(560px, calc(100% - 32px));
  max-width: calc(100% - 16px);
  max-height: calc(100dvh - 16px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  overflow: clip;
  border: 1px solid var(--line);

  background: var(--paper);
  color: var(--ink);
}

dialog#upload-dialog[open] { animation: dialog-in var(--motion-page) var(--ease-out) both; }

dialog#upload-dialog::backdrop {
  background: color-mix(in srgb, var(--viewer-bg) 46%, transparent);
  overscroll-behavior: contain;
}

.upload-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100dvh - 18px);
  padding: 20px;
}

.upload-body {
  display: grid;
  flex: 1 1 auto;
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.upload-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}

.upload-head h2 {
  flex: 1 1 auto;
  min-width: 0;
  font: 600 var(--text-l)/var(--leading-l) var(--serif);
}

.upload-close {
  flex: none;
  margin-left: auto;
  min-height: 44px;
  padding: 0 12px;
  white-space: nowrap;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: var(--text-m);
}

.upload-close:hover { text-decoration: underline; text-underline-offset: 4px; }

.upload-lede,
.upload-summary,
.upload-status {
  color: var(--muted);
  font-size: var(--text-s);
}

.upload-status { min-height: 1.6em; }
.upload-status.is-error { color: var(--danger); }

.upload-pick { width: 100%; }

.upload-add { width: 100%; }

.upload-item-preview {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 0;
  background: var(--line);
  object-fit: cover;
}

.upload-item-preview.is-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: var(--text-s);
}

.upload-item-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 6px;
}

.upload-remove {
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: var(--text-m);
  line-height: 1;
}

.upload-remove:hover { text-decoration: underline; }

.upload-field { display: grid; flex: none; gap: 6px; }

.upload-field-label {
  color: var(--muted);
  font-size: var(--text-s);
}

.upload-albums-field { gap: 8px; }

.upload-albums {
  display: grid;
  gap: 6px;
  max-height: min(168px, 26dvh);
  margin: 0;
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
}

.upload-albums li { margin: 0; }

.upload-album-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
}

.upload-album-option:has(input:checked),
.upload-album-option.is-selected {
  border-color: var(--accent);
  background: var(--line);
}

.upload-album-option:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.upload-album-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.upload-album-cover {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border-radius: 0;
  background: var(--line);
  color: var(--muted);
  font: 600 var(--text-s)/1 var(--serif);
}

.upload-album-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-album-text {
  display: grid;
  flex: 1;
  gap: 2px;
  min-width: 0;
}

.upload-album-name {
  overflow: hidden;
  font-size: var(--text-s);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-album-scope {
  color: var(--muted);
  font-size: var(--text-s);
}

.upload-destination {
  color: var(--ink);
  font-size: var(--text-s);
  line-height: 1.4;
}

.upload-destination:empty { display: none; }

.upload-note {
  color: var(--muted);
  font-size: var(--text-s);
  line-height: var(--leading-s);
}

.upload-progress { display: grid; gap: 8px; }

.upload-bar {
  height: 8px;
  overflow: hidden;
  background: var(--line);
}

.upload-bar span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width var(--motion) var(--ease-out);
}

.upload-progress-text {
  color: var(--muted);
  font-size: var(--text-s);
  font-variant-numeric: tabular-nums;
}

.upload-items {
  display: grid;
  gap: 6px;
  max-height: 34dvh;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.upload-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.upload-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: var(--text-s);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-item-state {
  flex: none;
  color: var(--muted);
  font-size: var(--text-s);
  font-variant-numeric: tabular-nums;
}

.upload-item-state.is-error { color: var(--danger); }

.upload-retry {
  flex: none;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: var(--text-m);
}

.upload-retry:hover { text-decoration: underline; text-underline-offset: 4px; }

.upload-actions {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.upload-actions .primary-button {
  flex: 1;
  min-width: 140px;
}

.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: var(--text-m);
  font-weight: 500;
  line-height: 1.2;
}

.text-button:hover { text-decoration: underline; text-underline-offset: 4px; }

dialog#confirm-dialog,
dialog#rename-dialog,
dialog#invite-dialog {
  width: min(460px, calc(100% - 32px));
  max-width: calc(100% - 16px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--line);

  background: var(--paper);
  color: var(--ink);
}

dialog#confirm-dialog[open],
dialog#rename-dialog[open],
dialog#invite-dialog[open] { animation: dialog-in-sm var(--motion-page) var(--ease-out) both; }

dialog#confirm-dialog::backdrop,
dialog#rename-dialog::backdrop,
dialog#invite-dialog::backdrop {
  background: color-mix(in srgb, var(--viewer-bg) 46%, transparent);
  overscroll-behavior: contain;
}

.confirm-panel {
  display: grid;
  gap: 12px;
  max-height: calc(100dvh - 34px);
  padding: 20px;
  overflow-y: auto;
}

.confirm-panel h2 {
  font: 600 var(--text-l)/var(--leading-l) var(--serif);
}

.confirm-body {
  color: var(--muted);
  font-size: var(--text-s);
  line-height: var(--leading-m);
}

.confirm-actions,
.rename-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

.confirm-actions .primary-button,
.rename-actions .primary-button { min-width: 120px; }

.primary-button.is-danger {
  background: var(--danger);
  color: var(--paper);
}

.primary-button.is-danger:hover {
  background: color-mix(in srgb, var(--danger), var(--ink) 18%);
}

.primary-button.is-danger:disabled {
  background: var(--line);
  color: var(--muted);
}

.rename-form {
  max-width: none;
  padding: 20px;
}

.rename-form h2 {
  font: 600 var(--text-l)/var(--leading-l) var(--serif);
}

.rename-hint {
  margin-top: -6px;
  color: var(--muted);
  font-size: var(--text-s);
}

#rename-name[aria-invalid="true"] { border-color: var(--danger); }

#confirm-error:not(:empty),
#rename-error:not(:empty) { display: block; }

.invite-panel {
  display: grid;
  gap: 12px;
  max-height: calc(100dvh - 32px);
  padding: 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.invite-lede {
  color: var(--muted);
  font-size: var(--text-s);
  line-height: var(--leading-m);
}

.invite-text {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font: var(--text-s)/var(--leading-m) var(--sans);
  resize: vertical;
}

.invite-status {
  min-height: 1.6em;
  color: var(--muted);
  font-size: var(--text-s);
}

.invite-status.is-error { color: var(--danger); }

.invite-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

.invite-actions .primary-button { min-width: 120px; }

.invite-arrival {
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  background: var(--paper);
}

.invite-arrival-title {
  font: 600 var(--text-l)/var(--leading-l) var(--serif);
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.invite-arrival-copy {
  max-width: 34em;
  margin-top: 6px;
  color: var(--muted);
  font-size: var(--text-s);
  line-height: var(--leading-m);
}

.invite-missing { margin-top: 20px; }

.invite-missing h2 { overflow-wrap: anywhere; }

@media (max-width: 479px) {
  .upload-panel { padding: 16px; }

  .upload-head h2 { font-size: var(--text-l); }

  .upload-actions .primary-button { flex-basis: 100%; }

  .invite-panel { padding: 16px; }

  .invite-actions .primary-button { flex-basis: 100%; }

  .invite-arrival { padding: 12px 14px; }
}

.hero-link {
  position: relative;
  display: block;
  width: 100%;
  height: min(56svh, 62vw);
  padding: 0;
  border: 0;
  overflow: hidden;
  background: var(--line);
  cursor: zoom-in;
}
.hero-bg, .hero-bg img {
  display: block;
  width: 100%;
  height: 100%;
}
.hero-bg img { object-fit: cover; }
@media (prefers-reduced-motion: no-preference) {
  .hero-bg img.is-loaded {
    transform-origin: 50% 38%;
    animation: portrait-drift 12s ease-in-out infinite alternate;
  }
  .hero-link:is(.motion-paused, .offscreen) img,
  body:has(dialog[open]) .hero-bg img { animation-play-state: paused; }
}
@keyframes portrait-drift {
  from { transform: scale(1); }
  to { transform: scale(1.035); }
}
.hero-link:focus-visible { outline: 3px solid var(--accent); outline-offset: -5px; }
.hero-expand {
  position: absolute;
  bottom: 12px;
  right: var(--pad);
  padding: 6px 10px;
  background: color-mix(in srgb, var(--viewer-bg) 80%, transparent);
  color: var(--viewer-ink);
  font-size: var(--text-s);
}
@media (min-width: 760px) {
  .hero-copy {
    position: absolute;
    inset: auto 0 0;
    align-items: end;
    padding: 52px max(var(--pad), calc((100vw - 1320px) / 2)) 24px;
    color: var(--viewer-ink);
    border: 0;
    background: linear-gradient(transparent, color-mix(in srgb, var(--viewer-bg) 86%, transparent));
    pointer-events: none;
  }
  .hero h1 { font-size: var(--text-2xl); }
  .hero-date, .hero .quiet-link, .hero .quiet-link:hover { color: var(--viewer-ink); }
  .hero .quiet-link { pointer-events: auto; border-color: currentColor; }
  .hero-expand { top: 16px; bottom: auto; }
}
@media (max-width: 759px) {
  .hero-link { height: min(75vw, 48svh); }
}

.recent { margin-top: clamp(26px, 4vw, 44px); }

.person-row {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 4px 0 2px;
}

.person-card {
  flex: none;
  width: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  border-radius: 8px;
  color: var(--ink);
  font-size: var(--text-s);
  line-height: var(--leading-s);
  text-align: center;
}

.person-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--line);
}

.person-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.person-avatar img.is-error { display: none; }

.person-avatar-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-family: var(--serif);
  font-size: var(--text-l);
  font-weight: 600;
}

.person-name {
  max-width: 100%;
  line-height: var(--leading-s);
  overflow-wrap: anywhere;
}

.person-card:is(:hover, :focus-visible) .person-name {
  text-decoration: underline;
  text-underline-offset: .2em;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.section-head h2 {
  font: 600 var(--text-l)/var(--leading-l) var(--serif);
  letter-spacing: 0;
  text-wrap: balance;
}

.section-tail {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 14px;
}

/* Below 640px the tail needs up to two 44px rows once the count and
   看全部新增 arrive. Reserve the final height in rem so 200% text keeps
   its 195px row. At 100% the reserve is 98px. */
@media (max-width: 639px) {
  #added .section-tail {
    flex-basis: 100%;
    min-height: 6.125rem;
    align-content: flex-end;
  }

  /* The 最近拍的 tail holds the count and 看全部. Its loaded height is
     101px at 200% text and 44px at 100%, so 3.2rem covers both. */
  section[aria-labelledby="recent-title"] .section-tail {
    min-height: 3.2rem;
    align-content: flex-end;
  }
}

/* At 354px and below the loaded count pushes this tail onto its own row.
   Give the skeleton the same two-row head so the page does not grow. */
@media (max-width: 354px) {
  section[aria-labelledby="recent-title"] .section-tail {
    flex-basis: 100%;
  }
}

/* At 640 to 649px the loaded count and 看全部新增 push the tail onto its
   own row. Reserve that row while the skeleton shows. */
@media (min-width: 640px) and (max-width: 649px) {
  #added .section-tail {
    flex-basis: 100%;
    min-height: 44px;
    align-content: flex-end;
  }
}

.section-note {
  flex: none;
  max-width: 100%;
  color: var(--muted);
  font-size: var(--text-s);
  line-height: var(--leading-s);
  font-variant-numeric: tabular-nums;
}

.section-all { font-weight: 500; }

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: var(--text-m);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
  white-space: nowrap;
}

.text-link span { font-size: var(--text-m); }

button.text-link {
  padding: 0;
  border: 0;
  background: transparent;
}

.collection {
  margin-top: clamp(32px, 5vw, 56px);
  padding-top: clamp(22px, 3vw, 32px);
  border-top: 1px solid var(--line);
}


#home-albums {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px 12px;
}
#home-albums .album-cover {
  aspect-ratio: 3 / 2;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
#home-albums .album-label { padding: 9px 0 0; }
#home-albums .album-label strong { font-size: var(--text-l); }
#home-albums .album-label small { font-variant-numeric: tabular-nums; }
#home-albums .album-card:hover { transform: none; }
#home-albums .album-card:is(:hover, :focus-visible) strong {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
}
@media (min-width: 760px) {
  #home-albums { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 20px; }
}
@media (min-width: 1100px) {
  #home-albums { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

.photo-grid {
  --cols: 3;
  --colw: calc((100cqw - (var(--cols) - 1) * var(--gut)) / var(--cols));
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: var(--gut);
  width: 100%;
  container-type: inline-size;
  grid-auto-flow: dense;
}

/* Album, timeline and search use equal-height rows: each row's height comes
   from the photos' own aspect ratios, so nothing is cropped and the row keeps
   its width before the images arrive. */
.photo-grid--rows {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: var(--photo-gap);
  width: auto;
  container-type: normal;
  grid-auto-flow: row;
}

.photo-grid--rows .photo-tile { flex: none; }
.photo-grid--rows .tile-media,
.photo-grid--rows .photo-tile.portrait .tile-media {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
}
.photo-grid--rows .photo-tile.portrait .tile-media img { object-fit: cover; }

/* Portraits keep their full height by taking two rows. The row height follows
   the grid's own width, so it stays exact without JS. */
.photo-grid:not(.photo-grid--rows) .photo-tile .tile-media {
  aspect-ratio: auto;
  height: calc(var(--colw) * 0.75);
}

.photo-grid:not(.photo-grid--rows) .photo-tile.portrait { grid-row: span 2; }

.photo-grid:not(.photo-grid--rows) .photo-tile.portrait .tile-media {
  height: calc(var(--colw) * 1.5 + var(--gut));
}

.photo-grid:not(.photo-grid--rows) .photo-tile.portrait .tile-media img { object-fit: contain; }

.photo-tile {
  display: block;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

.photo-tile:focus-visible { outline-offset: -3px; }

.tile-media {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--line);
  border-radius: 0;
}

.tile-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity var(--motion-fade) var(--ease), filter var(--motion-fast) var(--ease);
}

@media (hover: hover) and (pointer: fine) {
  .photo-tile:hover .tile-media img { filter: brightness(.96); }
}
.photo-tile:active .tile-media img { filter: brightness(.9); }

.tile-check {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  display: none;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background: color-mix(in srgb, var(--viewer-bg) 60%, transparent);
}

#album-photos.is-selecting .tile-check { display: grid; }

#album-photos.is-selecting .photo-tile[aria-pressed="true"] .tile-check {
  background: var(--accent);
}

#album-photos.is-selecting .photo-tile[aria-pressed="true"] .tile-check::before {
  content: "✓";
  color: var(--paper);
  font-size: var(--text-s);
  line-height: 1;
}

#album-photos.is-selecting .photo-tile[aria-pressed="true"] .tile-media {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}

.fade { opacity: 0; }
.fade.is-loaded { opacity: 1; }

.fade.is-error,
img.is-error { opacity: 0; }

.hero-bg:has(> img.is-error)::after,
.tile-media:has(> img.is-error)::after,
.album-cover:has(> img.is-error)::after,
.wall-photo:has(> img.is-error)::after,
.album-cover-large:has(> img.is-error)::after,
.viewer-stage:has(> img.is-error)::after {
  content: "照片没能显示\A 轻触重试";
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-content: center;
  padding: 8px;
  color: var(--muted);
  background: var(--line);
  font-size: var(--text-s);
  line-height: 1.5;
  text-align: center;
  white-space: pre-line;
  pointer-events: none;
}

.tile-media:has(> img.is-processing)::after,
.album-cover:has(> img.is-processing)::after,
.wall-photo:has(> img.is-processing)::after,
.album-cover-large:has(> img.is-processing)::after {
  content: "正在处理\A 马上就好";
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-content: center;
  padding: 8px;
  color: var(--muted);
  background: var(--line);
  font-size: var(--text-s);
  line-height: 1.5;
  text-align: center;
  white-space: pre-line;
  pointer-events: none;
}

.hero-bg:has(> img.is-error)::after,
.album-cover-large:has(> img.is-error)::after { font-size: var(--text-s); }

.album-cover:has(> img.is-error)::after,
.wall-photo:has(> img.is-error)::after { content: "没能显示\A 轻触重试"; }

.hero-bg:has(> img.is-error).is-retry-failed::after,
.album-cover-large:has(> img.is-error).is-retry-failed::after {
  content: "照片仍没能显示\A 请刷新页面后再试";
}

.viewer-stage:has(> img.is-error)::after {
  color: var(--viewer-muted);
  background: transparent;
  font-size: var(--text-s);
}

.viewer-stage:has(> img.is-error).is-retry-failed::after {
  content: "照片仍没能显示\A 请刷新页面后再试";
}

.live-badge,
.video-badge {
  position: absolute;
  bottom: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--paper);
  font-variant-numeric: tabular-nums;
}

.live-badge {
  left: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--viewer-bg) 72%, transparent);
}

.live-badge::before {
  content: "";
  width: 10px;
  height: 10px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}

.live-badge::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 3px;
  height: 3px;
  margin: auto;
  border-radius: 50%;
  background: currentColor;
}

.video-badge {
  right: 8px;
  height: 22px;
  padding: 0 7px;
  gap: 5px;
  background: var(--accent);
  font-size: var(--text-s);
  line-height: 1;
  letter-spacing: .02em;
}

.video-badge::before {
  content: "";
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 4px 0 4px 7px;
  border-color: transparent transparent transparent currentColor;
}

.skeleton-grid {
  --cols: 3;
  --colw: calc((100cqw - (var(--cols) - 1) * var(--gut)) / var(--cols));
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: var(--gut);
  width: 100%;
  container-type: inline-size;
}

.skeleton-grid.skeleton-rows {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: var(--photo-gap);
  width: auto;
  container-type: normal;
}

.skeleton-rows .skeleton-tile {
  flex: none;
  aspect-ratio: auto;
}

.skeleton-grid.skeleton-dense { grid-auto-flow: dense; }

.skeleton-dense .skeleton-tile.portrait {
  grid-row: span 2;
  aspect-ratio: auto;
  height: calc(var(--colw) * 1.5 + var(--gut));
}

.skeleton-tile {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--line);
  border-radius: 0;
}

.skeleton-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, var(--line) 50%, transparent 80%);
  opacity: .65;
}

.album-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-inline: 0;
}

.album-grid.is-revealing { animation: reveal-in var(--motion) var(--ease-out) both; }

@keyframes reveal-in {
  from { opacity: 0; transform: translateY(calc(var(--shift-xs) * -1)); }
  to { opacity: 1; transform: none; }
}

.album-card {
  display: block;
  min-width: 0;
  padding: 0 0 4px;
  color: inherit;
  touch-action: manipulation;
  transition: transform var(--motion) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.album-card:focus-visible { outline-offset: -3px; }

.album-cover {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  container-type: inline-size;
  border: 1px solid var(--line);
  border-radius: 0;
  background: linear-gradient(145deg, var(--line), var(--line));
  transition: box-shadow var(--motion) var(--ease-out);
}

.album-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 35%;
  border-radius: inherit;
  transition: opacity var(--motion-fade) var(--ease-out);
}

.album-cover-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: inherit;
  background: radial-gradient(120% 90% at 50% 30%, var(--line), var(--line) 75%);
}

.album-cover-fallback::before {
  content: "";
  width: 46px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: radial-gradient(circle at 13px 11px, var(--line) 0 2px, transparent 2.5px);
}

.album-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font: 500 var(--text-s)/1.2 var(--sans);
  letter-spacing: .04em;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.album-count-note {
  margin-top: 6px;
  color: var(--muted);
  font-size: var(--text-s);
  line-height: var(--leading-s);
}

.album-sharing {
  display: inline-flex;
  align-items: center;
  margin-top: 6px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: var(--text-s);
  line-height: var(--leading-s);
}

.album-sharing.is-shared {
  border-color: var(--line);
  background: var(--line);
  color: var(--ink);
}

.album-label {
  display: block;
  min-height: 44px;
  padding: 10px 2px 0;
}

.album-label strong {
  display: block;
  font: 600 var(--text-l)/var(--leading-l) var(--serif);
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.album-label small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: var(--text-s);
  line-height: var(--leading-s);
}

.album-end {
  margin-top: 24px;
  color: var(--muted);
  font-size: var(--text-s);
  text-align: center;
}

.year-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  scrollbar-width: none;
}

.year-jump::-webkit-scrollbar { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: var(--text-m);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.chip[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}

.chip-count {
  color: var(--muted);
  font-size: var(--text-s);
  line-height: var(--leading-s);
  font-variant-numeric: tabular-nums;
}

.chip[aria-pressed="true"] .chip-count { color: var(--paper); }

.year-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  background: var(--paper);
}

.year-note p { font-size: var(--text-s); }

.year-all {
  margin: 0;
  min-height: 44px;
  padding: 0 16px;
}

.year-group {
  padding-top: 16px;
  margin-top: 16px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 12px;
  content-visibility: auto;
  contain-intrinsic-size: auto 2600px;
}

.timeline-resizing .year-group,
.timeline-jumping .year-group { content-visibility: visible; }

.year-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.year-head h2 {
  font: 600 var(--text-xl)/var(--leading-xl) var(--serif);
  letter-spacing: 0;
  font-variant-numeric: lining-nums tabular-nums;
}

.day-block + .day-block {
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.day-label {
  margin: 0 0 8px;
  color: var(--ink);
  font: 600 var(--text-m)/var(--leading-m) var(--sans);
  font-variant-numeric: tabular-nums;
}

@media (min-width: 760px) {
  .day-label { font: 600 var(--text-l)/var(--leading-l) var(--sans); }
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 14px;
  border-radius: 8px;
  color: var(--muted);
  font-size: var(--text-m);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.back-link:hover { color: var(--ink); }

.album-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  margin-top: 6px;
  padding-block: clamp(20px, 3vw, 38px);
  border-block: 1px solid var(--line);
}

.album-copy { min-width: 0; }

.album-intro h1 {
  margin-top: 12px;
  font: 600 var(--text-xl)/var(--leading-xl) var(--serif);
  letter-spacing: 0;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

#album-description {
  max-width: 32em;
  margin-top: 10px;
  color: var(--muted);
  font-size: var(--text-m);
  line-height: 1.7;
}

.album-intro .view-summary { margin-top: 10px; }

.album-cover-large {
  position: relative;
  order: -1;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  justify-self: center;
  align-self: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--line);
}

.album-cover-large img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: clamp(300px, 44vh, 460px);
  object-fit: contain;
  border-radius: inherit;
  transition: transform var(--motion-fast) var(--ease-out);
}

.album-cover-button {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.album-cover-button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: -4px;
}

.album-cover-large:has(.album-cover-button:active) img { transform: scale(.995); }

.album-cover-hint {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  background: color-mix(in srgb, var(--viewer-bg) 72%, transparent);
  color: var(--paper);
  font-size: var(--text-s);
  line-height: 1.2;
  pointer-events: none;
}

.album-cover-large:has(.album-cover-button[hidden]) .album-cover-hint,
.album-cover-large:has(> img.is-error) .album-cover-hint { display: none; }

@media (max-width: 759px) {


  .day-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .day-grid .album-card {
    display: grid;
    grid-template-columns: clamp(88px, 30vw, 112px) minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    padding: 0;
  }

  .day-grid .album-cover { aspect-ratio: 4 / 3; }

  .day-grid .album-label {
    min-height: 0;
    padding: 0;
  }

  .day-grid .album-label strong {
    font-size: var(--text-l);
    line-height: 1.35;
  }

  .day-grid .album-label small {
    font-size: var(--text-s);
    line-height: 1.6;
  }

  #album { padding-bottom: calc(var(--tabbar-h) + 12px); }

  .album-intro {
    grid-template-columns: minmax(120px, 42%) minmax(0, 1fr);
    gap: 12px 14px;
    align-items: start;
    padding-block: 16px 20px;
  }

  .album-cover-large {
    width: 100%;
    aspect-ratio: var(--cover-ratio, 4 / 3);
    justify-self: stretch;
    align-self: start;
    border-radius: 0;
  }

  .album-cover-large img {
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: cover;
  }

  .album-intro:has(.album-cover-large.is-landscape) {
    grid-template-columns: minmax(0, 1fr);
  }

  .album-cover-large.is-landscape {
    grid-column: 1 / -1;
    width: 100%;
  }

  .album-intro:has(.album-cover-large.is-landscape) .album-copy { grid-column: 1; }

  .album-intro h1 { margin-top: 8px; }

  #album-description { margin-top: 8px; }
}

@media (max-width: 359px) {
  .album-intro { grid-template-columns: minmax(0, 1fr); }

  .album-cover-large {
    width: min(180px, 100%);
    justify-self: start;
  }

  .album-copy { grid-column: 1; }
}


@media (min-width: 760px) and (max-width: 1099px) {
  .day-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 20px;
  }

  .day-grid .album-card {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: 0;
  }

  .day-grid .album-cover { aspect-ratio: 4 / 3; }

  .day-grid .album-label {
    min-height: 0;
    padding: 0;
  }

  .day-grid .album-label strong {
    font-size: var(--text-l);
    line-height: 1.35;
  }

  .day-grid .album-label small {
    font-size: var(--text-s);
    line-height: 1.6;
  }
}

.gallery-form {
  display: grid;
  gap: 10px;
  max-width: 480px;
}

.gallery-form label { color: var(--muted); font-size: var(--text-s); }

.gallery-form input {
  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-size: var(--text-m);
  -webkit-appearance: none;
  appearance: none;
}

.gallery-form input::placeholder { color: var(--muted); opacity: 1; }

.field-error {
  display: none;
  margin-top: -4px;
  color: var(--danger);
  font-size: var(--text-s);
}

.gallery-form input:user-invalid { border-color: var(--danger); }

.gallery-form input:user-invalid + .field-error { display: block; }

#gallery-login { margin-top: 24px; }



#gallery-login button { width: 100%; margin-top: 4px; }



#login-status { min-height: 1.6em; }

.search-form {
  max-width: 46rem;
  margin-block: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.search-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.search-field { display: grid; gap: 6px; min-width: 0; }

.search-field label {
  color: var(--muted);
  font-size: var(--text-s);
  line-height: var(--leading-s);
}

.search-field-query { grid-column: 1 / -1; }

.search-field input, .search-field select { width: 100%; }

.search-field select {
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-size: var(--text-m);
}

.search-filter { grid-column: 1 / -1; }

.search-filter-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: var(--text-m);
  line-height: var(--leading-s);
  cursor: pointer;
  list-style: none;
}

.search-filter-toggle::-webkit-details-marker { display: none; }

.search-filter-toggle::before {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  transition: transform var(--motion-fast) var(--ease);
}

.search-filter[open] .search-filter-toggle::before { transform: rotate(-135deg) translateY(-1px); }

.search-filter-toggle:hover { color: var(--accent); }

.search-filter.has-filters .search-filter-toggle { color: var(--accent); }

.search-filter-state { color: var(--muted); }

.search-filter-state:empty { display: none; }

.search-filter.has-filters .search-filter-state { color: var(--accent); }

.search-filter-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr));
  gap: 12px;
  margin-top: 12px;
}

.search-actions { display: flex; gap: 8px; }



.search-actions .primary-button { flex: 1; }



.search-actions .text-button { flex: none; }



@media (min-width: 760px) {
  .search-actions { justify-content: flex-end; }

  .search-actions .primary-button { flex: none; min-width: 96px; }
}

.search-count {
  margin-top: 24px;
  color: var(--ink);
  font-size: var(--text-m);
  font-weight: 500;
  line-height: var(--leading-m);
}

.search-results { margin-top: 16px; }

.photo-day + .photo-day { margin-top: 24px; }

.photo-day-title {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: var(--text-l);
  line-height: var(--leading-l);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.search-note {
  max-width: 880px;
  margin-top: 12px;
  color: var(--muted);
  font-size: var(--text-s);
  line-height: var(--leading-s);
}

.search-albums { margin-block: 16px 24px; }

.search-start {
  max-width: 880px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.search-start-title {
  font: 600 var(--text-l)/var(--leading-l) var(--serif);
}

.search-start-albums { margin-top: 12px; }

@media (min-width: 760px) {
  .search-start-albums { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.empty-state .search-suggest-label {
  margin-top: 24px;
  color: var(--muted);
  font-size: var(--text-s);
  line-height: var(--leading-s);
  letter-spacing: .08em;
}

.search-suggest-years { margin-top: 8px; }

.search-suggest-albums { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.search-suggest-years .chip,
.search-suggest-albums .chip {
  color: var(--ink);
  font-size: var(--text-m);
  line-height: var(--leading-s);
}

.search-suggest-years .chip:hover,
.search-suggest-albums .chip:hover { color: var(--accent); }

.search-suggest-albums .chip { text-decoration: none; }

.empty-state {
  max-width: 620px;
  padding: 28px 0 34px;
  border-bottom: 1px solid var(--line);
}

.empty-rule {
  display: block;
  width: 56px;
  margin-bottom: 18px;
  border-top: 1px solid var(--line);
}

.empty-state h2 {
  font: 600 var(--text-l)/var(--leading-l) var(--serif);
  letter-spacing: 0;
}

.empty-state p {
  max-width: 34em;
  margin-top: 8px;
  color: var(--muted);
  font-size: var(--text-s);
  line-height: var(--leading-s);
}





.added-more { margin-block: 8px 0; }

#added-more-status { margin-block: 8px 0 0; }

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  margin-top: clamp(48px, 7vw, 80px);
  padding-block: 18px 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--text-s);
  line-height: var(--leading-s);
}

#live-footer { display: flex; align-items: center; gap: 14px; }

.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  border-bottom: 1px solid var(--line);
}

.site-footer a:hover { color: var(--ink); }

#gallery-logout {
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: var(--text-m);
}

#gallery-logout:hover { text-decoration: underline; text-underline-offset: 4px; }

.noscript { padding: 24px 0; }

dialog#lightbox[open] { animation: viewer-in var(--motion-open) var(--ease-open) both; }

dialog#lightbox.is-closing { animation: viewer-out var(--motion-close) var(--ease-close) both; }

@keyframes viewer-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes viewer-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

dialog#lightbox[open] .viewer-stage { animation: viewer-stage-in 220ms var(--ease-open) both; }

@keyframes viewer-stage-in {
  from { transform: scale(.992); }
  to { transform: none; }
}

@keyframes viewer-page-next {
  from { opacity: .4; transform: translateX(var(--shift-xs)); }
  to { opacity: 1; transform: none; }
}

@keyframes viewer-page-prev {
  from { opacity: .4; transform: translateX(calc(var(--shift-xs) * -1)); }
  to { opacity: 1; transform: none; }
}

dialog#lightbox {
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--viewer-bg);
  color: var(--viewer-ink);
}

dialog#lightbox::backdrop {
  background: var(--viewer-bg);
  overflow: hidden;
  overscroll-behavior: contain;
}

dialog:modal { overscroll-behavior: contain; }

dialog#lightbox:focus { outline: none; }

.viewer {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100%;
  background: var(--viewer-bg);
  padding: 0 0 env(safe-area-inset-bottom, 0px);
}

.viewer:focus { outline: none; }

.viewer-bar {
  position: absolute;
  inset: 0 0 auto;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(8px, env(safe-area-inset-top, 0px)) 8px 0;
  pointer-events: none;
}

.viewer-bar > * { pointer-events: auto; }

.viewer-context {
  color: var(--viewer-muted);
  font-size: var(--text-s);
  line-height: var(--leading-s);
  overflow-wrap: anywhere;
}

.viewer-count { color: var(--viewer-muted); }

.viewer-button {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: var(--text-xl)/1 var(--sans);
  -webkit-tap-highlight-color: transparent;
}

.viewer-button:hover { color: var(--viewer-focus); }

.viewer-button:disabled { opacity: .5; cursor: default; }
.viewer-button:disabled:hover { color: inherit; }

.viewer-close {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: auto;
  min-width: 84px;
  height: 48px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--viewer-ink);
  font-size: var(--text-m);
  line-height: 1.5;
  text-shadow: 0 1px 3px var(--viewer-bg);
  white-space: nowrap;
}

.viewer-zoom {
  flex: none;
  width: auto;
  min-width: 64px;
  height: 48px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--viewer-ink);
  font-size: var(--text-m);
  text-shadow: 0 1px 3px var(--viewer-bg);
  white-space: nowrap;
}

.viewer-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  background: transparent;
  border: 0;
  box-shadow: none;
  touch-action: pan-y pinch-zoom;
}

.viewer-skeleton {
  position: absolute;
  inset: 8% 6%;
  z-index: 0;
  border-radius: 0;
  background: color-mix(in srgb, var(--viewer-ink) 6%, transparent);
}

.viewer-stage .viewer-poster {
  z-index: 0;
  pointer-events: none;
}

.viewer-stage img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  transition: opacity var(--motion-fade) var(--ease-out);
}

.viewer-stage.has-poster:has(> img.is-error)::after {
  content: none;
}

.viewer-stage img.is-page-next,
.viewer-stage video.is-page-next { animation: viewer-page-next var(--motion-fade) var(--ease-out) both; }

.viewer-stage img.is-page-prev,
.viewer-stage video.is-page-prev { animation: viewer-page-prev var(--motion-fade) var(--ease-out) both; }

.viewer-stage.is-zoomed {
  touch-action: none;
  cursor: grab;
}

.viewer-stage.is-zoomed:active { cursor: grabbing; }

.viewer-stage:has(> img.is-loaded):not(:has(> video:not([hidden]))) {
  touch-action: none;
}

.viewer-stage video {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  min-height: 0;
  object-fit: contain;
  background: transparent;
}


.viewer-live:hover { text-decoration: underline; text-underline-offset: 4px; }

.viewer-live {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 2;
  width: auto;
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--viewer-ink);
  font-size: var(--text-m);
  text-shadow: 0 1px 3px var(--viewer-bg);
}

.viewer-status {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  max-width: min(calc(100% - 140px), 22rem);
  padding: 8px 10px;
  border: 1px solid var(--viewer-line);
  background: var(--viewer-bg);
  color: var(--viewer-ink);
  font-size: var(--text-s);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.viewer-swipe {
  position: absolute;
  top: 50%;
  z-index: 2;
  translate: 0 -50%;
  padding: 8px 12px;
  border: 1px solid var(--viewer-line);
  background: var(--viewer-bg);
  color: var(--viewer-ink);
  font-size: var(--text-s);
  line-height: 1.4;
  white-space: nowrap;
  pointer-events: none;
}

.viewer-swipe.is-next { right: 12px; }
.viewer-swipe.is-prev { left: 12px; }

.viewer-sheet {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  max-width: 1000px;
  margin-inline: auto;
  padding: 0 8px 4px;
}

.viewer-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 48px;
}

.viewer-note {
  padding-inline: 8px;
  color: var(--viewer-muted);
  font-size: var(--text-s);
  line-height: var(--leading-s);
}

.viewer-caption.is-caption-in { animation: caption-in 100ms var(--ease-out) both; }

@keyframes caption-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

.viewer-meta {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 10px;
  min-width: 0;
  padding-inline: 8px;
  color: var(--viewer-ink);
  font-size: var(--text-s);
  line-height: var(--leading-s);
  font-variant-numeric: tabular-nums;
}

.viewer-more-toggle {
  width: auto;
  min-width: 64px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--viewer-ink);
  font-size: var(--text-m);
  text-shadow: 0 1px 3px var(--viewer-bg);
  white-space: nowrap;
}

.viewer-more-toggle[aria-expanded="true"] { color: var(--viewer-focus); }

.viewer-end {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding-inline: 8px;
  color: var(--viewer-muted);
  font-size: var(--text-s);
  line-height: var(--leading-s);
}

.viewer-end p { margin: 0; }

.viewer-more {
  position: absolute;
  inset: auto 0 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: min(70dvh, 560px);
  max-width: 1000px;
  margin-inline: auto;
  padding: 12px 16px max(16px, env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 8px 8px 0 0;
  background: color-mix(in srgb, var(--viewer-ink) 4%, var(--viewer-bg));
  border-top: 1px solid color-mix(in srgb, var(--viewer-ink) 14%, transparent);
}

.viewer-more:not([hidden]) { animation: dialog-in-sm var(--motion-page) var(--ease-out) both; }

.viewer-more-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.viewer-more-head h2 {
  padding-top: 10px;
  font: 600 var(--text-l)/var(--leading-l) var(--serif);
  letter-spacing: 0;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.viewer-more-close {
  flex: none;
  width: auto;
  min-width: 64px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--viewer-ink);
  font-size: var(--text-m);
  text-shadow: 0 1px 3px var(--viewer-bg);
}

.viewer-same-day {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  text-decoration: none;
}

.viewer-description {
  color: var(--viewer-muted);
  font-size: var(--text-s);
  line-height: var(--leading-s);
}

.viewer-story {
  padding-left: 10px;
  border-left: 2px solid var(--viewer-line);
  color: var(--viewer-ink);
  font: 400 var(--text-s)/var(--leading-s) var(--serif);
  overflow-wrap: anywhere;
}

.viewer-comments {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid color-mix(in srgb, var(--viewer-ink) 14%, transparent);
}

.viewer-comments-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.viewer-comments-head h3 {
  font: 600 var(--text-s)/var(--leading-s) var(--serif);
  color: var(--viewer-ink);
}

.viewer-comments-count {
  color: var(--viewer-muted);
  font-size: var(--text-s);
}

.viewer-comment-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.viewer-comment {
  display: grid;
  gap: 2px;
}

.viewer-comment-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  color: var(--viewer-muted);
  font-size: var(--text-s);
}

.viewer-comment-author {
  color: var(--viewer-ink);
  font-weight: 600;
}

.viewer-comment-text {
  color: var(--viewer-ink);
  font-size: var(--text-s);
  line-height: var(--leading-s);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.viewer-comment-delete {
  justify-self: start;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--viewer-danger);
  font-size: var(--text-m);
}

.viewer-comments-status {
  color: var(--viewer-muted);
  font-size: var(--text-s);
  line-height: var(--leading-s);
}

.viewer-comments-status.is-error { color: var(--viewer-danger); }

.viewer-comments-empty {
  color: var(--viewer-muted);
  font-size: var(--text-s);
  line-height: var(--leading-s);
}

.viewer-comment-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 6px;
}

.viewer-comment-form:not([hidden]) { animation: dialog-in-sm var(--motion-page) var(--ease-out) both; }

.viewer-comment-form label {
  color: var(--viewer-muted);
  font-size: var(--text-s);
}

.viewer-comment-form textarea {
  width: 100%;
  min-height: 60px;
  padding: 8px 10px;
  border: 1px solid var(--viewer-line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--viewer-ink) 6%, transparent);
  color: var(--viewer-ink);
  font: inherit;
  line-height: 1.5;
  resize: vertical;
}

.viewer-comment-form textarea:focus-visible { outline-color: var(--viewer-focus); }

.viewer-comment-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.viewer-comment-count {
  color: var(--viewer-muted);
  font-size: var(--text-s);
}



.viewer.is-playing .viewer-comments { display: none; }

.viewer-albums,
.viewer-people {
  color: var(--viewer-muted);
  font-size: var(--text-s);
  line-height: var(--leading-s);
}

.viewer-albums a,
.viewer-people a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  vertical-align: middle;
  color: var(--viewer-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.viewer-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}

.viewer-tools-status {
  color: var(--viewer-muted);
  font-size: var(--text-s);
  line-height: var(--leading-s);
  overflow-wrap: anywhere;
}

.viewer-tools-status.is-error { color: var(--viewer-danger); }

.viewer-kind {
  display: inline-flex;
  align-items: center;
  padding: 0 6px;
  border: 1px solid var(--viewer-line);
  border-radius: 8px;
  color: var(--viewer-ink);
}

.viewer-nav {
  display: flex;
  flex: none;
  gap: 4px;
}

/* Short landscape: the bottom row is the only chrome, so the photo keeps
   nearly the full screen height. */
@media (orientation: landscape) and (max-height: 520px) and (min-width: 560px) {
  .viewer-more { max-height: 100dvh; max-width: min(420px, 60vw); inset: 0 0 0 auto; border-radius: 0; }
}

.viewer-actions {
  display: flex;
  flex-basis: 100%;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}

.viewer-action {
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--viewer-ink);
  font-size: var(--text-m);
}

.viewer-action:hover { text-decoration: underline; text-underline-offset: 4px; }

.viewer-action-danger { color: var(--viewer-danger); }

.viewer-manage { border-top: 1px solid color-mix(in srgb, var(--viewer-ink) 14%, transparent); }

.viewer-manage summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  border-radius: 8px;
  color: var(--viewer-muted);
  font-size: var(--text-m);
  cursor: pointer;
}

.viewer-manage[open] summary { color: var(--viewer-ink); }

.viewer-manage .viewer-actions { padding-block: 2px 8px; }

.viewer > .undo-bar.is-viewer {
  position: absolute;
  inset: auto 8px calc(56px + env(safe-area-inset-bottom, 0px));
  z-index: 5;
  max-width: 1000px;
  margin: 0 auto;
  box-shadow: none;
  background: color-mix(in srgb, var(--accent), var(--ink) 18%);
  border: 1px solid var(--paper);
}

.viewer :focus-visible { outline-color: var(--viewer-focus); }

@media (min-width: 760px) {
  html { scroll-padding-bottom: 0; }

  body { padding-bottom: 0; }

  .tabbar { display: none; }

  .header-inner { min-height: 88px; }

  .brand-mark { width: 34px; height: 34px; font-size: var(--text-m); }

  .brand-name { font-size: var(--text-l); }

  .top-nav { display: flex; align-items: center; gap: clamp(20px, 3vw, 36px); margin-left: auto; }

  .top-nav a {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    color: var(--muted);
    font-size: var(--text-m);
    white-space: nowrap;
  }

  .top-nav a:hover, .top-nav a[aria-current="page"] { color: var(--ink); }

  .top-nav a[aria-current="page"] { font-weight: 600; }

  .top-nav a[aria-current="page"]::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 4px;
    border-top: 1px solid var(--accent);
  }

  .photo-grid { --cols: 5; }

  .skeleton-grid { --cols: 5; }

  .year-head h2 { font: 500 var(--text-xl)/var(--leading-xl) var(--serif); }
  .page-head h1 { font-size: var(--text-xl); }
  .section-head h2 { font-size: var(--text-l); }


  .album-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }

  .album-label { padding: 14px 0 6px; }

  .album-intro {
    grid-template-columns: minmax(0, .95fr) minmax(0, 1.15fr);
    gap: clamp(24px, 4vw, 48px);
  }

  .album-cover-large { order: 0; border-radius: 0; }

  .viewer-bar { padding-inline: 16px; }
}

@media (min-width: 1200px) {
  .album-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 24px;
    max-width: 1200px;
    margin-inline: auto;
  }

}

@media (hover: hover) and (pointer: fine) {
  .album-card:hover { transform: translateY(-1px); }

  .album-card:hover .album-cover {
    outline: 2px solid var(--line); outline-offset: -2px;
  }
}

.album-card:active {
  transform: scale(.99);
  transition-duration: var(--motion-press);
}

@media (hover: none) {
  .album-card:active { transform: scale(.985); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    animation-delay: 0s !important;
    transition-delay: 0s !important;
  }

  .album-card:hover,
  .album-card:active,
  .album-cover-large:has(.album-cover-button:active) img { transform: none; }

  .select-bar,
  .undo-bar,
  .select-bar.is-closing,
  .undo-bar.is-closing,
  dialog[open],
  .viewer-stage,
  .viewer-stage img.is-page-next,
  .viewer-stage img.is-page-prev,
  .viewer-stage video.is-page-next,
  .viewer-stage video.is-page-prev,
  .album-grid.is-revealing,
  .reel-stage.is-first-paint,
  .viewer-caption.is-caption-in { transform: none !important; animation: none !important; }
}

/* Reel wall */
.reel-section { margin-top: clamp(26px, 4vw, 44px); }

.reel-back {
  display: none;
  margin-top: 0;
}

body.reel-standalone .reel-back { display: inline-flex; }

body.reel-standalone #reel .section-head h2 { display: none; }

.reel-page-title {
  margin: 0 0 10px;
  font: 600 var(--text-xl)/var(--leading-xl) var(--serif);
  letter-spacing: 0;
}

.reel-section .section-head { margin-bottom: 12px; }

.reel-section .section-note {
  color: var(--muted);
  font-size: var(--text-s);
  line-height: var(--leading-s);
}

body.reel-standalone #home > .hero,
body.reel-standalone #day-row,
body.reel-standalone #home > .recent,
body.reel-standalone #home > .collection { display: none !important; }

body.reel-standalone #reel { margin-top: 0; padding-top: 4px; }

.reel-stage {
  position: relative;
  overflow: hidden;
}

.reel-stage.is-first-paint { animation: reel-first-paint var(--motion) var(--ease-out) both; }

@keyframes reel-first-paint {
  from { opacity: .6; }
  to { opacity: 1; }
}

.reel-staging {
  position: absolute;
  inset-inline: 0;
  top: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: -1;
}

.reel-row {
  height: clamp(150px, 26vh, 280px);
  overflow: hidden;
}

body:not(.reel-standalone) .reel-row { height: clamp(100px, min(32vw, 19svh), 190px); }

.reel-row + .reel-row { margin-top: 8px; }

.reel-track {
  display: flex;
  width: max-content;
  height: 100%;
  will-change: transform;
}

.reel-group {
  display: flex;
  height: 100%;
  gap: 8px;
  padding-right: 8px;
}

.reel-frame {
  position: relative;
  flex: none;
  border-radius: 0;
  width: var(--reel-w, auto);
  height: 100%;
  aspect-ratio: var(--reel-ratio, 3 / 2);
  padding: 0;
  border: 0;
  overflow: hidden;
  background: var(--line);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.reel-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--viewer-ink) 8%, transparent) 50%, transparent 80%);
  opacity: .8;
  pointer-events: none;
}

.reel-frame:has(> img.is-loaded)::after,
.reel-frame:has(> img.is-error)::after { content: none; }

.reel-frame:focus-visible { outline-offset: -3px; }

.reel-frame img {
  position: relative;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
  transition: opacity var(--motion-fade) var(--ease-out);
}

.reel-toggle {
  margin-inline-start: auto;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: var(--text-m);
}

.reel-toggle:hover { text-decoration: underline; text-underline-offset: .2em; }

.reel-status { margin-top: 16px; }

.reel-empty {
  max-width: 34em;
  margin: 18px 0 24px;
  color: var(--muted);
  font-size: var(--text-s);
  line-height: var(--leading-s);
}

@media (max-width: 600px) {
  .reel-row { height: clamp(118px, 34.5vw, 184px); }

  .reel-row + .reel-row { margin-top: 6px; }

  .reel-group { gap: 6px; padding-right: 6px; }

}

/* Closing the lightbox briefly outlines the tile it came from, so the eye can
   return to the same place without a layout shift. */
.photo-tile.is-returned,
.album-card.is-returned,
.hero-link.is-returned,
.reel-frame.is-returned {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.photo-tile.is-upload-target {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

dialog#upload-dialog, dialog#confirm-dialog, dialog#rename-dialog, dialog#invite-dialog { border-radius: 8px; }


.text-button:disabled { opacity: .5; cursor: default; }
.viewer-action:disabled { opacity: .5; cursor: default; }
#load-retry, #added-retry, #load-more, #reel-retry { display: flex; margin: 28px auto; }
#added-more { display: flex; margin: 8px auto 0; }
#timeline-all { margin: 0; }
.empty-state .text-button { display: flex; margin: 20px auto 0; }

dialog.compat-dialog[open] { position: fixed; left: 0; right: 0; top: 0; bottom: 0; margin: auto; max-height: 96vh; overflow: auto; }
dialog#lightbox.compat-dialog[open] { max-height: 100vh; }
dialog + .backdrop, ._dialog_overlay { position: fixed; top: 0; right: 0; bottom: 0; left: 0; }
dialog + .backdrop { background: var(--ink); opacity: .4; }
@supports not (height: 1svh) {
  .hero-link { height: min(56vh, 62vw); }
  body:not(.reel-standalone) .reel-row { height: clamp(100px, min(32vw, 19vh), 190px); }
  @media (max-width: 759px) { .hero-link { height: min(75vw, 48vh); } }
}
@supports not (aspect-ratio: 3 / 2) {
  #home-albums .album-cover::before { content: ""; display: block; padding-top: 66.67%; }
}
