:root {
  color-scheme: light;
  --wine: #6d213c;
  --wine-dark: #471225;
  --rose: #c8838e;
  --ivory: #fbf7f0;
  --paper: #fffdf9;
  --ink: #281b1f;
  --muted: #77666c;
  --line: rgba(109, 33, 60, 0.15);
  --shadow: 0 24px 70px rgba(71, 18, 37, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 6%, rgba(200, 131, 142, 0.18), transparent 28rem),
    var(--ivory);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input { font: inherit; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
label:focus-within {
  outline: 3px solid rgba(109, 33, 60, .28);
  outline-offset: 3px;
}

.page-shell {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 18px 18px 44px;
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: 300px;
  padding: 58px clamp(26px, 7vw, 80px);
  border-radius: 32px;
  color: white;
  background:
    linear-gradient(125deg, rgba(71,18,37,.97), rgba(109,33,60,.88)),
    linear-gradient(45deg, #6d213c, #1d1720);
  box-shadow: var(--shadow);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 16px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 22px;
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 18px;
  letter-spacing: .22em;
  font-size: 12px;
  font-weight: 800;
  color: #f2cbd2;
}

.eyebrow.dark { color: var(--wine); }

h1 {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(42px, 8vw, 82px);
  font-weight: 500;
  line-height: .98;
  letter-spacing: -.045em;
}

.event-meta {
  position: relative;
  z-index: 1;
  margin: 24px 0 0;
  color: rgba(255,255,255,.76);
}

.hero-mark {
  position: absolute;
  right: clamp(14px, 5vw, 60px);
  bottom: -60px;
  font-family: Georgia, serif;
  font-size: 250px;
  color: rgba(255,255,255,.06);
}

.search-card {
  position: relative;
  z-index: 2;
  width: min(760px, calc(100% - 24px));
  margin: -38px auto 56px;
  padding: clamp(24px, 5vw, 48px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255,253,249,.96);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.step {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 24px;
  border-radius: 50%;
  color: white;
  background: var(--wine);
  font-weight: 800;
  font-size: 13px;
}

.section-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.section-heading .step { margin: 2px 0 0; }

.section-kicker,
.upload-kicker {
  margin: 0 0 8px;
  color: var(--wine);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .18em;
}

h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 5vw, 48px);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -.03em;
}

#searchTitle {
  white-space: nowrap;
  font-size: clamp(15px, 4.5vw, 40px);
  letter-spacing: -.045em;
}

.lead {
  margin: 14px 0 28px;
  color: var(--muted);
  line-height: 1.6;
}

.gallery-status {
  display: grid;
  gap: 11px;
  margin: 0 0 22px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fffaf5;
}

.gallery-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 14px;
}

.status-badge {
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--wine);
  background: rgba(109, 33, 60, .09);
  font-size: 12px;
  font-weight: 800;
}

.status-badge.ready {
  color: #17623b;
  background: rgba(23, 98, 59, .1);
}

.status-badge.working {
  color: #8a4a05;
  background: rgba(199, 117, 25, .12);
}

.status-badge.attention {
  color: #8a4a05;
  background: rgba(199, 117, 25, .12);
}

.progress-track {
  appearance: none;
  display: block;
  width: 100%;
  overflow: hidden;
  height: 8px;
  border: 0;
  border-radius: 999px;
  background: rgba(109, 33, 60, .1);
}

.progress-track::-webkit-progress-bar {
  border-radius: inherit;
  background: rgba(109, 33, 60, .1);
}

.progress-track::-webkit-progress-value,
.progress-track::-moz-progress-bar {
  border-radius: inherit;
  background: linear-gradient(90deg, var(--wine), var(--rose));
}

.gallery-status p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.consent {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 0 0 20px;
  padding: 16px;
  border-radius: 16px;
  color: var(--muted);
  background: #f7efe9;
  font-size: 14px;
  line-height: 1.5;
}

.consent input {
  width: 20px;
  height: 20px;
  accent-color: var(--wine);
  flex: none;
}

