:root {
  --ink: #1a1714;
  --muted: #4a453e;
  --line: #cfc6b8;
  --paper: #f4efe6;
  --cream: #fbf7f0;
  --white: #fffcf7;
  --soft: #eee6d8;
  --danger: #7a2e2e;
  --ok: #2c5536;
  --shadow: 0 10px 28px rgba(26, 23, 20, 0.06);
  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --script: "Great Vibes", "Allura", cursive;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--serif);
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
  letter-spacing: 0.01em;
  line-height: 1.45;
}

img, video { max-width: 100%; display: block; }
button, input, textarea { font-family: inherit; }
a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--ink);
  color: var(--cream);
  padding: 8px 12px;
  z-index: 80;
}
.skip:focus { left: 8px; }

.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 22px 16px 64px;
  position: relative;
}

.corner {
  position: absolute;
  width: 96px;
  height: 114px;
  background: url("/assets/leaves.svg") no-repeat center / contain;
  opacity: 0.88;
  pointer-events: none;
  z-index: 1;
  animation: leafFloat 9s ease-in-out infinite;
}
.corner-tl { top: 4px; left: 2px; transform: rotate(-8deg); }
.corner-tr { top: 4px; right: 2px; transform: scaleX(-1) rotate(-8deg); animation-delay: 1.2s; }
.corner-bl { bottom: 8px; left: 2px; transform: scaleY(-1) rotate(-8deg); animation-delay: 0.6s; }
.corner-br { bottom: 8px; right: 2px; transform: scale(-1) rotate(-8deg); animation-delay: 1.8s; }

@keyframes leafFloat {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 5px; }
}

.fade-in {
  opacity: 0;
  transform: translateY(12px);
  animation: rise 1.1s ease forwards;
}
.delay-1 { animation-delay: 0.12s; }
.delay-2 { animation-delay: 0.24s; }
.delay-3 { animation-delay: 0.36s; }
@keyframes rise {
  to { opacity: 1; transform: none; }
}

.kicker {
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 42px 0 10px;
  font-weight: 500;
}

.names {
  font-family: var(--script);
  font-size: clamp(52px, 14vw, 92px);
  text-align: center;
  line-height: 0.92;
  margin: 4px 0 8px;
  font-weight: 400;
}
.amp { font-size: 0.72em; }

.date-line {
  text-align: center;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  font-size: 15px;
  color: var(--ink);
  margin: 16px 0 6px;
  font-weight: 500;
}
.rule {
  width: 72px;
  height: 1px;
  background: var(--ink);
  margin: 10px auto 12px;
}
.sub {
  text-align: center;
  font-size: 15px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
}

.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 28px auto;
  max-width: 280px;
  color: var(--ink);
}
.ornament i {
  flex: 1;
  height: 1px;
  background: var(--ink);
  opacity: 0.55;
}
.ornament svg {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

.hero-wrap {
  margin: 22px auto 8px;
  max-width: min(92vw, 540px);
  position: relative;
  padding: 11px;
  background: var(--white);
  border: 1px solid var(--ink);
}
.hero-wrap::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid var(--line);
  pointer-events: none;
  z-index: 1;
}
.hero-wrap img,
.hero-wrap picture,
.hero-wrap picture img {
  width: 100%;
  height: min(68vh, 660px);
  object-fit: cover;
  filter: grayscale(1) contrast(1.06);
}
.hero-caption {
  text-align: center;
  font-style: italic;
  color: var(--ink);
  margin: 12px 12px 4px;
  font-size: 18px;
  line-height: 1.4;
}

.invite-copy {
  text-align: center;
  max-width: 520px;
  margin: 18px auto 4px;
  font-size: 19px;
  line-height: 1.55;
  color: var(--ink);
}

.thanks-note {
  text-align: center;
  max-width: 480px;
  margin: 0 auto 8px;
  font-size: 17px;
  font-style: italic;
  color: var(--ink);
}

.card {
  background: var(--white);
  border: 1px solid var(--line);
  padding: 22px 18px 14px;
  margin: 18px auto 10px;
  max-width: 560px;
}

