/* Gallery albums and album view */

.gallery-page-hero {
  padding-block: 52px 34px;
  border-bottom: 1px solid var(--color-border);
}

.gallery-hero-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
}

.gallery-page-hero h1 {
  max-width: 14ch;
  margin-top: 10px;
  font-size: clamp(2.5rem, 5vw, 4.5rem);
}

.gallery-lead {
  max-width: 56ch;
  margin-top: 14px;
  color: var(--color-text-muted);
  font-size: 1rem;
  line-height: 1.55;
}

.gallery-count {
  flex: 0 0 auto;
  color: var(--color-text-subtle);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.04em;
}

.gallery-search-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  margin-top: 22px;
}

.gallery-search-block {
  flex: 1 1 420px;
  max-width: 620px;
}

.gallery-search-block .gallery-search-form {
  max-width: none;
  margin-top: 8px;
}

.gallery-upload-button {
  flex: 0 0 auto;
}

.gallery-tool-label {
  display: block;
  color: var(--color-text-subtle);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gallery-action-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 36px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

.gallery-action-section {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.gallery-action-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.gallery-quick-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  color: var(--color-text-muted);
  font-size: 0.68rem;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.gallery-quick-link svg {
  width: 14px;
  height: 14px;
}

.gallery-quick-link:hover {
  border-color: var(--color-brand);
  color: var(--color-brand);
}

.gallery-list-section {
  padding-block: 38px 72px;
}

.gallery-group + .gallery-group {
  margin-top: 40px;
  padding-top: 30px;
  border-top: 1px solid var(--color-border);
}

.gallery-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px 20px;
  margin: 0 0 17px;
}

.gallery-section-head h2 {
  margin: 0;
  font-size: clamp(1.45rem, 2.5vw, 2rem);
  line-height: 1.15;
}

.gallery-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px 24px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--color-border);
}

.gallery-filter-group {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.gallery-filter-group--sort {
  align-items: flex-end;
}

.gallery-controls .news-filters {
  margin-top: 0;
}

.gallery-sort {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.gallery-sort-label {
  margin-right: 2px;
  color: var(--color-text-subtle);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gallery-sort .filter-chip {
  min-height: 32px;
  font-size: 0.74rem;
}

.album-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.album-card {
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  min-width: 0;
}

.album-cover {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--color-surface-2);
}

.album-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.album-card:hover .album-cover img {
  transform: scale(1.035);
}

.album-type {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  border-color: transparent;
  background: rgba(11, 13, 12, 0.86);
  color: #f2f1ea;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
}

[data-theme="chronicle"] .album-type {
  background: rgba(255, 255, 255, 0.92);
  color: #151515;
  box-shadow: 0 4px 18px rgba(21, 21, 21, 0.12);
}

.album-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.album-toolbar-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.album-toolbar-actions .btn svg {
  width: 14px;
  height: 14px;
}

.album-body {
  padding: 18px;
}

.album-section {
  display: block;
  margin-bottom: 7px;
  color: var(--color-text-subtle);
  font-family: var(--font-mono);
  font-size: 0.59rem;
  letter-spacing: 0.08em;
  line-height: 1.35;
  text-transform: uppercase;
}

.album-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  color: var(--color-text-subtle);
  font-family: var(--font-mono);
  font-size: 0.62rem;
}

.album-body h2 {
  margin-top: 7px;
  font-size: clamp(1.08rem, 1.45vw, 1.3rem);
  line-height: 1.12;
}

.album-body h2 a:hover {
  color: var(--color-brand);
}

.album-count {
  margin-top: 8px;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 0.66rem;
}

/* ---------- Album view ---------- */

.album-hero {
  padding-block: 46px 30px;
  border-bottom: 1px solid var(--color-border);
}

.album-hero h1 {
  max-width: 20ch;
  margin-top: 10px;
  font-size: clamp(2.3rem, 4.8vw, 4.2rem);
}

.album-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 18px;
  color: var(--color-text-subtle);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.04em;
}

.photo-hero {
  padding-block: 30px 22px;
}

.photo-hero h1 {
  max-width: 40ch;
  margin-top: 8px;
  font-size: clamp(1.8rem, 3.4vw, 3rem);
  line-height: 1.08;
}

.photo-hero .album-meta-row {
  margin-top: 10px;
}

.photo-actions-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
}

.album-content {
  padding-block: 30px 72px;
}

.album-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

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

.photo-card {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
}

.photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.photo-card:hover img {
  transform: scale(1.04);
}

[data-theme="chronicle"] .album-card,
[data-theme="chronicle"] .photo-card {
  border-radius: 0;
}

