:root {
  --ink: #211827;
  --muted: #6d6174;
  --line: #e4dbe9;
  --paper: #faf7fb;
  --surface: #ffffff;
  --teal: #5b2a86;
  --teal-2: #7c3fb1;
  --rose: #8f4c8f;
  --amber: #d8b46a;
  --lavender: #f0e7f5;
  --shadow: 0 18px 60px rgba(65, 36, 89, 0.14);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(247, 245, 239, 0.9);
  border-bottom: 1px solid rgba(228, 219, 233, 0.78);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #fff;
  background: var(--teal);
  border-radius: 8px;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.1;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.76rem;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-actions a {
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #fff;
  cursor: pointer;
  background: var(--teal);
  border: 0;
  border-radius: 8px;
}

.hero {
  position: relative;
  display: flex;
  min-height: 92vh;
  align-items: flex-end;
  overflow: hidden;
  padding: 112px clamp(18px, 5vw, 72px) 72px;
  isolation: isolate;
}

.hero-image,
.hero-overlay {
  position: absolute;
  inset: 0;
}

.hero-image {
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 56% 35%;
}

.hero-overlay {
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(28, 18, 36, 0.48), rgba(52, 31, 68, 0.16) 34%, rgba(52, 31, 68, 0.04) 64%),
    linear-gradient(0deg, rgba(28, 18, 36, 0.28), rgba(28, 18, 36, 0.02) 48%);
}

.hero-content {
  max-width: 760px;
  color: #fff;
  text-shadow:
    0 4px 18px rgba(28, 18, 36, 0.86),
    0 12px 42px rgba(28, 18, 36, 0.68);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--rose);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: #ead0ff;
}

.hero-rotator {
  display: inline-flex;
  width: min(100%, 520px);
  min-height: 76px;
  align-items: center;
  justify-content: flex-start;
  margin: 0 0 14px;
  padding: 0;
  color: #fff;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 950;
  letter-spacing: 0;
  line-height: 1;
  text-align: left;
  text-transform: uppercase;
}

.hero-rotator span {
  display: block;
  max-width: 100%;
  min-width: 1ch;
  white-space: nowrap;
  text-shadow:
    0 5px 18px rgba(28, 18, 36, 0.9),
    0 14px 48px rgba(28, 18, 36, 0.8);
}

.hero-rotator span[data-size="medium"] {
  font-size: 0.9em;
}

.hero-rotator span[data-size="long"] {
  font-size: 0.76em;
}

.hero h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(3rem, 8.4vw, 6.8rem);
  line-height: 0.92;
  letter-spacing: 0;
  text-shadow:
    0 4px 0 rgba(43, 20, 64, 0.12),
    0 8px 28px rgba(18, 8, 28, 0.9),
    0 20px 70px rgba(18, 8, 28, 0.86);
}

.hero p:not(.eyebrow) {
  max-width: 620px;
  margin: 22px 0 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: clamp(1rem, 2vw, 1.22rem);
  line-height: 1.55;
}

.hero-actions,
.album-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.primary-action,
.secondary-action,
.ghost-action {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
}

.primary-action {
  color: #fff;
  background: var(--teal-2);
}

.secondary-action {
  color: var(--teal);
  background: #fff;
  border-color: var(--line);
}

.admin-only {
  display: none;
}

.admin-mode .admin-only {
  display: block;
}

.ghost-action {
  color: var(--muted);
  background: transparent;
  border-color: var(--line);
}

.full,
.wide {
  width: 100%;
}

.workspace-band {
  padding: 38px clamp(14px, 3vw, 40px) 56px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 18px;
  max-width: 1280px;
  margin: 0 auto;
}

body:not(.admin-mode) .workspace-grid {
  grid-template-columns: minmax(0, 1fr);
}

.control-panel,
.main-panel,
.submit-area,
.memories-section,
.album-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.control-panel {
  position: sticky;
  top: 86px;
  align-self: start;
  padding: 20px;
}

