:root {
  color-scheme: dark;
  --bg: #111111;
  --bg-soft: #181818;
  --panel: rgba(24, 24, 24, 0.9);
  --panel-solid: #1f1f1f;
  --text: #f5f2ec;
  --muted: #b8b0a5;
  --line: rgba(245, 242, 236, 0.16);
  --accent: #ff6b4a;
  --accent-2: #42d0b4;
  --accent-3: #d5f46a;
  --danger: #ff5b6b;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root,
:root[data-theme="dark"] {
  --switch-track: linear-gradient(180deg, #313131, #171717);
  --switch-border: rgba(245, 242, 236, 0.2);
  --switch-border-hover: rgba(245, 242, 236, 0.34);
  --switch-text: #f5f2ec;
  --switch-thumb: linear-gradient(180deg, #69645c, #35312d);
  --switch-shadow:
    inset 0 2px 5px rgba(0, 0, 0, 0.58),
    inset 0 -1px 1px rgba(255, 255, 255, 0.08),
    0 1px 0 rgba(255, 255, 255, 0.04);
  --switch-thumb-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.26),
    inset 0 -2px 3px rgba(0, 0, 0, 0.32),
    0 3px 7px rgba(0, 0, 0, 0.48),
    0 1px 1px rgba(0, 0, 0, 0.42);
  --switch-focus-ring: color-mix(in srgb, var(--text) 20%, transparent);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f5ef;
  --bg-soft: #ebe7dd;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-solid: #fffdfa;
  --text: #171614;
  --muted: #655f57;
  --line: rgba(23, 22, 20, 0.14);
  --accent: #d7432a;
  --accent-2: #007e71;
  --accent-3: #516c00;
  --danger: #b91f35;
  --shadow: 0 24px 70px rgba(42, 35, 23, 0.17);
  --switch-track: linear-gradient(180deg, #f7f7f5, #e7e7e3);
  --switch-border: #cfcfcf;
  --switch-border-hover: #bdbdb8;
  --switch-text: #151515;
  --switch-thumb: linear-gradient(180deg, #fffdf8, #c9c7c0);
  --switch-shadow:
    inset 0 2px 5px rgba(0, 0, 0, 0.16),
    inset 0 -1px 1px rgba(255, 255, 255, 0.86),
    0 1px 0 rgba(255, 255, 255, 0.62);
  --switch-thumb-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.92),
    inset 0 -2px 3px rgba(0, 0, 0, 0.12),
    0 3px 7px rgba(0, 0, 0, 0.22),
    0 1px 1px rgba(0, 0, 0, 0.14);
  --switch-focus-ring: color-mix(in srgb, var(--text) 14%, transparent);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

@media (prefers-reduced-motion: no-preference) {
  body {
    animation: pageFade 0.5s ease both;
  }
}

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

button,
a {
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  text-decoration: none;
}

.hero-video {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  object-fit: cover;
  object-position: center center;
  z-index: -2;
  background: var(--bg);
}

.hero-shade {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.24), rgba(0, 0, 0, 0.04) 48%, var(--bg) 94%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.34), rgba(0, 0, 0, 0.02));
  pointer-events: none;
}

:root[data-theme="light"] .hero-shade {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(247, 245, 239, 0.02) 45%, var(--bg) 94%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.02));
}

.topbar,
.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  padding: 18px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 68%, transparent);
  backdrop-filter: blur(18px);
}

.admin-topbar {
  grid-template-columns: 1fr auto 1fr;
}

.brand {
  font-weight: 800;
  letter-spacing: 0;
  min-width: max-content;
}

.topnav {
  display: flex;
  justify-content: center;
  gap: clamp(14px, 3vw, 34px);
  color: var(--muted);
}

.topnav a {
  position: relative;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  transition: color 0.18s ease, transform 0.18s ease;
}

.topnav a::after {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2px;
  height: 1px;
  content: "";
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.18s ease;
}

.topnav a:hover {
  color: var(--text);
  transform: translateY(-1px);
}

.topnav a:hover::after {
  transform: scaleX(1);
}

.controls,
.save-row,
.admin-actions,
.media-toolbar,
.filter-row,
.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.controls {
  justify-content: flex-end;
}