.upload-zone {
  display: flex;
  min-height: 170px;
  padding: 24px;
  border: 1.5px dashed rgba(109,33,60,.35);
  border-radius: 22px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  text-align: center;
  cursor: pointer;
  background: linear-gradient(180deg, #fffdf9, #faf2ec);
  transition: transform .2s ease, border-color .2s ease;
}

.upload-zone:hover {
  transform: translateY(-2px);
  border-color: var(--wine);
}

.upload-zone.is-dragover {
  transform: translateY(-2px) scale(1.01);
  border-color: var(--wine);
  border-style: solid;
  background: #f7e8e6;
  box-shadow: inset 0 0 0 3px rgba(109, 33, 60, .08);
}

.upload-zone.is-dragover strong {
  color: var(--wine);
}

.upload-zone input { display: none; }
.upload-zone span:last-of-type { color: var(--muted); font-size: 13px; }
.upload-kicker { margin-bottom: 3px; }

.preview-wrap {
  align-items: center;
  gap: 16px;
  margin: 18px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.preview-wrap:not([hidden]) { display: flex; }
.preview-wrap img { width: 74px; height: 74px; object-fit: cover; border-radius: 14px; }

.text-button {
  display: block;
  margin-top: 8px;
  padding: 0;
  border: 0;
  color: var(--wine);
  background: none;
  cursor: pointer;
  font-weight: 700;
}

.primary-button {
  display: flex;
  width: 100%;
  margin-top: 22px;
  padding: 17px 20px;
  border: 0;
  border-radius: 16px;
  align-items: center;
  justify-content: space-between;
  color: white;
  background: var(--wine);
  cursor: pointer;
  font-weight: 800;
  box-shadow: 0 12px 28px rgba(109,33,60,.22);
}

.primary-button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.primary-button:not(:disabled):hover { background: var(--wine-dark); }
.message { min-height: 20px; margin: 14px 0 0; color: var(--muted); font-size: 14px; }
.message.error { color: #a2182f; }
.message.success { color: #17623b; }
.message.notice { color: #8a4a05; }
.button-state { font-size: 12px; font-weight: 700; opacity: .8; }

.trust-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.trust-row span {
  padding: 10px;
  border-radius: 12px;
  color: var(--muted);
  background: #f8f2ed;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
}

.live-section {
  margin: 34px 0 56px;
  padding: clamp(20px, 4vw, 38px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255,253,249,.96);
  box-shadow: var(--shadow);
}

.live-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.live-count {
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--wine);
  background: rgba(109, 33, 60, .09);
  font-size: 12px;
  font-weight: 800;
}

.live-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 22px;
}

.live-photo {
  position: relative;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 14px;
  aspect-ratio: 3 / 2;
  background: #eaded9;
  cursor: zoom-in;
}

.live-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .22s ease;
}

.live-photo:hover img { transform: scale(1.025); }

.live-watermark::after {
  content: "HARU WEDDING";
  position: absolute;
  right: 8px;
  bottom: 7px;
  color: rgba(255,255,255,.9);
  text-shadow: 0 1px 8px rgba(0,0,0,.7);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .12em;
}

.live-more { display: block; margin: 18px auto 0; }

.results-section { margin: 0 0 56px; }
.results-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.result-count { color: var(--wine); font-weight: 800; white-space: nowrap; }
.results-summary { display: grid; justify-items: end; gap: 4px; }
.selected-count { color: var(--muted); font-size: 13px; }
.privacy-note { color: var(--muted); line-height: 1.6; }

.result-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.result-actions[hidden] { display: none; }

.secondary-button {
  min-height: 46px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--wine);
  background: var(--paper);
  cursor: pointer;
  font-weight: 800;
}

.album-toggle-button {
  width: 100%;
  margin-top: 14px;
}

.album-section {
  scroll-margin-top: 18px;
}

.album-details {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.album-details span {
  color: var(--muted);
  font-size: 13px;
}

.album-load-more {
  display: block;
  min-width: 210px;
  margin: 24px auto 0;
}

.album-load-more[hidden] {
  display: none;
}

.primary-button.compact {
  width: auto;
  min-width: 220px;
  min-height: 46px;
  margin: 0;
  padding: 12px 16px;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.result-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
  box-shadow: 0 12px 30px rgba(71,18,37,.08);
}

.result-card.selected {
  border-color: rgba(109, 33, 60, .5);
  box-shadow: 0 12px 30px rgba(71,18,37,.14);
}

.result-image-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: #eee4df;
  cursor: zoom-in;
}

.result-card img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }

