@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600&family=Montserrat:wght@400;500;600&display=swap");

:root {
  color-scheme: light;
  --ink: #304254;
  --ink-soft: #657068;
  --sage: #748675;
  --sage-dark: #526656;
  --sage-pale: #e5ebe2;
  --ivory: #faf8f1;
  --paper: rgba(255, 255, 252, 0.9);
  --champagne: #b69a62;
  --line: rgba(82, 102, 86, 0.24);
  --danger: #994e45;
  --shadow: 0 22px 70px rgba(48, 66, 84, 0.13);
  font-family: "Montserrat", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--ivory); }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--ivory) url("/static/assets/botanical-frame.webp") top center / min(100%, 1100px) auto no-repeat fixed;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(250, 248, 241, 0.05), rgba(250, 248, 241, 0.54) 62%, var(--ivory));
  content: "";
}

button, input { font: inherit; }
button { touch-action: manipulation; }

.page-shell {
  width: min(100% - 32px, 680px);
  margin-inline: auto;
  padding: max(42px, env(safe-area-inset-top)) 0 max(32px, env(safe-area-inset-bottom));
}

.masthead {
  padding: clamp(120px, 24vh, 220px) 12px 36px;
  text-align: center;
}

.eyebrow, .section-kicker {
  margin: 0 0 8px;
  color: var(--sage-dark);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

h1, h2, h3 {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
}

h1 { font-size: clamp(3rem, 11vw, 5rem); line-height: 0.94; letter-spacing: -0.045em; }
h1 span { color: var(--champagne); font-style: italic; font-weight: 500; }
h2 { font-size: clamp(2rem, 7vw, 2.8rem); line-height: 1; }
h3 { font-size: 2rem; }

.welcome {
  max-width: 390px;
  margin: 18px auto 0;
  color: var(--ink-soft);
  line-height: 1.65;
}

.ornament { display: flex; align-items: center; gap: 14px; max-width: 270px; margin: 23px auto 0; }
.ornament span { height: 1px; flex: 1; background: linear-gradient(90deg, transparent, var(--champagne)); }
.ornament span:last-child { transform: scaleX(-1); }
.ornament i { color: var(--champagne); font: 600 0.72rem/1 "Montserrat", sans-serif; letter-spacing: 0.16em; }

.paper-card {
  position: relative;
  overflow: hidden;
  padding: clamp(24px, 6vw, 44px);
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 4px 28px 4px 28px;
  background: var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: blur(13px);
}

.paper-card::after {
  position: absolute;
  inset: 10px;
  border: 1px solid var(--line);
  border-radius: 1px 20px 1px 20px;
  content: "";
  pointer-events: none;
}

.paper-card > * { position: relative; z-index: 1; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 30px; }

label:not(.drop-zone) { display: block; margin: 0 0 9px; font-size: 0.9rem; font-weight: 600; }
label span { color: var(--ink-soft); font-weight: 400; }

input[type="text"], input:not([type]) {
  width: 100%;
  min-height: 50px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 3px 12px 3px 12px;
  outline: none;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
}

input:focus { border-color: var(--sage); box-shadow: 0 0 0 3px rgba(116, 134, 117, 0.14); }

.drop-zone {
  display: flex;
  min-height: 220px;
  margin-top: 22px;
  padding: 28px 18px;
  border: 1px dashed var(--sage);
  border-radius: 4px 22px 4px 22px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  cursor: pointer;
  background: rgba(229, 235, 226, 0.52);
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.drop-zone:hover, .drop-zone.is-dragging { border-color: var(--champagne); background: rgba(250, 248, 241, 0.9); transform: translateY(-2px); }
.drop-zone input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.drop-zone strong { margin-top: 14px; font-family: "Cormorant Garamond", Georgia, serif; font-size: 1.55rem; }
.drop-zone > span:not(.camera-mark) { margin-top: 3px; color: var(--ink-soft); font-size: 0.9rem; }
.drop-zone small { margin-top: 14px; color: var(--ink-soft); font-size: 0.72rem; line-height: 1.5; }

.camera-mark { display: grid; width: 58px; height: 58px; border-radius: 50%; place-items: center; color: white; background: var(--sage-dark); box-shadow: 0 8px 20px rgba(82, 102, 86, 0.25); }
.camera-mark svg { width: 28px; fill: none; stroke: currentColor; stroke-width: 1.5; }

.connection-pill { flex: none; padding: 7px 10px; border: 1px solid #cad8ca; border-radius: 100px; color: #416047; background: #edf5eb; font-size: 0.72rem; font-weight: 600; }
.connection-pill.offline { border-color: #e3c7bd; color: var(--danger); background: #fff0eb; }

.selection { margin-top: 26px; }
.selection-summary, .file-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.selection-summary p { margin: 0; font-weight: 600; }
.text-button { padding: 4px; border: 0; color: var(--sage-dark); background: transparent; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.file-list { display: grid; margin: 17px 0 22px; padding: 0; gap: 12px; list-style: none; }
.file-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) 30px; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 3px 14px 3px 14px; background: rgba(255, 255, 255, 0.64); }
.file-preview { width: 52px; height: 52px; overflow: hidden; border-radius: 2px 10px 2px 10px; background: var(--sage-pale); }
.file-preview img, .file-preview video { width: 100%; height: 100%; object-fit: cover; }
.file-heading strong { overflow: hidden; font-size: 0.83rem; text-overflow: ellipsis; white-space: nowrap; }
.file-size { flex: none; color: var(--ink-soft); font-size: 0.7rem; }
.file-status { margin: 5px 0 0; color: var(--ink-soft); font-size: 0.72rem; }
.file-row.is-error .file-status { color: var(--danger); }
.file-row.is-complete .file-status { color: var(--sage-dark); font-weight: 600; }
.progress-track { height: 4px; margin-top: 7px; overflow: hidden; border-radius: 10px; background: var(--sage-pale); }
.progress-track span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--sage), var(--champagne)); transition: width 120ms linear; }
.remove-file { width: 30px; height: 30px; border: 0; border-radius: 50%; color: var(--ink-soft); background: transparent; cursor: pointer; font-size: 1.3rem; }

