:root {
  --paper: #fffdf9;
  --wine: #4a2832;
  --olive: #5d6637;
  --coral: #e77a72;
  --text: #493f42;
  --muted: #817876;
  --line: #e6ddd7;
  --card: rgba(255,255,255,.93);
}

* { box-sizing: border-box; }

html { background: var(--paper); }

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 5%, rgba(245,198,193,.13), transparent 22rem),
    radial-gradient(circle at 90% 75%, rgba(125,139,82,.08), transparent 28rem),
    var(--paper);
  font-family: "Montserrat", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }

.login-body {
  min-height: 100dvh;
  display: grid;
  place-items: center;
}

.login-page {
  width: min(100%, 520px);
  padding: 24px 18px;
}

.login-card {
  padding: 18px 28px 30px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,253,249,.92);
  box-shadow: 0 18px 50px rgba(74,40,50,.08);
  text-align: center;
}

.login-flowers {
  display: block;
  width: 140px;
  max-height: 175px;
  margin: 0 auto 8px;
  object-fit: contain;
}

h1, h2 {
  font-family: "Bodoni Moda", Georgia, serif;
}

.login-card h1 {
  margin: 0;
  color: var(--wine);
  font-size: clamp(35px, 8vw, 48px);
  font-weight: 600;
  letter-spacing: -.03em;
  line-height: 1;
}

.date {
  margin: 7px 0 0;
  color: var(--coral);
  font-size: 14px;
  font-weight: 600;
}

.login-rule {
  width: 70px;
  height: 1px;
  margin: 22px auto;
  background: var(--line);
}

.login-card h2 {
  margin: 0;
  color: var(--wine);
  font-size: 30px;
  font-weight: 600;
}

.login-intro {
  margin: 8px auto 20px;
  color: var(--olive);
  font-size: 13px;
  line-height: 1.5;
}

.login-card form {
  text-align: left;
}

.login-card label,
.toolbar label {
  display: block;
  margin: 13px 0 6px 2px;
  color: var(--wine);
  font-size: 12px;
  font-weight: 700;
}

.login-card input,
.toolbar select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid #d5c8c3;
  border-radius: 9px;
  outline: none;
  background: #fff;
  color: var(--wine);
}

.login-card input:focus,
.toolbar select:focus {
  border-color: var(--coral);
  box-shadow: 0 0 0 3px rgba(231,122,114,.12);
}

.login-card button {
  width: 100%;
  min-height: 50px;
  margin-top: 18px;
  border: 0;
  border-radius: 9px;
  background: var(--wine);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.alert {
  margin: 14px 0;
  padding: 11px 13px;
  border-radius: 9px;
  background: #fae8e7;
  color: #7b3d3c;
  font-size: 12px;
  line-height: 1.4;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  min-height: 68px;
  padding: 10px max(18px, calc((100vw - 1400px) / 2));
  border-bottom: 1px solid rgba(230,221,215,.9);
  background: rgba(255,253,249,.94);
  backdrop-filter: blur(12px);
}

.brand {
  color: var(--wine);
  text-decoration: none;
}

.brand span {
  display: block;
  font-family: "Bodoni Moda", Georgia, serif;
  font-size: 22px;
  font-weight: 600;
}

.brand small {
  display: block;
  margin-top: 1px;
  color: var(--coral);
  font-size: 9px;
  font-weight: 700;
}

.logout {
  padding: 9px 13px;
  border: 1px solid #d7cbc6;
  border-radius: 8px;
  background: transparent;
  color: var(--wine);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.gallery-page {
  width: min(100%, 1400px);
  margin: 0 auto;
  padding: 24px 18px 45px;
}

.gallery-heading {
  display: flex;
  align-items: center;
  gap: 17px;
  margin-bottom: 20px;
}

.gallery-heading img {
  width: 76px;
  height: 96px;
  object-fit: contain;
}

.gallery-heading h1 {
  margin: 0;
  color: var(--wine);
  font-size: clamp(34px, 5vw, 48px);
  font-weight: 600;
}

.gallery-heading p {
  margin: 1px 0 0;
  color: var(--olive);
  font-size: 12px;
  font-weight: 600;
}

.toolbar {
  margin-bottom: 18px;
}

.toolbar form {
  max-width: 390px;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.clear-filter {
  flex: 0 0 auto;
  color: var(--coral);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
}

.media-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  cursor: pointer;
  box-shadow: 0 7px 22px rgba(74,40,50,.045);
  transition: transform .14s ease, box-shadow .14s ease;
}

.media-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(74,40,50,.09);
}

.media-preview {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #eee8e3;
}

.media-preview img,
.media-preview video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.play-badge {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(74,40,50,.82);
  color: #fff;
  font-size: 15px;
}

.unsupported-preview {
  height: 100%;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--wine);
}

.unsupported-preview span {
  font-family: "Bodoni Moda", Georgia, serif;
  font-size: 26px;
  font-weight: 600;
}

.unsupported-preview small {
  color: var(--olive);
  font-size: 10px;
}

.media-meta {
  padding: 9px 10px 10px;
}

.media-meta strong,
.media-meta span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-meta strong {
  color: var(--wine);
  font-size: 11px;
}

.media-meta span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.empty-state {
  padding: 70px 20px;
  text-align: center;
}

.empty-state > div {
  color: var(--coral);
  font-family: Georgia, serif;
  font-size: 42px;
}

.empty-state h2 {
  margin: 5px 0;
  color: var(--wine);
  font-size: 30px;
}

.empty-state p {
  color: var(--olive);
  font-size: 12px;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  margin-top: 26px;
  color: var(--muted);
  font-size: 11px;
}

.pagination a {
  color: var(--wine);
  font-weight: 700;
  text-decoration: none;
}

.lightbox[hidden] {
  display: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 26px;
  background: rgba(31,22,25,.94);
}

.lightbox-close {
  position: fixed;
  right: 18px;
  top: 12px;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 34px;
  cursor: pointer;
}

.lightbox-content {
  max-width: min(94vw, 1500px);
  max-height: 90vh;
}

.lightbox-content img,
.lightbox-content video {
  display: block;
  max-width: 100%;
  max-height: 90vh;
  margin: auto;
  object-fit: contain;
}

.gallery-alert {
  max-width: 700px;
}

@media (max-width: 1000px) {
  .media-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .media-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .gallery-page {
    padding: 15px 10px 30px;
  }

  .topbar {
    min-height: 60px;
    padding: 8px 12px;
  }

  .brand span { font-size: 19px; }

  .gallery-heading {
    gap: 10px;
    margin-bottom: 12px;
  }

  .gallery-heading img {
    width: 55px;
    height: 70px;
  }

  .gallery-heading h1 {
    font-size: 31px;
  }

  .media-meta {
    padding: 7px 8px 8px;
  }
}

@media (max-width: 420px) {
  .login-page {
    padding: 10px;
  }

  .login-card {
    padding: 12px 17px 22px;
  }

  .login-flowers {
    width: 110px;
    max-height: 135px;
  }
}
