:root {
  color-scheme: light;
  --paper: #f4f5f2;
  --surface: #ffffff;
  --surface-soft: #eaede7;
  --ink: #151815;
  --muted: #6d736c;
  --line: #d5d9d3;
  --focus: #526b56;
  --zunda: #557d5d;
  --darkroom: #0b0d0c;
  --danger: #913f37;
  --admin-paper: #e9f1e3;
  --admin-surface: #f5faef;
  --admin-line: #c4d0bb;
  --admin-accent: #557d5d;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Avenir Next", Avenir, "Helvetica Neue", sans-serif;
}
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

/* Public contact sheet */
.public-page { background: var(--paper); }
.public-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1600px, calc(100% - 48px));
  margin: 0 auto;
  padding: 22px 0 13px;
  border-bottom: 1px solid var(--line);
}
.public-title {
  color: var(--zunda);
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -.035em;
  text-decoration: none;
}
.public-title:hover,
.public-title:focus-visible { color: #36563d; outline: 0; }
.public-sections { display: flex; align-items: center; gap: 20px; }
.public-sections a,
.public-sections button {
  position: relative;
  padding: 0 0 5px;
  color: var(--muted);
  background: transparent;
  border: 0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  letter-spacing: .08em;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
}
.public-sections a:hover,
.public-sections a:focus-visible,
.public-sections button:hover,
.public-sections button:focus-visible { color: var(--ink); outline: 0; }
.public-sections a.is-current { color: var(--ink); }
.public-sections a.is-current::after { position: absolute; right: 0; bottom: 0; left: 0; height: 1px; background: currentColor; content: ""; }
.public-main {
  width: min(1600px, calc(100% - 48px));
  min-height: 76vh;
  margin: 0 auto;
  padding: 16px 0 48px;
}
.gallery-grid { display: grid; gap: 22px; }
.gallery-row { display: flex; align-items: flex-start; width: 100%; }
.gallery-item {
  display: block;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  cursor: zoom-in;
  opacity: 0;
  animation: contact-sheet-in .38s ease-out forwards;
  animation-delay: calc(var(--reveal-order) * 28ms);
}
.gallery-item img {
  display: block;
  width: 100%;
  object-fit: cover;
  background: #e1e4df;
  transition: filter .18s ease, opacity .18s ease;
}
.gallery-item:hover img { filter: brightness(.92) contrast(1.02); }
.gallery-item:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.gallery-caption { display: block; padding-top: 7px; text-align: left; }
.gallery-caption time {
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 9px;
  letter-spacing: .045em;
  text-transform: uppercase;
}
.gallery-empty { margin: 22vh auto 0; color: var(--muted); font-size: 13px; text-align: center; }

/* Contact note */
.public-message-dialog {
  width: min(460px, calc(100vw - 28px));
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid #bfc5bd;
  border-radius: 0;
  box-shadow: 0 24px 80px rgba(20, 25, 20, .22);
}
.public-message-dialog::backdrop { background: rgba(25, 29, 25, .42); backdrop-filter: blur(2px); }
.public-message-form { position: relative; display: grid; gap: 19px; padding: 28px; border-top: 3px solid var(--zunda); }
.public-message-kicker {
  color: var(--zunda);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.public-message-form h1 { margin: 1px 0 -10px; font-size: 26px; font-weight: 560; letter-spacing: -.025em; }
.public-message-form > p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.public-message-form label { display: grid; gap: 6px; }
.public-message-form label > span {
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.public-message-form label small { font: inherit; letter-spacing: inherit; opacity: .72; }
.public-message-form input,
.public-message-form textarea {
  width: 100%;
  padding: 9px 10px;
  color: var(--ink);
  background: #fafbf8;
  border: 1px solid var(--line);
  border-radius: 0;
  font-size: 15px;
}
.public-message-form textarea { min-height: 128px; resize: vertical; }
.public-message-form input:focus,
.public-message-form textarea:focus { border-color: var(--zunda); outline: 1px solid var(--zunda); outline-offset: 0; }
.public-message-close {
  position: absolute;
  top: 12px;
  right: 13px;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  font-size: 26px;
  cursor: pointer;
}
.public-message-close:hover,
.public-message-close:focus-visible { color: var(--ink); outline: 0; }
.public-message-honeypot { position: fixed; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.public-message-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.public-message-status { flex: 1; color: var(--muted); font-size: 13px; line-height: 1.35; }
.public-message-status.error { color: var(--danger); }
.public-message-button {
  min-height: 31px;
  padding: 5px 11px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  letter-spacing: .07em;
  text-transform: uppercase;
  cursor: pointer;
}
.public-message-button:hover,
.public-message-button:focus-visible { border-color: var(--zunda); outline: 0; }
.public-message-button.primary { color: #fff; background: var(--zunda); border-color: var(--zunda); }
.public-message-button.primary:hover { background: #43684a; }
.public-message-button:disabled { cursor: wait; opacity: .6; }

@keyframes contact-sheet-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Darkroom viewer */
.lightbox {
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  margin: 0;
  padding: 0;
  color: #f0f2ed;
  background: rgba(11, 13, 12, .985);
  border: 0;
}
.lightbox::backdrop { background: rgba(0, 0, 0, .88); }
.lightbox-shell { position: relative; display: grid; place-items: center; min-height: 100%; padding: 28px 76px; }
.lightbox-figure { display: flex; flex-direction: column; align-items: center; gap: 16px; width: min(1380px, 100%); margin: 0; }
.lightbox-figure > img { display: block; max-width: 100%; max-height: calc(100vh - 214px); margin: auto; object-fit: contain; }
.lightbox-figure figcaption { width: min(1080px, 100%); max-height: 170px; overflow-y: auto; }
.lightbox-copy h1 { margin: 0 0 7px; font-size: 18px; font-weight: 520; letter-spacing: -.01em; }
.lightbox-copy p { margin: 0 0 14px; color: #aeb3ac; font-size: 12px; line-height: 1.55; white-space: pre-line; }
.photo-metadata { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 20px; margin: 0; }
.photo-metadata div { display: grid; gap: 4px; min-width: 0; padding-top: 8px; border-top: 1px solid #343834; }
.photo-metadata .meta-lens { grid-column: span 2; }
.photo-metadata dt {
  color: #747b73;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 8px;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.photo-metadata dd { overflow: hidden; margin: 0; color: #dce0da; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.lightbox-close,
.lightbox-nav {
  position: fixed;
  z-index: 2;
  display: grid;
  place-items: center;
  color: #cfd3cc;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.lightbox-close { top: 10px; right: 14px; width: 44px; height: 44px; font-size: 26px; }
.lightbox-nav { top: 50%; width: 54px; height: 80px; font-size: 36px; transform: translateY(-50%); }
.lightbox-nav.previous { left: 8px; }
.lightbox-nav.next { right: 8px; }
.lightbox-close:hover,
.lightbox-nav:hover { color: #fff; background: rgba(255, 255, 255, .055); }

/* Admin contact sheet */
.admin-page {
  color: #2d372b;
  background: var(--admin-paper);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}
.admin-app { min-height: 100vh; }
.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  padding: 6px 10px;
  background: #dce8d5;
  border-bottom: 1px solid var(--admin-line);
}
.admin-brand,
.admin-actions { display: flex; align-items: center; gap: 6px; }
.admin-brand > span { display: grid; place-items: center; width: 23px; height: 23px; color: #fff; background: var(--admin-accent); border-radius: 3px; font-weight: 700; }
.admin-main { display: grid; gap: 8px; width: min(1320px, calc(100% - 16px)); margin: 0 auto; padding: 8px 0 24px; }
.upload-panel,
.library-panel { overflow: hidden; background: var(--admin-surface); border: 1px solid var(--admin-line); border-radius: 3px; }
.upload-panel { display: grid; grid-template-columns: minmax(240px, .65fr) minmax(360px, 1.35fr); gap: 10px; align-items: center; padding: 8px 10px; }
.upload-panel h1,
.library-head h2 { margin: 0; font-size: 13px; }
.upload-panel p,
.library-head p { margin: 2px 0 0; color: #687260; font-size: 9px; }
.upload-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 8px;
  color: #687260;
  background: #edf4e8;
  border: 1px dashed #94a38d;
  border-radius: 3px;
  cursor: pointer;
}
.upload-zone strong { color: #2d372b; }
.upload-zone.is-dragging,
.upload-zone:hover { color: #253b27; background: #d5e4ce; border-color: var(--admin-accent); }
.admin-status { grid-column: 1 / -1; min-height: 14px; color: #687260; font-size: 9px; }
.admin-status[data-state="error"] { color: var(--danger); }
.admin-status[data-state="ok"] { color: var(--admin-accent); }
.library-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 40px; padding: 6px 9px; background: #dce8d5; border-bottom: 1px solid var(--admin-line); }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 4px 9px;
  color: #2d372b;
  background: var(--admin-surface);
  border: 1px solid var(--admin-line);
  border-radius: 3px;
  text-decoration: none;
  cursor: pointer;
}
.button:hover,
.button:focus-visible { color: #1f3022; background: #d8e7d1; outline: 0; }
.button.primary { color: #fff; background: var(--admin-accent); border-color: var(--admin-accent); }
.button.danger { color: var(--danger); }
.admin-photo-list { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; padding: 8px; }
.admin-photo {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 4px;
  color: #2d372b;
  background: #edf4e8;
  border: 1px solid transparent;
  border-radius: 2px;
  text-align: left;
  cursor: pointer;
}
.admin-photo:hover,
.admin-photo:focus-visible { background: #e1ecdb; border-color: #94a38d; outline: 0; }
.admin-photo.is-hidden { opacity: .58; }
.admin-preview { display: block; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; background: #d8e2d2; }
.admin-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.admin-photo-footer { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-width: 0; padding: 0 1px 1px; }
.admin-photo-footer time { overflow: hidden; color: #687260; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.admin-visibility-dot { flex: 0 0 auto; width: 6px; height: 6px; background: var(--admin-accent); border-radius: 50%; }
.admin-photo.is-hidden .admin-visibility-dot { background: #8b9387; }
.admin-empty { margin: 60px 20px; color: #687260; text-align: center; }

/* Admin editor drawer */
.admin-editor-dialog {
  width: min(760px, calc(100vw - 24px));
  max-width: none;
  height: calc(100vh - 24px);
  max-height: none;
  margin: 12px 12px 12px auto;
  padding: 0;
  color: #2d372b;
  background: var(--admin-surface);
  border: 1px solid #81907b;
  border-radius: 4px;
  box-shadow: -16px 0 45px rgba(28, 39, 29, .18);
}
.admin-editor-dialog::backdrop { background: rgba(29, 38, 29, .38); }
.admin-editor-shell { min-height: 100%; }
.admin-editor-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
  padding: 7px 10px;
  background: #dce8d5;
  border-bottom: 1px solid var(--admin-line);
}
.admin-editor-head small { color: #687260; font-size: 8px; letter-spacing: .08em; text-transform: uppercase; }
.admin-editor-head h2 { margin: 2px 0 0; font-size: 13px; }
.admin-editor-content { padding: 10px; }
.admin-editor-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 10px; }
.admin-editor-preview { align-self: start; margin: 0; }
.admin-editor-preview img { display: block; width: 100%; max-height: 300px; object-fit: contain; background: #dfe7db; }
.admin-editor-preview figcaption { margin-top: 6px; color: #687260; font-size: 8px; line-height: 1.45; }
.admin-photo-fields { display: grid; gap: 7px; min-width: 0; }
.admin-field-grid { display: grid; gap: 6px; }
.admin-field-grid.primary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.admin-field-grid.exif { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.admin-field { display: grid; gap: 3px; min-width: 0; color: #687260; font-size: 8px; letter-spacing: .04em; text-transform: uppercase; }
.admin-field input,
.admin-field textarea {
  width: 100%;
  min-height: 29px;
  padding: 5px 6px;
  color: #2d372b;
  background: #fff;
  border: 1px solid var(--admin-line);
  border-radius: 2px;
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
}
.admin-field textarea { min-height: 62px; resize: vertical; }
.admin-field input:focus,
.admin-field textarea:focus { border-color: var(--admin-accent); outline: 1px solid var(--admin-accent); }
.admin-photo-actions { grid-column: 1 / -1; display: flex; align-items: center; justify-content: flex-end; gap: 6px; padding-top: 3px; }
.visibility-control { margin-right: auto; color: #2d372b; font-size: 10px; }

@media (max-width: 1050px) {
  .admin-photo-list { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 800px) {
  .public-header,
  .public-main { width: min(100% - 20px, 1600px); }
  .public-header { padding-top: 18px; }
  .gallery-grid { gap: 16px; }
  .lightbox-shell { padding: 52px 12px 18px; }
  .lightbox-figure > img { max-height: calc(100vh - 270px); }
  .lightbox-figure figcaption { max-height: 230px; }
  .photo-metadata { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
  .photo-metadata .meta-lens { grid-column: span 2; }
  .lightbox-nav { top: 36%; }
  .upload-panel { display: block; }
  .upload-zone { margin-top: 8px; }
  .admin-photo-list { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; padding: 5px; }
  .admin-editor-dialog { width: 100vw; height: 100vh; margin: 0; border: 0; border-radius: 0; }
  .admin-editor-layout { grid-template-columns: 1fr; }
  .admin-editor-preview { display: grid; grid-template-columns: 100px minmax(0, 1fr); align-items: end; gap: 8px; }
  .admin-editor-preview img { max-height: 100px; }
  .admin-field-grid.primary,
  .admin-field-grid.exif { grid-template-columns: 1fr; }
  .admin-photo-actions { flex-wrap: wrap; }
}

@media (max-width: 520px) {
  .admin-photo-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-item { opacity: 1; animation: none; }
  .gallery-item img { transition: none; }
}
