:root {
  --page: #fbf7f0;
  --page-deep: #f3eadf;
  --surface: #fffefd;
  --surface-soft: #fffaf4;
  --ink: #25231f;
  --muted: #756d63;
  --quiet: #9b9185;
  --line: rgba(83, 70, 55, 0.14);
  --line-strong: rgba(83, 70, 55, 0.22);
  --accent: #92724b;
  --accent-ink: #fffaf1;
  --accent-soft: #eee0ca;
  --sage: #60745f;
  --success: #3f724b;
  --success-soft: #edf7ef;
  --error: #a1463f;
  --error-soft: #fff0ee;
  --shadow: 0 18px 42px rgba(42, 35, 28, 0.08);
  --radius: 8px;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  overflow-x: hidden;
  background: var(--page);
}

body {
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(180deg, var(--page) 0%, var(--page-deep) 100%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

img,
video {
  max-width: 100%;
}

h1,
h2,
h3,
p,
figure {
  margin: 0;
}

h1,
h2,
h3 {
  letter-spacing: 0;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(146, 114, 75, 0.38);
  outline-offset: 3px;
}

.page-shell {
  width: 100%;
  min-width: 0;
  min-height: 100vh;
}

.landing-screen {
  min-height: 100svh;
  background: #e8ddd2;
}

.landing-hero {
  position: relative;
  isolation: isolate;
  min-height: 100svh;
  display: grid;
  align-items: end;
  overflow: hidden;
}

.landing-hero::after {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  background:
    linear-gradient(180deg, rgba(251, 247, 240, 0) 36%, rgba(251, 247, 240, 0.24) 58%, rgba(251, 247, 240, 0.94) 91%, var(--page) 100%),
    linear-gradient(90deg, rgba(251, 247, 240, 0.08), rgba(251, 247, 240, 0));
  pointer-events: none;
}

.couple-card {
  position: absolute;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background: #d9cdc0;
}

.couple-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: 35% center;
}

.landing-copy {
  width: min(100%, 34rem);
  display: grid;
  gap: var(--space-3);
  padding:
    0
    max(var(--space-5), env(safe-area-inset-right, 0px))
    calc(var(--space-6) + env(safe-area-inset-bottom, 0px))
    max(var(--space-5), env(safe-area-inset-left, 0px));
}

.landing-copy h1 {
  max-width: 11ch;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.6rem;
  font-weight: 500;
  line-height: 0.98;
}

.lede {
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.38;
}

.landing-note {
  max-width: 24rem;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.48;
}

.trust-notes {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  color: var(--sage);
  font-size: 0.82rem;
  font-weight: 750;
}

.trust-notes span + span::before {
  margin-right: var(--space-2);
  color: rgba(96, 116, 95, 0.52);
  content: "\00b7";
}

.primary-button,
.secondary-button,
.media-action-button,
.text-button,
.retry-button,
.back-button {
  min-height: 3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 760;
  text-align: center;
  text-decoration: none;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.primary-button {
  min-height: 3.25rem;
  padding: 0.85rem 1.25rem;
  color: var(--accent-ink);
  background: var(--accent);
  border-color: rgba(146, 114, 75, 0.95);
  box-shadow: 0 12px 28px rgba(60, 47, 31, 0.16);
}

.primary-button.is-secondary {
  color: var(--ink);
  background: rgba(255, 254, 253, 0.94);
  border-color: var(--line-strong);
  box-shadow: none;
}

.secondary-button {
  padding: 0.8rem 1.15rem;
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line-strong);
}

.primary-button:hover:not(:disabled),
.secondary-button:hover:not(:disabled),
.media-action-button:hover:not(:disabled),
.text-button:hover:not(:disabled),
.retry-button:hover:not(:disabled),
.back-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.start-button {
  width: min(100%, 14rem);
  margin-top: var(--space-2);
}

.upload-screen {
  width: min(100%, 50rem);
  min-height: 100svh;
  display: grid;
  align-content: start;
  gap: var(--space-5);
  margin: 0 auto;
  padding:
    var(--space-4)
    max(var(--space-4), env(safe-area-inset-right, 0px))
    calc(11rem + env(safe-area-inset-bottom, 0px))
    max(var(--space-4), env(safe-area-inset-left, 0px));
}

.upload-topbar {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-3);
  align-items: start;
}

.upload-heading {
  min-width: 0;
  display: grid;
  gap: var(--space-1);
  padding-top: 0.05rem;
}

.couple-label {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 820;
  line-height: 1.25;
}