@media (max-width: 1000px) {
  .album-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .photo-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.gallery-upload-action {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.upload-form {
  max-width: 820px;
}

.upload-files {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.upload-file-row {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
}

.upload-file-name {
  color: var(--color-text-muted);
  font-size: 0.78rem;
  line-height: 1.4;
  word-break: break-word;
}

.upload-file-row .input {
  width: 100%;
}

.photo-favorite-form {
  position: relative;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.photo-favorite-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--color-border-strong);
  border-radius: 50%;
  background: var(--color-card-glass);
  color: var(--color-text);
  cursor: pointer;
  box-shadow: var(--shadow-float);
  transition: color var(--transition), background var(--transition), border-color var(--transition), transform var(--transition);
}

.photo-favorite-btn svg,
.photo-favorite-form--inline .btn svg {
  width: 16px;
  height: 16px;
  fill: transparent;
}

.photo-favorite-btn.is-favorited svg,
.photo-favorite-form--inline .btn.is-favorited svg {
  fill: currentColor;
}

.photo-favorite-btn:hover {
  border-color: var(--color-danger);
  color: var(--color-danger);
  transform: translateY(-1px);
}

.photo-favorite-btn.is-favorited {
  border-color: var(--color-danger);
  color: var(--color-danger);
}

.photo-favorite-form--inline {
  position: static;
}

.photo-favorite-form--inline .btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.photo-favorite-form--inline .btn svg {
  width: 14px;
  height: 14px;
}

.photo-favorite-form--inline .btn.is-favorited {
  border-color: var(--color-danger);
  color: var(--color-danger);
}

.photo-favorite-row {
  display: flex;
  align-items: center;
  margin-top: 10px;
}

.photo-like-form {
  position: relative;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.photo-like-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.64rem;
  line-height: 1;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}

.photo-like-btn svg {
  width: 15px;
  height: 15px;
}

.photo-like-btn:hover {
  border-color: var(--color-brand);
  color: var(--color-brand);
}

.photo-like-btn.is-liked {
  border-color: var(--color-brand);
  background: var(--color-brand);
  color: var(--color-brand-ink);
}

.photo-like-count {
  min-width: 1ch;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-variant-numeric: tabular-nums;
}

.photo-likes-tooltip {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  display: grid;
  gap: 4px;
  min-width: 180px;
  max-width: 270px;
  max-height: 190px;
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  box-shadow: var(--shadow-float);
  color: var(--color-text-muted);
  font-size: 0.72rem;
  line-height: 1.35;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity var(--transition), visibility var(--transition), transform var(--transition);
}

.photo-likes-tooltip strong {
  color: var(--color-text);
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.photo-likes-tooltip span {
  overflow-wrap: anywhere;
}

.photo-like-form:hover .photo-likes-tooltip,
.photo-like-form:focus-within .photo-likes-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.photo-like-row {
  display: flex;
  align-items: center;
  margin-top: 12px;
}

.photo-card-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
}

.photo-card-wrap:hover {
  z-index: 5;
}

.photo-card-wrap .photo-card {
  border: 0;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--color-surface-3);
}

.photo-card-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--color-border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: var(--color-surface-2);
  color: var(--color-text-subtle);
  font-size: 0.66rem;
}

.photo-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 7px;
  min-width: 0;
}

.photo-card-title {
  flex: 0 1 auto;
  max-width: 100%;
  overflow: hidden;
  color: var(--color-text);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  text-overflow: ellipsis;
  transition: color var(--transition);
  white-space: nowrap;
}

.photo-card-title:hover {
  color: var(--color-brand);
}

.photo-card-sep {
  color: var(--color-border-strong);
  font-size: 0.7rem;
}

