:root {
  color-scheme: light;
  --ink: #151515;
  --ink-soft: #363432;
  --muted: #817a71;
  --paper: #f5f1e9;
  --paper-bright: #fffaf0;
  --stone: #d7d0c4;
  --line: rgba(21, 21, 21, 0.13);
  --line-strong: rgba(21, 21, 21, 0.28);
  --green: #214f46;
  --oxblood: #7b2634;
  --blue: #283f58;
  --gold: #b88b4a;
  --danger: #a23030;
  --shadow-soft: 0 22px 70px rgba(31, 26, 19, 0.14);
  --shadow-crisp: 0 14px 35px rgba(31, 26, 19, 0.17);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(21, 21, 21, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, #f8f4eb 0%, #ebe4d7 54%, #f5f1e9 100%);
  background-size: 88px 100%, 100% 100%;
  font-family: "Avenir Next", Avenir, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 20%, rgba(123, 38, 52, 0.12), transparent 28rem),
    radial-gradient(circle at 80% 10%, rgba(40, 63, 88, 0.16), transparent 34rem),
    radial-gradient(circle at 52% 90%, rgba(33, 79, 70, 0.12), transparent 30rem);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(184, 139, 74, 0.34);
  outline-offset: 3px;
}

.site-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 clamp(18px, 4vw, 58px);
  border-bottom: 1px solid rgba(21, 21, 21, 0.09);
  background: rgba(245, 241, 233, 0.78);
  backdrop-filter: blur(18px) saturate(120%);
}

.brand {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.24rem;
  font-weight: 700;
  letter-spacing: 0;
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 8px;
}

.nav-button,
.text-button {
  min-height: 40px;
  border: 0;
  padding: 0;
  color: var(--ink-soft);
  background: transparent;
  box-shadow: none;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.nav-button {
  border-radius: 999px;
  padding: 0 14px;
}

.nav-button:hover,
.text-button:hover {
  color: var(--oxblood);
  background: transparent;
  box-shadow: none;
  transform: none;
}

body[data-view="index-gate"] #home-link,
body[data-view="index-gate"] #logout,
body[data-view="loading"] #logout {
  display: none;
}

.shell {
  width: min(1440px, calc(100vw - 36px));
  margin: 0 auto;
  padding: clamp(34px, 6vw, 86px) 0 76px;
}

.gate-panel,
.index-view,
.gallery-view {
  animation: enter 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.gate-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.72fr);
  gap: clamp(28px, 6vw, 92px);
  align-items: end;
  min-height: calc(100vh - 190px);
  padding: clamp(12px, 2vw, 28px) 0;
}

.gallery-gate {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.68fr);
}

.gate-copy,
.index-hero,
.gallery-heading {
  max-width: 1050px;
}

.gate-copy {
  display: grid;
  gap: 22px;
}

.eyebrow {
  margin: 0;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(4.2rem, 9vw, 10.5rem);
  font-weight: 500;
  line-height: 0.88;
}

.gallery-heading h1,
.index-hero h1 {
  max-width: 1120px;
}

.lede {
  max-width: 680px;
  margin: 0;
  color: var(--ink-soft);
  font-size: clamp(1.08rem, 1.6vw, 1.36rem);
  line-height: 1.58;
}

.gate-art {
  position: absolute;
  right: 2vw;
  top: 5vh;
  z-index: -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(60px, 9vw));
  gap: clamp(10px, 1.4vw, 18px);
  opacity: 0.86;
  transform: rotate(-4deg);
}

.gate-art span {
  display: block;
  aspect-ratio: 3 / 4;
  border: 1px solid rgba(21, 21, 21, 0.14);
  border-radius: 3px;
  background:
    linear-gradient(180deg, rgba(255, 250, 240, 0.62), rgba(21, 21, 21, 0.08)),
    var(--stone);
  box-shadow: var(--shadow-crisp);
}

.gate-art span:nth-child(2) {
  margin-top: 12vh;
  background:
    linear-gradient(180deg, rgba(255, 250, 240, 0.7), rgba(123, 38, 52, 0.12)),
    #c9d0cf;
}

.gate-art span:nth-child(3) {
  margin-top: 5vh;
  background:
    linear-gradient(180deg, rgba(255, 250, 240, 0.72), rgba(40, 63, 88, 0.14)),
    #d9cdb9;
}

.access-form {
  display: grid;
  gap: 13px;
  align-self: end;
  padding: clamp(18px, 3vw, 30px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.78);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px) saturate(120%);
}

label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

input {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0 15px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

input:focus {
  border-color: var(--gold);
  background: #ffffff;
}

button {
  min-height: 52px;
  border: 0;
  border-radius: 6px;
  padding: 0 20px;
  color: #fffaf0;
  background: var(--ink);
  box-shadow: 0 12px 28px rgba(21, 21, 21, 0.18);
  font-weight: 850;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, color 180ms ease;
}

button:hover {
  background: var(--green);
  box-shadow: 0 18px 40px rgba(21, 21, 21, 0.22);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

.status {
  min-height: 1.3em;
  margin: 0;
  color: var(--blue);
  font-size: 0.94rem;
}

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

.index-view {
  display: grid;
  gap: clamp(30px, 5vw, 68px);
}

.index-hero {
  display: grid;
  gap: 18px;
  padding: clamp(18px, 4vw, 50px) 0 clamp(4px, 1vw, 12px);
}

.gallery-list {
  display: grid;
  border-top: 1px solid var(--line);
}

.gallery-card {
  display: grid;
  grid-template-columns: minmax(66px, 0.12fr) minmax(0, 1fr);
  gap: clamp(18px, 4vw, 60px);
  align-items: center;
  min-height: clamp(128px, 15vw, 190px);
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: clamp(18px, 3vw, 32px) 0;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
  text-align: left;
  animation: enter 560ms cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--card-index) * 60ms);
}

