/* Album cưới — peony ink stationery
   Palette: rose mist · warm ink · peony · sage leaf */

:root {
  --bg: #f7f0ee;
  --bg-deep: #efe4df;
  --ink: #241e1b;
  --ink-soft: #5c534e;
  --peony: #b34d5c;
  --peony-deep: #8f3a48;
  --sage: #5e7359;
  --line: rgba(36, 30, 27, 0.12);
  --paper: #fffaf7;
  --shadow: 0 18px 40px rgba(36, 30, 27, 0.08);
  --radius: 4px;
  --font-display: "Fraunces", "Times New Roman", serif;
  --font-body: "Be Vietnam Pro", system-ui, sans-serif;
  --space: 8px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(179, 77, 92, 0.12), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 20%, rgba(94, 115, 89, 0.1), transparent 50%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
}

.page-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.45'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

/* —— Buttons —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--space) * 1);
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.25s var(--ease), background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--ink);
  color: var(--paper);
}

.btn-primary:hover {
  background: var(--peony-deep);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
  min-height: 40px;
}

.btn-ghost:hover {
  border-color: var(--ink);
}

.btn-danger {
  background: transparent;
  border-color: rgba(179, 77, 92, 0.35);
  color: var(--peony-deep);
  min-height: 40px;
}

.btn-danger:hover {
  background: rgba(179, 77, 92, 0.08);
}

/* —— Hero (full-bleed) —— */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  padding: clamp(28px, 6vw, 72px);
  overflow: hidden;
  color: #fffaf7;
}

.hero-visual {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.hero-wash {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(155deg, #c9948f 0%, #b88978 32%, #7f9178 68%, #5d6b58 100%);
  transform: scale(1.06);
  animation: drift 16s ease-in-out infinite alternate;
}

.hero-wash::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(20, 16, 14, 0.18) 0%, rgba(20, 16, 14, 0.55) 72%, rgba(20, 16, 14, 0.72) 100%),
    radial-gradient(circle at 70% 20%, rgba(255, 250, 247, 0.18), transparent 42%);
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 38rem;
  animation: rise 0.9s var(--ease) both;
}

.eyebrow {
  margin: 0 0 calc(var(--space) * 2);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 250, 247, 0.78);
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(3.2rem, 11vw, 6.4rem);
  line-height: 0.94;
  letter-spacing: -0.02em;
  color: #fffaf7;
  text-wrap: balance;
}

.brand-name {
  display: block;
}

.brand-amp {
  display: inline-block;
  margin: 0.06em 0;
  font-size: 0.4em;
  font-weight: 500;
  color: #f0c4c8;
  font-style: italic;
}

.lede {
  margin: calc(var(--space) * 3) 0 0;
  max-width: 30ch;
  font-size: 1.05rem;
  color: rgba(255, 250, 247, 0.86);
}

.hero-cta {
  margin-top: calc(var(--space) * 4);
}

.hero .btn-primary {
  background: #fffaf7;
  color: var(--ink);
}

.hero .btn-primary:hover {
  background: #f0c4c8;
  color: var(--ink);
}

@keyframes drift {
  from { transform: scale(1.05) translate(0, 0); }
  to { transform: scale(1.12) translate(-2%, 1%); }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-inner,
  .hero-visual,
  .hero-wash,
  .gallery-item {
    animation: none !important;
  }
}

/* —— Album —— */
.album {
  padding: clamp(48px, 8vw, 96px) clamp(20px, 5vw, 56px) clamp(64px, 10vw, 120px);
}

.album-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: calc(var(--space) * 4);
  padding-bottom: calc(var(--space) * 3);
  border-bottom: 1px solid var(--line);
}

.album-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.album-sub {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.sort-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: rgba(36, 30, 27, 0.04);
  border-radius: var(--radius);
}

.sort-tab {
  border: 0;
  background: transparent;
  min-height: 40px;
  padding: 0 16px;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.2s ease, color 0.2s ease;
}

.sort-tab.is-active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(36, 30, 27, 0.06);
}

.gallery {
  columns: 1;
  column-gap: 14px;
}

@media (min-width: 600px) {
  .gallery { columns: 2; }
}

@media (min-width: 980px) {
  .gallery { columns: 3; column-gap: 18px; }
}

.gallery-item {
  break-inside: avoid;
  margin: 0 0 14px;
  position: relative;
  background: var(--paper);
  border-radius: 2px;
  overflow: hidden;
  opacity: 0;
  animation: rise 0.55s var(--ease) forwards;
}

@media (min-width: 980px) {
  .gallery-item { margin-bottom: 18px; }
}