.photo-card-uploader {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--color-text-subtle);
  font-size: 0.62rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-card-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.photo-card-comments {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.photo-comments-popover {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 10;
  display: grid;
  gap: 10px;
  width: 300px;
  max-width: min(300px, calc(100vw - 32px));
  max-height: 320px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  box-shadow: var(--shadow-float);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity var(--transition), visibility var(--transition), transform var(--transition);
}

.photo-card-comments:hover .photo-comments-popover,
.photo-card-comments:focus-within .photo-comments-popover {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.photo-comment-preview {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.photo-comment-preview-avatar {
  flex: 0 0 auto;
}

.photo-comment-preview-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.photo-comment-preview-body strong {
  color: var(--color-text);
  font-size: 0.68rem;
}

.photo-comment-preview-body span {
  color: var(--color-text-muted);
  font-size: 0.68rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.photo-comments-popover-more {
  color: var(--color-brand);
  font-size: 0.66rem;
  text-decoration: none;
}

.photo-comments-popover-more:hover {
  text-decoration: underline;
}

.photo-card-divider {
  width: 1px;
  height: 16px;
  background: var(--color-border-strong);
}

.photo-card-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  color: var(--color-text-muted);
  font-size: 0.64rem;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.photo-card-action svg {
  width: 14px;
  height: 14px;
}

.photo-card-action:hover {
  border-color: var(--color-brand);
  color: var(--color-brand);
}

.photo-card-panel .photo-favorite-btn {
  width: 28px;
  height: 28px;
  border-color: var(--color-border);
  background: transparent;
  box-shadow: none;
  color: var(--color-text-muted);
}

.photo-card-panel .photo-favorite-btn svg {
  width: 15px;
  height: 15px;
}

.photo-unpublish-form {
  display: inline-flex;
  margin: 0;
}

.photo-unpublish-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-size: 0.64rem;
  line-height: 1;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}

.photo-unpublish-btn:hover {
  border-color: var(--color-danger);
  background: rgba(255, 107, 90, 0.1);
  color: var(--color-danger);
}

.photo-unpublish-icon {
  display: none;
  width: 12px;
  height: 12px;
}

.photo-comments {
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--color-border);
}

.photo-comments-head h2 {
  margin: 0 0 16px;
  font-size: clamp(1.35rem, 2.5vw, 1.9rem);
}

.photo-comments-login {
  margin: 0 0 18px;
  color: var(--color-text-muted);
}

.photo-comment-form {
  display: grid;
  gap: 10px;
  max-width: 760px;
  margin-bottom: 24px;
}

.photo-comment-author {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text-muted);
  font-size: 0.78rem;
}

.photo-comment-author strong {
  color: var(--color-text);
}

.photo-comment-author-handle {
  color: var(--color-text-subtle);
  font-family: var(--font-mono);
  font-size: 0.66rem;
}

.photo-comment-form .textarea {
  min-height: 86px;
}

.photo-comments-list {
  display: grid;
  max-width: 860px;
}

.photo-comment {
  display: flex;
  gap: 10px;
  padding: 14px 0;
  border-top: 1px solid var(--color-border);
}

.photo-comment:first-child {
  border-top: 0;
  padding-top: 0;
}

.photo-comment-avatar {
  flex: 0 0 auto;
}

.photo-comment-body {
  flex: 1 1 auto;
  min-width: 0;
}

.photo-comment-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 14px;
  margin-bottom: 6px;
}

.photo-comment-head strong {
  color: var(--color-text);
  font-size: 0.8rem;
}

.photo-comment-head time {
  color: var(--color-text-subtle);
  font-family: var(--font-mono);
  font-size: 0.62rem;
}

.photo-comment-text {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  line-height: 1.55;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.photo-comment-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 7px;
}

.photo-comment-action {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-text-subtle);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  cursor: pointer;
}

.photo-comment-action:hover {
  color: var(--color-brand);
}

.photo-comment-action-danger:hover {
  color: var(--color-danger);
}

.photo-comment-delete {
  display: inline;
  margin: 0;
}

.photo-comment-edit-form {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.photo-comment-edit-form .textarea {
  min-height: 76px;
}

.photo-comment-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.photo-comment-edit-form[hidden],
.photo-comment-actions[hidden],
.photo-comment-text[hidden] {
  display: none;
}

.photo-comments-empty {
  margin: 0;
  color: var(--color-text-subtle);
  font-size: 0.82rem;
}

@media (max-width: 700px) {
  .photo-unpublish-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 50%;
  }

  .photo-unpublish-text {
    display: none;
  }

  .photo-unpublish-icon {
    display: block;
  }

  .photo-likes-tooltip {
    min-width: 150px;
    max-width: 210px;
  }
}

.album-scope-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: center;
}

.photo-edit-preview {
  margin-bottom: 18px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-3);
}

.photo-edit-preview img {
  display: block;
  width: 100%;
  max-height: 560px;
  object-fit: contain;
}

.photo-title-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.photo-title-form .input {
  flex: 1 1 320px;
  max-width: 520px;
}

.photo-owner-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.photo-owner-actions form {
  margin: 0;
}

.my-photos-group + .my-photos-group {
  margin-top: 36px;
  padding-top: 28px;
  border-top: 1px solid var(--color-border);
}

.my-photos-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.my-photo-card {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 14px;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
}

.my-photo-thumb {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--color-surface-3);
}

.my-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.my-photo-body {
  display: grid;
  gap: 9px;
  min-width: 0;
  align-content: start;
}

.my-photo-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  color: var(--color-text-subtle);
  font-family: var(--font-mono);
  font-size: 0.62rem;
}

