/* ============================================================
   We're in the Band!
   Blue fade palette + engraved typography
   ============================================================ */

:root {
  /* Warm eggshell palette: pale parchment at the top of every gradient,
     deepening to a darker eggshell at the base and edge. */
  --fade-top: #fdfbf3;
  --fade-upper: #f3ecdc;
  --fade-mid: #e4dac3;
  --fade-lower: #cfc2a5;
  --fade-bottom: #b5a787;
  --fade-edge: #9d8e6d;
  --ink: #362d1c;
  --engrave: 0 1px 0 rgba(255, 255, 255, 0.9), 0 -1px 1px rgba(48, 40, 26, 0.45);
}

/* General Reset */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: var(--ink);
  text-shadow: var(--engrave);
  /* The concert photo sits behind the whole site as a sepia print, unmasked,
     so the picture reads at full strength; the cards and nav carry their own
     pale surfaces to keep the text legible. */
  background-image: url('/assets/welcome-sepia.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-color: #241d12;
  min-height: 100vh;
  padding-bottom: 3.2rem;
}

/* Welcome screen */
body.pre-entry {
  overflow: hidden;
}

body.pre-entry .site-title,
body.pre-entry nav,
body.pre-entry main,
body.pre-entry footer {
  display: none;
}

.welcome {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 1rem 8vh;
  background: url('/assets/welcome-sepia.jpg') center / cover no-repeat;
  background-size: cover;
  background-color: #241d12;
  transition: opacity 0.5s ease;
}

.welcome.hidden {
  opacity: 0;
  pointer-events: none;
}

