*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #ffffff;
  --bg-subtle: #fafafa;
  --surface: #f5f5f5;
  --border: #e8e8e8;
  --text: #1a1a1a;
  --muted: #5c5c5c;
  --accent: #1a1a1a;
  --accent-hover: #444444;
  --danger: #b42318;
  --danger-border: #d4a09c;
  --success-bg: #e8f5ef;
  --success-text: #0d4a2e;
  --error-bg: #fdecea;
  --error-text: #7a1e16;
  --radius: 2px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", Times, serif;
  font-family: var(--font-sans);
}

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

body.auth-page {
  background: var(--bg-subtle);
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--accent-hover);
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  font-weight: 600;
  font-size: 0.8125rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
}

.logo:hover {
  color: var(--muted);
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.8125rem;
}

.nav a {
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.75rem;
}

.nav a:hover {
  text-decoration: underline;
}

.nav-user {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.site-footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-top: 1px solid var(--border);
}

.site-footer p {
  margin: 0;
}

.site-footer p + p {
  margin-top: 0.65rem;
}

.site-footer-copyright {
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 0.6875rem;
}

.flash-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
}

.flash {
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  border: 1px solid var(--border);
}

.flash-success {
  background: var(--success-bg);
  color: var(--success-text);
}

.flash-error {
  background: var(--error-bg);
  color: var(--error-text);
}

.page-hero {
  padding-top: 2.5rem;
  padding-bottom: 0.5rem;
}

.collection-title {
  margin: 0 0 1.5rem;
  font-family: var(--font-sans);
  font-size: clamp(1.75rem, 4.5vw, 2.25rem);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.15;
}

.intro-block {
  max-width: 42rem;
}

.intro-text {
  margin: 0 0 2.75rem;
  font-family: var(--font-serif);
  font-size: 1.125rem;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
}

.admin-tabs {
  margin: 0 0 2rem;
}

.admin-tab-list {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin: 0 0 1rem;
}

.admin-tab {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  padding: 0.6rem 0.85rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.admin-tab:hover {
  color: var(--text);
  border-color: #cdcdcd;
}

.admin-tab.is-active {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}

.admin-tab-panel {
  display: block;
}

.admin-tab-panel[hidden] {
  display: none;
}

.bg-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.8rem;
}

.bg-choice-card {
  display: block;
  cursor: pointer;
}

.bg-choice-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.bg-choice-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 2px solid var(--border);
  background: #f7f7f7;
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.bg-choice-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bg-choice-thumb-white {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}

.bg-choice-card.is-active .bg-choice-thumb,
.bg-choice-card input[type="radio"]:checked + .bg-choice-thumb {
  border-color: var(--text);
  box-shadow: 0 0 0 1px var(--text);
}

.admin-help {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--muted);
  max-width: 36rem;
}

.admin-panel .stack-form {
  margin-top: 0;
}

.admin-panel .stack-form textarea {
  min-height: 9rem;
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.55;
}

.admin-reset-form {
  margin-top: 0.85rem;
}

.admin-password-form {
  margin-top: 1.1rem;
}

.admin-password-help {
  font-size: 0.95rem;
  line-height: 1.6;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2.5rem;
}

.admin-panel-title {
  margin-top: 0;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.upload-form {
  display: grid;
  gap: 1rem;
}

.upload-form label,
.stack-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

input[type="text"],
input[type="password"],
input[type="file"],
textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.55rem 0.65rem;
}

input[type="file"] {
  padding: 0.45rem;
}

textarea {
  resize: vertical;
  min-height: 3rem;
}

.btn {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  padding: 0.55rem 1.1rem;
  transition: background 0.15s, opacity 0.15s;
}

.btn:active {
  opacity: 0.92;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.75rem;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary.is-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  cursor: wait;
  opacity: 0.95;
}

.btn-primary.is-loading:disabled {
  cursor: wait;
  opacity: 0.95;
}

.btn-spinner {
  box-sizing: border-box;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spinner-rotate 0.7s linear infinite;
}

@keyframes btn-spinner-rotate {
  to {
    transform: rotate(360deg);
  }
}

.form-is-uploading {
  pointer-events: none;
  opacity: 0.92;
}

.btn-compact {
  align-self: flex-start;
}