.upload-topbar h2 {
  font-size: clamp(2rem, 9vw, 2.35rem);
  font-weight: 730;
  line-height: 1.05;
}

.upload-topbar h2:focus {
  outline: none;
}

.upload-subtitle {
  max-width: 30rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
}

.back-button {
  min-height: 2.35rem;
  gap: 0.32rem;
  padding: 0.44rem 0.68rem;
  color: var(--ink);
  background: rgba(255, 254, 253, 0.84);
  border-color: var(--line);
  font-size: 0.9rem;
  box-shadow: none;
}

.back-button span:first-child {
  font-size: 1.1rem;
  line-height: 1;
}

.upload-panel,
.upload-content {
  min-width: 0;
  display: grid;
  gap: var(--space-4);
}

.media-card,
.guest-field,
.progress-state,
.success-state {
  min-width: 0;
  background: rgba(255, 254, 253, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
}

.media-card {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-4);
}

.media-card__header {
  min-width: 0;
  display: grid;
  grid-template-columns: 2.45rem minmax(0, 1fr);
  gap: var(--space-3);
  align-items: start;
}

.media-card__mark,
.video-summary__mark {
  width: 2.45rem;
  height: 2.45rem;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: rgba(146, 114, 75, 0.11);
  border: 1px solid rgba(146, 114, 75, 0.16);
  border-radius: 50%;
  font-size: 1.25rem;
  font-weight: 740;
  line-height: 1;
}

.media-card__mark--video {
  color: var(--sage);
  background: rgba(96, 116, 95, 0.1);
  border-color: rgba(96, 116, 95, 0.16);
}

.media-card__copy {
  min-width: 0;
  display: grid;
  gap: var(--space-1);
}

.media-card__title-row,
.progress-state__heading {
  min-width: 0;
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  align-items: flex-start;
}

.media-card h3,
.progress-state h3 {
  min-width: 0;
  color: var(--ink);
  font-size: 1.22rem;
  font-weight: 740;
  line-height: 1.18;
}

.media-card p,
.progress-state p,
.submit-area p,
.success-state p {
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.45;
}