.main-panel {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.panel-heading h2,
.section-head h2,
.album-preview h2,
.event-summary h2 {
  margin: 0;
  font-size: 1.35rem;
}

.stacked-form,
.memory-form {
  display: grid;
  gap: 13px;
}

.memory-form {
  grid-template-columns: minmax(0, 1fr);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  color: var(--ink);
  background: #fbfaf6;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
}

input,
select {
  height: 44px;
  padding: 0 12px;
}

textarea {
  min-height: 96px;
  resize: vertical;
  padding: 12px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--teal-2);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.qr-box {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.qr-box h3 {
  margin: 0;
  font-size: 1.05rem;
}

.qr-box img {
  width: min(100%, 240px);
  aspect-ratio: 1;
  justify-self: center;
  border: 10px solid #fff;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(23, 33, 31, 0.12);
}

.event-summary,
.submit-area,
.memories-section,
.album-section {
  padding: 22px;
}

.event-summary {
  display: block;
  background: var(--lavender);
}

.event-summary p:not(.eyebrow),
.album-preview p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.life-dates {
  color: var(--teal);
  font-weight: 900;
}

.short-bio {
  max-width: 680px;
}

.upload-zone {
  min-height: 104px;
  align-content: center;
  justify-items: center;
  padding: 16px;
  color: var(--teal);
  text-align: center;
  background: #fbf7fd;
  border: 1px dashed var(--teal-2);
  border-radius: 8px;
  cursor: pointer;
}

.upload-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.upload-zone span {
  font-size: 1rem;
}

.upload-zone small {
  color: var(--muted);
  font-weight: 600;
}

.attachment-preview {
  display: grid;
  gap: 4px;
  padding: 14px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.attachment-preview strong {
  color: var(--teal);
}

.attachment-preview span,
.attachment-preview small {
  overflow-wrap: anywhere;
}

.attachment-warning {
  margin: 6px 0 0;
  color: #9a3412;
  font-weight: 800;
}

.upload-progress {
  display: grid;
  gap: 9px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.upload-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.upload-progress-head strong {
  color: var(--teal);
}

.upload-progress-track {
  height: 10px;
  overflow: hidden;
  background: #eee6f3;
  border-radius: 999px;
}

.upload-progress-bar {
  width: 0;
  height: 100%;
  background: var(--teal-2);
  border-radius: inherit;
  transition: width 0.18s ease;
}

.section-head,
.album-preview {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.memory-card {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.memory-card figure {
  margin: 0;
}

.memory-media-button {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 180px;
  place-items: center;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  background: #eee6f3;
  border: 0;
}

.memory-media-button img,
.memory-media-button video,
.placeholder-media {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  background: #eee6f3;
}

.memory-media-button video {
  aspect-ratio: 16 / 9;
}

.video-play-badge {
  position: absolute;
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  color: #fff;
  background: rgba(91, 42, 134, 0.88);
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  font-size: 1.15rem;
  box-shadow: 0 12px 34px rgba(28, 18, 36, 0.3);
}

.placeholder-media {
  display: grid;
  min-height: 180px;
  place-items: center;
  color: var(--teal);
  font-weight: 900;
}

.memory-body {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.memory-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.memory-body p {
  margin: 0;
  color: var(--ink);
  line-height: 1.45;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 34px 18px;
  color: var(--muted);
  text-align: center;
  background: #fbfaf6;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  max-width: min(360px, calc(100vw - 36px));
  padding: 13px 16px;
  color: #fff;
  background: var(--teal);
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.media-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(18, 8, 28, 0.88);
}

.media-modal.show {
  display: flex;
}

.media-modal-content {
  display: grid;
  max-width: min(1120px, 96vw);
  max-height: 88vh;
  place-items: center;
}

.media-modal-content img,
.media-modal-content video,
.media-modal-content iframe {
  display: block;
  max-width: 100%;
  max-height: 88vh;
  object-fit: contain;
  background: #000;
  border-radius: 8px;
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.42);
}

.media-modal-content iframe {
  width: min(1120px, 96vw);
  height: min(630px, 54vw);
  min-height: 240px;
  border: 0;
}

.media-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  color: #fff;
  cursor: pointer;
  background: rgba(91, 42, 134, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 8px;
  font-size: 2rem;
  line-height: 1;
}

@media (max-width: 880px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: static;
  }

  .event-summary,
  .section-head,
  .album-preview {
    display: grid;
  }

}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
  }

  .nav-actions a {
    display: none;
  }

  .hero {
    min-height: 88vh;
    padding: 96px 18px 44px;
  }

  .hero-rotator {
    width: 100%;
    min-height: 62px;
    padding: 0;
    font-size: clamp(2.2rem, 12vw, 3.6rem);
  }

  .hero-image {
    object-position: 56% 35%;
  }

  .hero h1 {
    font-size: clamp(3rem, 15vw, 4.6rem);
  }

  .memory-form {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: auto;
  }

}

@media print {
  .topbar,
  .control-panel,
  .submit-area,
  .album-actions,
  .media-modal,
  .toast {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .hero {
    min-height: 42vh;
  }

  .workspace-grid,
  .main-panel {
    display: block;
  }

  .main-panel,
  .event-summary,
  .memories-section,
  .album-section {
    box-shadow: none;
    border: 0;
  }
}
