:root {
  color-scheme: light;
  --bg: #f3f6f3;
  --panel: #ffffff;
  --ink: #1f2428;
  --muted: #6d746d;
  --line: #d5ddd5;
  --accent: #2f6f73;
  --accent-ink: #ffffff;
  --rose: #a94d57;
  --leaf: #556b3f;
  --shadow: 0 18px 60px rgba(31, 36, 40, 0.14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(rgba(31, 36, 40, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 36, 40, 0.025) 1px, transparent 1px);
  background-size: 28px 28px;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 14px clamp(18px, 4vw, 54px);
  border-bottom: 1px solid rgba(217, 209, 196, 0.78);
  background: rgba(243, 246, 243, 0.86);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.15;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 26px);
  color: var(--muted);
  font-size: 0.92rem;
}

.top-nav a:hover {
  color: var(--ink);
}

.nav-action {
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 8px 14px;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
}

.nav-action:hover {
  filter: brightness(0.96);
}

.nav-action.secondary {
  border-color: var(--line);
  background: var(--panel);
  color: var(--muted);
}

main {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 0 clamp(18px, 4vw, 54px) 56px;
}

.hero {
  min-height: min(72vh, 760px);
  padding: clamp(18px, 4vw, 36px) 0 30px;
}

.hero-photo {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: 10px;
  width: 100%;
  height: min(72vh, 760px);
  min-height: 360px;
  margin: 0;
  border: 1px solid rgba(31, 36, 40, 0.12);
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(47, 111, 115, 0.28), transparent 38%),
    linear-gradient(315deg, rgba(184, 91, 91, 0.23), transparent 42%),
    #d5ddd5;
  box-shadow: var(--shadow);
}

.hero-photo.is-empty {
  box-shadow: none;
}

.hero-tile {
  position: relative;
  overflow: hidden;
  border: 0;
  border-radius: 4px;
  padding: 0;
  background: #cfd8d0;
  cursor: zoom-in;
}

.hero-layout-single .hero-tile {
  grid-area: 1 / 1 / -1 / -1;
}

.hero-layout-three-a .tile-1 {
  grid-area: 1 / 1 / -1 / 8;
}

.hero-layout-three-a .tile-2 {
  grid-area: 1 / 8 / 5 / -1;
}

.hero-layout-three-a .tile-3 {
  grid-area: 5 / 8 / -1 / -1;
}

.hero-layout-three-b .tile-1 {
  grid-area: 1 / 5 / -1 / -1;
}

.hero-layout-three-b .tile-2 {
  grid-area: 1 / 1 / 5 / 5;
}

.hero-layout-three-b .tile-3 {
  grid-area: 5 / 1 / -1 / 5;
}

.hero-layout-five-a .tile-1 {
  grid-area: 1 / 1 / -1 / 7;
}

.hero-layout-five-a .tile-2 {
  grid-area: 1 / 7 / 5 / 10;
}

.hero-layout-five-a .tile-3 {
  grid-area: 1 / 10 / 5 / -1;
}

.hero-layout-five-a .tile-4 {
  grid-area: 5 / 7 / -1 / 10;
}

.hero-layout-five-a .tile-5 {
  grid-area: 5 / 10 / -1 / -1;
}

.hero-layout-five-b .tile-1 {
  grid-area: 1 / 5 / -1 / 10;
}

.hero-layout-five-b .tile-2 {
  grid-area: 1 / 1 / 4 / 5;
}

.hero-layout-five-b .tile-3 {
  grid-area: 4 / 1 / -1 / 5;
}

.hero-layout-five-b .tile-4 {
  grid-area: 1 / 10 / 5 / -1;
}

.hero-layout-five-b .tile-5 {
  grid-area: 5 / 10 / -1 / -1;
}

.hero-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 320ms ease;
}

.hero-tile:hover img,
.hero-tile:focus-visible img {
  transform: scale(1.025);
}

.toolbar {
  position: sticky;
  top: 73px;
  z-index: 9;
  display: grid;
  grid-template-columns: minmax(220px, 360px) minmax(0, 1fr) 132px;
  gap: 14px;
  align-items: end;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(243, 246, 243, 0.9);
  backdrop-filter: blur(16px);
}

.search-wrap {
  display: grid;
  gap: 6px;
}

label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
}

input {
  padding: 0 13px;
}

select {
  padding: 0 12px;
}

textarea {
  min-height: 84px;
  padding: 11px 13px;
  resize: vertical;
}

.control-group {
  display: flex;
  min-width: 0;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 1px;
}

.pill {
  min-height: 42px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 16px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
}

.pill[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.tag-panel {
  display: grid;
  gap: 10px;
  padding: 18px 0 4px;
  border-bottom: 1px solid var(--line);
}

.tag-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.tag-panel-head strong {
  font-size: 0.9rem;
  letter-spacing: 0;
}

.clear-tags {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.86rem;
}

.clear-tags:disabled {
  cursor: default;
  opacity: 0.42;
}

.tag-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.tag-chip {
  min-height: 34px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 13px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
}

.tag-chip[aria-pressed="true"] {
  border-color: var(--rose);
  background: var(--rose);
  color: #fff;
}

.sets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  padding: 28px 0 10px;
}

