* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: #000;
  color: #f5f5f5;
  font-family: 'Oswald', Arial, sans-serif;
  font-size: var(--body-size, 14px);
  line-height: 1.4;
  letter-spacing: 0;
}

body.lightbox-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.import-button {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid #f5f5f5;
  background: #f5f5f5;
  color: #000;
  cursor: pointer;
}

button:hover,
.import-button:hover {
  background: #dcdcdc;
}

.secondary-button {
  background: #000;
  color: #f5f5f5;
}

.secondary-button:hover {
  background: #171717;
}

.danger-button {
  border-color: #9d1b1b;
  background: #9d1b1b;
}

.danger-button:hover {
  background: #7f1515;
}

.site-header {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 1fr);
  align-items: center;
  min-height: 160px;
  padding: 50px 4vw 42px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.nav a,
.mobile-nav a {
  font-family: 'Oswald', Arial, sans-serif;
  font-size: 15px;
  font-weight: 400;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0.42;
  transition: opacity 160ms ease;
}

.nav a:hover,
.nav a.active,
.mobile-nav a:hover,
.mobile-nav a.active {
  opacity: 1;
}

.logo {
  justify-self: center;
  display: inline-block;
  font-family: 'Amatic SC', cursive;
  font-size: calc(var(--logo-size, 34px) * 1.5);
  font-weight: 400;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.menu-button {
  display: none;
  justify-self: end;
  width: 42px;
  height: 42px;
  padding: 10px;
  border: 0;
  background: transparent;
}

.menu-button:hover {
  background: transparent;
}

.menu-button span {
  display: block;
  width: 22px;
  height: 2px;
  margin: 5px 0;
  background: #f5f5f5;
}

.mobile-panel {
  display: none;
}

.site-content {
  width: calc(100% - 8vw);
  max-width: 1164px;
  margin: 0 auto;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.project-card {
  position: relative;
  display: block;
  aspect-ratio: 1.778 / 1;
  overflow: hidden;
  background: #111;
}

.project-card[hidden] {
  display: none;
}

.project-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: auto;
}

.project-card span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: rgba(0, 0, 0, 0.52);
  color: #fff;
  font-family: 'Oswald', Arial, sans-serif;
  font-size: var(--project-title-size, 21px);
  font-weight: 400;
  line-height: 1.25;
  text-align: center;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 180ms ease;
}

.project-card:hover span,
.project-card:focus-visible span {
  opacity: 1;
}

.project-detail {
  max-width: 1164px;
  min-height: 58vh;
  margin: 0 auto;
  padding-bottom: 90px;
}

.back-link {
  display: inline-block;
  margin: 0 0 18px;
  color: #aaa;
  font-size: 12px;
  font-family: 'Oswald', Arial, sans-serif;
  font-weight: 400;
  text-transform: uppercase;
  transition: color 160ms ease;
}

.back-link:hover {
  color: #fff;
}

.detail-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 5px;
  align-items: stretch;
}

.artwork-item {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #050505;
}

body.project-editing .artwork-item {
  cursor: grab;
}

body.project-editing .artwork-item:active {
  cursor: grabbing;
}

.artwork-item.is-sorting {
  opacity: 0.45;
}

.artwork-item.is-drop-target {
  outline: 2px solid #fff;
  outline-offset: -2px;
}

.artwork-item img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  cursor: zoom-in;
}

.delete-artwork {
  position: absolute;
  top: 8px;
  right: 8px;
  display: none;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 13px;
}

body.project-editing .delete-artwork {
  display: inline-flex;
  align-items: center;
}

body.project-editing .artwork-item::after {
  content: "拖动排序";
  position: absolute;
  left: 8px;
  top: 8px;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 13px;
  pointer-events: none;
}

.project-edit-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 18px;
  color: #999;
  font-size: 12px;
}

.edit-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.project-edit-toolbar button {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid #777;
  background: transparent;
  color: #fff;
  font-size: 13px;
}

