/* Gallery components and their responsive rules.
 * Keep ordered overrides intact; see web/static/styles/README.md. */

.settings-section small {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: var(--rust);
}
.gallery-main {
  margin-left: 245px;
}
.gallery-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 30px;
  gap: 24px;
}
.gallery-header h1 {
  font-size: 45px;
  margin: 18px 0 8px;
}
.gallery-header p {
  font:
    13px Georgia,
    serif;
  color: var(--muted);
  margin: 0;
}
.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.gallery-tabs {
  display: flex;
  gap: 30px;
  border-bottom: 1px solid var(--line);
  margin: 25px 0 35px;
}
.gallery-tabs button {
  border: 0;
  background: transparent;
  padding: 0 0 12px;
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
  cursor: pointer;
}
.gallery-tabs button.active {
  color: var(--ink);
  border-bottom: 2px solid var(--rust);
}
.gallery-tabs span {
  background: #ddd9cf;
  padding: 2px 6px;
  border-radius: 10px;
}
.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}
.upload-zone {
  border: 1px dashed #aaa99f;
  background: #eeece4;
  padding: 34px;
  display: flex;
  align-items: center;
  gap: 18px;
  position: relative;
}
.upload-zone > input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.upload-zone label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  cursor: pointer;
  letter-spacing: 0;
}
.upload-zone strong {
  font:
    16px Georgia,
    serif;
}
.upload-zone small {
  font-size: 9px;
  color: var(--muted);
}
.upload-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  display: grid;
  place-items: center;
  font-size: 18px;
}
.upload-submit {
  display: inline-flex;
}
.photo-toolbar {
  display: flex;
  justify-content: space-between;
  margin: 35px 0 15px;
  font-size: 9px;
  color: var(--muted);
  gap: 16px;
  flex-wrap: wrap;
}
.admin-photo-grid {
  columns: 4 220px;
  column-gap: 10px;
}
.admin-photo-grid figure {
  margin: 0 0 10px;
  break-inside: avoid;
  position: relative;
  background: #ddd;
}
.admin-photo-grid img {
  width: 100%;
  max-height: 450px;
  object-fit: cover;
}
.admin-photo-grid figcaption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  opacity: 0;
  transition: 0.2s opacity;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
  color: white;
  padding: 35px 10px 9px;
  font-size: 8px;
  display: flex;
  justify-content: space-between;
}
.admin-photo-grid figure:hover figcaption {
  opacity: 1;
}
.small-empty {
  text-align: center;
  padding: 70px;
  display: flex;
  flex-direction: column;
  color: var(--muted);
}
.small-empty strong {
  font:
    20px Georgia,
    serif;
  color: var(--ink);
}
.settings-form {
  max-width: 900px;
}
.settings-section {
  display: grid;
  gap: 80px;
  padding: 35px 0;
  border-bottom: 1px solid var(--line);
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
}
.settings-section h2 {
  font-size: 29px;
  margin: 10px 0;
}
.settings-section p {
  font-size: 11px;
  color: var(--muted);
  max-width: 270px;
}
.settings-section > div:last-child {
  display: grid;
  gap: 17px;
}
.form-actions {
  padding: 25px 0;
  text-align: right;
}
@media (max-width: 1000px) {
  .header-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}