.card h2 {
  font-family: var(--script);
  font-size: 40px;
  text-align: center;
  font-weight: 400;
  margin: 0 0 6px;
}
.card p.hint {
  text-align: center;
  color: var(--ink);
  margin: 0 0 14px;
  font-size: 17px;
}

label {
  display: block;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 14px 0 6px;
  font-weight: 500;
}
input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--ink);
  background: transparent;
  padding: 8px 2px 10px;
  font-size: 18px;
  color: var(--ink);
  outline: none;
  resize: vertical;
}
textarea { min-height: 70px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--cream);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 13px;
  cursor: pointer;
  margin-top: 14px;
  transition: background 0.25s ease, color 0.25s ease, opacity 0.25s ease;
}
.btn:hover { background: #000; color: var(--cream); }
.btn.ghost {
  background: transparent;
  color: var(--ink);
}
.btn.ghost:hover { background: var(--ink); color: var(--cream); }
.btn:disabled,
.btn[disabled] {
  background: transparent;
  color: #8d867c;
  border-color: #cfc6b8;
  cursor: not-allowed;
  opacity: 1;
}
.btn.solid:not(:disabled) {
  background: var(--ink);
  color: var(--cream);
  border-color: var(--ink);
}
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.small {
  min-height: 42px;
  width: auto;
  padding: 0 16px;
  font-size: 12px;
  margin: 0;
}

.file-btn { position: relative; overflow: hidden; margin-top: 18px; }
.file-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.limits {
  text-align: center;
  color: var(--ink);
  margin: 10px 0 0;
  font-size: 15px;
  line-height: 1.45;
}

.previews {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}
.previews:empty { display: none; }
.previews .item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--soft);
  border: 1px solid var(--line);
}
.previews img, .previews video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1);
}
.previews .tag {
  position: absolute;
  left: 6px;
  bottom: 6px;
  background: rgba(255,252,247,0.92);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 6px;
  color: var(--ink);
}
.previews .bad { outline: 2px solid var(--danger); }
.previews .err {
  position: absolute;
  inset: auto 4px 4px 4px;
  font-size: 12px;
  color: var(--danger);
  background: var(--white);
  padding: 4px;
}

.progress {
  display: none;
  margin-top: 12px;
  height: 3px;
  background: var(--soft);
}
.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--ink);
  transition: width 0.2s linear;
}
.progress.show { display: block; }

.toast {
  display: none;
  margin-top: 12px;
  text-align: center;
  border: 1px solid var(--ink);
  padding: 14px 12px;
  background: var(--cream);
}
.toast.show { display: block; }
.toast strong {
  display: block;
  font-family: var(--script);
  font-size: 30px;
  font-weight: 400;
  margin-bottom: 4px;
}

.section-title {
  text-align: center;
  margin: 28px 0 10px;
}
.section-title h2 {
  font-family: var(--script);
  font-size: 42px;
  margin: 0;
  font-weight: 400;
}
.section-title p {
  color: var(--ink);
  margin: 8px 0 0;
  font-size: 17px;
}

.toolbar {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 8px 0 14px;
}
.toolbar.hidden { display: none; }