.enter-btn {
  padding: 0.85rem 3.2rem;
  border: 1px solid transparent;
  border-radius: 40px;
  font-family: inherit;
  font-size: 1.25rem;
  font-weight: bold;
  letter-spacing: 5px;
  text-transform: uppercase;
  color: var(--ink);
  cursor: pointer;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95),
    0 -1px 1px rgba(40, 32, 18, 0.55);
  background-image:
    linear-gradient(to bottom, var(--fade-top) 0%, var(--fade-mid) 55%, var(--fade-lower) 100%),
    linear-gradient(to bottom, var(--fade-upper) 0%, var(--fade-bottom) 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow:
    0 10px 26px rgba(36, 28, 14, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
  transition: transform 0.15s, box-shadow 0.25s, background-image 0.25s;
}

.enter-btn:hover {
  transform: translateY(-2px);
  background-image:
    linear-gradient(to bottom, var(--fade-upper) 0%, var(--fade-lower) 60%, var(--fade-bottom) 100%),
    linear-gradient(to bottom, var(--fade-lower) 0%, #8a7a56 100%);
  box-shadow:
    0 14px 32px rgba(36, 28, 14, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.enter-btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 4px;
}

/* App Container */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
}

/* Site Title - engraved, top left */
.site-title {
  position: fixed;
  top: 1.25rem;
  left: 2rem;
  max-width: 60vw;
  /* Heavy, poster-weight lettering. */
  font-family: "Arial Black", "Arial Bold", Impact, Haettenschweiler, "Franklin Gothic Heavy", sans-serif;
  font-weight: 900;
  font-size: clamp(2rem, 4.4vw, 3.8rem);
  line-height: 0.98;
  letter-spacing: 0.02em;
  text-transform: none;
  text-decoration: none;
  z-index: 100;
  padding: 0;
  /* Solid eggshell letters standing proud of the print: lit across the top of
     the face, shaded along the bottom, then extruded to the lower right. */
  color: #e8c877;
  background-image: linear-gradient(
    172deg,
    #fff4c6 0%,
    #f6d98b 18%,
    #e4ba5c 46%,
    #cb9a31 72%,
    #a2741a 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  opacity: 0.97;
  text-shadow: none;
  filter:
    drop-shadow(0 -2px 0 rgba(62, 50, 30, 0.45))
    drop-shadow(1.5px 1.5px 0 #cfc5aa)
    drop-shadow(1.5px 1.5px 0 #c7bda1)
    drop-shadow(1.5px 1.5px 0 #bfb598)
    drop-shadow(1.5px 1.5px 0 #b7ad90)
    drop-shadow(1.5px 1.5px 0 #afa587)
    drop-shadow(1.5px 1.5px 0 #a79c7e)
    drop-shadow(1.5px 1.5px 0 #9f9475)
    drop-shadow(1.5px 1.5px 0 #978b6c)
    drop-shadow(1.5px 1.5px 0 #8f8363)
    drop-shadow(1.5px 1.5px 0 #877a5a)
    drop-shadow(1.5px 1.5px 0 #7f7251)
    drop-shadow(1.5px 1.5px 0 #776a48)
    drop-shadow(0 2px 0 #1c1509)
    drop-shadow(5px 26px 0 #14100a);
  transition: opacity 0.35s ease;
}

/* The chiselled groove under the name, fading away to the right. */
.site-title::after {
  content: "";
  display: block;
  height: 4px;
  margin-top: 0.85rem;
  border-radius: 4px;
  background-image: linear-gradient(
    to right,
    rgba(66, 60, 44, 0.55) 0%,
    rgba(240, 236, 222, 0.85) 45%,
    rgba(66, 60, 44, 0.06) 100%
  );
  box-shadow:
    0 -2px 0 rgba(255, 255, 255, 0.55),
    0 2px 2px rgba(40, 34, 22, 0.35);
}

.site-title:hover,
.site-title:focus-visible {
  opacity: 1;
}

/* Navigation */
nav {
  position: fixed;
  top: 1.5rem;
  right: 2rem;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  z-index: 90;
}

nav a,
nav button {
  color: var(--ink);
  text-decoration: none;
  font-family: inherit;
  font-weight: bold;
  font-size: 0.9rem;
  padding: 0.45rem 1rem;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 20px;
  background-image:
    linear-gradient(to bottom, var(--fade-top) 0%, var(--fade-mid) 100%),
    linear-gradient(to bottom, var(--fade-upper) 0%, var(--fade-edge) 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: 0 2px 6px rgba(54, 45, 28, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: background-image 0.3s, box-shadow 0.3s, transform 0.15s;
}

nav a:hover,
nav button:hover {
  background-image:
    linear-gradient(to bottom, var(--fade-mid) 0%, var(--fade-lower) 100%),
    linear-gradient(to bottom, var(--fade-mid) 0%, var(--fade-bottom) 100%);
  box-shadow: 0 4px 10px rgba(54, 45, 28, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transform: translateY(-1px);
}

/* Main Content Area - the canvas spans the whole window so cards can be
   placed against any edge, not just inside a centred column. */
.main-content {
  margin-top: 7rem;
  width: 100%;
  max-width: none;
  padding: 2rem 0;
}

/* All four cards live on one canvas and can be placed freely.
   Only one of them is on the page at a time. */
.panel-columns {
  position: relative;
  display: block;
  width: 100%;
  min-height: 200px;
}

.panel {
  position: absolute;
  display: flex;
  flex-direction: column;
  width: 48.5%;
  max-width: none;
  margin: 0;
  padding: 1rem;
  overflow: hidden;
}

/* Only the card picked in the nav is visible */
.panel:not(.is-active) {
  display: none;
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes panel-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-6px); }
}

.panel.is-active {
  animation: panel-in 0.22s ease-out;
}

.panel.panel-leaving {
  animation: panel-out 0.14s ease-in forwards;
  pointer-events: none;
}

/* A nav link with no saved page is dimmed and inert */
nav a.nav-link-empty {
  opacity: 0.5;
  cursor: default;
}

nav a.nav-link-empty:hover {
  transform: none;
  box-shadow: 0 2px 6px rgba(54, 45, 28, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* Shows what the Spotify / YouTube buttons will open */
.link-state {
  margin: 0.35rem 0 0;
  font-size: 0.72rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
  opacity: 0.8;
}

.link-state.is-set {
  opacity: 1;
}

.link-state a {
  color: var(--ink);
  font-weight: bold;
  text-decoration: underline;
}

/* Highlight the nav button of the card you jumped to */
nav [data-panel][aria-current="true"] {
  background-image:
    linear-gradient(to bottom, var(--fade-lower) 0%, var(--fade-bottom) 100%),
    linear-gradient(to bottom, var(--fade-bottom) 0%, #8a7a56 100%);
  box-shadow: 0 4px 10px rgba(54, 45, 28, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.panel .content-grid {
  grid-template-columns: 1fr;
  gap: 1rem;
}

/* Cards Grid */
.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  width: 100%;
}

/* Shared blue fade card surface (audio, video, forms, expandable) */
.audio-card,
.video-card,
.media-card,
.upload-form,
.expandable-card {
  position: relative;
  border: 1px solid transparent;
  border-radius: 12px;
  background-image:
    linear-gradient(to bottom, rgba(253, 251, 243, 0.98) 0%, rgba(223, 214, 193, 0.96) 100%),
    linear-gradient(to bottom, var(--fade-upper) 0%, var(--fade-bottom) 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow:
    0 4px 15px rgba(54, 45, 28, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: transform 0.2s, box-shadow 0.2s;
}

.audio-card,
.video-card {
  padding: 1.6rem 1.4rem 1.4rem;
}

.audio-card:hover,
.video-card:hover {
  transform: translateY(-4px);
  box-shadow:
    0 10px 22px rgba(54, 45, 28, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

/* Category labels on cards */
.audio-card .category-label,
.video-card .category-label {
  position: absolute;
  top: 0.7rem;
  left: 0.7rem;
  padding: 3px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 0.6rem;
  font-weight: bold;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  background-image:
    linear-gradient(to bottom, var(--fade-mid) 0%, var(--fade-lower) 100%),
    linear-gradient(to bottom, var(--fade-lower) 0%, var(--fade-bottom) 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.audio-card h3,
.video-card h3 {
  margin: 1.5rem 0 0.4rem;
  color: var(--ink);
  font-size: 1.2rem;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95),
    0 -1px 1px rgba(40, 32, 18, 0.45);
}

.audio-card p,
.video-card p {
  margin: 0.2rem 0;
  font-size: 0.85rem;
  color: var(--ink);
  opacity: 0.9;
}

/* Audio Player within card */
.audio-player {
  width: 100%;
  margin: 0.6rem 0;
}

/* Video Preview - YouTube style */
.video-preview {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid transparent;
  border-radius: 6px;
  margin: 0.25rem 0;
  overflow: hidden;
  position: relative;
  background: #000;
  cursor: pointer;
}

.video-preview video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* Still frame shown until a video is chosen */
.video-poster {
  pointer-events: none;
}

#videoPlayer {
  z-index: 1;
}

/* With no source loaded the player stays clear, so the preview shows */
#videoPlayer:not([src]) {
  background: transparent;
}

/* Action Buttons */
.action-buttons {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
}

.action-buttons button,
.track-actions button,
.upload-form button,
.admin-modal-button {
  flex: 1;
  padding: 0.55rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: bold;
  color: var(--ink);
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95),
    0 -1px 1px rgba(40, 32, 18, 0.4);
  cursor: pointer;
  background-image:
    linear-gradient(to bottom, var(--fade-top) 0%, var(--fade-mid) 60%, var(--fade-lower) 100%),
    linear-gradient(to bottom, var(--fade-mid) 0%, var(--fade-edge) 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow:
    0 2px 6px rgba(54, 45, 28, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
  transition: background-image 0.25s, box-shadow 0.25s, transform 0.15s;
}

.action-buttons button:hover:not(:disabled),
.track-actions button:hover:not(:disabled),
.upload-form button:hover,
.admin-modal-button:hover {
  background-image:
    linear-gradient(to bottom, var(--fade-upper) 0%, var(--fade-lower) 100%),
    linear-gradient(to bottom, var(--fade-lower) 0%, var(--fade-bottom) 100%);
  box-shadow:
    0 5px 12px rgba(54, 45, 28, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
  transform: translateY(-1px);
}

/* Upload Form */
.upload-form {
  padding: 2rem;
  margin: 2rem 0;
  max-width: 500px;
  width: 100%;
}

.upload-form h2 {
  margin-top: 0;
  color: var(--ink);
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95),
    0 -1px 1px rgba(40, 32, 18, 0.5);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.upload-form .form-group {
  margin-bottom: 1rem;
}

.upload-form label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: bold;
  color: var(--ink);
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95),
    0 -1px 1px rgba(40, 32, 18, 0.4);
}

.upload-form input,
.upload-form select {
  width: 100%;
  padding: 0.5rem;
  font-family: inherit;
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: 5px;
  background-image:
    linear-gradient(to bottom, #ffffff 0%, var(--fade-upper) 100%),
    linear-gradient(to bottom, var(--fade-mid) 0%, var(--fade-edge) 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
}

.upload-form button {
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.75rem;
  font-size: 0.95rem;
}

/* Media card: player + track list */
.media-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  gap: 0.7rem;
  padding: 0.9rem;
}

.now-playing {
  margin: 0;
}

.now-label {
  display: block;
  margin-bottom: 0.15rem;
  font-size: 0.6rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  opacity: 0.8;
}

.now-playing p {
  margin: 0;
  font-size: 0.9rem;
  font-weight: bold;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-actions {
  display: flex;
  gap: 0.5rem;
}

.track-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 320px;
  overflow-y: auto;
}

.track-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  background-image:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.9) 0%, rgba(243, 236, 220, 0.95) 100%),
    linear-gradient(to bottom, var(--fade-mid) 0%, var(--fade-edge) 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  transition: background-image 0.2s, transform 0.12s;
}

.track-item:hover {
  transform: translateX(2px);
  background-image:
    linear-gradient(to bottom, var(--fade-upper) 0%, var(--fade-lower) 100%),
    linear-gradient(to bottom, var(--fade-lower) 0%, var(--fade-bottom) 100%);
}

.track-item:focus-visible {
  outline: 2px solid var(--fade-edge);
  outline-offset: 2px;
}

.track-item.active {
  background-image:
    linear-gradient(to bottom, var(--fade-bottom) 0%, var(--fade-edge) 100%),
    linear-gradient(to bottom, var(--fade-edge) 0%, #8a7a56 100%);
  color: #fdfaf0;
  text-shadow: 0 1px 1px rgba(40, 32, 18, 0.65);
}

.track-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.85rem;
  font-weight: bold;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Inline name editor on a song or video row */
.rename-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.2rem 0.35rem;
  border: 1px solid var(--fade-edge);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: bold;
  color: var(--ink);
  text-shadow: none;
  background: #fffdf6;
}

.rename-input:focus {
  outline: 2px solid var(--fade-edge);
  outline-offset: 1px;
}

.row-save {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.28rem 0.55rem;
  border: 1px solid transparent;
  border-radius: 5px;
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: bold;
  letter-spacing: 0.5px;
  color: var(--ink);
  text-shadow: var(--engrave);
  cursor: pointer;
  background-image:
    linear-gradient(to bottom, var(--fade-top) 0%, var(--fade-mid) 100%),
    linear-gradient(to bottom, var(--fade-mid) 0%, var(--fade-edge) 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: 0 1px 4px rgba(54, 45, 28, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.row-save:hover {
  background-image:
    linear-gradient(to bottom, var(--fade-upper) 0%, var(--fade-lower) 100%),
    linear-gradient(to bottom, var(--fade-lower) 0%, var(--fade-bottom) 100%);
  transform: translateY(-1px);
}

.track-meta {
  flex: 0 0 auto;
  font-size: 0.68rem;
  opacity: 0.75;
  white-space: nowrap;
}

.list-empty {
  padding: 0.35rem 0.2rem;
  font-size: 0.8rem;
  opacity: 0.75;
}

.track-actions button:disabled {
  opacity: 0.55;
  cursor: default;
  transform: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

/* Expandable Cards */
.expandable-card {
  padding: 1.5rem;
  margin: 1.2rem 0;
  cursor: default;
}

.expandable-card:hover {
  box-shadow:
    0 10px 22px rgba(54, 45, 28, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.expandable-card .toggle {
  display: block;
  width: 100%;
  padding: 0.9rem 1.1rem;
  border: 1px solid transparent;
  border-radius: 7px;
  text-align: left;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 2px;
  cursor: default;
  margin: 0 0 0.9rem;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95),
    0 -1px 1px rgba(40, 32, 18, 0.5);
  background-image:
    linear-gradient(to bottom, var(--fade-upper) 0%, var(--fade-mid) 100%),
    linear-gradient(to bottom, var(--fade-mid) 0%, var(--fade-edge) 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.expandable-card .toggle:hover {
  background-image:
    linear-gradient(to bottom, var(--fade-mid) 0%, var(--fade-lower) 100%),
    linear-gradient(to bottom, var(--fade-lower) 0%, var(--fade-bottom) 100%);
}

.expandable-card .content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
  color: var(--ink);
}

.expandable-card .content p {
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

.panel .content p {
  font-size: 0.85rem;
}

/* Expanded state */
.expandable-card.expanded .content {
  max-height: 2600px;
}

/* Footer */
footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 400;
  padding: 0.7rem 1rem;
  width: 100%;
  text-align: center;
  color: var(--ink);
  font-size: 0.8rem;
  background-image: linear-gradient(to top, var(--fade-lower) 0%, rgba(243, 236, 220, 0.9) 100%);
  border-top: 1px solid transparent;
  border-image: linear-gradient(to right, var(--fade-mid), var(--fade-bottom)) 1;
  backdrop-filter: blur(4px);
}

/* Admin Modal */
.admin-modal {
  display: none;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, rgba(54, 45, 28, 0.55) 0%, rgba(54, 45, 28, 0.85) 100%);
  z-index: 1000;
}

.admin-modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, calc(100vw - 2rem));
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
  padding: 2rem;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--ink);
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95),
    0 -1px 1px rgba(40, 32, 18, 0.45);
  background-image:
    linear-gradient(to bottom, var(--fade-top) 0%, var(--fade-mid) 100%),
    linear-gradient(to bottom, var(--fade-upper) 0%, var(--fade-bottom) 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: 0 18px 40px rgba(36, 28, 14, 0.5);
}

.admin-modal-content h3 {
  margin-top: 0;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95),
    0 -1px 1px rgba(40, 32, 18, 0.5);
}

.admin-modal-input {
  width: 100%;
  padding: 0.5rem;
  margin: 0.6rem 0;
  font-family: inherit;
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: 5px;
  background-image:
    linear-gradient(to bottom, #ffffff 0%, var(--fade-upper) 100%),
    linear-gradient(to bottom, var(--fade-mid) 0%, var(--fade-edge) 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
}

.admin-modal-button {
  width: 100%;
  padding: 0.6rem;
}

.admin-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.72rem;
  font-weight: bold;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.admin-message {
  min-height: 1.1rem;
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
}

.admin-upload .form-group {
  margin-bottom: 0.8rem;
}

.admin-upload label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  font-weight: bold;
}

.admin-upload input[type="text"],
.admin-upload select,
.admin-upload input[type="file"] {
  width: 100%;
  padding: 0.45rem;
  font-family: inherit;
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: 5px;
  background-image:
    linear-gradient(to bottom, #ffffff 0%, var(--fade-upper) 100%),
    linear-gradient(to bottom, var(--fade-mid) 0%, var(--fade-edge) 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
}

.admin-upload input[type="file"] {
  font-size: 0.75rem;
}

.admin-lock-btn {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.4rem;
  font-family: inherit;
  font-size: 0.75rem;
  color: var(--ink);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
}

.uploaded-list {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid transparent;
  border-image: linear-gradient(to right, var(--fade-mid), var(--fade-bottom)) 1;
}

.uploaded-list h4 {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  letter-spacing: 1px;
  text-transform: uppercase;
}

#uploadedItems {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 220px;
  overflow-y: auto;
}

.uploaded-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.uploaded-item input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.35rem 0.45rem;
  font-family: inherit;
  font-size: 0.78rem;
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: 4px;
  background-image:
    linear-gradient(to bottom, #ffffff 0%, var(--fade-upper) 100%),
    linear-gradient(to bottom, var(--fade-mid) 0%, var(--fade-edge) 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
}

.uploaded-save {
  flex: 0 0 auto;
  padding: 0.35rem 0.55rem;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: bold;
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  background-image:
    linear-gradient(to bottom, #fdfbf3 0%, var(--fade-mid) 100%),
    linear-gradient(to bottom, var(--fade-mid) 0%, var(--fade-edge) 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  text-shadow: var(--engrave);
}

.uploaded-save:disabled {
  opacity: 0.65;
  cursor: default;
}

/* Like/Subscribe Active State */
.action-buttons button.active {
  background-image:
    linear-gradient(to bottom, var(--fade-bottom) 0%, var(--fade-edge) 100%),
    linear-gradient(to bottom, var(--fade-edge) 0%, #8a7a56 100%);
  color: #fdfaf0;
  text-shadow: 0 1px 1px rgba(40, 32, 18, 0.7);
}

/* ============================================================
   Admin controls: gallery, delete buttons, bio editor, card order
   ============================================================ */

[hidden] {
  display: none !important;
}

/* Controls that only exist for the owner */
.admin-only {
  display: none;
}

body.admin .panel-admin,
body.admin .bio-actions {
  display: flex;
}

body.admin .row-delete,
body.admin .row-rename,
body.admin .pic-delete,
body.admin .mini-btn {
  display: inline-flex;
}

/* Small blue buttons used by all the admin controls */
.move-btn,
.row-delete,
.row-rename,
.pic-delete,
.mini-btn {
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.28rem 0.55rem;
  border: 1px solid transparent;
  border-radius: 5px;
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: bold;
  letter-spacing: 0.5px;
  color: var(--ink);
  text-shadow: var(--engrave);
  cursor: pointer;
  background-image:
    linear-gradient(to bottom, var(--fade-top) 0%, var(--fade-mid) 100%),
    linear-gradient(to bottom, var(--fade-mid) 0%, var(--fade-edge) 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: 0 1px 4px rgba(54, 45, 28, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: background-image 0.2s, transform 0.12s, box-shadow 0.2s;
}

.move-btn:hover:not(:disabled),
.row-delete:hover,
.row-rename:hover,
.pic-delete:hover,
.mini-btn:hover {
  background-image:
    linear-gradient(to bottom, var(--fade-upper) 0%, var(--fade-lower) 100%),
    linear-gradient(to bottom, var(--fade-lower) 0%, var(--fade-bottom) 100%);
  transform: translateY(-1px);
}

.move-btn:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
}

.row-delete,
.pic-delete,
.mini-btn.danger {
  background-image:
    linear-gradient(to bottom, var(--fade-lower) 0%, var(--fade-bottom) 100%),
    linear-gradient(to bottom, var(--fade-bottom) 0%, #8a7a56 100%);
}

/* Card order strip at the top of each card */
.panel-admin {
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.55rem;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.7) 0%, rgba(223, 214, 193, 0.8) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.panel-admin-label {
  flex: 1 1 auto;
  font-size: 0.6rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  opacity: 0.8;
}

/* Picture gallery */
.gallery-hint {
  margin: 0 0 0.1rem;
  font-size: 0.78rem;
  opacity: 0.85;
}

.picture-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.6rem;
  max-height: 60vh;
  overflow-y: auto;
}

.picture-grid .list-empty {
  grid-column: 1 / -1;
}

.picture-tile {
  position: relative;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  background-image:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.92) 0%, rgba(243, 236, 220, 0.95) 100%),
    linear-gradient(to bottom, var(--fade-mid) 0%, var(--fade-edge) 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.picture-link {
  display: block;
}

.picture-tile img {
  display: block;
  width: 100%;
  height: 120px;
  object-fit: cover;
  background: rgba(54, 45, 28, 0.15);
}

.picture-tile figcaption {
  padding: 0.3rem 0.45rem;
  font-size: 0.68rem;
  font-weight: bold;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pic-delete {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  padding: 0.22rem 0.45rem;
  font-size: 0.62rem;
}

/* Bio editing */
.bio-actions {
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}

.bio-empty {
  font-style: italic;
  opacity: 0.75;
}

/* An address in the bio: underlined so it reads as clickable, in the same
   ink as the surrounding text. */
.bio-email {
  color: inherit;
  font-weight: bold;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

.bio-email:hover,
.bio-email:focus-visible {
  color: #6b4f1d;
  text-decoration-thickness: 2px;
}

.bio-editor {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.4rem;
}

.bio-editor label {
  font-size: 0.72rem;
  font-weight: bold;
}

.bio-editor textarea {
  width: 100%;
  padding: 0.5rem;
  font-family: inherit;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--ink);
  resize: vertical;
  border: 1px solid transparent;
  border-radius: 5px;
  background-image:
    linear-gradient(to bottom, #ffffff 0%, var(--fade-upper) 100%),
    linear-gradient(to bottom, var(--fade-mid) 0%, var(--fade-edge) 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
}

.bio-editor-actions {
  display: flex;
  gap: 0.4rem;
}

.bio-editor-actions .mini-btn {
  flex: 1 1 auto;
  padding: 0.45rem 0.6rem;
  font-size: 0.75rem;
}

/* Admin modal section headings */
.admin-section-title {
  margin: 1.1rem 0 0.5rem;
  padding-top: 0.8rem;
  font-size: 0.72rem;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  border-top: 1px solid transparent;
  border-image: linear-gradient(to right, var(--fade-mid), var(--fade-bottom)) 1;
}

/* Visit counter in the admin panel */
.admin-stats {
  margin: 0.2rem 0 0.6rem;
  padding: 0.65rem 0.7rem 0.55rem;
  border: 1px solid var(--fade-mid);
  border-radius: 8px;
  background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.85) 0%, rgba(246, 240, 226, 0.9) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.stats-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.stats-head .admin-section-title {
  margin: 0;
  padding-top: 0;
  border-top: none;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  margin: 0.55rem 0 0.6rem;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  padding: 0.4rem 0.25rem;
  border-radius: 6px;
  background: rgba(255, 253, 246, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.stat-value {
  font-size: 1.15rem;
  font-weight: bold;
}

.stat-label {
  font-size: 0.6rem;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  text-align: center;
  opacity: 0.75;
}

.stats-week-label {
  display: block;
  font-size: 0.66rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  opacity: 0.7;
}

.stats-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 0.25rem;
  margin-top: 0.35rem;
}

.stat-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.stat-day-count {
  font-size: 0.62rem;
}

.stat-bar {
  width: 100%;
  max-width: 26px;
  border-radius: 3px 3px 0 0;
  background-image: linear-gradient(to top, var(--fade-bottom) 0%, var(--fade-mid) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.stat-day-label {
  font-size: 0.6rem;
  opacity: 0.65;
}

.admin-hint {
  margin: 0.3rem 0 0;
  font-size: 0.72rem;
  line-height: 1.45;
  opacity: 0.85;
}

/* ============================================================
   Free canvas: cards fill their set height and scroll inside
   ============================================================ */

.panel {
  position: absolute;
  margin: 0;
}

.panel .content {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

.panel .track-list {
  flex: 1 1 auto;
  min-height: 90px;
  max-height: none;
}

.panel .picture-grid {
  max-height: none;
}

/* Move handle and corner resize grip, both admin only */
.drag-handle {
  flex: 0 0 auto;
  padding: 0.28rem 0.6rem;
  border: 1px solid transparent;
  border-radius: 5px;
  font-size: 0.62rem;
  font-weight: bold;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  cursor: grab;
  user-select: none;
  touch-action: none;
  background-image:
    linear-gradient(to bottom, var(--fade-lower) 0%, var(--fade-bottom) 100%),
    linear-gradient(to bottom, var(--fade-bottom) 0%, #8a7a56 100%);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

body.dragging .drag-handle {
  cursor: grabbing;
}

body.dragging {
  user-select: none;
}

.resize-handle {
  display: none;
  position: absolute;
  right: 0;
  bottom: 0;
  width: 20px;
  height: 20px;
  z-index: 6;
  cursor: nwse-resize;
  touch-action: none;
  background-image: repeating-linear-gradient(
    135deg,
    transparent 0 4px,
    rgba(54, 45, 28, 0.38) 4px 5px
  );
}

body.admin .resize-handle {
  display: block;
}

/* ============================================================
   Free canvas only (wider than the mobile breakpoint)
   The player and preview are locked to the top of their card; only
   the file list scrolls, however many files are added.
   ============================================================ */
@media (min-width: 721px) {
  #audio .content,
  #videos .content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  #audio .media-card,
  #videos .media-card {
    container-type: size;
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
  }

  #audio .audio-player,
  #videos .video-preview,
  #audio .now-playing,
  #videos .now-playing,
  #audio .track-actions,
  #videos .track-actions {
    flex: 0 0 auto;
    min-height: 0;
  }

  #audio .track-list,
  #videos .track-list {
    flex: 1 1 auto;
    min-height: 90px;
    max-height: none;
    overflow-y: auto;
  }

  /* Videos: the 4:3 player sits on the left with its title underneath, and
     the file list fills the right-hand side. */
  #videos .media-card {
    display: grid;
    grid-template-columns: 58% minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
  }

  /* Player and title stay together, so the title always sits directly
     under the box instead of drifting to the bottom of the card. */
  #videos .video-left {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    min-width: 0;
    min-height: 0;
  }

  /* The 4:3 box is capped by the card height (minus the title and gaps),
     so it never grows past the space the card actually has. */
  #videos .video-preview {
    width: min(100%, max(140px, calc((100cqh - 66px) * 4 / 3)));
    margin: 0;
  }

  #videos .track-list {
    grid-column: 2;
    grid-row: 1;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* Small screens: stack the fixed header items */
@media (max-width: 720px) {
  .site-title {
    position: static;
    display: block;
    max-width: none;
    margin: 1rem 0 0.5rem;
    text-align: center;
  }

  nav {
    position: static;
    justify-content: center;
    margin-bottom: 0.5rem;
  }

  .main-content {
    margin-top: 1rem;
    padding: 1rem 0;
  }

  /* Phones: cards stack in their saved order instead of floating,
     edge to edge so they use the whole width of the screen */
  .panel-columns {
    height: auto !important;
  }

  .panel {
    position: static;
    width: 100%;
    height: auto;
    margin: 0 0 1.2rem;
    padding: 1rem 0.9rem;
    border-radius: 0;
    overflow: visible;
  }

  .panel .content {
    overflow: visible;
  }

  .panel .track-list {
    flex: none;
    max-height: 320px;
  }

  .media-card {
    height: auto;
  }

  .panel-admin,
  .resize-handle {
    display: none !important;
  }
}