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

:root {
  --ink: #141414;
  --ink-muted: #5a5a5a;
  --line: rgba(20, 20, 20, 0.12);
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.88);
  --shadow: 0 12px 40px rgba(20, 20, 20, 0.08);
  --radius: 12px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  min-height: 100%;
}

body {
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  font-weight: 500;
  color: var(--ink);
  background-color: #fff;
  background-image: url("assets/PastelBG.jpg");
  background-repeat: repeat-y;
  background-size: 100% auto;
  background-position: top center;
  background-attachment: fixed;
  line-height: 1.6;
  width: 100%;
  min-height: 100vh;
  padding: 0 clamp(1rem, 4vw, 3rem) 3rem;
  -webkit-font-smoothing: antialiased;
}

.site-header {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-bottom: 2rem;
  padding: 0;
  background: var(--surface);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

header {
  padding: 1.25rem clamp(1rem, 4vw, 3rem) 0;
  padding-right: clamp(6rem, 18vw, 10rem);
}

h1 {
  font-size: clamp(1.25rem, 2.5vw, 1.625rem);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.logo-link {
  position: relative;
  z-index: 1;
  display: block;
  height: 100%;
  aspect-ratio: 1;
  flex-shrink: 0;
  transition: opacity 0.2s var(--ease);
}

.logo-link:hover {
  opacity: 0.85;
}

.logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: top right;
}

.header-actions {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  z-index: 2;
}

.header-buttons {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-self: flex-start;
  margin-top: 1.25rem;
  z-index: 5;
}

.header-btn {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font: inherit;
  font-weight: 600;
  font-size: clamp(0.75rem, 1.8vw, 0.8125rem);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease),
    transform 0.2s var(--ease);
}

.header-btn:hover {
  border-color: rgba(20, 20, 20, 0.28);
  background: #fff;
}

.header-btn:active {
  transform: scale(0.98);
}

nav {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0 clamp(1rem, 4vw, 3rem) 0;
  padding-right: clamp(6rem, 18vw, 10rem);
}

.tab-indicator {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--ink);
  border-radius: 999px;
  transition: transform 0.35s var(--ease), width 0.35s var(--ease);
  pointer-events: none;
}

.tab {
  position: relative;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.65rem 0.9rem;
  margin-bottom: -1px;
  font: inherit;
  font-weight: 500;
  font-size: clamp(0.8125rem, 2vw, 0.875rem);
  color: var(--ink-muted);
  cursor: pointer;
  transition: color 0.25s var(--ease);
}

.tab:hover {
  color: var(--ink);
}

.tab.active {
  color: var(--ink);
  font-weight: 600;
}

main {
  display: grid;
  max-width: 960px;
  margin: 0 auto;
}

main:has(#art.active) {
  max-width: none;
  width: 100vw;
  margin-left: calc(50% - 50vw);
}

#art .admin-upload {
  padding: 0 clamp(1rem, 4vw, 3rem);
}

.panel {
  grid-area: 1 / 1;
  width: 100%;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition:
    opacity 0.4s var(--ease),
    transform 0.4s var(--ease),
    visibility 0.4s;
  pointer-events: none;
}

.panel.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
  z-index: 1;
}

.panel-content {
  min-height: 12rem;
}

#home .panel-content {
  background: var(--surface);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.25rem, 3vw, 2rem);
}

#art .panel-content,
#voice .panel-content {
  min-height: 0;
  padding: 0;
}

.hidden {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.25s var(--ease), visibility 0.25s var(--ease);
}

.modal.hidden {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(20, 20, 20, 0.35);
  backdrop-filter: blur(4px);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(100% - 2rem, 24rem);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  transform: translateY(0);
  transition: transform 0.25s var(--ease);
}

.modal.hidden .modal-panel {
  transform: translateY(8px);
}

.modal-panel h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.modal-panel label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.modal-panel input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  font: inherit;
  margin-bottom: 0.75rem;
  background: #fff;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.modal-panel input:focus {
  outline: none;
  border-color: rgba(20, 20, 20, 0.35);
  box-shadow: 0 0 0 3px rgba(20, 20, 20, 0.08);
}

.modal-panel button[type="submit"],
.modal-panel #login-submit {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}

.modal-panel button[type="submit"]:hover,
.modal-panel #login-submit:hover {
  opacity: 0.9;
}

.modal-panel button[type="submit"]:active,
.modal-panel #login-submit:active {
  transform: scale(0.98);
}

.modal-panel #login-submit[aria-busy="true"] {
  opacity: 0.7;
  cursor: wait;
}

.form-error {
  color: #a00;
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}

.server-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
  margin: 0;
  padding: 0.75rem 1rem;
  background: #a00;
  color: #fff;
  font-size: 0.875rem;
  text-align: center;
}

.server-banner code {
  font-family: inherit;
  font-weight: 600;
}

body.is-admin .header-btn#login-btn {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.admin-upload {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.admin-upload label {
  font-weight: 600;
}

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

.admin-upload button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease);
}

.admin-upload button:hover {
  border-color: rgba(20, 20, 20, 0.28);
}

.admin-upload button:active {
  transform: scale(0.98);
}

.gallery {
  display: grid;
  gap: 1rem;
}

.art-masonry,
#art-gallery {
  --art-gap: clamp(0.5rem, 1vw, 0.75rem);
  display: flex;
  align-items: flex-start;
  gap: var(--art-gap);
  width: 100%;
  padding: 0 clamp(0.5rem, 2vw, 1.25rem);
  box-sizing: border-box;
}

.art-masonry:empty,
#art-gallery:empty {
  display: none;
}

.art-masonry-column {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--art-gap);
}

.gallery-item--art {
  margin: 0;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 4px 16px rgba(20, 20, 20, 0.05);
  overflow: hidden;
  width: 100%;
}

.gallery-item--art img {
  display: block;
  width: 100%;
  height: auto;
}

#voice-gallery {
  grid-template-columns: 1fr;
}

.gallery-item {
  overflow: hidden;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 4px 16px rgba(20, 20, 20, 0.05);
}

.gallery-item img {
  display: block;
  width: 100%;
  height: auto;
}

.gallery-item--audio {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
}

.gallery-filename {
  flex: 0 0 min(12rem, 35%);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
  word-break: break-word;
}

.gallery-item--audio audio {
  display: block;
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
