:root {
  --ink: #181716;
  --muted: #74706a;
  --line: #d8d4cd;
  --paper: #f7f6f2;
  --red: #a92d25;
  --background: #fff;
  --field: #fff;
  --button-ink: #fff;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --ink: #efede8;
  --muted: #aaa59c;
  --line: #45423d;
  --paper: #211f1c;
  --red: #df6257;
  --background: #11100f;
  --field: #181715;
  --button-ink: #11100f;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--background);
  color: var(--ink);
  font-family: "Courier Prime", "Courier New", monospace;
  font-size: 15px;
  line-height: 1.55;
  transition: background-color .2s ease, color .2s ease;
}

button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 4px; }
a:hover, .plain-button:hover { color: var(--red); }

.site-header, main, footer {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0;
  border-bottom: 1px solid var(--ink);
}

.wordmark { font-size: 19px; font-weight: 700; text-decoration: none; }
.header-left { display: flex; align-items: center; gap: 30px; }
.header-actions { display: flex; align-items: center; gap: 24px; }
.album-menu { position: relative; }
.album-list {
  position: absolute;
  z-index: 5;
  top: calc(100% + 14px);
  left: 0;
  min-width: 190px;
  padding: 8px;
  border: 1px solid var(--ink);
  background: var(--background);
  box-shadow: 7px 7px 0 var(--paper);
}
.album-option {
  display: block;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  background: none;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.album-option:hover, .album-option.active { color: var(--red); }
.header-mark { margin: 0; }
.blink { animation: blink 1.2s steps(1) infinite; color: var(--red); }
@keyframes blink { 50% { opacity: 0; } }

.plain-button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.intro {
  display: grid;
  grid-template-columns: 1fr 0.62fr;
  gap: 60px;
  align-items: end;
  min-height: 470px;
  padding: 90px 0 70px;
}

.eyebrow {
  display: block;
  margin-bottom: 16px;
  color: var(--red);
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
h1 {
  margin-bottom: 0;
  max-width: 760px;
  font-size: clamp(42px, 6.5vw, 96px);
  line-height: .98;
  letter-spacing: -.07em;
  font-weight: 400;
}

.intro-foot { border-left: 1px solid var(--line); padding-left: 24px; }
.intro-foot p { max-width: 400px; color: var(--muted); }
.intro-foot nav { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }

.rule {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  font-size: 12px;
  text-transform: uppercase;
}

.photo-entry {
  display: grid;
  grid-template-columns: 110px 1fr;
  padding: 80px 0;
  border-bottom: 1px solid var(--line);
}

.entry-meta {
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}
.entry-number { color: var(--red); }
.entry-album { font-style: italic; }
.empty-album { padding: 80px 0; color: var(--muted); font-style: italic; }

figure { margin: 0; }
.photo-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: var(--paper);
  cursor: zoom-in;
  overflow: hidden;
}
.photo-button img {
  display: block;
  width: 100%;
  max-height: 78vh;
  object-fit: cover;
  filter: saturate(.82) contrast(1.04);
  transition: filter .25s ease, transform .5s ease;
}
.photo-button:hover img { filter: saturate(1) contrast(1.02); transform: scale(1.006); }

figcaption {
  display: grid;
  grid-template-columns: .8fr 1.2fr;
  gap: 50px;
  margin-top: 18px;
}
figcaption h2 { margin-bottom: 2px; font-size: 18px; font-weight: 700; }
.location { color: var(--red); font-size: 12px; }
.note { margin-bottom: 0; color: var(--muted); }

.comments { grid-column: 2; margin-top: 28px; }
.comment-drawer { margin-top: 20px; padding: 24px; background: var(--paper); }
.comment-list { display: grid; gap: 12px; margin-bottom: 24px; }
.comment { padding-bottom: 12px; border-bottom: 1px dotted #aaa59d; }
.comment p { margin: 3px 0 0; }
.comment small { color: var(--red); }
.empty-comments { color: var(--muted); font-style: italic; }

.comment-form, #postForm { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--field);
  color: var(--ink);
  padding: 10px;
  outline: none;
}
input:focus, textarea:focus { border-color: var(--red); }
select:focus { border-color: var(--red); }
textarea { resize: vertical; }
.comment-message, #postForm label { grid-column: 1 / -1; }
button[type="submit"] {
  justify-self: start;
  padding: 9px 13px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--ink);
  color: var(--button-ink);
  cursor: pointer;
}
button[type="submit"]:hover { background: var(--red); border-color: var(--red); }