.set-card {
  display: grid;
  min-height: 118px;
  align-content: end;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 16px;
  background: var(--panel);
}

.set-card strong {
  font-size: 1rem;
}

.set-card span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.88rem;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  grid-auto-flow: dense;
  gap: 14px;
  padding-top: 24px;
}

.photo-card {
  position: relative;
  overflow: hidden;
  min-height: 260px;
  border: 0;
  border-radius: 6px;
  padding: 0;
  background: #d5ddd5;
  color: #fff;
  cursor: zoom-in;
  isolation: isolate;
}

.photo-card.tall {
  grid-row: span 2;
  min-height: 420px;
}

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

.photo-card img {
  width: 100%;
  height: 100%;
  min-height: inherit;
  object-fit: cover;
  display: block;
  transition: transform 280ms ease;
}

.photo-card:hover img,
.photo-card:focus-visible img {
  transform: scale(1.035);
}

.photo-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, transparent 50%, rgba(0, 0, 0, 0.64));
}

.photo-card span {
  position: absolute;
  right: 14px;
  bottom: 13px;
  left: 14px;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
  color: #fff;
  text-align: left;
  text-shadow: 0 1px 16px rgba(0, 0, 0, 0.5);
}

.photo-card strong {
  overflow-wrap: anywhere;
}

.photo-card small {
  flex: 0 0 auto;
  opacity: 0.86;
}

.empty {
  grid-column: 1 / -1;
  display: grid;
  min-height: 220px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.56);
}

.lightbox {
  width: min(1180px, calc(100vw - 28px));
  max-width: none;
  height: min(820px, calc(100vh - 28px));
  max-height: none;
  border: 0;
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
  background: #101312;
  color: #fff;
}

.lightbox::backdrop {
  background: rgba(10, 12, 12, 0.82);
}

.lightbox figure {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  width: 100%;
  height: 100%;
  margin: 0;
}

.lightbox img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #101312;
}

.lightbox figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 64px;
  padding: 16px 74px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.lightbox figcaption div {
  min-width: 0;
}

.lightbox figcaption strong,
.lightbox figcaption span {
  display: block;
}

.lightbox figcaption span {
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.72);
  overflow-wrap: anywhere;
}

.identify-button {
  min-height: 38px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 6px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
}

.identify-button:disabled {
  cursor: wait;
  opacity: 0.64;
}

.identify-button.danger {
  border-color: rgba(255, 140, 140, 0.44);
  color: #ffd7d7;
}

.lightbox-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.upload-dialog,
.auth-dialog {
  width: min(520px, calc(100vw - 28px));
  max-width: none;
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
  color: var(--ink);
}

.upload-dialog::backdrop,
.auth-dialog::backdrop {
  background: rgba(31, 36, 40, 0.48);
}

.upload-panel,
.auth-panel {
  display: grid;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.dialog-head strong,
.dialog-head span {
  display: block;
}

.dialog-head strong {
  font-size: 1.12rem;
}

.dialog-head span,
#uploadStatus {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.9rem;
}

.upload-panel label,
.auth-panel label {
  display: grid;
  gap: 8px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 170px;
  gap: 12px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-transform: none;
}

.check-row input {
  width: 18px;
  min-height: 18px;
  margin: 0;
}

.upload-panel input[type="file"] {
  min-height: auto;
  padding: 11px;
}

.plain-button {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
}

.upload-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

#uploadStatus {
  min-width: 0;
  overflow-wrap: anywhere;
}

.submit-button {
  min-height: 42px;
  flex: 0 0 auto;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 0 18px;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
}

.submit-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.icon-button {
  position: absolute;
  z-index: 3;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  background: rgba(16, 19, 18, 0.64);
  color: #fff;
  cursor: pointer;
}

.close-button {
  top: 16px;
  right: 16px;
}

.nav-button {
  top: 50%;
  transform: translateY(-50%);
}

.prev-button {
  left: 16px;
}

.next-button {
  right: 16px;
}

@media (max-width: 900px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero {
    min-height: auto;
  }

  .hero-photo {
    height: 58vh;
    min-height: 340px;
    gap: 8px;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .top-nav {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .gallery {
    grid-template-columns: 1fr;
  }

  .hero-photo {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(5, 1fr);
  }

  .hero-photo .hero-tile {
    grid-column: 1 / -1;
  }

  .hero-photo .tile-1 {
    grid-row: 1 / 4;
  }

  .hero-photo .tile-2 {
    grid-row: 4 / 5;
  }

  .hero-photo .tile-3 {
    grid-row: 5 / 6;
  }

  .hero-photo .tile-4,
  .hero-photo .tile-5 {
    display: none;
  }

  .photo-card.wide {
    grid-column: span 1;
  }

  .photo-card,
  .photo-card.tall {
    min-height: 320px;
  }

  .lightbox figcaption {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 18px;
  }

  .lightbox-actions {
    width: 100%;
    overflow-x: auto;
  }

  .upload-actions {
    align-items: stretch;
    flex-direction: column;
  }

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

  .submit-button {
    width: 100%;
  }
}
