:root {
  --paper: #F7F4EE;
  --ink: #292723;
  --muted: rgba(41, 39, 35, .62);
  --line: rgba(41, 39, 35, .18);
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --serif: "Iowan Old Style", Palatino, Palatino Linotype, "Times New Roman", serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

html {
  background: var(--paper);
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.4;
  overflow-x: clip;
}

body:not(.gate-body) {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

body:not(.gate-body) main {
  flex: 1 1 auto;
}

button, a, input { font: inherit; }

img {
  max-width: 100%;
  height: auto;
}

.serif {
  font-family: var(--serif);
}

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

.masthead {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: clamp(2.25rem, 5.5vh, 4.25rem) 24px clamp(1.5rem, 3.4vh, 2.5rem);
  text-align: center;
}

.site-title {
  margin: 0 auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  color: var(--ink);
  font-weight: 400;
  font-size: clamp(4rem, 4.6vw, 5rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.site-credit {
  margin: 0;
  color: var(--muted);
  font-size: .72rem;
  letter-spacing: .06em;
}

.site-credit a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, currentColor 32%, transparent);
}

.site-credit a:hover,
.site-credit a:focus-visible {
  color: var(--ink);
}

.site-footer {
  padding: 28px 24px 40px;
  text-align: center;
}

.title-break {
  display: none;
}

.cover {
  overflow: hidden;
  background: #d8d2c6;
}

.cover img {
  display: block;
  width: 100%;
  height: 72svh;
  object-fit: cover;
  object-position: 50% 46%;
}

main {
  padding: 20px 24px 28px;
}

.gallery-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 12px;
  width: 100%;
  max-width: 1680px;
  margin: 0 auto 20px;
  min-width: 0;
  min-height: 44px;
}

.gallery-toolbar span {
  color: var(--muted);
  font-size: .8rem;
  letter-spacing: .04em;
  white-space: nowrap;
}

.download-all {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  min-width: 0;
  max-width: 100%;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  font-size: .84rem;
}

.download-all svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

.download-all:hover,
.download-all:focus-visible {
  border-color: var(--ink);
  outline: none;
}

#gallery {
  max-width: 1680px;
  margin: 0 auto;
}

.chapter {
  margin: 0 0 4.75rem;
}

.chapter:last-child {
  margin-bottom: 0;
}

.chapter-title {
  margin: 0 0 1.65rem;
  font-size: clamp(1.7rem, 3.4vw, 2.35rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.chapter-unassigned {
  margin-top: 3.5rem;
}

.masonry {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.masonry.is-masonry {
  display: block;
  position: relative;
  gap: 0;
}

.tile {
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-decoration: none;
  cursor: zoom-in;
}

.tile img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: var(--w, 3) / var(--h, 2);
}

.masonry.is-masonry .tile {
  position: absolute;
  top: 0;
  left: 0;
}

.tile:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.empty-message {
  text-align: center;
  color: var(--muted);
  margin: 48px 0;
}

.gate-body {
  min-height: 100svh;
  background: var(--paper);
  color: var(--ink);
}

.gate-scene {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

.gate-visual {
  flex: 0 0 min(46svh, 420px);
  background: #efeae2 url('login-bg.jpg') no-repeat 28% 42% / cover;
}

.gate-panel {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2.4rem 1.4rem 3.2rem;
  background: var(--paper);
}

.gate-title {
  margin: 0 0 2.1rem;
  font-size: clamp(2.35rem, 9vw, 3.15rem);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.03em;
}

.gate-note {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.gate-form {
  width: 100%;
  max-width: 340px;
}

.gate-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.password-field {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

.password-field input {
  display: block;
  width: 100%;
  height: 40px;
  margin: 0;
  padding: 0 44px 0 12px;
  border: 1px solid rgba(122, 108, 94, .32);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  font-weight: 400;
  outline: none;
  box-shadow: none;
}

.password-field input::placeholder {
  color: rgba(41, 39, 35, .42);
  font-size: 16px;
  font-weight: 400;
}

.password-field input:focus,
.password-field input:focus-visible {
  outline: none;
  border-color: #8d7b6c;
  box-shadow: none;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  transform: translateY(-50%);
  cursor: pointer;
  box-shadow: none;
}

.password-toggle svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
}

.password-toggle .icon-eye-off {
  display: none;
}

.password-toggle[aria-pressed="true"] .icon-eye {
  display: none;
}

.password-toggle[aria-pressed="true"] .icon-eye-off {
  display: inline;
}

.password-toggle:focus-visible {
  outline: 1px solid #8d7b6c;
  outline-offset: 0;
}

.gate-submit {
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(122, 108, 94, .32);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  box-shadow: none;
}

.gate-submit svg {
  display: block;
  width: 18px;
  height: 18px;
}

.gate-submit:hover,
.gate-submit:focus-visible {
  background: transparent;
}

.gate-submit:focus-visible {
  outline: none;
  border-color: #8d7b6c;
}

.form-error {
  margin: 8px 0 0;
  color: #8a3b32;
  font-size: .95rem;
}

@media (max-width: 719px) {
  .password-field input,
  .gate-submit {
    height: 44px;
  }

  .gate-submit {
    flex-basis: 44px;
    width: 44px;
  }
}

@media (min-width: 720px) {
  main {
    padding: 24px 32px 32px;
  }

  .masonry {
    gap: 16px;
  }

  .gallery-toolbar {
    margin-bottom: 20px;
  }
}

@media (min-width: 900px) {
  .gate-scene {
    background: #F7F4EE url('login-bg.jpg') no-repeat left center / cover;
    flex-direction: row;
    justify-content: flex-end;
    align-items: stretch;
  }

  .gate-visual {
    display: none;
  }

  .gate-panel {
    width: min(38vw, 460px);
    flex: 0 0 min(38vw, 460px);
    justify-content: center;
    padding: 4.5rem 4.25rem 4.5rem 1.5rem;
    background: transparent;
  }

  .gate-title {
    margin-bottom: 2.6rem;
    font-size: clamp(2.6rem, 4vw, 3.4rem);
  }
}

@media (min-width: 1200px) {
  #gallery,
  .gallery-toolbar {
    max-width: 1760px;
  }

  .gate-panel {
    width: min(34vw, 480px);
    flex-basis: min(34vw, 480px);
    padding-right: 5.5rem;
  }
}

@media (max-width: 719px) {
  .masthead {
    padding: 2rem 16px 1.15rem;
  }

  .site-title {
    font-size: clamp(2.375rem, 9.4vw, 2.875rem);
  }

  .title-break {
    display: block;
  }

  .cover img {
    height: 58svh;
    object-position: 46% 42%;
  }

  main {
    padding: 16px 12px 20px;
  }

  .site-footer {
    padding: 8px 16px 32px;
  }

  .gallery-toolbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 12px;
  }

  .download-all {
    width: 100%;
    margin-left: 0;
    padding: 0 12px;
    font-size: .8rem;
  }
}
