:root {
  --cream: #faf7f2;
  --cream-deep: #f9f6f0;
  --night: #252d45;
  --eggplant: #6b515e;
  --lavender: #dbc0e8;
  --sky: #a3c1e2;
  --daffodil: #f7e289;
  --peaches: #fbb28b;
  --poppy: #f76f54;
  --fuchsia: #ea5e86;
  --pool: #47b5a8;
  --cotton: #f9a2c5;
  --hay: #b79a65;
  --radius: 14px;
  font-family: "DM Sans", system-ui, sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--night);
  line-height: 1.5;
  overflow-x: hidden;
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
  background-color: var(--cream-deep);
  background-image:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(247, 226, 137, 0.55), transparent 55%),
    radial-gradient(ellipse 70% 50% at 0% 30%, rgba(219, 192, 232, 0.5), transparent 50%),
    radial-gradient(ellipse 65% 55% at 100% 25%, rgba(163, 193, 226, 0.55), transparent 50%),
    radial-gradient(ellipse 50% 40% at 15% 85%, rgba(249, 162, 197, 0.35), transparent 45%),
    radial-gradient(ellipse 45% 40% at 85% 80%, rgba(71, 181, 168, 0.35), transparent 45%),
    radial-gradient(ellipse 60% 50% at 50% 100%, rgba(247, 111, 84, 0.2), transparent 55%),
    linear-gradient(180deg, var(--cream) 0%, var(--cream-deep) 100%);
}

.site-header {
  position: relative;
  text-align: center;
  padding: clamp(1.5rem, 5vw, 2.75rem) clamp(1rem, 4vw, 2rem) clamp(1.25rem, 4vw, 2rem);
  padding-top: max(clamp(1.5rem, 5vw, 2.75rem), env(safe-area-inset-top, 0px));
  border-bottom: 1px solid rgba(163, 193, 226, 0.35);
  background: linear-gradient(
    180deg,
    rgba(249, 246, 240, 0.35) 0%,
    rgba(249, 246, 240, 0) 100%
  );
}

.nav-actions {
  position: absolute;
  top: max(clamp(0.75rem, 3vw, 1.25rem), env(safe-area-inset-top, 0px));
  right: max(clamp(0.75rem, 4vw, 1.5rem), env(safe-area-inset-right, 0px));
  display: flex;
  gap: 0.5rem;
  align-items: center;
  z-index: 2;
}

.nav-status {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--pool);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(0.75rem, 2.5vw, 1.35rem);
  max-width: 42rem;
  width: 100%;
  margin: 0 auto;
  padding-inline: 0.25rem;
}

.logo {
  display: block;
  width: clamp(200px, 58vw, 380px);
  max-width: 100%;
  height: auto;
  border-radius: 18px;
  box-shadow:
    0 28px 56px rgba(234, 94, 134, 0.1),
    0 14px 32px rgba(71, 181, 168, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.5) inset;
  filter: saturate(1.04);
  opacity: 0.97;
}

.brand-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  max-width: 100%;
}

.site-title {
  margin: 0;
  font-size: clamp(2.1rem, 10vw, 5.25rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  max-width: 100%;
  padding-inline: 0.25rem;
  word-break: break-word;
  background: linear-gradient(
    115deg,
    var(--night) 0%,
    var(--fuchsia) 28%,
    var(--pool) 52%,
    var(--poppy) 78%,
    var(--sky) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline {
  margin: 0;
  font-size: clamp(1rem, 3.8vw, 1.85rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  max-width: 100%;
  padding-inline: 0.25rem;
  line-height: 1.35;
  flex-wrap: wrap;
  justify-content: center;
  display: flex;
  align-items: baseline;
  gap: 0.05em 0.15em;
}

.tag-ink {
  color: var(--fuchsia);
}

.tag-space {
  color: var(--pool);
}

.tag-noise {
  color: var(--poppy);
}

.tag-punct {
  color: var(--eggplant);
  opacity: 0.75;
  margin-right: 0.08em;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem clamp(0.75rem, 4vw, 2.5rem) max(3rem, env(safe-area-inset-bottom, 0px));
  width: 100%;
}

.admin-panel {
  padding: 1.25rem clamp(1rem, 3vw, 1.5rem);
  margin-bottom: 2rem;
  border-radius: var(--radius);
  border: 1px solid rgba(163, 193, 226, 0.45);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 36px rgba(37, 45, 69, 0.06);
}

.storage-meter {
  margin-bottom: 1.25rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid rgba(163, 193, 226, 0.4);
}

.storage-meter-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  margin-bottom: 0.5rem;
}

.storage-meter-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--night);
}

.storage-meter-numbers {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--eggplant);
  font-variant-numeric: tabular-nums;
}

.storage-meter-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(163, 193, 226, 0.35);
  overflow: hidden;
}

.storage-meter-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pool), var(--sky), var(--fuchsia));
  transition: width 0.25s ease;
}

.storage-meter-fill.storage-meter-fill-warn {
  background: linear-gradient(90deg, var(--peaches), var(--poppy));
}

.storage-meter-fill.storage-meter-fill-full {
  background: linear-gradient(90deg, var(--poppy), var(--fuchsia));
}

.admin-panel h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
}

.upload-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: stretch;
}

.file-label {
  position: relative;
  cursor: pointer;
}

.file-label input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.file-label-text {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.65rem 1rem;
  min-height: 44px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(249, 162, 197, 0.45), rgba(247, 226, 137, 0.4));
  color: var(--night);
  font-weight: 600;
  border: 1px solid rgba(234, 94, 134, 0.35);
}