.btn-small {
  padding: 0.35rem 0.65rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.btn-edit {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-edit:hover {
  background: var(--surface);
}

.btn-danger {
  background: var(--bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.btn-danger:hover {
  background: var(--error-bg);
}

.empty-state {
  color: var(--muted);
  text-align: left;
  padding: 3rem 0;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  border-bottom: 1px solid var(--border);
}

.muted {
  color: var(--muted);
}

.gallery-section {
  margin-top: 0.5rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2.5rem 2.1rem;
}

/* Public home page: one more column so each thumb is smaller; generous gaps */
.collection-home.collection-home-public .gallery-grid {
  grid-template-columns: repeat(6, 1fr);
  gap: 2.5rem 2.1rem;
}

.gallery-card-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.gallery-card {
  background: var(--bg);
  border: none;
  border-radius: 0;
  overflow: hidden;
  cursor: pointer;
  transition: opacity 0.15s;
  display: block;
  text-decoration: none;
  color: inherit;
}

.gallery-card:hover,
.gallery-card:focus-visible {
  outline: none;
  opacity: 0.92;
}

.card-actions-home {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.thumb-wrap {
  aspect-ratio: 1 / 1;
  background: #eee;
  overflow: hidden;
}

.thumb-wrap img,
.thumb-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-wrap-video,
.thumb-wrap-pdf {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thumb-wrap-pdf {
  background: #e8e4dc;
}

.thumb-wrap-pdf img {
  object-fit: cover;
  background: transparent;
}

.thumb-badge {
  position: absolute;
  bottom: 0.35rem;
  right: 0.35rem;
  padding: 0.15rem 0.4rem;
  font-size: 0.625rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
}

.thumb-badge-pdf {
  position: static;
  font-size: 0.875rem;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}

.card-caption {
  margin: 0;
  padding: 0.65rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.4;
  flex: 1;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-sans);
  color: var(--muted);
}

.gallery-card-title {
  margin: 0.5rem 0 0;
  padding: 0 0.25rem;
  font-size: 0.8125rem;
  line-height: 1.35;
  text-align: center;
  color: var(--text);
  font-weight: 500;
}

.gallery-card-title-untitled {
  color: var(--muted);
  font-weight: 400;
  font-style: italic;
}

.card-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 0 0;
  flex-wrap: wrap;
}

.inline-form {
  display: inline;
  margin: 0;
}

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-root.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(3px);
}

.modal-dialog {
  position: relative;
  max-width: min(920px, 100%);
  max-height: min(92vh, 900px);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-dialog-narrow {
  max-width: 420px;
  padding: 1.25rem 1.5rem 1.5rem;
}

.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.55rem;
  z-index: 2;
  background: var(--text);
  color: #fff;
  border: none;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  opacity: 0.85;
}

.modal-image {
  width: 100%;
  max-height: min(65vh, 620px);
  object-fit: contain;
  background: #f0f0f0;
}

.modal-body {
  padding: 1rem 1.25rem 1.25rem;
}

.modal-title {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.modal-description {
  margin: 0;
  color: var(--text);
  font-size: 0.95rem;
  font-family: var(--font-serif);
  white-space: pre-wrap;
}

.auth-panel {
  max-width: 400px;
  margin: 2rem auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.75rem;
  box-shadow: var(--shadow);
}

.auth-panel h1 {
  margin-top: 0;
  font-size: 1.35rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.25rem;
}

@media (max-width: 1000px) {
  .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 2.15rem 1.75rem;
  }

  .collection-home.collection-home-public .gallery-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 2.15rem 1.75rem;
  }
}

@media (max-width: 720px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.85rem 1.45rem;
  }

  .collection-home.collection-home-public .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1.85rem 1.45rem;
  }
}

@media (max-width: 520px) {
  .header-inner {
    flex-wrap: wrap;
  }

  .gallery-grid,
  .collection-home.collection-home-public .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem 1.15rem;
  }

  .intro-text {
    font-size: 1rem;
  }

  .card-caption {
    font-size: 0.78rem;
  }
}

/* ——— Work detail page ——— */

body.work-detail .main {
  max-width: 1100px;
}

.back-row {
  margin: 0 0 1.5rem;
  font-size: 0.8125rem;
}

.back-row a {
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
}

.back-row a:hover {
  text-decoration: underline;
}

.work-hero {
  margin-bottom: 2.5rem;
}