.button { display: inline-flex; min-height: 50px; padding: 0 22px; border: 1px solid transparent; border-radius: 3px 14px 3px 14px; align-items: center; justify-content: center; cursor: pointer; font-weight: 600; transition: transform 160ms ease, box-shadow 160ms ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: 0.58; transform: none; }
.button-primary { width: 100%; color: white; background: var(--ink); box-shadow: 0 10px 24px rgba(48, 66, 84, 0.2); }
.button-secondary { border-color: var(--sage); color: var(--sage-dark); background: transparent; }
.inline-form { display: flex; gap: 10px; }

.event-navigation {
  display: grid;
  width: min(100%, 430px);
  margin: 0 auto 20px;
  padding: 5px;
  grid-template-columns: 1fr 1fr;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 4px 18px 4px 18px;
  background: rgba(255, 255, 252, 0.82);
  box-shadow: 0 9px 30px rgba(48, 66, 84, 0.1);
  backdrop-filter: blur(12px);
}

.nav-tab {
  min-height: 44px;
  border: 0;
  border-radius: 2px 13px 2px 13px;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  font-weight: 600;
}

.nav-tab.is-active { color: white; background: var(--ink); }
.upload-card { max-width: 680px; margin-inline: auto; }

.gallery-panel { width: min(1060px, calc(100vw - 32px)); margin-left: 50%; transform: translateX(-50%); }
.gallery-heading { display: flex; align-items: flex-end; justify-content: space-between; margin: 6px 0 24px; padding: 0 4px; }
.round-button, .viewer-close {
  display: grid;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 50%;
  place-items: center;
  color: var(--ink);
  background: rgba(255, 255, 252, 0.88);
  cursor: pointer;
  font-size: 1.4rem;
  box-shadow: 0 6px 20px rgba(48, 66, 84, 0.1);
}

.gallery-grid { columns: 3 250px; column-gap: 14px; }
.gallery-item {
  position: relative;
  display: block;
  width: 100%;
  margin: 0 0 14px;
  padding: 0;
  overflow: hidden;
  break-inside: avoid;
  border: 0;
  border-radius: 3px 18px 3px 18px;
  cursor: zoom-in;
  background: var(--sage-pale);
  box-shadow: 0 10px 28px rgba(48, 66, 84, 0.13);
}