.my-photo-status {
  color: var(--color-success);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.my-photo-status.is-pending {
  color: var(--color-warning);
}

.my-photo-rename {
  display: flex;
  gap: 7px;
  align-items: center;
}

.my-photo-rename .input {
  min-width: 0;
  flex: 1 1 auto;
}

.my-photo-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.my-photo-actions form {
  margin: 0;
}

@media (max-width: 1000px) {
  .my-photos-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .my-photo-card {
    grid-template-columns: 104px minmax(0, 1fr);
  }

  .my-photo-rename {
    flex-wrap: wrap;
  }

  .my-photo-rename .btn {
    width: 100%;
  }
}

@media (max-width: 700px) {
  .gallery-search-block {
    flex-basis: 100%;
    max-width: none;
  }

  .gallery-upload-button {
    width: 100%;
  }

  .gallery-action-panel {
    flex-direction: column;
    gap: 14px;
  }

  .gallery-action-section {
    width: 100%;
  }

  .gallery-controls {
    align-items: center;
    flex-direction: column;
    text-align: center;
  }

  .gallery-filter-group {
    justify-items: center;
    width: 100%;
  }

  .gallery-controls .news-filters,
  .gallery-sort {
    justify-content: center;
  }

  .gallery-sort {
    width: 100%;
  }

  .gallery-page-hero {
    padding-block: 38px 26px;
  }

  .gallery-hero-top {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .gallery-page-hero h1 {
    font-size: clamp(2.3rem, 11vw, 3.4rem);
  }

  .album-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .album-hero {
    padding-block: 34px 22px;
  }

  .album-hero h1 {
    font-size: clamp(2rem, 9vw, 3rem);
  }

  .album-content {
    padding-block: 22px 52px;
  }

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

  .album-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
}

/* ---------- Photo tags ---------- */

.photo-tags {
  margin-top: 22px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
}

.photo-tags-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 12px;
}

.photo-tags-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.photo-tags-count {
  color: var(--color-text-subtle);
  font-family: var(--font-mono);
  font-size: 0.66rem;
}

.photo-tags-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.photo-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 4px 6px 4px 4px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
}

.photo-tag-avatar {
  flex: 0 0 auto;
}

.photo-tag-name {
  overflow: hidden;
  color: var(--color-text);
  font-size: 0.74rem;
  font-weight: 600;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-tag-name:hover {
  color: var(--color-brand);
}

.photo-tag-username {
  max-width: 12ch;
  overflow: hidden;
  color: var(--color-text-subtle);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-tag-remove {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--color-text-subtle);
  font-size: 0.68rem;
  line-height: 1;
  cursor: pointer;
}

.photo-tag-remove:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-brand);
}

.photo-tags-empty {
  color: var(--color-text-subtle);
  font-size: 0.78rem;
}

.photo-tag-status {
  margin: 8px 0 0;
  color: var(--color-brand);
  font-size: 0.72rem;
}

.photo-tag-search {
  position: relative;
  max-width: 360px;
  margin-top: 12px;
}

.photo-tag-search .input {
  width: 100%;
}

.photo-tag-suggestions,
.people-search-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  z-index: 15;
  display: grid;
  max-height: 280px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  box-shadow: var(--shadow-float);
}

.photo-tag-suggestions[hidden],
.people-search-suggestions[hidden] {
  display: none;
}

.user-suggestion {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.user-suggestion:hover,
.user-suggestion:focus-visible {
  background: var(--color-surface-3);
}

.user-suggestion-body {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.user-suggestion-body strong {
  overflow: hidden;
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-suggestion-body span {
  color: var(--color-text-subtle);
  font-family: var(--font-mono);
  font-size: 0.62rem;
}

.user-suggestion-empty {
  padding: 8px;
  color: var(--color-text-subtle);
  font-size: 0.74rem;
}

.photo-tag-hint {
  margin: 8px 0 0;
  color: var(--color-text-subtle);
  font-size: 0.68rem;
}

/* ---------- People page ---------- */

.people-search-form {
  position: relative;
  max-width: 560px;
  margin-top: 20px;
}

.people-search-field {
  display: flex;
  gap: 8px;
}

.people-search-field .input {
  flex: 1 1 auto;
  min-width: 0;
}

.people-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.people-search-results {
  margin-bottom: 34px;
}

.people-results-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.people-result {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 6px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface-2);
  color: var(--color-text);
  transition: border-color var(--transition), background var(--transition);
}

.people-result:hover,
.people-result.is-active {
  border-color: var(--color-brand);
  background: var(--color-surface-3);
}

.people-result-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.people-result-profile {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--color-text-subtle);
  text-decoration: none;
}

.people-result-profile svg {
  width: 14px;
  height: 14px;
}

.people-result-profile:hover {
  background: var(--color-surface);
  color: var(--color-brand);
}

.people-result-body {
  display: grid;
  gap: 1px;
}

.people-result-body strong {
  font-size: 0.78rem;
}

.people-result-body span {
  color: var(--color-text-subtle);
  font-family: var(--font-mono);
  font-size: 0.62rem;
}

.people-selected-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--color-border);
}