footer {
  display: flex;
  justify-content: space-between;
  padding: 30px 0 60px;
  color: var(--muted);
  font-size: 12px;
}
.footer-actions { display: flex; gap: 24px; align-items: center; }

dialog {
  width: min(680px, calc(100% - 28px));
  max-height: 90vh;
  padding: 28px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--background);
  color: var(--ink);
  overflow: auto;
}
dialog::backdrop { background: rgba(20, 18, 15, .75); backdrop-filter: blur(3px); }
.dialog-top { display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); }
.dialog-top h2 { font-size: 26px; font-weight: 400; }
.admin-login { max-width: 380px; margin: 38px auto 20px; }
.admin-login label { margin-bottom: 12px; }
.microcopy, .form-error { margin-top: 15px; color: var(--muted); font-size: 11px; }
.form-error { color: var(--red); }
.admin-panel { padding-top: 24px; }
.form-actions { display: flex; align-items: center; gap: 15px; grid-column: 1 / -1; }
.admin-posts { display: grid; gap: 8px; margin-top: 30px; }
.admin-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.admin-row small { color: var(--red); }
.danger { color: var(--red); }
.album-manager {
  max-width: 850px;
  padding: 55px 0;
  border-bottom: 1px solid var(--line);
}
.album-manager h2 { font-size: 28px; font-weight: 400; }
.rename-album-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.rename-album-form button, .rename-album-form .form-error { grid-column: 1 / -1; }
.settings-form { display: grid; gap: 14px; }
.socials-form { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.socials-form fieldset {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
}
.socials-form legend { padding: 0 7px; color: var(--red); }
.socials-form button, .socials-form .form-error { grid-column: 1 / -1; }

#lightbox { width: min(1200px, calc(100% - 28px)); padding: 10px; background: #111; }
#lightbox form { display: flex; justify-content: flex-end; padding: 5px 5px 10px; color: #fff; }
#lightbox img { display: block; width: 100%; max-height: 82vh; object-fit: contain; }

.desk-main { padding-bottom: 100px; }
.login-view { min-height: calc(100vh - 100px); padding-top: 18vh; }
.login-view h1 { margin-bottom: 55px; }
.desk-heading {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 60px;
  align-items: end;
  padding: 90px 0 60px;
  border-bottom: 1px solid var(--ink);
}
.desk-heading p { max-width: 430px; color: var(--muted); }
.desk-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  max-width: 850px;
  padding: 55px 0;
  border-bottom: 1px solid var(--line);
}
.desk-form label, .desk-form .form-error { grid-column: 1 / -1; }
.desk-form label:last-of-type { grid-column: auto; }
.upload-field {
  min-height: 120px;
  justify-content: center;
  padding: 20px;
  border: 1px dashed var(--muted);
  cursor: pointer;
}
.upload-field input { border: 0; padding: 8px 0; }
.upload-field span { color: var(--red); }
.published-section { padding-top: 50px; }

@media (min-width: 900px) {
  .photo-entry:nth-child(even) { grid-template-columns: 110px minmax(0, 880px); justify-content: end; }
  .photo-entry:nth-child(3n) figure { width: 76%; }
}

@media (max-width: 760px) {
  .site-header, main, footer { width: min(100% - 24px, 1180px); }
  .intro { display: block; min-height: 0; padding: 70px 0 50px; }
  .intro-foot { margin-top: 45px; }
  .header-left { gap: 13px; }
  .header-actions { gap: 13px; }
  .photo-entry { display: block; padding: 50px 0; }
  .entry-meta { flex-direction: row; justify-content: space-between; margin-bottom: 12px; }
  figcaption { display: block; }
  .note { margin-top: 15px; }
  .comments { margin-top: 22px; }
  .comment-form { display: block; }
  .comment-form label { margin-bottom: 10px; }
  footer { gap: 25px; }
  .footer-actions { flex-direction: column; align-items: flex-end; gap: 8px; text-align: right; }
  .desk-heading, .desk-form { display: block; }
  .desk-heading p { margin-top: 30px; }
  .desk-form label { margin-bottom: 15px; }
  .rename-album-form { display: block; }
  .rename-album-form label { margin-bottom: 15px; }
  .admin-row { grid-template-columns: 1fr; }
  .socials-form { display: block; }
  .socials-form fieldset { margin-bottom: 15px; }
}