.work-hero-inner {
  position: relative;
  background: #e4e4e4;
  min-height: min(70vh, 640px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.work-main-hit {
  display: block;
  width: 100%;
  height: 100%;
  min-height: min(70vh, 640px);
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  cursor: zoom-in;
}

.work-viewer {
  width: 100%;
}

.work-main-hit img,
.work-main-hit video,
.detail-main-media {
  display: block;
  width: 100%;
  height: min(70vh, 640px);
  object-fit: contain;
  background: #e4e4e4;
}

.work-main-hit-static {
  cursor: default;
  display: flex;
  width: 100%;
  min-height: min(70vh, 640px);
  align-items: stretch;
  justify-content: center;
}

.work-main-hit-pdf {
  flex-direction: column;
  align-items: stretch;
}

.pdf-viewer-host {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: min(70vh, 640px);
  min-height: min(70vh, 640px);
  background: #fff;
  border: 1px solid var(--border);
}

.pdf-viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0.65rem;
  background: #3a3a3a;
  color: #f2f2f2;
  flex-shrink: 0;
}

.pdf-viewer-toolbar-left,
.pdf-viewer-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.pdf-tb-btn {
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem;
  border: 1px solid #555;
  background: #2f2f2f;
  color: #f2f2f2;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 2px;
  font-family: inherit;
}

.pdf-tb-btn:hover:not(:disabled) {
  background: #454545;
}

.pdf-tb-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.pdf-tb-fit {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0 0.65rem;
}

.pdf-page-label,
.pdf-zoom-label {
  font-size: 0.8125rem;
  padding: 0 0.35rem;
  white-space: nowrap;
}

.pdf-viewer-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: #f0f0f0;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.pdf-viewer-stage.is-panning {
  cursor: grabbing;
}

.pdf-viewer-stage canvas {
  display: block;
  margin: 0;
  pointer-events: auto;
}

.pdf-viewer-host.is-busy .pdf-viewer-toolbar {
  opacity: 0.55;
  pointer-events: none;
}

.pdf-viewer-stage.is-loading canvas {
  visibility: hidden;
}

/* Zoom / page change: dim previous frame under overlay instead of blank white */
.pdf-viewer-stage.is-rendering canvas {
  visibility: visible;
  opacity: 0.4;
}

.pdf-viewer-loading.is-render {
  background: rgba(248, 248, 248, 0.82);
}

.pdf-viewer-loading.is-render .pdf-viewer-loading-preview,
.pdf-viewer-loading.is-render .pdf-viewer-loading-tip {
  display: none;
}

.pdf-viewer-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  color: var(--text);
  font-size: 0.875rem;
  background: rgba(248, 248, 248, 0.94);
  z-index: 2;
}

.pdf-viewer-loading[hidden] {
  display: none;
}

.pdf-viewer-loading-card {
  width: min(22rem, 88%);
  text-align: center;
  padding: 1.25rem 1rem;
}

.pdf-viewer-loading-preview {
  display: block;
  width: 100%;
  max-height: 10rem;
  object-fit: contain;
  margin: 0 auto 0.85rem;
  border-radius: 4px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  opacity: 0.92;
}

.pdf-viewer-loading-preview[hidden] {
  display: none;
}