.gallery-item button.thumb {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.gallery-item img {
  width: 100%;
  height: auto;
  vertical-align: middle;
  transition: transform 0.6s var(--ease);
}

.gallery-item:hover img {
  transform: scale(1.03);
}

.gallery-item .vote-btn {
  position: absolute;
  right: 10px;
  bottom: 10px;
}

.gallery-skeleton {
  columns: inherit;
  column-gap: inherit;
}

.gallery-skeleton span {
  display: block;
  break-inside: avoid;
  margin-bottom: 14px;
  height: 220px;
  background: linear-gradient(90deg, rgba(36,30,27,0.04), rgba(36,30,27,0.08), rgba(36,30,27,0.04));
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
  border-radius: 2px;
}

.gallery-skeleton span:nth-child(2) { height: 300px; }
.gallery-skeleton span:nth-child(3) { height: 180px; }
.gallery-skeleton span:nth-child(5) { height: 260px; }

@keyframes shimmer {
  to { background-position: -200% 0; }
}

.gallery-empty {
  margin: 48px auto;
  max-width: 36ch;
  text-align: center;
  color: var(--ink-soft);
}

/* —— Vote —— */
.vote-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px 0 10px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 250, 247, 0.92);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 16px rgba(36, 30, 27, 0.12);
  transition: transform 0.2s var(--ease), background 0.2s ease, color 0.2s ease;
}

.vote-btn:hover {
  transform: translateY(-1px);
}

.vote-btn[aria-pressed="true"] {
  background: var(--peony);
  color: #fffaf7;
}

.vote-icon {
  width: 16px;
  height: 16px;
  display: block;
  background: currentColor;
  clip-path: path("M8 14.25 6.9 13.25C3.4 10.1 1 7.9 1 5.2 1 3 2.7 1.25 4.9 1.25c1.25 0 2.45.6 3.1 1.55.65-.95 1.85-1.55 3.1-1.55C13.3 1.25 15 3 15 5.2c0 2.7-2.4 4.9-5.9 8.05L8 14.25Z");
}

.vote-btn.is-pulse {
  animation: pulse 0.35s var(--ease);
}

@keyframes pulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* —— Lightbox —— */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(20, 16, 14, 0.88);
  padding: 24px;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-figure {
  margin: 0;
  max-width: min(92vw, 980px);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.lightbox-figure img {
  max-height: 76vh;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.lightbox-figure figcaption {
  display: flex;
  align-items: center;
  gap: 16px;
  color: #f7f0ee;
  font-size: 0.95rem;
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  border: 0;
  background: transparent;
  color: #f7f0ee;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
}

.lightbox-close:hover,
.lightbox-nav:hover {
  opacity: 1;
}

.lightbox-close {
  top: 16px;
  right: 20px;
  font-size: 2.4rem;
}

.lightbox-nav.prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lightbox-nav.next { right: 12px; top: 50%; transform: translateY(-50%); }

.site-footer {
  padding: 0 clamp(20px, 5vw, 56px) 48px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

/* —— Gate —— */
.gate {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(179, 77, 92, 0.14), transparent 50%),
    var(--bg);
}

.gate .eyebrow {
  color: var(--sage);
}

.gate-panel {
  width: min(100%, 420px);
  text-align: center;
}

.gate-brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 8vw, 3.4rem);
  line-height: 1;
  font-weight: 600;
}

.gate-brand span {
  color: var(--peony);
  font-style: italic;
  font-size: 0.55em;
}

.gate-form {
  margin-top: 28px;
  display: grid;
  gap: 12px;
}

.gate-form input,
.admin-form input[type="password"],
.admin-form input[type="text"],
.inline-form input[type="text"] {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--ink);
}

.gate-form input:focus,
.admin-form input:focus,
.inline-form input:focus {
  outline: 2px solid rgba(179, 77, 92, 0.35);
  outline-offset: 1px;
}

.form-error {
  color: var(--peony-deep);
  font-size: 0.92rem;
}

.form-ok {
  color: var(--sage);
  font-size: 0.95rem;
}

/* —— Admin —— */
.admin-body {
  background: var(--bg);
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
}

.admin-card {
  width: min(100% - 32px, 400px);
  margin: 12vh auto;
  padding: 32px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 2px;
}

.admin-card h1,
.admin-top h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
}

.admin-eyebrow {
  margin: 0 0 8px;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--sage);
}

.admin-form {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.admin-form label {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 500;
}

.admin-back {
  margin-top: 20px;
  font-size: 0.9rem;
}

.admin-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  padding: 28px clamp(20px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
}

.admin-actions {
  display: flex;
  gap: 8px;
}

.admin-wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 28px clamp(20px, 4vw, 48px) 64px;
  display: grid;
  gap: 28px;
}

.admin-panel {
  padding: 24px;
  background: var(--paper);
  border: 1px solid var(--line);
}

.admin-panel h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.4rem;
}

.admin-hint {
  margin: 0 0 16px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.file-drop {
  display: grid;
  place-items: center;
  min-height: 120px;
  border: 1px dashed rgba(36, 30, 27, 0.25);
  border-radius: var(--radius);
  background: rgba(36, 30, 27, 0.02);
  cursor: pointer;
  font-weight: 500;
}

.file-drop input {
  max-width: 100%;
  margin-top: 8px;
}

.admin-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.admin-list li {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
}

.admin-list img {
  width: 88px;
  height: 72px;
  object-fit: cover;
  border-radius: 2px;
}

.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inline-form input {
  flex: 1;
  min-height: 40px;
}

@media (max-width: 640px) {
  .admin-list li {
    grid-template-columns: 72px 1fr;
  }
  .admin-list li form:last-child {
    grid-column: 1 / -1;
  }
}