.count-pill {
  flex: 0 0 auto;
  min-width: 4.2rem;
  padding: 0.32rem 0.55rem;
  color: var(--sage);
  background: rgba(96, 116, 95, 0.08);
  border: 1px solid rgba(96, 116, 95, 0.14);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 760;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.media-action-button {
  width: 100%;
  min-width: 0;
  min-height: 3.1rem;
  padding: 0.78rem 1rem;
  color: var(--ink);
  background: var(--surface-soft);
  border-color: var(--line-strong);
  box-shadow: none;
}

.media-action-button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-action-button:not(:disabled) {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: rgba(146, 114, 75, 0.95);
  box-shadow: 0 10px 22px rgba(60, 47, 31, 0.12);
}

.message,
.form-message {
  min-width: 0;
  color: var(--error);
  font-size: 0.92rem;
  line-height: 1.42;
}

.message:empty,
.form-message:empty {
  display: none;
}

.message:not(:empty),
.form-message:not(:empty) {
  padding: 0.65rem 0.75rem;
  background: var(--error-soft);
  border: 1px solid rgba(161, 70, 63, 0.16);
  border-radius: var(--radius);
}

.message.is-success,
.form-message.is-success {
  color: var(--success);
}

.message.is-success:not(:empty),
.form-message.is-success:not(:empty) {
  background: var(--success-soft);
  border-color: rgba(63, 114, 75, 0.16);
}

.selected-media-list {
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

.selected-photo {
  min-width: 0;
  display: grid;
  grid-template-columns: 3.6rem minmax(0, 1fr) auto;
  gap: var(--space-3);
  align-items: center;
  padding: 0.65rem;
  overflow: hidden;
  background: rgba(255, 250, 244, 0.82);
  border: 1px solid rgba(83, 70, 55, 0.11);
  border-radius: var(--radius);
}

.selected-photo img {
  width: 3.6rem;
  height: 3.6rem;
  display: block;
  object-fit: cover;
  border-radius: 6px;
}

.selected-photo__body {
  min-width: 0;
  display: grid;
  gap: var(--space-2);
}

.selected-photo__summary {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.selected-photo__label,
.selected-photo__size {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-photo__label {
  padding: 0.18rem 0.45rem;
  color: var(--ink);
  background: rgba(37, 35, 31, 0.06);
  border: 1px solid rgba(37, 35, 31, 0.08);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 760;
}

.selected-photo__label--optimized {
  color: var(--success);
  background: var(--success-soft);
  border-color: rgba(63, 114, 75, 0.16);
}

.selected-photo__size {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.25;
}

.remove-photo {
  min-height: 2.45rem;
  max-width: 5.6rem;
  padding: 0 var(--space-2);
  color: var(--error);
  background: transparent;
  border: 1px solid rgba(161, 70, 63, 0.18);
  border-radius: var(--radius);
  font-size: 0.86rem;
  font-weight: 760;
}

.item-progress {
  min-width: 0;
  display: grid;
  gap: var(--space-1);
}

.item-progress__bar,
.upload-progress,
.progress-row__bar {
  overflow: hidden;
  background: rgba(37, 35, 31, 0.1);
  border-radius: 999px;
}

.item-progress__bar {
  height: 0.3rem;
}

.upload-progress {
  height: 0.42rem;
}

.progress-row__bar {
  width: 100%;
  height: 0.28rem;
}

.item-progress__bar span,
.upload-progress span,
.progress-row__bar span {
  width: 0;
  height: 100%;
  display: block;
  background: var(--accent);
  border-radius: inherit;
  transition: width 160ms ease;
}

.item-progress__text {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
}

.video-summary {
  min-width: 0;
  display: grid;
  grid-template-columns: 2.45rem minmax(0, 1fr);
  gap: var(--space-3);
  align-items: start;
  padding: 0.75rem;
  overflow: hidden;
  background: rgba(255, 250, 244, 0.82);
  border: 1px solid rgba(83, 70, 55, 0.11);
  border-radius: var(--radius);
}

.video-summary__mark {
  color: var(--success);
  background: var(--success-soft);
  border-color: rgba(63, 114, 75, 0.16);
}

.video-summary__body {
  min-width: 0;
  display: grid;
  gap: var(--space-2);
}

.video-summary strong {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 760;
}

.video-summary span:not(.video-summary__mark) {
  min-width: 0;
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.42;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metadata-video {
  display: none;
}

.video-actions {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.text-button,
.retry-button {
  min-height: 2.55rem;
  padding: 0 var(--space-3);
  color: var(--accent);
  background: rgba(146, 114, 75, 0.08);
  border-color: rgba(146, 114, 75, 0.15);
}

.text-button--danger,
.retry-button {
  color: var(--error);
  background: rgba(161, 70, 63, 0.07);
  border-color: rgba(161, 70, 63, 0.15);
}

.trim-panel {
  min-width: 0;
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
  background: rgba(238, 224, 202, 0.5);
  border: 1px solid rgba(146, 114, 75, 0.16);
  border-radius: var(--radius);
}

.trim-panel__heading {
  min-width: 0;
  display: grid;
  gap: var(--space-1);
}

.trim-panel__heading strong {
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 760;
  line-height: 1.3;
}

.trim-panel__heading span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.trim-panel input[type="range"] {
  width: 100%;
  min-height: 2.75rem;
  accent-color: var(--accent);
}

.guest-field {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4);
}

.guest-field span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 730;
}

.guest-field input {
  width: 100%;
  min-height: 2.9rem;
  padding: 0.72rem 0.82rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.progress-state {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-5);
  border-color: rgba(146, 114, 75, 0.2);
  box-shadow: var(--shadow);
}

.progress-state__heading {
  align-items: start;
}

.progress-state__heading div {
  min-width: 0;
}

.progress-state__heading strong {
  flex: 0 0 auto;
  max-width: 8rem;
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 780;
  line-height: 1.25;
  text-align: right;
  overflow-wrap: anywhere;
}

.progress-rows {
  min-width: 0;
  display: grid;
  gap: var(--space-2);
}

.progress-row {
  min-width: 0;
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--surface-soft);
  border: 1px solid rgba(83, 70, 55, 0.1);
  border-radius: var(--radius);
}

.progress-row__meta {
  min-width: 0;
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  align-items: center;
}

.progress-row__name {
  min-width: 0;
  color: var(--ink);
  font-weight: 760;
}

.progress-row__status {
  flex: 0 0 auto;
  max-width: 8rem;
  padding: 0.18rem 0.5rem;
  overflow: hidden;
  color: var(--muted);
  background: rgba(37, 35, 31, 0.06);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 760;
  line-height: 1.25;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-row .retry-button {
  justify-self: start;
}

.progress-row__status--complete {
  color: var(--success);
  background: var(--success-soft);
}

.progress-row__status--failed {
  color: var(--error);
  background: var(--error-soft);
}

.progress-row__status--uploading {
  color: var(--accent);
  background: rgba(238, 224, 202, 0.58);
}

.submit-area {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 5;
  display: grid;
  gap: var(--space-2);
  width: 100%;
  padding:
    var(--space-3)
    max(var(--space-4), env(safe-area-inset-right, 0px))
    calc(var(--space-3) + env(safe-area-inset-bottom, 0px))
    max(var(--space-4), env(safe-area-inset-left, 0px));
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -14px 30px rgba(42, 35, 28, 0.07);
}

.submit-area .primary-button,
.submit-area p,
.submit-area .form-message {
  width: min(100%, 50rem);
  justify-self: center;
}

.submit-area p {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
  text-align: center;
}

.upload-panel.is-submitting .media-card,
.upload-panel.is-submitting .guest-field,
.upload-panel.is-submitting .submit-area {
  display: none;
}

.success-state {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-8) var(--space-5);
  text-align: center;
  border-color: rgba(63, 114, 75, 0.22);
  box-shadow: var(--shadow);
}

.success-state h2 {
  color: var(--success);
  font-size: 2.2rem;
  font-weight: 720;
  line-height: 1.05;
}

.success-state .secondary-button {
  justify-self: center;
}

[hidden] {
  display: none !important;
}

.view-enter {
  animation: rise-in 260ms ease-out both;
}

.upload-screen.view-enter {
  animation-name: fade-in;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(0.5rem);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

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

@media (max-width: 23.5rem) {
  .landing-copy {
    padding-inline: max(var(--space-4), env(safe-area-inset-left, 0px));
  }

  .landing-copy h1 {
    font-size: 2.32rem;
  }

  .upload-screen {
    padding-inline:
      max(var(--space-3), env(safe-area-inset-right, 0px))
      max(var(--space-3), env(safe-area-inset-left, 0px));
  }

  .upload-topbar {
    gap: var(--space-2);
  }

  .upload-topbar h2 {
    font-size: 2rem;
  }

  .media-card,
  .progress-state,
  .success-state {
    padding: var(--space-4);
  }

  .media-card__header {
    grid-template-columns: 2.25rem minmax(0, 1fr);
    gap: var(--space-2);
  }

  .media-card__mark,
  .video-summary__mark {
    width: 2.25rem;
    height: 2.25rem;
  }

  .selected-photo {
    grid-template-columns: 3.25rem minmax(0, 1fr);
    gap: var(--space-2);
  }

  .selected-photo img {
    width: 3.25rem;
    height: 3.25rem;
  }

  .remove-photo {
    grid-column: 2;
    justify-self: start;
  }
}

@media (min-width: 42rem) {
  .landing-copy {
    padding:
      0
      max(var(--space-8), env(safe-area-inset-right, 0px))
      calc(var(--space-8) + env(safe-area-inset-bottom, 0px))
      max(var(--space-8), env(safe-area-inset-left, 0px));
  }

  .landing-copy h1 {
    font-size: 3.45rem;
  }

  .lede {
    font-size: 1.18rem;
  }

  .upload-screen {
    padding:
      var(--space-8)
      var(--space-6)
      var(--space-8)
      var(--space-6);
  }

  .upload-content {
    gap: var(--space-5);
  }

  .selected-media-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .submit-area {
    position: static;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .submit-area .form-message,
  .submit-area p {
    grid-column: 1;
    width: auto;
    justify-self: stretch;
    text-align: left;
  }

  .submit-area .primary-button {
    grid-column: 2;
    grid-row: 1 / span 2;
    width: auto;
    min-width: 13rem;
  }
}

@media (min-width: 64rem) {
  .landing-hero {
    align-items: end;
  }

  .landing-hero::after {
    background:
      linear-gradient(90deg, rgba(251, 247, 240, 0.86) 0%, rgba(251, 247, 240, 0.52) 34%, rgba(251, 247, 240, 0) 68%),
      linear-gradient(180deg, rgba(251, 247, 240, 0) 62%, rgba(251, 247, 240, 0.7) 100%);
  }

  .couple-card img {
    object-position: 38% center;
  }

  .landing-copy {
    width: min(40rem, 48vw);
    padding-left: clamp(3rem, 7vw, 7rem);
    padding-bottom: clamp(3rem, 8vh, 5rem);
  }

  .landing-copy h1 {
    max-width: 12ch;
    font-size: 3.8rem;
  }

  .start-button {
    width: 14rem;
  }
}