.icon-button,
.text-button,
.primary-button,
.secondary-button,
.danger-button,
.filter-button,
.contact-link {
  min-height: 40px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 0 14px;
  background: var(--panel);
  color: var(--text);
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.icon-button {
  width: 42px;
  padding: 0;
}

.primary-button,
.contact-link {
  border-color: transparent;
  background: var(--text);
  color: var(--bg);
  font-weight: 800;
}

.primary-button:hover,
.secondary-button:hover,
.danger-button:hover,
.filter-button:hover,
.contact-link:hover {
  transform: translateY(-2px);
}

.theme-switch,
.language-switch {
  position: relative;
  isolation: isolate;
  display: inline-grid;
  align-items: center;
  height: 42px;
  border: 1px solid var(--switch-border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--switch-track);
  color: var(--switch-text);
  box-shadow: var(--switch-shadow);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.theme-switch:hover,
.language-switch:hover {
  border-color: var(--switch-border-hover);
  box-shadow: var(--switch-shadow);
}

.theme-switch:focus-visible,
.theme-switch.is-focused,
.language-switch:focus-visible,
.language-switch.is-focused {
  outline: 2px solid color-mix(in srgb, var(--text) 72%, transparent);
  outline-offset: 4px;
  box-shadow: var(--switch-shadow), 0 0 0 5px var(--switch-focus-ring);
}

.theme-switch {
  grid-template-columns: 42px 42px;
  column-gap: 6px;
  width: 104px;
  padding: 0 7px;
}

.language-switch {
  grid-template-columns: 58px 58px;
  column-gap: 4px;
  width: 134px;
  padding: 0 7px;
  font-weight: 800;
}

.language-switch span:not(.switch-thumb) {
  display: inline-grid;
  place-items: center;
  width: 100%;
  height: 30px;
  z-index: 1;
  font-size: 0.82rem;
  line-height: 1;
}

.switch-thumb {
  position: absolute;
  top: 50%;
  left: 7px;
  width: 42px;
  height: 30px;
  border-radius: 999px;
  background: var(--switch-thumb);
  box-shadow: var(--switch-thumb-shadow);
  transform: translate(0, -50%);
  transition: transform 0.2s ease, background 0.18s ease, box-shadow 0.18s ease;
  z-index: 0;
}

.language-switch .switch-thumb {
  width: 58px;
}

.theme-switch.is-dark .switch-thumb {
  transform: translate(48px, -50%);
}

.language-switch.is-zh .switch-thumb {
  transform: translate(62px, -50%);
}

.sun-icon,
.moon-icon {
  position: relative;
  z-index: 1;
  width: 18px;
  height: 18px;
  align-self: center;
  justify-self: center;
}

.sun-icon {
  background:
    linear-gradient(currentColor, currentColor) center top / 2px 4px no-repeat,
    linear-gradient(currentColor, currentColor) center bottom / 2px 4px no-repeat,
    linear-gradient(currentColor, currentColor) left center / 4px 2px no-repeat,
    linear-gradient(currentColor, currentColor) right center / 4px 2px no-repeat;
}

.sun-icon::before {
  position: absolute;
  inset: 5px;
  content: "";
  border: 2px solid currentColor;
  border-radius: 50%;
}

.moon-icon {
  border-radius: 50%;
  box-shadow: inset 5px 0 0 currentColor;
}

.secondary-button,
.filter-button {
  color: var(--muted);
}

.danger-button {
  border-color: color-mix(in srgb, var(--danger) 48%, var(--line));
  color: var(--danger);
}

.filter-button.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.hero {
  min-height: calc(100vh - 78px);
  display: flex;
  align-items: flex-end;
  padding: 64px clamp(18px, 5vw, 72px) min(14vh, 120px);
}

.hero-copy {
  width: min(760px, 100%);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(3.1rem, 8.5vw, 8rem);
  line-height: 0.92;
  max-width: 11ch;
}

h2 {
  font-size: clamp(2rem, 4vw, 4.5rem);
  line-height: 0.98;
}

.hero-copy p:last-child {
  max-width: 680px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.3rem);
  line-height: 1.55;
}

.section-band,
.contact-band {
  background: var(--bg);
  padding: 72px clamp(18px, 5vw, 72px);
}

.section-head,
.contact-band {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: end;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
  margin-top: 38px;
}

.project-card {
  grid-column: span 4;
  display: block;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--panel-solid);
  border-radius: var(--radius);
  overflow: clip;
  box-shadow: var(--shadow);
  text-align: left;
  padding: 0;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.project-card:hover {
  border-color: color-mix(in srgb, var(--accent-2) 46%, var(--line));
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.44);
  transform: translateY(-8px);
}

.project-card:nth-child(5n + 1),
.project-card:nth-child(5n + 2) {
  grid-column: span 6;
}

.project-card:focus-visible,
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

.thumb {
  aspect-ratio: 4 / 3;
  background: var(--bg-soft);
  overflow: hidden;
}

.thumb img,
.thumb video,
.dialog-media img,
.dialog-media video,
.project-media img,
.project-media video,
.media-tile img,
.media-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.28s ease, filter 0.28s ease;
}

.project-card:hover .thumb img,
.project-card:hover .thumb video {
  filter: saturate(1.08) contrast(1.04);
  transform: scale(1.045);
}