.people-selected-person {
  display: flex;
  align-items: center;
  gap: 14px;
}

.people-selected-person h2 {
  margin: 2px 0 0;
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  line-height: 1.1;
}

.people-selected-handle {
  margin: 2px 0 0;
  color: var(--color-text-subtle);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.people-selected-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--color-text-subtle);
  font-size: 0.72rem;
}

.people-album-group {
  margin-top: 28px;
}

.people-album-group .gallery-section-head h3 {
  margin: 0;
  font-size: 1.1rem;
}

.people-album-group .gallery-section-head h3 a {
  color: inherit;
  text-decoration: none;
}

.people-album-group .gallery-section-head h3 a:hover {
  color: var(--color-brand);
}

.people-empty {
  margin: 24px 0;
  color: var(--color-text-muted);
}

@media (max-width: 700px) {
  .photo-tags {
    padding: 12px;
  }

  .people-search-field {
    align-items: stretch;
    flex-direction: column;
  }

  .people-selected-person {
    align-items: flex-start;
  }
}

.photo-tag-self {
  margin-top: 12px;
}

.photo-tag-self[hidden] {
  display: none;
}

.people-self-removal-hint {
  margin: 0 0 18px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  font-size: 0.76rem;
  line-height: 1.5;
}

.people-self-remove {
  align-self: flex-start;
  color: var(--color-text-muted);
}

.people-self-remove:hover {
  border-color: var(--color-danger);
  color: var(--color-danger);
}

.photo-card-self-remove {
  margin: 0;
}

.people-remove-all-form {
  margin: 0 0 12px;
}

/* ---------- Gallery search ---------- */

.gallery-search-form {
  max-width: 620px;
  margin-top: 20px;
}

.gallery-search-field {
  position: relative;
  display: flex;
  gap: 8px;
}

.gallery-search-icon {
  position: absolute;
  top: 50%;
  left: 13px;
  width: 18px;
  height: 18px;
  color: var(--color-text-subtle);
  pointer-events: none;
  transform: translateY(-50%);
}

.gallery-search-field .input {
  flex: 1 1 auto;
  min-width: 0;
  padding-left: 40px;
}

.gallery-search-empty {
  margin: 24px 0;
  color: var(--color-text-muted);
}

.gallery-search-group + .gallery-search-group {
  margin-top: 34px;
  padding-top: 26px;
  border-top: 1px solid var(--color-border);
}

@media (max-width: 600px) {
  .gallery-search-field {
    align-items: stretch;
    flex-direction: column;
  }

  .gallery-search-icon {
    top: 22px;
  }

  .gallery-search-field .btn {
    width: 100%;
  }
}

/* ---------- Comments feed ---------- */

.comment-feed {
  display: grid;
  gap: 12px;
  max-width: 980px;
}

.comment-feed-item {
  display: flex;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
}

.comment-feed-avatar {
  flex: 0 0 auto;
}

.comment-feed-body {
  flex: 1 1 auto;
  min-width: 0;
}

.comment-feed-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 14px;
  margin-bottom: 6px;
}

.comment-feed-author {
  color: var(--color-text);
  font-size: 0.82rem;
  font-weight: 600;
}

.comment-feed-head time {
  color: var(--color-text-subtle);
  font-family: var(--font-mono);
  font-size: 0.62rem;
}

.comment-feed-text {
  margin: 0 0 10px;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.comment-feed-photo {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 440px;
  padding: 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  text-decoration: none;
}

.comment-feed-photo:hover {
  border-color: var(--color-brand);
}

.comment-feed-photo img {
  width: 72px;
  height: 54px;
  border-radius: 3px;
  object-fit: cover;
}

.comment-feed-photo span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.comment-feed-photo strong {
  overflow: hidden;
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comment-feed-photo small {
  overflow: hidden;
  color: var(--color-text-subtle);
  font-size: 0.66rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comment-feed-empty {
  margin: 24px 0;
  color: var(--color-text-muted);
}

@media (max-width: 600px) {
  .comment-feed-item {
    padding: 11px;
  }

  .comment-feed-photo img {
    width: 56px;
    height: 42px;
  }
}