.add-artwork-panel {
  display: flex;
  align-items: stretch;
  gap: 10px;
  padding: 10px;
  border: 1px solid #555;
  background: #080808;
}

.add-artwork-panel label {
  display: grid;
  gap: 5px;
  color: #aaa;
  font-size: 12px;
}

.add-artwork-panel select {
  min-height: 34px;
  min-width: 150px;
  border: 1px solid #777;
  background: #000;
  color: #fff;
  font-size: 13px;
}

.drop-zone {
  position: relative;
  display: grid;
  place-items: center;
  gap: 3px;
  min-width: 220px;
  min-height: 62px;
  padding: 10px 18px;
  border: 1px dashed #777;
  color: #fff;
  text-align: center;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.drop-zone strong {
  font-size: 13px;
  font-weight: 400;
}

.drop-zone span {
  color: #aaa;
  font-size: 12px;
}

.drop-zone.is-dragging {
  border-color: #fff;
  background: #1a1a1a;
}

.drop-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.related-projects {
  margin-top: 64px;
}

.related-projects h2 {
  margin: 0 0 28px;
  color: #fff;
  font-family: 'Oswald', Arial, sans-serif;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: uppercase;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.related-card {
  position: relative;
  display: block;
  aspect-ratio: 1.778 / 1;
  overflow: hidden;
  background: #111;
}

.related-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.related-card span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(0, 0, 0, 0.52);
  color: #fff;
  font-family: 'Oswald', Arial, sans-serif;
  font-size: var(--project-title-size, 21px);
  font-weight: 400;
  text-align: center;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 180ms ease;
}

.related-card:hover span,
.related-card:focus-visible span {
  opacity: 1;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 72px;
  grid-template-rows: 72px minmax(0, 1fr) 48px;
  align-items: center;
  justify-items: center;
  background: rgba(0, 0, 0, 0.92);
  color: #fff;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-image {
  grid-column: 2;
  grid-row: 2;
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  border: 0;
  background: transparent;
  color: #fff;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: transparent;
  opacity: 0.68;
}

.lightbox-close {
  grid-column: 3;
  grid-row: 1;
  align-self: start;
  justify-self: end;
  width: 64px;
  height: 64px;
  padding: 0;
  font-size: 38px;
  line-height: 1;
}

.lightbox-prev,
.lightbox-next {
  width: 72px;
  height: 96px;
  padding: 0;
  font-size: 56px;
  line-height: 1;
}

.lightbox-prev {
  grid-column: 1;
  grid-row: 2;
}

.lightbox-next {
  grid-column: 3;
  grid-row: 2;
}

.lightbox-count {
  grid-column: 2;
  grid-row: 3;
  margin: 0;
  color: #ccc;
  font-size: 12px;
}

.detail-copy {
  display: none;
}

.detail-category {
  display: none;
}

.detail-title {
  margin: 0 0 18px;
  font-family: 'Oswald', Arial, sans-serif;
  font-size: 22px;
  font-weight: 400;
  line-height: 1.15;
  text-transform: uppercase;
}

.detail-text {
  margin: 0;
  color: #bdbdbd;
  font-size: 15px;
  line-height: 1.65;
}

.contact,
.admin {
  max-width: 760px;
  min-height: 48vh;
  padding: 38px 0 100px;
}

.contact h1,
.admin h1 {
  margin: 0 0 16px;
  font-family: 'Oswald', Arial, sans-serif;
  font-size: var(--detail-title-size, 28px);
  font-weight: 400;
  line-height: 1.15;
}

.contact p,
.admin p {
  margin: 0 0 10px;
  color: #bdbdbd;
  font-size: 16px;
}

.contact-link {
  display: inline-block;
  font-size: 18px;
  font-weight: 400;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.admin-login,
.admin-panel {
  border-top: 1px solid #f5f5f5;
  padding-top: 28px;
}

.key-form,
.editor-form {
  display: grid;
  gap: 18px;
  margin-top: 26px;
}

.key-form label,
.editor-form label {
  display: grid;
  gap: 8px;
  color: #cfcfcf;
  font-size: 12px;
  font-weight: 400;
  text-transform: none;
}

.key-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #555;
  border-radius: 0;
  background: #050505;
  color: #f5f5f5;
  padding: 10px 11px;
}

input::placeholder,
textarea::placeholder {
  color: #777;
}

textarea {
  resize: vertical;
}

.key-error {
  min-height: 20px;
  color: #9d1b1b;
}

.admin-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.admin-actions,
.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.image-editor {
  display: grid;
  gap: 18px;
  margin-top: 24px;
}

.image-editor-controls {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 10px;
}

.image-editor-controls label {
  display: grid;
  gap: 6px;
  color: #999;
  font-size: 12px;
}

.image-editor-controls select {
  min-height: 40px;
  min-width: 170px;
  border: 1px solid #777;
  background: #000;
  color: #fff;
  font-size: 14px;
}

.editor-drop-zone,
.cover-drop-zone {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 240px;
  min-height: 74px;
  padding: 12px 22px;
  border: 1px dashed #777;
  background: #080808;
  color: #fff;
  text-align: center;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.cover-drop-zone {
  border-style: solid;
}

.editor-drop-zone strong,
.cover-drop-zone strong {
  font-size: 13px;
}

.editor-drop-zone span,
.cover-drop-zone span {
  color: #aaa;
  font-size: 12px;
}

.editor-drop-zone.is-dragging,
.cover-drop-zone.is-dragging {
  border-color: #fff;
  background: #1a1a1a;
}

.editor-drop-zone input,
.cover-drop-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.image-editor-status {
  margin: 0;
  color: #aaa;
  font-size: 13px;
}

.image-editor-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.editor-image-item {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #050505;
  cursor: grab;
}

.editor-image-item:active {
  cursor: grabbing;
}

.editor-image-item.is-sorting {
  opacity: 0.45;
}

.editor-image-item.is-drop-target {
  outline: 2px solid #fff;
  outline-offset: -2px;
}

.editor-image-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.editor-image-item span,
.editor-image-item button {
  position: absolute;
  top: 8px;
  min-height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 12px;
}

.editor-image-item span {
  left: 8px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
}

.editor-image-item button {
  right: 8px;
  padding: 0 12px;
}

.editor-open-project {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid #f5f5f5;
}

.settings-form {
  display: grid;
  gap: 18px;
  margin: 28px 0;
  padding: 24px 0;
  border-top: 1px solid #333;
  border-bottom: 1px solid #333;
}

.add-project-form {
  display: grid;
  gap: 18px;
  margin: 28px 0;
  padding: 22px;
  border: 1px solid #555;
  background: #050505;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.settings-form label,
.add-project-form label {
  display: grid;
  gap: 8px;
  color: #cfcfcf;
  font-size: 12px;
  font-weight: 400;
  text-transform: none;
}

.settings-form h2,
.add-project-form h2 {
  margin: 0;
  font-family: 'Oswald', Arial, sans-serif;
  font-size: 18px;
  line-height: 1.2;
}

.settings-form p,
.add-project-form p {
  margin: 0;
}

.settings-note {
  color: #aaa;
  font-size: 13px;
  line-height: 1.55;
}

.import-button {
  display: inline-flex;
  align-items: center;
}

.import-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.preview-box {
  min-height: 180px;
  background: #111;
}

.editor-preview {
  display: block;
  width: 100%;
  max-height: 340px;
  object-fit: contain;
}

.footer {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 82px 20px 30px;
  color: #aaa;
  font-size: 11px;
}

.footer a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 1020px) {
  .site-header {
    grid-template-columns: 1fr auto;
    min-height: 116px;
    padding: 35px 28px;
  }

  .nav {
    display: none;
  }

  .logo {
    justify-self: start;
    font-size: 42px;
  }

  .menu-button {
    display: block;
  }

  .mobile-panel {
    display: block;
    max-height: 0;
    overflow: hidden;
    border-top: 1px solid transparent;
    transition: max-height 220ms ease;
  }

  body.menu-open .mobile-panel {
    max-height: 360px;
    border-top-color: #222;
  }

  .mobile-nav {
    display: grid;
    gap: 18px;
    padding: 22px 28px 30px;
  }

  .site-content {
    width: calc(100% - 56px);
  }

  .detail-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .image-editor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .site-header {
    min-height: 98px;
    padding: 28px 20px;
  }

  .logo {
    font-size: 36px;
  }

  .site-content {
    width: calc(100% - 40px);
  }

  .project-grid {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .project-card span {
    font-size: 18px;
    padding: 24px;
  }

  .detail-gallery {
    grid-template-columns: 1fr;
  }

  .related-grid {
    grid-template-columns: 1fr;
  }

  .artwork-item {
    grid-column: 1 / -1;
  }

  .project-detail {
    padding-bottom: 60px;
  }

  .detail-title {
    font-size: min(var(--detail-title-size, 24px), 24px);
  }

  .lightbox {
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    grid-template-rows: 56px minmax(0, 1fr) 40px;
  }

  .lightbox-close {
    width: 52px;
    height: 52px;
    font-size: 32px;
  }

  .lightbox-prev,
  .lightbox-next {
    width: 48px;
    height: 72px;
    font-size: 42px;
  }

  .key-row,
  .admin-head,
  .settings-grid,
  .image-editor-controls {
    display: grid;
  }

  .image-editor-grid {
    grid-template-columns: 1fr;
  }

  .footer {
    padding-top: 54px;
  }
}

body {
  background: #000;
  color: #f5f5f5;
}

button,
.import-button {
  border-color: #f5f5f5;
  background: #f5f5f5;
  color: #000;
}

button:hover,
.import-button:hover {
  background: #dcdcdc;
}

.secondary-button {
  border-color: #f5f5f5;
  background: transparent;
  color: #f5f5f5;
}

.secondary-button:hover {
  background: #171717;
}

.danger-button {
  border-color: #9d1b1b;
  background: #9d1b1b;
  color: #fff;
}

.danger-button:hover {
  background: #7f1515;
}

.menu-button span {
  background: #f5f5f5;
}

.project-card,
.related-card,
.artwork-item,
.editor-image-item,
.preview-box {
  background: #000;
}

.nav a,
.mobile-nav a {
  opacity: 0.55;
}

.nav a:hover,
.nav a.active,
.mobile-nav a:hover,
.mobile-nav a.active,
.back-link:hover {
  color: #fff;
  opacity: 1;
}

.back-link,
.footer,
.detail-category,
.detail-text,
.admin p,
.contact p,
.image-editor-status,
.settings-note,
.project-edit-toolbar,
.add-artwork-panel label,
.drop-zone span,
.editor-drop-zone span,
.cover-drop-zone span {
  color: #aaa;
}

.admin-login,
.admin-panel {
  border-top-color: #222;
}

input,
select,
textarea,
.image-editor-controls select,
.add-artwork-panel select {
  border-color: #777;
  background: #080808;
  color: #fff;
}

input::placeholder,
textarea::placeholder {
  color: #777;
}

.editor-drop-zone,
.cover-drop-zone,
.add-artwork-panel,
.drop-zone {
  border-color: #777;
  background: #080808;
  color: #fff;
}

.editor-drop-zone.is-dragging,
.cover-drop-zone.is-dragging,
.drop-zone.is-dragging {
  border-color: #fff;
  background: #1a1a1a;
}

.editor-open-project {
  border-color: #fff;
}

.lightbox {
  background: rgba(0, 0, 0, 0.92);
  color: #fff;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  color: #fff;
}

body.menu-open .mobile-panel {
  border-top-color: #222;
}