.mosaic {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
@media (min-width: 720px) {
  .mosaic { grid-template-columns: repeat(3, 1fr); gap: 10px; }
}
.tile {
  position: relative;
  cursor: pointer;
  background: var(--soft);
  overflow: hidden;
  aspect-ratio: 1;
}
.tile img, .tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.05);
  display: block;
  transition: transform 0.7s ease, filter 0.7s ease;
}
.tile:hover img, .tile:hover video,
.tile:focus-visible img, .tile:focus-visible video {
  transform: scale(1.03);
  filter: grayscale(0.3) contrast(1.05);
}
.tile .play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 26px;
  letter-spacing: 0.2em;
  text-shadow: 0 1px 8px rgba(0,0,0,0.35);
  pointer-events: none;
}
.tile .meta {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 22px 10px 8px;
  background: linear-gradient(transparent, rgba(20,16,12,0.55));
  color: #fff;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.tile:hover .meta, .tile:focus-visible .meta { opacity: 1; }
@media (hover: none) {
  .tile .meta { opacity: 1; }
}
.empty {
  text-align: center;
  color: var(--ink);
  font-style: italic;
  font-size: 17px;
  padding: 18px 10px 6px;
}

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(16,14,12,0.94);
  z-index: 50;
  align-items: center;
  justify-content: center;
  padding: 18px;
  touch-action: pan-y;
}
.lightbox.open { display: flex; flex-direction: column; }
.lightbox .stage {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
.lightbox img, .lightbox video {
  max-width: min(100%, 920px);
  max-height: calc(100vh - 130px);
  object-fit: contain;
  filter: none;
}
.lightbox .bar {
  color: #f7f3ec;
  text-align: center;
  padding: 10px 8px 4px;
  font-size: 16px;
}
.lightbox .actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 8px 0 6px;
}
.lightbox .actions .btn {
  width: auto;
  min-height: 40px;
  padding: 0 14px;
  background: transparent;
  color: #f7f3ec;
  border-color: #f7f3ec;
  margin: 0;
}
.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 42px;
  cursor: pointer;
  padding: 10px 16px;
}
.nav-prev { left: 0; }
.nav-next { right: 0; }
.close-x {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: 0;
  color: #fff;
  font-size: 32px;
  cursor: pointer;
}

footer {
  text-align: center;
  margin-top: 42px;
  color: var(--ink);
  font-size: 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.6;
}

.admin-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.admin-login .card { width: 100%; max-width: 420px; }

.admin-shell { max-width: 1100px; margin: 0 auto; padding: 18px 14px 60px; }
.admin-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 18px;
}
.admin-top h1 {
  font-family: var(--script);
  font-size: 38px;
  margin: 0;
  font-weight: 400;
}
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 16px; }
.tab {
  border: 1px solid var(--line);
  background: transparent;
  padding: 8px 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 12px;
  cursor: pointer;
  color: var(--ink);
}
.tab.on { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.batch { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.admin-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 720px) {
  .admin-grid { grid-template-columns: 1fr 1fr; }
}
.admin-item {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  border: 1px solid var(--line);
  background: var(--white);
  padding: 10px;
}
.admin-item img, .admin-item video {
  width: 110px;
  height: 110px;
  object-fit: cover;
  filter: grayscale(1);
}
.admin-item h3 { margin: 0 0 4px; font-size: 18px; }
.admin-item p { margin: 0 0 8px; color: var(--muted); font-size: 16px; }
.status {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  padding: 2px 6px;
  margin-bottom: 8px;
}
.status.pending { color: #6b4e1a; }
.status.approved { color: var(--ok); }
.status.rejected { color: var(--danger); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.settings {
  border: 1px solid var(--line);
  background: var(--white);
  padding: 18px;
  margin-top: 24px;
}
.settings h2 {
  font-family: var(--script);
  font-size: 32px;
  margin: 0 0 12px;
  font-weight: 400;
}
.hidden { display: none !important; }
.error-text { color: var(--danger); text-align: center; min-height: 1.2em; font-size: 16px; }
.admin-list { margin: 0; padding-left: 18px; }
.admin-list li { margin: 4px 0; }

.album-box { margin-top: 28px; }
.album-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 12px;
}
@media (min-width: 720px) {
  .album-grid { grid-template-columns: repeat(3, 1fr); }
}
.album-card {
  border: 1px solid var(--line);
  background: var(--cream);
  padding: 8px;
  cursor: grab;
  touch-action: none;
  position: relative;
}
.album-card.dragging { opacity: 0.55; }
.album-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  filter: grayscale(1) contrast(1.04);
}
.album-card textarea {
  width: 100%;
  min-height: 48px;
  margin-top: 8px;
  font-size: 15px;
}
.album-card .row-actions { margin-top: 8px; }
.album-card .hero-mark {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--white);
  border: 1px solid var(--ink);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 6px;
}
.album-card.is-hero { outline: 1px solid var(--ink); }

@media (max-width: 420px) {
  .hero-wrap img,
  .hero-wrap picture img { height: min(62vh, 520px); }
  .corner { width: 72px; height: 86px; }
  .previews { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .corner, .fade-in, .tile img, .tile video, .btn {
    animation: none !important;
    transition: none !important;
  }
  .fade-in { opacity: 1; transform: none; }
}