@media (max-width: 720px) {
  .gallery-main {
    margin: 0;
  }
  .gallery-header {
    display: block;
  }
  .header-actions {
    justify-content: flex-start;
    margin-top: 20px;
  }
  .header-actions form {
    width: 100%;
  }
  .header-actions form button {
    width: 100%;
  }
  .upload-zone {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .admin-photo-grid {
    columns: 2;
  }
  .settings-section {
    gap: 20px;
  }
}
.upload-zone.is-dragging {
  border-color: var(--rust);
  background: #e5ded4;
  box-shadow: inset 0 0 0 2px rgba(169, 93, 64, 0.15);
}
.photo-toolbar p {
  margin: 0;
}
.photo-filter {
  display: flex;
  gap: 5px;
}
.photo-filter button {
  border: 1px solid var(--line);
  border-radius: 2px;
  background: transparent;
  padding: 5px 10px;
  font-size: 9px;
  color: var(--muted);
  cursor: pointer;
}
.photo-filter button.active {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}
.admin-photo-grid figure[hidden] {
  display: none !important;
}
.admin-photo-grid figcaption > div {
  display: flex;
  align-items: center;
  gap: 9px;
}
.admin-photo-grid figcaption form {
  display: inline-flex;
}
.photo-delete {
  border: 0;
  background: transparent;
  color: white;
  padding: 0;
  font-size: 8px;
  text-decoration: underline;
  cursor: pointer;
}
.filter-empty {
  border-top: 1px solid var(--line);
}
.danger-zone {
  max-width: 900px;
  margin-top: 55px;
  padding: 28px 0;
  border-top: 1px solid #c9aaa0;
  border-bottom: 1px solid #c9aaa0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 35px;
}
.danger-zone small {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: #8a382b;
}
.danger-zone h2 {
  font-size: 27px;
  margin: 7px 0;
}
.danger-zone p {
  font-size: 10px;
  color: var(--muted);
  margin: 0;
}
@media (max-width: 720px) {
  .photo-toolbar {
    align-items: center;
  }
  .admin-photo-grid figcaption {
    opacity: 1;
  }
  .danger-zone {
    align-items: flex-start;
    flex-direction: column;
  }
  .danger-zone form,
  .danger-zone .btn {
    width: 100%;
  }
}
.photo-delete-form {
  position: absolute;
  z-index: 2;
  top: 9px;
  right: 9px;
}
.photo-delete-form .photo-delete {
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 2px;
  background: rgba(25, 28, 24, 0.82);
  color: white;
  padding: 5px 8px;
  font-size: 8px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  backdrop-filter: blur(4px);
}
.photo-delete-form .photo-delete:hover {
  background: #7b2f24;
}
.cover-picker {
  border: 0;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  max-height: 480px;
  overflow: auto;
}
.cover-picker legend {
  margin-bottom: 12px;
}
.cover-picker label {
  position: relative;
  padding: 8px;
  border: 1px solid var(--line);
  cursor: pointer;
  overflow-wrap: anywhere;
}
.cover-picker label:has(input:checked) {
  outline: 2px solid var(--rust);
}
.cover-picker input {
  width: auto;
}
.cover-picker img {
  display: block;
  width: 100%;
  height: 100px;
  object-fit: contain;
  margin: 6px 0;
}
.cover-picker span {
  font-size: 10px;
}
.settings-form textarea {
  width: 100%;
  resize: vertical;
  padding: 12px;
  border: 1px solid var(--line);
  background: transparent;
  font: inherit;
}
.gallery-back-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-bottom: 16px;
  font-size: 13px;
  text-decoration: underline;
}
.gallery-header > div,
.settings-section > * {
  min-width: 0;
}
.gallery-header,
.small-empty {
  overflow-wrap: anywhere;
}
.gallery-tabs button,
.photo-filter button {
  min-height: 44px;
}
.admin-photo-grid figcaption span {
  overflow-wrap: anywhere;
  min-width: 0;
}
.admin-photo-grid figcaption b {
  flex-shrink: 0;
}
.upload-zone > input[type="file"] {
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  clip-path: inset(50%);
}
.upload-zone:focus-within {
  outline: 3px solid var(--rust);
  outline-offset: 3px;
}
.gallery-header > div:first-child {
  flex: 1;
}
.gallery-header .header-actions {
  max-width: 50%;
}
@media (max-width: 1000px) {
  .gallery-main {
    margin-left: 0;
  }
  .gallery-header {
    display: block;
  }
  .gallery-header .header-actions {
    max-width: 100%;
    justify-content: flex-start;
    margin-top: 20px;
  }
  .settings-section {
    gap: 32px;
  }
}
@media (max-width: 720px) {
  .settings-form textarea {
    font-size: 16px;
  }
  .settings-section {
    grid-template-columns: minmax(0, 1fr);
  }
  .gallery-header h1 {
    font-size: clamp(30px, 8vw, 40px);
  }
  .small-empty {
    padding: 36px 20px;
  }
  .header-actions > .btn {
    flex: 1 1 130px;
  }
  .header-actions form {
    flex-basis: 100%;
  }
  .gallery-tabs {
    gap: 24px;
    margin: 20px 0 24px;
  }
  .upload-zone {
    padding: 22px;
  }
  .upload-zone label {
    min-width: 0;
  }
  .photo-toolbar p {
    font-size: 12px;
  }
  .photo-filter button {
    font-size: 12px;
    padding-inline: 14px;
  }
  .photo-delete-form .photo-delete {
    min-height: 44px;
    min-width: 44px;
    font-size: 11px;
  }
  .cover-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 3px;
  }
  .cover-picker label {
    min-height: 44px;
  }
  .cover-picker input[type="radio"] {
    width: 18px;
    height: 18px;
    padding: 0;
    accent-color: var(--ink);
  }
  .form-actions .btn {
    width: 100%;
  }
}
