:root {
  color-scheme: light;
  --ink: #111114;
  --muted: #747782;
  --faint: #aeb2bb;
  --line: #e8e8ec;
  --paper: #fbfbfc;
  --panel: #ffffff;
  --soft: #f2f3f5;
  --accent: #111114;
  --warm: #f06c4f;
  --focus: #2d7cff;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

body.modal-open {
  overflow: hidden;
}

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

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  min-height: 72px;
  padding: 0 clamp(18px, 4vw, 48px);
  background: rgba(251, 251, 252, 0.9);
  border-bottom: 1px solid rgba(232, 232, 236, 0.82);
  backdrop-filter: blur(18px);
}

.brand {
  color: var(--ink);
  text-decoration: none;
  font-size: 1.18rem;
  font-weight: 950;
  letter-spacing: 0;
  white-space: nowrap;
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.nav-tab,
.sort-tab {
  min-height: 38px;
  padding: 0 16px;
  color: #555965;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 800;
  white-space: nowrap;
}

.nav-tab.is-active,
.sort-tab.is-active {
  color: #fff;
  background: var(--ink);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ghost-button,
.primary-button,
.secondary-button,
.submit-button {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  font-weight: 900;
  white-space: nowrap;
}

.ghost-button {
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
}

.primary-button,
.submit-button {
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
}

.secondary-button {
  color: var(--ink);
  background: var(--soft);
  border: 1px solid var(--line);
}

.user-badge {
  max-width: 120px;
  overflow: hidden;
  color: var(--muted);
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-shell {
  width: min(1320px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 72px;
}

.studio-head {
  display: grid;
  grid-template-columns: minmax(240px, 0.75fr) minmax(320px, 1fr);
  align-items: end;
  gap: 28px;
  margin-bottom: 30px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--warm);
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.studio-head h1 {
  max-width: 560px;
  margin: 0;
  font-size: clamp(2rem, 5vw, 4.7rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.search-box {
  position: relative;
  display: block;
}

.search-box span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.search-box input {
  width: 100%;
  min-height: 48px;
  padding: 0 18px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  outline: none;
}

.search-box input:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 4px rgba(45, 124, 255, 0.12);
}

.sort-tabs {
  display: flex;
  gap: 8px;
  padding: 4px;
  background: var(--soft);
  border-radius: 999px;
}

.sort-tab {
  min-height: 40px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-flow: dense;
  gap: 18px;
}

.photo-card {
  min-width: 0;
  animation: rise 420ms ease both;
  animation-delay: var(--delay, 0ms);
}

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

.photo-card.is-tall {
  grid-row: auto;
}

.photo-button {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  background: #dddfe4;
  border: 0;
  border-radius: 8px;
  cursor: zoom-in;
}

.photo-button img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  transition: transform 260ms ease, filter 260ms ease;
}

.is-wide .photo-button img {
  aspect-ratio: 16 / 10;
}

.is-tall .photo-button img {
  aspect-ratio: 3 / 4;
}

.hover-layer {
  position: absolute;
  inset: 0;
  display: grid;
  align-items: end;
  padding: 14px;
  color: #fff;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.42));
  opacity: 0;
  transition: opacity 220ms ease;
}

.zoom-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  min-height: 30px;
  padding: 7px 11px;
  color: #fff;
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  backdrop-filter: blur(12px);
  font-size: 0.78rem;
  font-weight: 900;
}

.hover-layer span {
  width: max-content;
  min-height: 34px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 999px;
  backdrop-filter: blur(12px);
  font-size: 0.88rem;
  font-weight: 900;
}

.photo-card:hover .photo-button img {
  transform: scale(1.035);
  filter: saturate(1.06);
}

.photo-card:hover .hover-layer {
  opacity: 1;
}

.card-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 2px 0;
}

.card-meta h2 {
  margin: 0;
  overflow: hidden;
  font-size: 1rem;
  line-height: 1.28;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-meta p {
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.88rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.author-button,
.author-inline,
.mini-thumb {
  padding: 0;
  background: transparent;
  border: 0;
}

.author-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 130px;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 850;
}

.author-button img {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 50%;
}

.author-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 2px 0;
}

.tag-row span {
  color: #696d76;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.78rem;
}

.empty {
  display: none;
  padding: 60px 0;
  color: var(--muted);
}

.empty p {
  margin: 0;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
}

.modal.is-open {
  display: block;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(13, 14, 18, 0.58);
  backdrop-filter: blur(8px);
}

.floating-panel,
.author-drawer {
  position: absolute;
  display: grid;
  gap: 16px;
  background: #fff;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.28);
}

.floating-panel {
  top: 50%;
  right: clamp(14px, 4vw, 52px);
  width: min(520px, calc(100% - 28px));
  max-height: calc(100vh - 42px);
  overflow: auto;
  padding: 22px;
  border-radius: 8px;
  transform: translateY(-50%);
}

.login-panel {
  width: min(420px, calc(100% - 28px));
}

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

.panel-head h2,
.lightbox-info h2,
.author-profile h3 {
  margin: 0;
}

.icon-button {
  width: 38px;
  height: 38px;
  color: var(--ink);
  background: var(--soft);
  border: 0;
  border-radius: 50%;
  font-size: 1.55rem;
  line-height: 1;
}

.lightbox {
  position: absolute;
  inset: clamp(12px, 3vw, 34px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  overflow: hidden;
  background: #090a0d;
  border-radius: 8px;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.38);
}

.lightbox-stage {
  display: grid;
  min-height: 0;
  overflow: hidden;
  padding: clamp(12px, 2vw, 26px);
  place-items: center;
  background: #050506;
}

.lightbox-stage img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.lightbox-info {
  display: grid;
  align-content: center;
  gap: 18px;
  padding: clamp(22px, 4vw, 42px);
  color: #fff;
  background: #15161b;
}

.lightbox-info h2 {
  font-size: clamp(1.7rem, 3.2vw, 2.6rem);
  line-height: 1.1;
}

.lightbox-info p {
  margin: 0;
  color: #c8ccd5;
  line-height: 1.75;
}

.author-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-align: left;
}

.author-inline img {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 50%;
}

.lightbox-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 4;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
}