.gallery-card:hover {
  color: var(--oxblood);
  background: rgba(255, 250, 240, 0.32);
  box-shadow: none;
  transform: none;
}

.gallery-number {
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.8rem, 6vw, 6.8rem);
  line-height: 0.86;
}

.gallery-card-copy {
  display: grid;
  gap: 16px;
}

.gallery-card-copy strong {
  max-width: 980px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 5vw, 5.6rem);
  font-weight: 500;
  line-height: 0.94;
}

.gallery-card-copy span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 850;
  text-transform: uppercase;
}

.gallery-view {
  display: grid;
  gap: clamp(24px, 4vw, 52px);
}

.gallery-heading {
  display: grid;
  gap: 12px;
  min-height: 160px;
  padding: 8px 0 clamp(22px, 4vw, 42px);
  border-bottom: 1px solid var(--line);
}

.gallery-meta {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.96rem;
  font-weight: 760;
  text-transform: uppercase;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: clamp(14px, 2vw, 25px);
  align-items: start;
}

.photo-card {
  position: relative;
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.photo-card:hover {
  background: transparent;
  box-shadow: none;
}

.photo-card.featured {
  grid-column: span 2;
}

.photo-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid rgba(21, 21, 21, 0.12);
  border-radius: 6px;
  background: var(--stone);
  box-shadow: var(--shadow-crisp);
  filter: saturate(0.98) contrast(1.02);
  transition: transform 240ms ease, filter 240ms ease, box-shadow 240ms ease;
}

.photo-card:hover img {
  box-shadow: 0 24px 54px rgba(31, 26, 19, 0.24);
  filter: saturate(1.04) contrast(1.03);
  transform: translateY(-4px);
}

.photo-card span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 820;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

dialog {
  width: min(1460px, calc(100vw - 22px));
  max-height: calc(100vh - 22px);
  border: 1px solid rgba(255, 250, 240, 0.14);
  border-radius: 8px;
  padding: clamp(10px, 1.6vw, 18px);
  color: #f8f4eb;
  background: #080807;
  box-shadow: 0 34px 110px rgba(0, 0, 0, 0.62);
}

dialog::backdrop {
  background: rgba(8, 8, 7, 0.84);
  backdrop-filter: blur(10px);
}

.viewer-toolbar {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;
  display: flex;
  gap: 8px;
}

.viewer-button {
  display: grid;
  place-items: center;
  width: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 6px;
  color: #080807;
  background: rgba(255, 250, 240, 0.88);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.26);
}

.viewer-button:hover {
  color: #fffaf0;
  background: var(--oxblood);
}

.viewer-button:disabled {
  cursor: default;
  opacity: 0.38;
  transform: none;
}

.viewer-button:disabled:hover {
  color: #080807;
  background: rgba(255, 250, 240, 0.88);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.26);
}

.viewer-stage {
  display: grid;
  place-items: center;
  width: 100%;
  height: min(82vh, 830px);
  overflow: hidden;
  border-radius: 6px;
  background: #050505;
}

.viewer-stage.is-zoomed {
  display: block;
  overflow: auto;
}

#viewer-image {
  display: block;
  width: 100%;
  height: 100%;
  margin: auto;
  border-radius: 6px;
  cursor: zoom-in;
  object-fit: contain;
  opacity: 1;
  transition: opacity 140ms ease;
}

#viewer-image.is-loading {
  opacity: 1;
}

.viewer-stage.is-zoomed #viewer-image {
  width: auto;
  max-width: none;
  height: auto;
  max-height: none;
  cursor: zoom-out;
}

#deepzoom-viewer {
  width: 100%;
  height: 100%;
  background: #050505;
}

#deepzoom-viewer:empty {
  display: none;
}

#deepzoom-viewer:not(:empty) + #viewer-image {
  display: none;
}

#viewer-caption {
  margin: 14px 54px 0 2px;
  color: rgba(248, 244, 235, 0.72);
  font-size: 0.92rem;
}

.close:hover {
  color: #fffaf0;
  background: var(--oxblood);
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 860px) {
  .site-bar {
    min-height: 62px;
    padding: 0 16px;
  }

  .shell {
    width: min(100vw - 24px, 1440px);
    padding-top: 28px;
  }

  .gate-panel,
  .gallery-gate {
    grid-template-columns: 1fr;
    align-items: start;
    min-height: auto;
  }

  .gate-art {
    opacity: 0.28;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .gallery-card {
    grid-template-columns: 1fr;
    gap: 14px;
  }

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

  .photo-card.featured {
    grid-column: span 2;
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: clamp(3.25rem, 16vw, 5rem);
  }

  .site-nav {
    gap: 2px;
  }

  .nav-button {
    padding: 0 8px;
  }

  .photo-card span {
    font-size: 0.7rem;
  }
}
