:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 18px;
  line-height: 1.5;
  color: #292824;
  background: #f8f7f3;
  --paper: #f8f7f3;
  --ink: #292824;
  --muted: #625f57;
  --line: #d8d5cc;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; min-height: 44px; }
button:disabled { cursor: default; opacity: .4; }
button, input { border-radius: 4px; }
a { color: inherit; }
:focus-visible { outline: 3px solid #245c92; outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: 2rem; line-height: 1.2; }
h2 { font-size: 1rem; font-weight: 600; line-height: 1.5; }
.text-button { padding: 8px 12px; border: 1px solid transparent; color: var(--ink); background: transparent; }
.text-button:hover { background: #eae8e1; }
.primary-button, .secondary-button { padding: 10px 20px; border: 1px solid var(--ink); }
.primary-button { background: var(--ink); color: var(--paper); }
.primary-button:hover { background: #45433c; }
.secondary-button { background: transparent; color: var(--ink); }
.secondary-button:hover { background: #eae8e1; }
.welcome { width: min(100% - 40px, 400px); margin: 0 auto; padding: max(48px, 18svh) 0 40px; }
.login-form { margin-top: 32px; }
.login-form label { display: block; margin-bottom: 8px; }
.password-field { display: flex; gap: 4px; border: 1px solid #8a867b; background: #fffefa; border-radius: 4px; padding: 4px; }
.password-field:focus-within { outline: 3px solid #245c92; outline-offset: 3px; }
.password-field input { background: transparent; border: 0; width: 100%; min-width: 0; padding: 8px; color: var(--ink); }
.password-field input:focus { outline: none; }
.password-field button { flex-shrink: 0; min-width: 68px; }
.error-message { color: #942d25; margin-top: 16px; }
.login-form .primary-button { width: 100%; margin-top: 20px; }
.site-header { max-width: 1800px; padding: 20px 24px 16px; margin: auto; display: flex; align-items: center; gap: 16px; }
.site-header form { margin-left: auto; flex-shrink: 0; }
.album-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 20px; }
.album-summary { color: var(--muted); }
.album-summary:empty { display: none; }
.album { max-width: 1800px; margin: auto; padding: 0 24px 24px; }
.month-group { margin-bottom: 24px; }
.month-group h2 { margin-bottom: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.photo-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.photo-card { display: block; position: relative; width: 100%; min-width: 0; aspect-ratio: 1; padding: 0; border: 0; border-radius: 2px; overflow: hidden; background: #e6e3db; color: var(--ink); text-align: left; }
.photo-card img { display: block; height: 100%; width: 100%; object-fit: cover; }
.photo-card:focus-visible { outline-offset: 2px; z-index: 1; }
.media-badge { position: absolute; bottom: 8px; left: 8px; padding: 1px 7px; border-radius: 3px; background: #24231fe8; color: #f8f7f3; font-size: 1rem; }
.thumbnail-fallback { display: grid; place-items: center; height: 100%; padding: 12px 12px 40px; text-align: center; }
.state-panel { text-align: center; padding: 40px 16px; color: var(--muted); }
.state-panel button { margin-top: 20px; }
.load-more-area { text-align: center; }
#load-status { color: var(--muted); margin-bottom: 12px; }
#load-status:empty { display: none; }
.skip-link { position: fixed; top: 12px; left: 12px; z-index: 5; background: var(--paper); padding: 12px 20px; transform: translateY(-180%); }
.skip-link:focus { transform: none; }
.viewer-open { overflow: hidden; }
.viewer { color-scheme: dark; width: 100%; max-width: none; height: 100%; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; background: #1c1c1a; color: #f8f7f3; }
.viewer::backdrop { background: #1c1c1a; }
.viewer-shell { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.viewer-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 20px; }
.viewer-header h2 { font-size: 1rem; font-weight: 500; }
#viewer-position { color: #cbc8bf; }
.viewer-button { border: 1px solid #8c8980; color: #f8f7f3; background: transparent; padding: 8px 16px; flex-shrink: 0; }
.viewer-button:hover:not(:disabled) { background: #3b3a35; }
.viewer :focus-visible { outline-color: #a8d3ff; }
.viewer-media { grid-row: 2; position: relative; min-height: 0; min-width: 0; display: flex; align-items: center; justify-content: center; padding: 0 20px; }
.viewer-media img, .viewer-media video { display: block; max-width: 100%; max-height: 100%; width: 100%; height: 100%; object-fit: contain; }
.viewer-media[aria-busy="true"]::before { content: "Loading…"; position: absolute; background: #1c1c1ae8; color: #f8f7f3; border-radius: 3px; padding: 8px 16px; pointer-events: none; }
.viewer-footer { grid-row: 4; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; }
.viewer-error { grid-row: 3; padding: 8px 20px; text-align: center; }
.viewer-error button { margin-top: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 1099px) {
  .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .site-header { padding: 16px 12px 12px; gap: 8px; }
  .site-header h1 { font-size: 1.75rem; }
  .album-heading { display: block; }
  .album-summary { margin-top: 4px; }
  .site-header .text-button { padding: 8px; }
  .album { padding: 0 12px 20px; }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .month-group { margin-bottom: 20px; }
  .month-group h2 { margin-bottom: 8px; padding-top: 8px; }
  .media-badge { left: 6px; bottom: 6px; }
  .viewer-header { padding: 10px 12px; align-items: flex-start; }
  .viewer-media { padding: 0; }
  .viewer-footer { padding: 10px 12px; }
  .viewer-button { padding: 8px 12px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .viewer-header, .viewer-footer { padding: 6px 16px; }
  .viewer-header > div { display: flex; gap: 20px; }
  .viewer-error { padding: 4px 16px; }
}