@media (prefers-reduced-motion: no-preference) {
  .thumb img.is-animated-photo {
    animation: previewDrift 7s ease-in-out infinite alternate;
    transform-origin: center;
  }

  .project-card:hover .thumb img.is-animated-photo {
    animation-play-state: paused;
  }
}

.project-meta {
  padding: 18px;
}

.project-meta h3 {
  margin: 0 0 10px;
  font-size: clamp(1.15rem, 2vw, 1.55rem);
}

.project-meta p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.meta-line {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.9rem;
}

.contact-band {
  border-top: 1px solid var(--line);
  min-height: 38vh;
}

.contact-band h2 {
  max-width: 820px;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.project-dialog {
  width: min(1120px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  background: var(--panel-solid);
  color: var(--text);
  box-shadow: var(--shadow);
}

.project-dialog::backdrop {
  background: rgba(0, 0, 0, 0.64);
}

.close-button {
  position: sticky;
  top: 12px;
  margin: 12px 12px 0 auto;
  z-index: 2;
  display: block;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.dialog-content {
  padding: 10px 22px 28px;
}

.dialog-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.38fr);
  gap: 28px;
  margin-bottom: 24px;
}

.dialog-heading p {
  color: var(--muted);
  line-height: 1.6;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  font-size: 0.86rem;
}

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

.dialog-media {
  min-height: 220px;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--bg-soft);
}

body[data-page="admin"] {
  background: var(--bg);
}

body[data-page="project"] {
  background: var(--bg);
}

body[data-page="contact"] {
  background: var(--bg);
}

.project-page {
  padding: 72px clamp(18px, 5vw, 72px);
}

.contact-page {
  padding: 72px clamp(18px, 5vw, 72px);
}

.contact-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.5fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: end;
  padding-bottom: 48px;
  border-bottom: 1px solid var(--line);
}

.contact-hero h1 {
  max-width: 12ch;
}

.contact-direct p {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.65;
}

.contact-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding-top: 34px;
  max-width: 960px;
}

.contact-form-wide,
.contact-submit {
  grid-column: 1 / -1;
}

.contact-submit {
  width: fit-content;
  padding-inline: 22px;
}

.back-button {
  position: sticky;
  top: 92px;
  z-index: 8;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  margin-bottom: 28px;
  border: 1px solid color-mix(in srgb, var(--text) 18%, var(--line));
  border-radius: 999px;
  padding: 0 14px;
  background: color-mix(in srgb, var(--panel-solid) 94%, transparent);
  color: var(--text);
  backdrop-filter: blur(18px);
  box-shadow: none;
  transition: color 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.back-button.is-floating {
  box-shadow:
    0 14px 36px rgba(0, 0, 0, 0.24),
    0 2px 8px rgba(0, 0, 0, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.back-button:hover {
  border-color: color-mix(in srgb, var(--accent-2) 45%, var(--line));
  color: var(--text);
  transform: translateX(-2px);
}

.back-button.is-floating:hover {
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.28),
    0 3px 12px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.project-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.45fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: end;
  padding-bottom: 48px;
  border-bottom: 1px solid var(--line);
}

.project-hero h1 {
  max-width: 12ch;
}

.project-summary p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.project-gallery {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
  padding-top: 34px;
  align-items: start;
}

.project-media {
  display: grid;
  grid-column: span 6;
  place-items: center;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  transition: transform 0.22s ease, border-color 0.22s ease;
}

.project-media-trigger {
  display: grid;
  width: 100%;
  min-height: 100%;
  place-items: center;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  cursor: zoom-in;
}

.project-gallery.is-single .project-media {
  grid-column: 2 / span 10;
}

.project-gallery.is-pair .project-media {
  grid-column: span 6;
}

.project-gallery.is-many .project-media {
  grid-column: span 4;
}

.project-gallery.is-many .project-media.is-video {
  grid-column: span 6;
}

.project-media:hover {
  border-color: color-mix(in srgb, var(--accent-2) 45%, var(--line));
  transform: translateY(-5px);
}

.project-media:hover img,
.project-media:hover video {
  transform: scale(1.02);
}

.project-media img,
.project-media video {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: min(72vh, 760px);
  object-fit: contain;
}

.media-dialog {
  width: min(1180px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  background: var(--panel-solid);
  color: var(--text);
  box-shadow: var(--shadow);
}

.media-dialog::backdrop {
  background: rgba(0, 0, 0, 0.68);
}

.media-dialog-content {
  display: grid;
  gap: 18px;
  padding: 10px 22px 28px;
}

.media-dialog-media {
  display: grid;
  min-height: 220px;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--bg-soft);
}

.media-dialog-media img,
.media-dialog-media video {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: min(74vh, 780px);
  object-fit: contain;
}

.media-dialog-copy h2 {
  font-size: clamp(1.5rem, 3vw, 3rem);
}

.media-dialog-copy p:last-child {
  max-width: 760px;
  color: var(--muted);
  line-height: 1.6;
}

.admin-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: calc(100vh - 77px);
}

.admin-sidebar {
  border-right: 1px solid var(--line);
  padding: 18px;
  background: var(--bg-soft);
}

.admin-login,
.admin-actions {
  margin-bottom: 16px;
}

.admin-login {
  display: grid;
  gap: 10px;
}

.admin-list {
  display: grid;
  gap: 8px;
}

.admin-empty {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.admin-list button {
  width: 100%;
  min-height: 52px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-solid);
  color: var(--text);
  padding: 10px 12px;
}

.admin-list button.is-active {
  border-color: var(--accent);
}

.admin-editor {
  min-width: 0;
  padding: 24px clamp(18px, 4vw, 44px) 60px;
}

.editor-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  margin-bottom: 22px;
}