.result-details {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.result-selection {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

.result-selection input {
  width: 19px;
  height: 19px;
  accent-color: var(--wine);
}

.result-download {
  color: var(--wine);
  font-weight: 800;
  text-decoration: none;
}

.empty-results {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  padding: 34px;
  border: 1px dashed var(--line);
  border-radius: 20px;
  color: var(--muted);
  text-align: center;
}

.empty-results strong { color: var(--ink); }

.lightbox {
  width: min(94vw, 1040px);
  max-height: 94vh;
  padding: 14px;
  border: 0;
  border-radius: 22px;
  background: #171114;
  box-shadow: 0 30px 100px rgba(0, 0, 0, .45);
}

.lightbox::backdrop {
  background: rgba(20, 11, 15, .8);
  backdrop-filter: blur(8px);
}

.lightbox img {
  display: block;
  width: 100%;
  max-height: calc(94vh - 100px);
  border-radius: 14px;
  object-fit: contain;
}

.lightbox-close,
.lightbox-download {
  position: absolute;
  top: 24px;
  z-index: 1;
  min-height: 42px;
  padding: 10px 14px;
  border: 0;
  border-radius: 12px;
  color: white;
  background: rgba(20, 11, 15, .82);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.lightbox-close { right: 24px; }
.lightbox-download { left: 24px; }

footer {
  display: flex;
  padding: 28px 6px 0;
  border-top: 1px solid var(--line);
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

footer strong { color: var(--wine); }

.landing-shell { min-height: 100vh; }
.landing-hero { min-height: 390px; display: flex; flex-direction: column; justify-content: center; }
.landing-hero h1 { max-width: 820px; }
.landing-card { margin-bottom: 36px; }

.landing-notice {
  display: grid;
  gap: 7px;
  margin-top: 26px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f7efe9;
  line-height: 1.55;
}

.landing-notice strong { color: var(--wine); }
.landing-notice span { color: var(--muted); }

.privacy-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.privacy-summary span {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

@media (max-width: 720px) {
  .landing-hero { min-height: 330px; }
  .privacy-summary { grid-template-columns: 1fr; }
  .live-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .page-shell { padding: 10px 10px 32px; }
  .hero { min-height: 250px; padding: 44px 28px 78px; border-radius: 24px; }
  .search-card { width: calc(100% - 12px); margin-top: -45px; border-radius: 22px; }
  .search-card .section-heading { grid-template-columns: 1fr; gap: 12px; }
  .search-card .section-heading .step { margin-bottom: 0; }
  .results-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  #resultsGrid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }
  #resultsGrid .result-card { border-radius: 12px; }
  #resultsGrid .result-details {
    min-width: 0;
    gap: 6px;
    padding: 7px;
  }
  #resultsGrid .result-selection {
    min-width: 0;
    gap: 5px;
    font-size: 10px;
    line-height: 1.25;
  }
  #resultsGrid .result-selection input {
    flex: 0 0 auto;
    width: 15px;
    height: 15px;
  }
  #resultsGrid .result-download {
    font-size: 11px;
    line-height: 1.2;
  }
  .results-heading { display: block; }
  .results-summary { justify-items: start; margin-top: 12px; }
  .result-actions { align-items: stretch; flex-direction: column; }
  .primary-button.compact { width: 100%; }
  .trust-row { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .live-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .album-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #resultsGrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .section-heading { grid-template-columns: 1fr; }
  .gallery-status-row { align-items: flex-start; flex-direction: column; gap: 8px; }
  footer { align-items: flex-start; flex-direction: column; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