.pdf-viewer-spinner {
  width: 2.25rem;
  height: 2.25rem;
  margin: 0 auto 0.75rem;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-top-color: var(--accent, #1a1a1a);
  border-radius: 50%;
  animation: pdf-spin 0.85s linear infinite;
}

@keyframes pdf-spin {
  to {
    transform: rotate(360deg);
  }
}

.pdf-viewer-loading-title {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.pdf-viewer-progress-track {
  height: 6px;
  margin: 0 0 0.65rem;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.pdf-viewer-progress-track.is-indeterminate .pdf-viewer-progress-bar {
  width: 35% !important;
  animation: pdf-progress-indeterminate 1.2s ease-in-out infinite;
}

@keyframes pdf-progress-indeterminate {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(320%);
  }
}

.pdf-viewer-progress-bar {
  height: 100%;
  background: var(--accent, #1a1a1a);
  border-radius: 999px;
  transition: width 0.2s ease;
}

.pdf-viewer-loading-detail {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

.pdf-viewer-loading-tip {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
  font-style: italic;
  line-height: 1.45;
  min-height: 2.2em;
}

.pdf-viewer-error {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
}

.pdf-viewer-hint {
  margin: 0;
  padding: 0.45rem 0.75rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid var(--border);
  background: #fafafa;
  flex-shrink: 0;
}

.detail-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.detail-thumb-label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.view-remove-thumb-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  background: var(--surface);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
}

.work-toolbar {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  z-index: 2;
  display: flex;
  gap: 0;
  background: #2a2a2a;
  border-radius: 2px;
  /* must not clip .share-menu (abs. positioned above / beside buttons) */
  overflow: visible;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.work-toolbar > .tool-btn:first-child {
  border-radius: 2px 0 0 2px;
}

.work-toolbar .share-wrap .tool-btn {
  border-radius: 0 2px 2px 0;
}

.tool-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  margin: 0;
  border: none;
  border-right: 1px solid #444;
  background: #2a2a2a;
  color: #f0f0f0;
  cursor: pointer;
  text-decoration: none;
}

.tool-btn:last-child {
  border-right: none;
}

.tool-btn[hidden],
.tool-btn.is-disabled {
  display: none !important;
}

.tool-btn:hover {
  background: #3d3d3d;
  color: #fff;
}

.share-wrap {
  position: relative;
}

.share-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  min-width: 11rem;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 50;
}

.share-menu.hidden {
  display: none;
}

.share-item {
  display: block;
  width: 100%;
  padding: 0.55rem 0.85rem;
  font-size: 0.8125rem;
  color: var(--text);
  text-decoration: none;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.share-item:hover {
  background: var(--surface);
}

.share-item + .share-item {
  border-top: 1px solid var(--border);
}

.detail-thumbs {
  display: flex;
  justify-content: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.detail-thumb {
  width: 4.5rem;
  height: 4.5rem;
  padding: 0;
  border: 2px solid transparent;
  background: #ddd;
  cursor: pointer;
  overflow: hidden;
  border-radius: 2px;
}

.detail-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.detail-thumb-pdf img {
  object-fit: cover;
  background: transparent;
}

.detail-thumb.is-active,
.detail-thumb:focus-visible {
  border-color: var(--text);
  outline: none;
}

.work-body {
  display: grid;
  grid-template-columns: minmax(7rem, 10rem) 1fr;
  gap: 2rem 2.5rem;
  align-items: start;
}

.work-aside {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.aside-note {
  margin: 0 0 0.5rem;
  font-weight: 600;
}

.aside-meta {
  margin: 0;
  line-height: 1.4;
}

.work-main-text {
  max-width: 40rem;
}

.work-title {
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 3vw, 2.35rem);
  font-weight: 400;
  margin: 0 0 0.5rem;
  line-height: 1.2;
}

.work-title-untitled {
  color: var(--muted);
}

.work-origin {
  margin: 0 0 1.25rem;
  font-size: 1rem;
  color: var(--muted);
  font-family: var(--font-sans);
}

.work-description {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
}

.work-admin {
  margin-top: 3rem;
}

.admin-subtitle {
  margin: 2rem 0 0.75rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.admin-upload-hint {
  margin: 0.5rem 0 0;
  max-width: 42rem;
}

.view-remove-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.view-manage-table {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.view-manage-header,
.view-manage-row {
  display: grid;
  grid-template-columns: 3.5rem minmax(8rem, 1fr) auto;
  align-items: center;
  gap: 1rem;
}

.view-manage-header {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
}

.view-manage-row:not(:last-child) {
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}

.view-manage-col-downloadable {
  justify-self: start;
}

.view-manage-col-action {
  justify-self: end;
}

.view-downloadable-form {
  margin: 0;
}

.view-downloadable-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8125rem;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.view-downloadable-label input {
  width: 1rem;
  height: 1rem;
  margin: 0;
}

.media-no-download {
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  pointer-events: auto;
}

.work-main-hit-protected {
  position: relative;
}

.media-view-shield {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: transparent;
  cursor: zoom-in;
}

.work-main-hit-protected .detail-main-media {
  pointer-events: none;
  -webkit-user-drag: none;
}

.view-manage-table-single .view-manage-header,
.view-manage-table-single .view-manage-row {
  grid-template-columns: 3.5rem minmax(8rem, 1fr);
}

.view-remove-list li {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.view-remove-thumb {
  width: 3rem;
  height: 3rem;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.view-remove-thumb-video {
  display: block;
  background: #ddd;
  pointer-events: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(26, 26, 26, 0.94);
  padding: 2rem 1rem 5rem;
  cursor: zoom-out;
}

.lightbox.hidden {
  display: none;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 2;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.lightbox-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: calc(100vh - 8rem);
  cursor: default;
}

.lightbox-img-frame {
  position: relative;
  display: inline-block;
  max-width: 100%;
  max-height: calc(100vh - 8rem);
  transform-origin: center center;
  transition: transform 0.15s ease-out;
}

#lightbox-img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 8rem);
  object-fit: contain;
}

.lightbox-shield {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: transparent;
  cursor: default;
}

.lightbox-protected #lightbox-img {
  pointer-events: none;
  -webkit-user-drag: none;
}

.lightbox-protected .lightbox-shield {
  display: block;
}

.lightbox-zoom-bar {
  position: absolute;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  gap: 0;
  background: #2a2a2a;
  border-radius: 2px;
  overflow: hidden;
}

.lightbox-zoom-bar .lightbox-zoom {
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.25rem;
  line-height: 1;
  border-right: 1px solid #444;
}

.lightbox-zoom-bar .lightbox-zoom:last-child {
  border-right: none;
}

@media (max-width: 720px) {
  .work-body {
    grid-template-columns: 1fr;
  }

  .work-aside {
    order: 2;
  }

  .work-main-text {
    order: 1;
  }
}