.editor-head h1 {
  font-size: clamp(2rem, 4vw, 4.4rem);
  line-height: 1;
}

.project-form {
  display: grid;
  gap: 18px;
  min-width: 0;
}

fieldset {
  min-width: 0;
  min-inline-size: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--panel-solid);
}

legend {
  padding: 0 8px;
  color: var(--accent-2);
  font-weight: 800;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.92rem;
  min-width: 0;
}

input,
textarea,
select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  padding: 11px 12px;
}

button:disabled,
input:disabled,
textarea:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

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

.check-row {
  margin: 14px 0;
}

.check-row label {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
}

.check-row input {
  width: 18px;
  height: 18px;
}

.media-toolbar {
  margin: 12px 0;
}

.media-toolbar input {
  width: min(420px, 100%);
}

.media-toolbar input[type="file"] {
  width: min(280px, 100%);
  padding: 8px 10px;
}

.media-scope {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.media-library {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  max-height: 560px;
  overflow: auto;
  padding-right: 4px;
}

.media-tile {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
}

.media-tile input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.media-tile.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent);
}

.media-tile.is-cover {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-2) 34%, transparent);
}

.media-tile.is-extra {
  border-style: dashed;
}

.media-preview {
  aspect-ratio: 4 / 3;
  background: var(--bg-soft);
}

.media-tile-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  padding: 8px;
}

.media-select,
.cover-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-solid);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 800;
}

.media-select {
  display: grid;
  place-items: center;
  cursor: pointer;
}

.cover-button {
  padding: 0 10px;
}

.media-tile.is-selected .media-select {
  border-color: var(--accent);
  color: var(--accent);
}

.media-tile.is-cover .cover-button {
  border-color: var(--accent-2);
  background: color-mix(in srgb, var(--accent-2) 18%, var(--panel-solid));
  color: var(--accent-2);
}

.media-name {
  display: block;
  padding: 8px;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.cover-status {
  margin: 10px 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel-solid);
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.empty-state {
  grid-column: 1 / -1;
  min-height: 200px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--panel-solid);
}

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

  .back-button {
    top: 142px;
  }

  .topnav {
    grid-column: 1 / -1;
    justify-content: flex-start;
    order: 3;
  }

  .project-card,
  .project-card:nth-child(5n + 1),
  .project-card:nth-child(5n + 2) {
    grid-column: span 6;
  }

  .dialog-heading,
  .contact-hero,
  .project-hero,
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 52vh;
    overflow: auto;
  }
}

@media (max-width: 680px) {
  .topbar,
  .admin-topbar {
    padding: 14px 16px;
  }

  .brand {
    min-width: 0;
  }

  .hero {
    min-height: calc(100vh - 118px);
    padding: 48px 18px 72px;
  }

  h1 {
    font-size: clamp(2.6rem, 16vw, 4.6rem);
  }

  .section-band,
  .contact-band {
    padding: 54px 18px;
  }

  .section-head,
  .contact-band,
  .editor-head {
    display: grid;
    align-items: start;
  }

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

  .project-card,
  .project-card:nth-child(5n + 1),
  .project-card:nth-child(5n + 2) {
    grid-column: auto;
  }

  .dialog-gallery,
  .project-gallery,
  .contact-form,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .project-media,
  .project-gallery.is-single .project-media,
  .project-gallery.is-pair .project-media,
  .project-gallery.is-many .project-media,
  .project-gallery.is-many .project-media.is-video {
    grid-column: auto;
  }

  .admin-actions,
  .save-row {
    width: 100%;
  }

  .admin-actions button,
  .save-row button {
    flex: 1 1 140px;
  }
}

@keyframes pageFade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes previewDrift {
  from {
    transform: scale(1.01) translate3d(-1.2%, -0.8%, 0);
  }

  to {
    transform: scale(1.08) translate3d(1.2%, 0.8%, 0);
  }
}