.gallery-media { display: block; min-height: 170px; }
.gallery-media img, .gallery-media video { display: block; width: 100%; min-height: 170px; max-height: 520px; object-fit: cover; }
.gallery-attribution {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 36px 13px 12px;
  overflow: hidden;
  color: white;
  background: linear-gradient(transparent, rgba(27, 39, 47, 0.75));
  font-size: 0.78rem;
  font-weight: 600;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-badge { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; padding: 10px 8px 10px 11px; border-radius: 50%; color: white; background: rgba(48, 66, 84, 0.82); font-size: 0.72rem; }
.gallery-skeleton span { display: block; height: 270px; margin-bottom: 14px; break-inside: avoid; border-radius: 3px 18px 3px 18px; background: linear-gradient(100deg, rgba(229, 235, 226, 0.65) 25%, rgba(255, 255, 252, 0.92) 45%, rgba(229, 235, 226, 0.65) 65%); background-size: 200% 100%; animation: shimmer 1.25s infinite linear; }
.gallery-skeleton span:nth-child(2n) { height: 205px; }
.gallery-skeleton span:nth-child(3n) { height: 330px; }
.gallery-sentinel { height: 1px; }
.load-more { display: flex; margin: 24px auto 0; background: rgba(255, 255, 252, 0.78); }
.empty-gallery { max-width: 560px; margin: 0 auto; text-align: center; }
.empty-gallery p { margin: 10px auto 24px; color: var(--ink-soft); line-height: 1.6; }
.empty-monogram { display: block; margin-bottom: 16px; color: var(--champagne); font: italic 600 1rem/1 "Cormorant Garamond", Georgia, serif; letter-spacing: 0.2em; }

.media-viewer { width: min(94vw, 980px); max-width: none; padding: 0; overflow: visible; border: 0; border-radius: 4px 24px 4px 24px; color: var(--ink); background: #121816; box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45); }
.media-viewer::backdrop { background: rgba(22, 29, 28, 0.84); backdrop-filter: blur(5px); }
.viewer-frame { position: relative; }
.viewer-media { display: grid; min-height: 220px; max-height: 78vh; place-items: center; overflow: hidden; }
.viewer-media img, .viewer-media video { display: block; max-width: 100%; max-height: 78vh; object-fit: contain; }
.viewer-close { position: absolute; top: -16px; right: -12px; z-index: 2; border-color: rgba(255, 255, 255, 0.35); color: white; background: rgba(48, 66, 84, 0.94); }
.viewer-caption { padding: 15px 20px 17px; color: white; background: var(--ink); }
.viewer-caption h3 { font-size: 1.35rem; }
.viewer-caption p { margin: 4px 0 0; color: rgba(255, 255, 255, 0.7); font-size: 0.78rem; }

@keyframes shimmer { to { background-position-x: -200%; } }

.success-panel { padding: 34px 0 12px; text-align: center; }
.success-mark { display: grid; width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 50%; place-items: center; color: white; background: var(--sage-dark); font-size: 1.7rem; }
.success-panel p { margin: 9px 0 24px; color: var(--ink-soft); line-height: 1.6; }
.page-message { margin-top: 16px; padding: 14px 16px; border: 1px solid #e3c7bd; border-radius: 3px 12px 3px 12px; color: var(--danger); background: rgba(255, 240, 235, 0.94); line-height: 1.5; }

footer { padding: 34px 0 0; text-align: center; color: var(--ink-soft); font: 500 1.05rem/1.5 "Cormorant Garamond", Georgia, serif; }
footer span { color: var(--ink); font-style: italic; }
[hidden] { display: none !important; }

@media (max-width: 540px) {
  body { background-size: 780px auto; background-position: top center; }
  .page-shell { width: min(100% - 20px, 680px); }
  .masthead { padding-top: 130px; }
  .paper-card { padding: 28px 22px; }
  .section-heading { display: block; }
  .connection-pill { display: inline-block; margin-top: 14px; }
  .inline-form { align-items: stretch; flex-direction: column; }
  .file-row { grid-template-columns: 46px minmax(0, 1fr) 28px; gap: 9px; }
  .file-preview { width: 46px; height: 46px; }
  .gallery-panel { width: calc(100vw - 20px); }
  .gallery-heading { align-items: center; }
  .gallery-grid { columns: 2 140px; column-gap: 9px; }
  .gallery-item, .gallery-skeleton span { margin-bottom: 9px; }
  .gallery-media, .gallery-media img, .gallery-media video { min-height: 130px; }
  .viewer-close { top: 8px; right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
  .gallery-skeleton span { animation: none; }
}