.file-label:hover .file-label-text {
  background: linear-gradient(135deg, rgba(249, 162, 197, 0.65), rgba(247, 226, 137, 0.55));
}

.gallery-heading {
  font-size: 1.15rem;
  margin: 0 0 1rem;
  color: var(--night);
  font-weight: 700;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: clamp(0.65rem, 2vw, 1rem);
}

.card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(163, 193, 226, 0.5);
  background: #fff;
  box-shadow: 0 10px 28px rgba(37, 45, 69, 0.07);
}

.card-media {
  cursor: pointer;
  display: block;
}

.card-thumb-img,
.card-thumb-video {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.card-thumb-video {
  background: #000;
  pointer-events: none;
}

.card-expand,
.card-delete {
  position: absolute;
  z-index: 3;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 1.25rem;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  border: 1px solid rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.92);
  color: var(--night);
  box-shadow: 0 2px 10px rgba(37, 45, 69, 0.12);
}

.card-expand {
  top: 0.45rem;
  right: 0.45rem;
}

.card-delete {
  top: 0.45rem;
  left: 0.45rem;
  font-size: 1.5rem;
  line-height: 0.9;
  color: var(--poppy);
  border-color: rgba(247, 111, 84, 0.45);
  background: rgba(255, 255, 255, 0.95);
}

.card-expand:hover,
.card-expand:active,
.card-delete:hover,
.card-delete:active {
  filter: brightness(0.97);
}

body.lightbox-open {
  overflow: hidden;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(0.5rem, env(safe-area-inset-top)) max(0.5rem, env(safe-area-inset-right))
    max(0.5rem, env(safe-area-inset-bottom)) max(0.5rem, env(safe-area-inset-left));
}

.lightbox-scrim {
  position: absolute;
  inset: 0;
  z-index: 0;
  margin: 0;
  padding: 0;
  border: none;
  cursor: pointer;
  background: rgba(37, 45, 69, 0.88);
}

.lightbox-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(100%, 100vw);
  max-width: 100%;
  height: min(100%, 100dvh);
  max-height: 100%;
  pointer-events: none;
}

.lightbox-panel > * {
  pointer-events: auto;
}

.lightbox-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.lightbox-toolbar .btn-ghost {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}

.lightbox-toolbar .btn-ghost:hover,
.lightbox-toolbar .btn-ghost:active {
  border-color: rgba(255, 255, 255, 0.65);
  color: #fff;
}

.lightbox-fs {
  margin-right: auto;
}

.lightbox-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-media {
  max-width: 100%;
  max-height: min(85dvh, 85vh);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
}

.lightbox-video {
  width: auto;
  max-width: 100%;
  max-height: min(85dvh, 85vh);
  background: #000;
}

.gallery-empty {
  color: var(--eggplant);
  margin: 0;
}

.site-footer {
  text-align: center;
  padding: 2rem 1rem;
  padding-bottom: max(2rem, env(safe-area-inset-bottom, 0px));
  color: var(--eggplant);
  font-size: 0.85rem;
  border-top: 1px solid rgba(163, 193, 226, 0.35);
}

.btn {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 999px;
  padding: 0.65rem 1.2rem;
  min-height: 44px;
  font-weight: 600;
  touch-action: manipulation;
}

.btn-primary {
  background: linear-gradient(135deg, var(--poppy), var(--fuchsia));
  color: #fff;
}

.btn-primary:hover,
.btn-primary:active {
  filter: brightness(1.06);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.65);
  color: var(--night);
  border: 1px solid rgba(163, 193, 226, 0.65);
  backdrop-filter: blur(6px);
}

.btn-ghost:hover,
.btn-ghost:active {
  border-color: var(--pool);
  color: var(--pool);
}

.btn-danger {
  background: linear-gradient(135deg, var(--poppy), #c94a3d);
  color: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.btn-danger:hover,
.btn-danger:active {
  filter: brightness(1.05);
}

.status {
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
  color: var(--pool);
}

.status.error {
  color: var(--poppy);
}

.hidden {
  display: none !important;
}

.modal {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  margin: auto;
  width: min(100% - 1.5rem, 380px);
  max-width: calc(100vw - 1.5rem);
  max-height: min(90vh, 90dvh);
  overflow: auto;
  box-shadow: 0 20px 50px rgba(37, 45, 69, 0.15);
}

.modal::backdrop {
  background: rgba(37, 45, 69, 0.38);
}

.login-form {
  padding: 1.5rem;
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.login-form h2 {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
}

.login-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--eggplant);
}

.login-form input {
  font: inherit;
  font-size: 16px;
  padding: 0.65rem 0.75rem;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid rgba(163, 193, 226, 0.55);
  background: #fff;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

/* Narrow phones: keep nav in flow so it never covers the title */
@media (max-width: 520px) {
  .site-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding-top: max(1rem, env(safe-area-inset-top, 0px));
  }

  .nav-actions {
    position: static;
    align-self: flex-end;
    order: -1;
    margin-bottom: 0.35rem;
  }

  .brand {
    padding-top: 0;
  }

  .upload-form {
    flex-direction: column;
  }

  .upload-form .file-label,
  .upload-form .btn {
    width: 100%;
  }

  .modal-actions {
    flex-direction: column;
  }

  .modal-actions .btn {
    width: 100%;
  }

  .lightbox-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .lightbox-fs {
    margin-right: 0;
  }

  .lightbox-toolbar .btn {
    width: 100%;
  }

  .tagline {
    letter-spacing: 0.02em;
  }
}

@media (max-width: 380px) {
  .site-title {
    font-size: clamp(1.85rem, 12vw, 2.5rem);
  }
}

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