.nav-arrow {
  position: absolute;
  top: 50%;
  z-index: 3;
  width: 44px;
  height: 44px;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  font-size: 2rem;
  line-height: 1;
  transform: translateY(-50%);
}

.nav-arrow.left {
  left: 16px;
}

.nav-arrow.right {
  right: 396px;
}

.author-drawer {
  top: 0;
  right: 0;
  width: min(420px, 100%);
  height: 100%;
  align-content: start;
  padding: 26px;
  overflow: auto;
}

.author-profile {
  display: grid;
  justify-items: start;
  gap: 12px;
}

.author-profile img {
  width: 92px;
  height: 92px;
  object-fit: cover;
  border-radius: 50%;
}

.author-profile h3 {
  font-size: 1.75rem;
}

.author-profile p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.author-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.author-stats span {
  padding: 8px 12px;
  color: var(--ink);
  background: var(--soft);
  border-radius: 999px;
  font-weight: 900;
}

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

.mini-thumb {
  overflow: hidden;
  border-radius: 8px;
}

.mini-thumb img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.dropzone {
  position: relative;
  display: grid;
  min-height: 230px;
  overflow: hidden;
  place-items: center;
  background: var(--soft);
  border: 1px dashed #bfc2c9;
  border-radius: 8px;
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.preview-image {
  position: absolute;
  inset: 0;
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dropzone.has-preview .preview-image {
  display: block;
}

.dropzone.has-preview .drop-content {
  color: #fff;
  background: rgba(0, 0, 0, 0.44);
}

.drop-content {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 8px;
  width: calc(100% - 28px);
  padding: 22px;
  text-align: center;
  border-radius: 8px;
}

.drop-title {
  font-weight: 900;
}

.drop-hint,
.status {
  color: var(--muted);
  font-size: 0.92rem;
}

.captcha-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.captcha-question {
  margin: -4px 0 0;
  color: var(--ink);
  font-weight: 900;
}

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

.wide-field {
  grid-column: 1 / -1;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: #4c505b;
  font-size: 0.86rem;
  font-weight: 850;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

.status {
  min-height: 24px;
  margin: 0;
}

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

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

@media (max-width: 1120px) {
  .topbar {
    grid-template-columns: auto 1fr;
  }

  .top-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .studio-head {
    grid-template-columns: 1fr;
  }

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

  .lightbox {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
  }

  .lightbox-stage {
    grid-column: 1;
    grid-row: 1;
    padding: 0;
  }

  .lightbox-info {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2;
    align-content: start;
    max-height: 42vh;
    overflow: auto;
    padding: clamp(18px, 4vw, 30px);
    background: linear-gradient(180deg, rgba(21, 22, 27, 0), rgba(21, 22, 27, 0.92) 18%, #15161b 100%);
  }

  .nav-arrow.right {
    right: 16px;
  }
}

@media (max-width: 740px) {
  .topbar {
    gap: 12px;
    padding: 12px 14px;
  }

  .brand {
    font-size: 1rem;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .site-shell {
    width: calc(100% - 28px);
    padding-top: 24px;
  }

  .studio-head h1 {
    font-size: 2.35rem;
  }

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

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

  .photo-card.is-wide,
  .photo-card.is-tall {
    grid-column: auto;
    grid-row: auto;
  }

  .photo-button img {
    aspect-ratio: 4 / 5;
  }

  .is-wide .photo-button img {
    aspect-ratio: 4 / 3;
  }

  .is-tall .photo-button img {
    aspect-ratio: 3 / 4;
  }

  .login-button,
  .logout-button,
  .user-badge {
    display: none;
  }

  .floating-panel {
    right: 14px;
    left: 14px;
    width: auto;
  }

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

  .lightbox {
    inset: 0;
    border-radius: 0;
  }

  .lightbox-info {
    max-height: 36vh;
    padding: 16px;
  }

  .lightbox-stage {
    place-items: start center;
  }

  .nav-arrow {
    display: none;
  }
}
