/* After-Wedding · Guest experience
   World: the day's own stationery – invitation card, instant prints with handwritten captions,
   a navy premiere room for the films. */

/* --- Paper ground: a faint fibre grain so the page reads as stationery, not a flat screen --- */

:root {
  --grain: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%27180%27 height=%27180%27%3E%3Cfilter id=%27n%27%3E%3CfeTurbulence type=%27fractalNoise%27 baseFrequency=%27.85%27 numOctaves=%272%27 stitchTiles=%27stitch%27/%3E%3CfeColorMatrix values=%270 0 0 0 .18 0 0 0 0 .16 0 0 0 0 .25 0 0 0 .055 0%27/%3E%3C/filter%3E%3Crect width=%27100%25%27 height=%27100%25%27 filter=%27url(%23n)%27/%3E%3C/svg%3E");
}

body {
  background-image: var(--grain);
}

/* --- Demo notice ------------------------------------------------------------------------- */

.demo-bar {
  margin: 0;
  padding: 0.45rem var(--gutter);
  background: var(--color-blush);
  color: var(--color-primary);
  font-size: var(--step--1);
  text-align: center;
  line-height: 1.4;
}

.demo-bar strong {
  display: inline-block;
  margin-right: 0.5em;
  padding: 0.05em 0.55em;
  border-radius: var(--radius-pill);
  background: var(--color-primary);
  color: var(--paper);
  font-size: var(--step--2);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* --- Header ------------------------------------------------------------------------------ */

.site-header {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--s-5);
  padding: var(--s-5) var(--gutter);
}

.brand {
  justify-self: start;
  color: var(--color-primary);
  text-decoration: none;
  white-space: nowrap;
}

.brand__mono {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.01em;
}

.brand__mono em {
  margin-inline: 0.06em;
  font-weight: 400;
}

.site-nav ul {
  display: flex;
  gap: clamp(1rem, 2.6vw, 2.5rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  position: relative;
  display: inline-block;
  padding: 0.4rem 0;
  color: var(--ink-soft);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  transition: color var(--dur-1);
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -0.15rem;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-accent);
  transform: translateX(-50%) scale(0);
  transition: transform var(--dur-2) var(--ease-out);
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--color-primary);
}

.site-nav a[aria-current="page"]::after {
  transform: translateX(-50%) scale(1);
}

.site-header__action {
  justify-self: end;
  display: flex;
  gap: var(--s-2);
}

.menu-toggle {
  display: none;
}

/* Account: the guest's initials on a blush seal plus the name; opens a small paper card (D31) */
.account {
  position: relative;
}

.account__toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 2.5rem;
  max-width: 15rem;
  padding: 0.2rem 0.7rem 0.2rem 0.2rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-primary);
  font-size: var(--step--1);
  font-weight: 500;
  line-height: 1.15;
  transition: background-color var(--dur-1), border-color var(--dur-1);
  -webkit-tap-highlight-color: transparent;
}

.account__toggle:hover,
.account__toggle[aria-expanded="true"] {
  background: color-mix(in srgb, var(--color-blush-light) 60%, transparent);
}

.account__toggle:focus-visible {
  outline-offset: 3px;
  border-radius: var(--radius-pill);
}

.account__avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--color-blush);
  color: var(--color-primary);
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.account__avatar .icon {
  width: 1.1rem;
  height: 1.1rem;
}

.account__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account--anon .account__name {
  color: var(--color-accent-text);
}

.account__chevron {
  width: 1rem;
  height: 1rem;
  margin-left: -0.15rem;
  transition: transform var(--dur-2) var(--ease-out);
}

.account__toggle[aria-expanded="true"] .account__chevron {
  transform: rotate(180deg);
}

.account__panel {
  position: absolute;
  top: calc(100% + var(--s-2));
  right: 0;
  z-index: 30;
  width: min(22rem, calc(100vw - 2 * var(--gutter)));
  padding: var(--s-5);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--paper-raised);
  box-shadow: var(--shadow-print);
  color: var(--ink);
  text-align: left;
  animation: sheet-fade var(--dur-2) var(--ease-out);
}

.account__panel[hidden] {
  display: none;
}

.account__row {
  display: flex;
  gap: var(--s-2);
}

.account__row .input {
  min-width: 0;
}

.account__row .btn {
  min-height: 3rem;
}

.account__foot {
  margin-top: var(--s-4);
  padding-top: var(--s-3);
  border-top: 1px solid var(--line);
}

.account__foot .link-btn {
  min-height: 2.75rem;
  color: var(--ink-soft);
}

/* Narrow desktops: the centred links need the room, so the name gets shorter, then only initials */
@media (max-width: 1180px) and (min-width: 861px) {
  .account__toggle {
    max-width: 10rem;
  }

  .account__chevron {
    display: none;
  }
}

@media (max-width: 980px) and (min-width: 861px) {
  .account__name {
    display: none;
  }

  .account__toggle {
    padding: 0.2rem;
  }
}

@media (max-width: 860px) {
  .site-header {
    grid-template-columns: 1fr auto;
    padding-block: var(--s-4);
  }

  .site-nav {
    display: none;
  }

  .menu-toggle {
    display: inline-flex;
  }

  /* On phones the card hangs from the whole header, so it never runs off the screen */
  .account {
    position: static;
  }

  .account__panel {
    top: calc(100% - var(--s-2));
    right: var(--gutter);
    width: auto;
    left: var(--gutter);
    max-width: 26rem;
    margin-left: auto;
  }

  .account__toggle {
    max-width: min(10rem, 40vw);
  }

  .account__chevron {
    display: none;
  }
}

/* Very small phones: initials only, the name is in the card */
@media (max-width: 339px) {
  .account__name {
    display: none;
  }

  .account__toggle {
    padding: 0.2rem;
  }
}

/* Menu sheet (mobile) */
.menu-sheet {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: var(--s-4) var(--gutter) calc(var(--s-6) + env(safe-area-inset-bottom));
  border: 0;
  background: var(--paper);
  color: var(--ink);
}

.menu-sheet[open] {
  display: flex;
  flex-direction: column;
  animation: sheet-fade var(--dur-2) var(--ease-out);
}

.menu-sheet::backdrop {
  background: rgb(9 14 45 / 0.3);
}

.menu-sheet__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.menu-sheet__links {
  display: grid;
  gap: var(--s-2);
  margin: var(--s-8) 0 0;
  padding: 0;
  list-style: none;
}

.menu-sheet__links a {
  display: block;
  padding: var(--s-2) 0;
  color: var(--color-primary);
  font-family: var(--font-heading);
  font-size: var(--step-4);
  line-height: 1.1;
  text-decoration: none;
}

.menu-sheet__links a[aria-current="page"] {
  font-style: italic;
}

.menu-sheet__foot {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3) var(--s-5);
  align-items: center;
  margin-top: auto;
  padding-top: var(--s-6);
  border-top: 1px solid var(--line);
  font-size: var(--step--1);
}

.menu-sheet__date {
  flex-basis: 100%;
  color: var(--ink-meta);
}

@keyframes sheet-fade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* --- Instant prints ---------------------------------------------------------------------- */

/* Proportions are relative to the print's own width (container units), so a print keeps
   real instant-film margins at every size and inside any grid or flex parent. */
.print {
  --tilt: 0deg;
  container-type: inline-size;
  margin: 0;
  padding: 0;
  background: var(--paper-raised);
  box-shadow: var(--shadow-print);
  transform: rotate(var(--tilt));
}

.print__photo {
  overflow: hidden;
  aspect-ratio: 1;
  margin: 5.5cqi 5.5cqi 0;
  background: var(--paper-sunk);
}

.print__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.print__caption {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 17cqi;
  padding: 1cqi 5.5cqi 2cqi;
  color: var(--handwriting);
  font-family: var(--font-script);
  font-size: clamp(1.25rem, 14cqi, 2.3rem);
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.print:not(:has(.print__caption)) .print__photo {
  margin-bottom: 17cqi;
}

.print--empty .print__photo {
  background: linear-gradient(160deg, var(--color-neutral-soft), var(--color-blush-light));
}

/* --- Hero -------------------------------------------------------------------------------- */

.hero {
  position: relative;
  isolation: isolate;
  overflow-x: clip;
  margin-top: calc(-1 * (2 * var(--s-5) + 3rem));
  padding-top: calc(2 * var(--s-5) + 3rem + clamp(0.75rem, 3vh, 2.5rem));
}

.hero__backdrop {
  position: absolute;
  inset: 0 0 clamp(4rem, 12vw, 11rem);
  z-index: -1;
  overflow: hidden;
  background: var(--room-deep);
}

.hero__backdrop img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 70%;
}

/* Navy veil: densest behind header and headline, a little lighter where the prints lie,
   so the photo still reads as a photo while the white copy keeps its contrast. */
.hero__backdrop::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 55% at 50% 30%, rgb(9 14 45 / 0.4), transparent 75%),
    linear-gradient(to bottom, rgb(9 14 45 / 0.84) 0%, rgb(14 20 64 / 0.74) 45%, rgb(14 20 64 / 0.62) 100%);
}

.hero__backdrop::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 22%;
  background: linear-gradient(to bottom, transparent, var(--paper));
}

.hero__copy {
  position: relative;
  z-index: 5;
  text-align: center;
}

.hero__names {
  color: var(--names);
  font-family: var(--font-script);
  font-size: clamp(2.6rem, 1.8rem + 3vw, 4.25rem);
  line-height: 1;
  margin-bottom: 0.05em;
}

.hero__title {
  max-width: 15ch;
  margin-inline: auto;
  font-size: var(--step-5);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.025em;
}

.hero__lead {
  max-width: 50ch;
  margin: var(--s-4) auto 0;
  color: var(--ink-soft);
  font-size: var(--step-1);
  line-height: 1.6;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s-3);
  margin-top: var(--s-5);
}

/* Copy on the veiled photo: white type, a soft navy halo for the brightest spots of the image */
.hero--photo .hero__names {
  color: var(--color-blush);
}

.hero--photo .hero__title {
  color: #fff;
}

.hero--photo .hero__lead {
  color: rgb(255 255 255 / 0.9);
}

.hero--photo :is(.hero__names, .hero__title, .hero__lead) {
  text-shadow: 0 1px 2px rgb(9 14 45 / 0.3), 0 2px 30px rgb(9 14 45 / 0.5);
}

.hero--photo .btn--room-ghost {
  --btn-line: rgb(255 255 255 / 0.5);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.hero--photo .btn--room-ghost:hover {
  --btn-bg: rgb(255 255 255 / 0.14);
}

.hero--photo .hero__copy :focus-visible {
  outline-color: var(--color-blush);
}

/* The fan of prints: positioned on a fixed-aspect stage so the composition scales as one object */
.hero__prints {
  position: relative;
  padding: 0;
  list-style: none;
  width: min(84rem, 100% - 2 * var(--gutter));
  margin: clamp(-3.5rem, -3.5vw, -1rem) auto 0;
  aspect-ratio: 1280 / 520;
}

.hero__print-link {
  position: absolute;
  display: block;
  animation: print-in 1100ms var(--ease-out) both;
  animation-delay: calc(240ms + var(--i) * 110ms);
}

.hero__print-link a {
  display: block;
  color: inherit;
  text-decoration: none;
}

.hero__print-link .print {
  transition: transform var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out);
}

.hero__print-link a:hover .print,
.hero__print-link a:focus-visible .print {
  transform: translateY(-8px) rotate(calc(var(--tilt) * 0.4));
  box-shadow: var(--shadow-lift);
}

.hero__print-link a:focus-visible {
  outline: none;
}

.hero__print-link a:focus-visible .print {
  outline: 2px solid var(--color-accent-dark);
  outline-offset: 4px;
}

.print--a { left: 2.5%; bottom: 30%; width: 13.5%; z-index: 2; }
.print--a .print { --tilt: -5deg; }
.print--b { left: 17%; bottom: 2%; width: 16.5%; z-index: 3; }
.print--b .print { --tilt: 3.5deg; }
.print--c { left: 35%; bottom: -18%; width: 31%; z-index: 4; }
.print--c .print { --tilt: -0.6deg; }
.print--c .print__photo { aspect-ratio: 4 / 5; margin-bottom: 12cqi; }
.print--d { right: 2.5%; bottom: 6%; width: 27%; z-index: 3; }
.print--d .print { --tilt: 2.2deg; }
.print--d .print__photo { aspect-ratio: 5 / 4; }
.print--e { right: 6%; top: -48%; width: 10%; z-index: 1; }
.print--e .print { --tilt: 7deg; filter: blur(1.6px); opacity: 0.55; }

@keyframes print-in {
  from {
    opacity: 0;
    transform: translateY(46px) rotate(-2deg) scale(0.97);
  }
}

@media (max-width: 760px) {
  .hero {
    padding-top: calc(2 * var(--s-4) + 3rem + 1.5rem);
  }

  .hero__title {
    max-width: 11ch;
  }

  .hero__lead {
    font-size: var(--step-0);
  }

  .hero__prints {
    aspect-ratio: 390 / 330;
    width: 100%;
    margin-top: var(--s-7);
  }

  .print--a { left: -3%; bottom: 30%; width: 34%; }
  .print--b,
  .print--e { display: none; }
  .print--c { left: 22%; bottom: -14%; width: 56%; }
  .print--d { right: -5%; bottom: 20%; width: 38%; }
  .print--d .print__photo { aspect-ratio: 1; }
}

/* --- Intro ------------------------------------------------------------------------------- */

.intro {
  max-width: 48rem;
  padding-block: clamp(7rem, 15vw, 12rem) clamp(4rem, 9vw, 7rem);
  text-align: center;
}

.intro__title {
  font-size: var(--step-4);
}

.intro__text {
  display: grid;
  gap: 1em;
  max-width: 54ch;
  margin: var(--s-6) auto 0;
  color: var(--ink-soft);
  font-size: var(--step-1);
  line-height: 1.7;
}

.intro__signature {
  margin-top: var(--s-5);
  color: var(--names);
  font-family: var(--font-script);
  font-size: clamp(2.2rem, 1.6rem + 2vw, 3.2rem);
  line-height: 1;
}

/* --- Navy room (cinema) ------------------------------------------------------------------ */

.room {
  --focus-ring: var(--color-accent-light);
  position: relative;
  isolation: isolate;
  background: var(--room);
  color: var(--room-ink);
}

.room::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: min(70vh, 40rem);
  z-index: -1;
  background: radial-gradient(60% 70% at 50% 0%, rgb(26 35 96 / 0.95), transparent 70%);
  pointer-events: none;
}

.room :focus-visible {
  outline-color: var(--color-accent-light);
}

.room--band {
  padding-block: clamp(4.5rem, 10vw, 8rem);
}

.room__head {
  max-width: 40rem;
  margin: 0 auto clamp(2.5rem, 6vw, 4.5rem);
  text-align: center;
}

.room__title {
  color: var(--room-ink);
  font-size: var(--step-4);
}

.room__lead {
  margin-top: var(--s-4);
  color: var(--room-ink-soft);
  font-size: var(--step-1);
}

.films {
  display: grid;
  gap: clamp(2.5rem, 5vw, 4rem) clamp(1.5rem, 3vw, 3rem);
}

.films--pair {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 28rem), 1fr));
}

.films--stack {
  max-width: 64rem;
  margin-inline: auto;
}

.film__screen {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-s);
  background: var(--room-deep);
  box-shadow: 0 30px 60px -30px rgb(0 0 0 / 0.7), 0 0 0 1px var(--room-line);
}

.film__poster,
.film__screen video,
.film__screen iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
}

.film__screen video {
  object-fit: contain;
  background: #000;
}

.film__play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  width: 100%;
  border: 0;
  background: linear-gradient(to top, rgb(9 14 45 / 0.55), rgb(9 14 45 / 0.05) 55%);
  color: var(--color-primary);
}

.film__play-disc {
  display: grid;
  place-items: center;
  width: clamp(4rem, 8vw, 5.5rem);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 0 12px 30px -8px rgb(0 0 0 / 0.55), 0 0 0 0 rgb(214 162 141 / 0.6);
  transition: transform var(--dur-2) var(--ease-out), box-shadow var(--dur-3) var(--ease-out);
}

.film__play-disc .icon {
  width: 38%;
  height: 38%;
  margin-left: 8%;
}

.film__play:hover .film__play-disc,
.film__play:focus-visible .film__play-disc {
  transform: scale(1.07);
  box-shadow: 0 12px 30px -8px rgb(0 0 0 / 0.55), 0 0 0 10px rgb(214 162 141 / 0.22);
}

.film__play:focus-visible {
  outline: none;
}

.film__placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: var(--s-2);
  padding: var(--s-5);
  text-align: center;
  background:
    repeating-linear-gradient(90deg, rgb(246 238 233 / 0.035) 0 1px, transparent 1px 64px),
    var(--room-raised);
}

.film--pending .film__poster {
  opacity: 0.25;
}

.film__placeholder-script {
  color: var(--color-accent-light);
  font-family: var(--font-script);
  font-size: clamp(2.6rem, 2rem + 3vw, 4.5rem);
  line-height: 1;
}

.film__placeholder-text {
  max-width: 30ch;
  color: var(--room-ink-soft);
  font-size: var(--step--1);
}

.film__meta {
  margin-top: var(--s-5);
}

.film__title {
  color: var(--room-ink);
  font-size: var(--step-2);
}

.film__text {
  max-width: 52ch;
  margin-top: var(--s-2);
  color: var(--room-ink-soft);
}

.film__facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-4);
  margin-top: var(--s-3);
  color: var(--room-ink-soft);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.film__facts:empty {
  display: none;
}

.room--page {
  min-height: 80vh;
  padding-block: clamp(2rem, 6vw, 4rem) clamp(5rem, 10vw, 8rem);
}

.room__head--page .room__title {
  font-size: var(--step-5);
}

.films--stack .film {
  display: grid;
  gap: var(--s-5);
}

@media (min-width: 900px) {
  .films--stack .film {
    grid-template-columns: minmax(0, 2.2fr) minmax(15rem, 1fr);
    align-items: end;
    gap: var(--s-7);
  }

  .films--stack .film:nth-child(even) {
    grid-template-columns: minmax(15rem, 1fr) minmax(0, 2.2fr);
  }

  .films--stack .film:nth-child(even) .film__screen {
    order: 2;
  }

  .films--stack .film__meta {
    margin: 0;
    padding-bottom: var(--s-3);
  }
}

/* Inverted header inside the room – and on the start page, where it sits on the veiled hero photo */
.theme-room {
  background: var(--room);
}

:is(.theme-room, body:has(.hero--photo)) .site-header .brand,
:is(.theme-room, body:has(.hero--photo)) .site-nav a:hover,
:is(.theme-room, body:has(.hero--photo)) .site-nav a[aria-current="page"] {
  color: var(--room-ink);
}

:is(.theme-room, body:has(.hero--photo)) .site-nav a {
  color: var(--room-ink-soft);
}

:is(.theme-room, body:has(.hero--photo)) .menu-toggle {
  --btn-ink: var(--room-ink);
  --btn-line: var(--room-line);
}

:is(.theme-room, body:has(.hero--photo)) .menu-toggle:hover {
  --btn-bg: rgb(246 238 233 / 0.1);
}

:is(.theme-room, body:has(.hero--photo)) .account__toggle {
  border-color: var(--room-line);
  color: var(--room-ink);
}

:is(.theme-room, body:has(.hero--photo)) .account__toggle:is(:hover, [aria-expanded="true"]) {
  background: rgb(246 238 233 / 0.1);
}

:is(.theme-room, body:has(.hero--photo)) .account--anon .account__name {
  color: var(--color-blush);
}

body:has(.hero--photo) .account__toggle {
  border-color: rgb(246 238 233 / 0.4);
}

body:has(.hero--photo) .site-header :focus-visible {
  outline-color: var(--color-blush);
}

body:has(.hero--photo) .menu-toggle {
  --btn-line: rgb(246 238 233 / 0.4);
}

.theme-room .site-footer {
  background: var(--room-deep);
  color: var(--room-ink-soft);
  border-top-color: var(--room-line);
}

.theme-room .site-footer__nav a {
  color: var(--room-ink);
}

.theme-room .site-footer__names {
  color: var(--color-accent-light);
}

.theme-room .demo-bar {
  background: var(--room-raised);
  color: var(--room-ink);
}

.theme-room .demo-bar strong {
  background: var(--color-blush);
  color: var(--color-primary);
}

/* --- Gallery chapters (home) ------------------------------------------------------------- */

.chapters {
  display: grid;
  gap: clamp(2.5rem, 6vw, 5rem);
  padding-block: clamp(5rem, 11vw, 9rem);
}

@media (min-width: 960px) {
  .chapters {
    grid-template-columns: minmax(18rem, 5fr) 7fr;
    align-items: center;
  }
}

.chapters__title {
  font-size: var(--step-4);
}

.chapters__lead {
  max-width: 40ch;
  margin-top: var(--s-4);
  color: var(--ink-soft);
}

.chapters__list {
  margin: var(--s-6) 0 var(--s-6);
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.chapters__list a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-4);
  padding: 0.85rem 0.15rem;
  border-bottom: 1px solid var(--line);
  color: var(--color-primary);
  text-decoration: none;
  transition: padding var(--dur-2) var(--ease-out), background-color var(--dur-2);
}

.chapters__list a:hover {
  padding-left: 0.6rem;
  background: linear-gradient(90deg, var(--color-blush-light), transparent 70%);
}

.chapters__name {
  font-family: var(--font-heading);
  font-size: var(--step-2);
  line-height: 1.2;
}

.chapters__list a:hover .chapters__name {
  font-style: italic;
}

.chapters__count {
  color: var(--ink-meta);
  font-size: var(--step--1);
  font-weight: 500;
}

/* --- Justified photo rows ---------------------------------------------------------------- */

.justified {
  --row: clamp(9rem, 19vw, 17.5rem);
  --gap: clamp(6px, 0.8vw, 12px);
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.justified::after {
  content: "";
  flex-grow: 999999;
}

/* Photos stand on their own: no frame, no shadow, square corners, calm gaps. */
.tile {
  --ar: 1.5;
  position: relative;
  flex: calc(var(--ar) * 100) 1 calc(var(--ar) * var(--row));
  aspect-ratio: var(--ar);
  max-height: calc(var(--row) * 1.9);
  overflow: hidden;
  background: var(--paper-sunk);
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 700ms var(--ease-out), filter var(--dur-2);
}

.tile--static a {
  display: block;
  height: 100%;
}

.tile--static:hover img,
.gallery .tile:hover img {
  transform: scale(1.025);
}

/* Selection: a fine passe-partout line inside the photo (navy outer hairline, white inner
   hairline, so it reads on light and dark motifs) and a small navy seal with a check. */
.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 0 transparent;
  transition: box-shadow var(--dur-2) var(--ease-out);
  pointer-events: none;
}

.tile.is-selected::after {
  box-shadow: inset 0 0 0 2px var(--color-primary), inset 0 0 0 3.5px rgb(255 255 255 / 0.95);
}

.tile.is-selected img {
  filter: brightness(0.96);
}

.chapters__mosaic {
  --row: clamp(7rem, 13vw, 11.5rem);
}

/* --- Envelope band (share teaser) -------------------------------------------------------- */

.envelope-band {
  overflow-x: clip;
  background:
    linear-gradient(175deg, transparent 0 62%, color-mix(in srgb, var(--color-blush) 55%, var(--color-blush-light)) 62.1%),
    var(--color-blush-light);
  padding-block: clamp(5rem, 11vw, 9rem);
}

.envelope-band__inner {
  display: grid;
  gap: clamp(3rem, 7vw, 5rem);
  align-items: center;
}

@media (min-width: 860px) {
  .envelope-band__inner {
    grid-template-columns: 1fr 1fr;
  }
}

.envelope-band__prints {
  position: relative;
  min-height: clamp(18rem, 34vw, 26rem);
}

.print--stack {
  position: absolute;
  width: clamp(10rem, 19vw, 15rem);
}

.print--stack-0 { left: 4%; top: 6%; --tilt: -6deg; }
.print--stack-1 { left: 33%; top: 0; --tilt: 3deg; z-index: 2; }
.print--stack-2 { left: 58%; top: 12%; --tilt: -2deg; }

.envelope-band__copy h2 {
  font-size: var(--step-4);
}

.envelope-band__copy p {
  max-width: 44ch;
  margin: var(--s-4) 0 var(--s-6);
  color: var(--ink-soft);
  font-size: var(--step-1);
}

/* --- Footer ------------------------------------------------------------------------------ */

.site-footer {
  border-top: 1px solid var(--line);
  padding-block: var(--s-8) calc(var(--s-7) + env(safe-area-inset-bottom));
  text-align: center;
  color: var(--ink-meta);
  font-size: var(--step--1);
}

.page-galerie .site-footer {
  padding-bottom: calc(var(--s-10) + env(safe-area-inset-bottom));
}

.site-footer__names {
  color: var(--names);
  font-family: var(--font-script);
  font-size: clamp(2.4rem, 1.8rem + 2vw, 3.4rem);
  line-height: 1;
}

.site-footer__date {
  margin-top: var(--s-2);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: var(--step--2);
  font-weight: 600;
}

.site-footer__nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s-2) var(--s-5);
  margin-top: var(--s-6);
}

.site-footer__nav a {
  color: var(--color-primary);
  font-weight: 500;
  font-size: var(--step--1);
  text-decoration: none;
}

.site-footer__note {
  margin-top: var(--s-5);
}

/* --- Page head --------------------------------------------------------------------------- */

.page-head {
  padding-block: clamp(2rem, 6vw, 4.5rem) clamp(1.5rem, 4vw, 2.5rem);
  text-align: center;
}

.page-head__title {
  font-size: var(--step-5);
}

/* Personal greeting with the name given once (handwriting, like the couple's names) */
.page-head__hello {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 0 var(--s-3);
  margin-bottom: var(--s-2);
}

.page-head__hello[hidden] {
  display: none;
}

.page-head__hello-text {
  color: var(--names);
  font-family: var(--font-script);
  font-size: clamp(2rem, 1.6rem + 1.5vw, 2.6rem);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.page-head__lead {
  max-width: 56ch;
  margin: var(--s-4) auto 0;
  color: var(--ink-soft);
  font-size: var(--step-1);
}

/* Photographer credit for social media posts */
.page-head__note {
  max-width: 56ch;
  margin: var(--s-3) auto 0;
  color: var(--ink-soft);
  font-size: var(--step--1);
}

.page-head__note a,
.lightbox__social a {
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
}

.page-head__note a {
  color: var(--color-accent-text, var(--ink-strong));
}

/* On phones the photos (or the upload tray) start on the first screen, not below three
   lines of large lead text. */
@media (max-width: 600px) {
  .page-head {
    padding-block: var(--s-5) var(--s-4);
  }

  .page-head__lead {
    margin-top: var(--s-3);
    font-size: var(--step-0);
  }

  .page-head__hello {
    margin-bottom: 0;
  }
}

/* --- Gallery ----------------------------------------------------------------------------- */

.gallery-bar {
  position: sticky;
  top: 0;
  z-index: 15;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur-2), box-shadow var(--dur-2);
}

.gallery-bar.is-stuck {
  background: var(--grain), var(--paper);
  border-bottom-color: var(--line);
  box-shadow: 0 10px 24px -22px rgb(14 20 64 / 0.5);
}

.gallery-bar__inner {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding-block: var(--s-3);
}

.chips {
  display: flex;
  gap: var(--s-2);
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 3px;
  margin: -3px;
  mask-image: linear-gradient(to right, #000 calc(100% - 2rem), transparent);
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  min-height: 2.5rem;
  padding: 0.4rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--paper-raised);
  color: var(--color-primary);
  font-size: var(--step--1);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--dur-1), border-color var(--dur-1), color var(--dur-1);
}

.chip:hover {
  border-color: var(--color-blush-dark);
  background: var(--color-blush-light);
}

.chip[aria-current="true"] {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: var(--paper);
}

.chip__count {
  color: var(--ink-meta);
  font-size: var(--step--2);
  font-weight: 600;
}

.chip[aria-current="true"] .chip__count {
  color: var(--color-blush);
}

.gallery {
  padding-block: var(--s-4) var(--s-8);
}

.gallery .tile {
  cursor: zoom-in;
}

.tile__open {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: inherit;
}

.tile__open:focus-visible {
  outline: none;
}

.tile__open:focus-visible img {
  outline: 3px solid var(--color-accent-dark);
  outline-offset: -3px;
}

/* No long-press menu or text selection on photos: saving goes through the download control
   (full resolution, and the couple sees who took which photo). */
.tile {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Download control: bottom right, a 48px target around a paper disc with a navy edge (reads
   on light and dark photos). Only with a mouse, on hover/focus. On touch screens the grid stays
   clean: a tap opens the large view, which has the download button (operator decision). */
.tile__dl {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  color: var(--color-primary);
  cursor: pointer;
}

.tile__dl-disc {
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border: 1.5px solid rgb(14 20 64 / 0.55);
  border-radius: 50%;
  background: rgb(253 246 243 / 0.88);
  box-shadow: 0 1px 4px rgb(9 14 45 / 0.28);
  transition: opacity var(--dur-1), background-color var(--dur-1), transform var(--dur-2) var(--ease-out);
}

.tile__dl .icon {
  width: 1rem;
  height: 1rem;
  stroke-width: 2.2;
}

.tile__dl:hover .tile__dl-disc {
  transform: scale(1.08);
  background: var(--paper);
}

.tile__dl:active .tile__dl-disc {
  transform: scale(0.94);
}

.tile__dl[aria-busy="true"] .tile__dl-disc {
  animation: dl-pulse 0.9s ease-in-out infinite alternate;
}

@keyframes dl-pulse {
  to {
    opacity: 0.45;
  }
}

.tile__dl:focus-visible {
  outline: none;
}

.tile__dl:focus-visible .tile__dl-disc {
  opacity: 1;
  outline: 2px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--color-primary);
}

@media (hover: hover) {
  .tile__dl-disc {
    opacity: 0;
  }

  .tile:hover .tile__dl-disc,
  .tile:focus-within .tile__dl-disc {
    opacity: 1;
  }
}

@media (hover: none) {
  .tile__dl {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tile__dl[aria-busy="true"] .tile__dl-disc {
    animation: none;
    opacity: 0.6;
  }
}

.tile--skeleton {
  cursor: default;
  box-shadow: none;
  background: linear-gradient(100deg, var(--paper-sunk) 30%, var(--color-neutral-soft) 50%, var(--paper-sunk) 70%) 0 0 / 300% 100%;
  animation: shimmer 1.6s linear infinite;
}

@keyframes shimmer {
  to {
    background-position: -150% 0;
  }
}

.tile.is-new {
  animation: tile-in 520ms var(--ease-out) both;
}

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

.gallery__state:empty {
  display: none;
}

.gallery-empty {
  display: grid;
  justify-items: center;
  gap: var(--s-4);
  max-width: 30rem;
  margin: var(--s-6) auto;
  text-align: center;
}

.gallery-empty .print {
  width: 11rem;
  --tilt: -3deg;
}

.gallery-empty h2 {
  font-size: var(--step-3);
}

.gallery-empty p {
  color: var(--ink-soft);
}

.gallery__more {
  display: flex;
  justify-content: center;
  margin-top: var(--s-6);
}

/* Short notice on the page (e.g. „Euer Foto ist bereit“ on the iPhone) */
.page-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--s-4) + env(safe-area-inset-bottom));
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-3);
  width: max-content;
  max-width: calc(100% - 2 * var(--s-4));
  padding: var(--s-2) var(--s-2) var(--s-2) var(--s-4);
  border-radius: var(--radius-l);
  background: var(--room);
  color: var(--room-ink);
  box-shadow: var(--shadow-float);
  font-size: var(--step--1);
  transform: translateX(-50%);
  animation: bar-in 420ms var(--ease-out);
}

.page-toast[hidden] {
  display: none;
}

.page-toast .icon {
  flex: none;
  color: var(--color-blush);
}

.page-toast .btn {
  --btn-bg: var(--paper);
  --btn-ink: var(--color-primary);
}

@keyframes bar-in {
  from {
    opacity: 0;
    transform: translate(-50%, 24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-toast {
    animation: none;
  }
}

/* Lightbox */
.lightbox {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--room-deep);
  color: var(--room-ink);
  overflow: hidden;
}

.lightbox[open] {
  display: grid;
  grid-template-rows: auto 1fr auto;
  animation: lb-in var(--dur-2) var(--ease-out);
}

.lightbox::backdrop {
  background: var(--room-deep);
}

.lightbox :focus-visible {
  outline-color: var(--color-accent-light);
}

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

.lightbox__top,
.lightbox__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-3) var(--gutter);
}

.lightbox__top {
  padding-top: calc(var(--s-3) + env(safe-area-inset-top));
}

/* Bottom: the download button, the photographer note below it (no photo title). */
.lightbox__bottom {
  flex-direction: column;
  justify-content: center;
  gap: var(--s-2);
  padding-bottom: calc(var(--s-4) + env(safe-area-inset-bottom));
  text-align: center;
}

.lightbox__count {
  color: var(--room-ink-soft);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.04em;
}

.lightbox__stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  margin: 0;
  padding: 0 clamp(0.5rem, 6vw, 6rem);
  touch-action: pan-y pinch-zoom;
}

.lightbox__stage img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 30px 80px -30px rgb(0 0 0 / 0.8);
  transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out);
}

.lightbox__stage.is-loading img {
  opacity: 0.35;
}

/* No name yet: no iPhone long-press menu on the large photo (it would save without asking);
   „Herunterladen“ asks once, afterwards the menu is back (D32). */
.lightbox[data-anon] .lightbox__stage img {
  -webkit-touch-callout: none;
}

.lightbox__nav {
  position: absolute;
  top: 50%;
  width: 3.25rem;
  height: 3.25rem;
  margin-top: -1.6rem;
  background: rgb(246 238 233 / 0.1);
  color: var(--room-ink);
}

.lightbox__nav:hover {
  background: rgb(246 238 233 / 0.2);
}

.lightbox__nav[disabled] {
  opacity: 0.25;
  cursor: default;
}

.lightbox__nav--prev {
  left: clamp(0.5rem, 2vw, 1.5rem);
}

.lightbox__nav--next {
  right: clamp(0.5rem, 2vw, 1.5rem);
}

.lightbox__social {
  color: var(--room-ink-soft);
  font-size: var(--step--2);
}

.lightbox__social a {
  color: var(--room-ink);
}

/* Bright primary action on the dark room: paper fill, navy text (btn--on-room). */
.lightbox__download {
  flex: none;
  min-width: 15rem;
  font-weight: 600;
  box-shadow: 0 10px 28px -12px rgb(0 0 0 / 0.65);
}

.lightbox__download[aria-busy="true"] {
  opacity: 0.7;
  cursor: progress;
}

/* Confirmation after a single-photo download, under the top bar (clear of the photo nav). */
.lightbox__toast {
  position: absolute;
  top: calc(4.25rem + env(safe-area-inset-top));
  left: 50%;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-1) var(--s-3);
  width: max-content;
  max-width: calc(100% - 2 * var(--gutter));
  padding: var(--s-2) var(--s-4);
  border-radius: var(--radius-l);
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-float);
  font-size: var(--step--1);
  transform: translateX(-50%);
  animation: toast-in var(--dur-2) var(--ease-out);
}

.lightbox__toast[hidden] {
  display: none;
}

.lightbox__toast .icon {
  flex: none;
  color: var(--success);
}

.lightbox__toast[data-tone="error"] .icon {
  color: var(--danger);
}

.lightbox__toast strong {
  color: var(--color-primary);
}

.lightbox__toast .link-btn {
  min-height: 2.75rem;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, -8px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox__toast {
    animation: none;
  }
}

@media (max-width: 700px) {
  /* Arrows sit just above the bottom bar; --lb-bottom is its measured height (set in gallery.js). */
  .lightbox__nav {
    top: auto;
    bottom: calc(var(--lb-bottom, calc(4.45rem + env(safe-area-inset-bottom))) + 0.75rem);
  }

  .lightbox__stage {
    padding-inline: 0;
  }
}

/* Phones: the download button across the full width. */
@media (max-width: 560px) {
  .lightbox__download {
    align-self: stretch;
    justify-content: center;
  }
}

/* Sheet dialog (asks for the name) */
.sheet {
  width: min(32rem, 100% - 2rem);
  max-height: calc(100% - 2rem);
  padding: 0;
  border: 0;
  border-radius: var(--radius-l);
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-lift);
}

.sheet[open] {
  animation: sheet-up 420ms var(--ease-out);
}

.sheet::backdrop {
  background: rgb(9 14 45 / 0.45);
  animation: lb-in var(--dur-2) var(--ease-out);
}

@keyframes sheet-up {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
}

@media (max-width: 600px) {
  .sheet {
    width: 100%;
    max-width: none;
    margin: auto 0 0;
    border-radius: var(--radius-l) var(--radius-l) 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
}

.sheet__body {
  display: grid;
  gap: var(--s-5);
  padding: var(--s-6) clamp(1.25rem, 5vw, 2.25rem) var(--s-6);
}

.sheet__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
}

.sheet__head .icon-btn {
  margin: -0.5rem -0.75rem 0 0;
}

.sheet__title {
  font-size: var(--step-3);
}

.sheet__lead {
  color: var(--ink-soft);
}

.sheet__lead[hidden] {
  display: none;
}

.sheet__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--s-2);
  margin-top: var(--s-2);
}

/* --- Share / upload ---------------------------------------------------------------------- */

.share {
  padding-bottom: var(--s-9);
}

.share__card {
  --card-pad: clamp(1.25rem, 4vw, 2.75rem);
  position: relative;
  display: grid;
  gap: var(--s-6);
  max-width: 56rem;
  margin-inline: auto;
  padding: var(--card-pad);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--paper-raised);
  box-shadow: var(--shadow-card);
}

.share__fields {
  display: grid;
  gap: var(--s-5);
  max-width: 26rem;
}

/* The tray is the drop target. Empty: one tilted empty print to drop onto. Filled: a grid of
   prints that develop while they upload, with an empty "noch mehr?" print in front. While files
   are dragged anywhere over the page, the tray lights up; dropping anywhere adds them. */
.tray {
  position: relative;
  border: 1.5px dashed color-mix(in srgb, var(--color-blush-dark) 75%, transparent);
  border-radius: var(--radius-l);
  background: color-mix(in srgb, var(--color-neutral-soft) 70%, transparent);
  transition: background-color var(--dur-2), border-color var(--dur-2);
}

.tray:has(> input:focus-visible) {
  outline: 2px solid var(--color-accent-dark);
  outline-offset: 3px;
}

.tray[data-state="empty"]:hover,
.share.is-dragging .tray {
  border-color: var(--color-accent-light);
  background: color-mix(in srgb, var(--color-blush-light) 45%, transparent);
}

.tray.is-over {
  border-style: solid;
  border-color: var(--color-accent);
  background: color-mix(in srgb, var(--color-blush-light) 80%, transparent);
}

.tray[data-state="empty"] .develop-grid,
.tray[data-state="filled"] .dropzone {
  display: none;
}

.dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(1.5rem, 4vw, 3rem);
  padding: var(--s-7) var(--s-4);
  cursor: pointer;
}

.dropzone__print {
  --tilt: -4deg;
  display: block;
  flex: none;
  width: clamp(9.5rem, 24vw, 12.5rem);
  transition: transform 420ms var(--ease-out), box-shadow 420ms var(--ease-out);
}

.dropzone__print .print__photo {
  display: grid;
  place-items: center;
}

.dropzone__print .print__caption {
  display: flex;
}

.tray:hover .dropzone__print,
.tray.is-over .dropzone__print {
  --tilt: -1deg;
  box-shadow: var(--shadow-lift);
  transform: rotate(var(--tilt)) translateY(-4px);
}

.tray.is-over .dropzone__print {
  transform: rotate(var(--tilt)) translateY(-8px) scale(1.03);
}

.dropzone__icon {
  width: 28%;
  height: auto;
  aspect-ratio: 1;
  fill: none;
  stroke: var(--color-primary);
  stroke-width: 1.4;
  stroke-linejoin: round;
  stroke-linecap: round;
  opacity: 0.5;
  transition: transform 420ms var(--ease-out), opacity var(--dur-2);
}

.tray.is-over .dropzone__icon {
  opacity: 0.85;
  transform: translateY(-6%);
}

.dropzone__copy {
  display: grid;
  justify-items: start;
  gap: var(--s-2);
  text-align: left;
}

.dropzone__or,
.dropzone__hint {
  color: var(--ink-soft);
  font-size: var(--step--1);
}

.dropzone__hint {
  color: var(--ink-meta);
}

@media (hover: none) {
  .dropzone__or {
    display: none;
  }
}

@media (max-width: 560px) {
  .dropzone {
    flex-direction: column;
    padding-block: var(--s-6);
  }

  .dropzone__copy {
    justify-items: center;
    text-align: center;
  }
}

/* Drop hint over a filled tray */
.tray__drop {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  margin: 0;
  border-radius: inherit;
  background: color-mix(in srgb, var(--color-blush-light) 72%, transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-2);
}

.tray__drop span {
  padding: 0.6rem 1.3rem;
  border-radius: var(--radius-pill);
  background: var(--color-primary);
  color: var(--paper);
  font-size: var(--step--1);
  font-weight: 500;
  box-shadow: var(--shadow-float);
  transform: translateY(8px);
  transition: transform var(--dur-2) var(--ease-out);
}

.tray[data-state="filled"].is-over .tray__drop {
  opacity: 1;
}

.tray[data-state="filled"].is-over .tray__drop span {
  transform: none;
}

/* Grid of prints */
.develop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.25rem, 1fr));
  gap: var(--s-5) var(--s-4);
  margin: 0;
  padding: var(--s-5);
  list-style: none;
}

/* Phones: three small prints per row, like the photo library they come from. */
@media (max-width: 600px) {
  .develop-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--s-4) var(--s-3);
    padding: var(--s-4) var(--s-3);
  }
}

/* Each upload is an instant print that develops with the upload progress (--p from 0 to 1). */
.develop {
  --p: 0;
  position: relative;
  display: grid;
  align-content: start;
  gap: var(--s-2);
  min-width: 0;
  font-size: var(--step--2);
  contain: layout style;
  animation: develop-in 460ms var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 35ms);
}

@keyframes develop-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }
}

.develop.is-leaving {
  animation: develop-out 220ms var(--ease-in-out) forwards;
  pointer-events: none;
}

@keyframes develop-out {
  to {
    opacity: 0;
    transform: scale(0.88);
  }
}

.develop .print {
  --tilt: 0deg;
  transition: transform 600ms var(--ease-out);
}

.develop .print__photo {
  position: relative;
}

/* Undeveloped: pale and soft but recognisable. Developed: the photo as it is. */
.develop .print__photo img {
  filter: saturate(calc(0.35 + var(--p) * 0.65)) contrast(calc(0.86 + var(--p) * 0.14)) brightness(calc(1.1 - var(--p) * 0.1));
  transition: filter 400ms linear, opacity 320ms var(--ease-out);
}

.develop .print__photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, #f6f1ec, #efe4dc);
  opacity: calc(0.32 - var(--p) * 0.32);
  transition: opacity 400ms linear;
  pointer-events: none;
}

.develop.is-done .print__photo img {
  filter: none;
}

/* Thumbnail still being made */
.develop.is-loading .print__photo img {
  opacity: 0;
}

.develop.is-loading .print__photo::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, var(--color-neutral-soft), var(--color-blush-light));
  animation: develop-wait 1.2s ease-in-out infinite alternate;
}

@keyframes develop-wait {
  from {
    opacity: 0.45;
  }
}

/* No preview possible (e.g. HEIC outside Safari): the file type on the empty photo */
.develop__ext {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  background: linear-gradient(160deg, var(--color-neutral-soft), var(--color-blush-light));
  color: var(--ink-meta);
  font-size: var(--step--2);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.develop.no-preview .develop__ext {
  display: grid;
}

.develop.no-preview img {
  display: none;
}

.develop__bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  height: 3px;
  background: rgb(255 255 255 / 0.55);
  opacity: 0;
  transition: opacity var(--dur-2);
}

.develop__bar span {
  display: block;
  height: 100%;
  background: var(--color-accent);
  transform: scaleX(calc(var(--p) / 0.9));
  transform-origin: left;
  transition: transform 240ms linear;
}

.develop.is-uploading .develop__bar {
  opacity: 1;
}

.develop.is-saving .develop__bar span {
  animation: develop-save 0.9s ease-in-out infinite alternate;
}

@keyframes develop-save {
  from {
    opacity: 0.45;
  }
}

.develop.is-waiting .develop__bar span {
  background: var(--color-neutral-muted);
}

.develop .print__caption {
  min-height: 17cqi;
  font-size: clamp(0.95rem, 17cqi, 2rem);
}

/* Arrived: the print settles at its own small angle and the thanks is written on it. */
.develop.is-done .print {
  --tilt: var(--develop-tilt, 0deg);
}

.develop.is-done .print__caption {
  animation: develop-ink 900ms var(--ease-out) both;
}

@keyframes develop-ink {
  from {
    opacity: 0;
    clip-path: inset(0 100% 0 0);
  }

  to {
    opacity: 1;
    clip-path: inset(0 0 0 0);
  }
}

.develop.is-error .print__photo::after {
  background: repeating-linear-gradient(135deg, #fbe4e1 0 8px, #f7d6d1 8px 16px);
  opacity: 0.8;
}

.develop__note {
  margin: 0;
  color: var(--ink-meta);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.develop__note:empty {
  display: none;
}

.develop.is-error .develop__note {
  color: var(--danger);
  font-weight: 500;
}

.develop__note .link-btn {
  padding: 0;
  font-size: inherit;
}

/* Remove: a small round pin on the print's corner (always visible on touch screens) */
.develop__remove {
  position: absolute;
  top: -0.55rem;
  right: -0.55rem;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper-raised);
  color: var(--color-primary);
  box-shadow: 0 3px 8px -3px rgb(14 20 64 / 0.4);
  cursor: pointer;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity var(--dur-1), transform var(--dur-1) var(--ease-out), background-color var(--dur-1);
}

.develop__remove::before {
  content: "";
  position: absolute;
  inset: -0.55rem;
}

.develop__remove .icon {
  width: 0.95rem;
  height: 0.95rem;
  stroke-width: 2;
}

.develop:hover .develop__remove,
.develop__remove:focus-visible,
.develop.is-error .develop__remove {
  opacity: 1;
  transform: none;
}

.develop__remove:hover {
  background: var(--color-blush-light);
}

.develop__remove:focus-visible {
  border-radius: 50%;
}

@media (hover: none) {
  .develop__remove {
    opacity: 1;
    transform: none;
  }
}

/* The empty print in front: tap to add more */
.develop--add {
  animation: none;
}

.add-print {
  --tilt: -3deg;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: center;
  cursor: pointer;
  transition: transform 420ms var(--ease-out), box-shadow 420ms var(--ease-out);
}

.add-print .print__photo {
  display: grid;
  place-items: center;
}

.add-print__icon {
  width: 32%;
  height: auto;
  aspect-ratio: 1;
  fill: none;
  stroke: var(--color-primary);
  stroke-width: 1.4;
  stroke-linecap: round;
  opacity: 0.5;
  transition: opacity var(--dur-2), transform 420ms var(--ease-out);
}

.add-print:hover,
.add-print:focus-visible {
  --tilt: -1deg;
  box-shadow: var(--shadow-lift);
  transform: rotate(var(--tilt)) translateY(-3px);
}

.add-print:hover .add-print__icon,
.add-print:focus-visible .add-print__icon {
  opacity: 0.85;
  transform: rotate(90deg);
}

.add-print:focus-visible {
  border-radius: 0;
}

/* Files that cannot go (wrong type, too big) and duplicates */
.share__skipped-body {
  flex: 1;
  display: grid;
  gap: var(--s-1);
  min-width: 0;
}

.share__skipped-body p {
  margin: 0;
  overflow-wrap: anywhere;
}

.share__skipped-body strong {
  font-weight: 600;
}

.share__skipped-close {
  width: 2rem;
  height: 2rem;
  margin: -0.35rem -0.5rem -0.35rem 0;
  color: inherit;
}

/* Summary bar: count, size, time left and the one button. Floats at the bottom of the screen
   while there are more photos than fit, so the button is always one tap away. */
.share__foot {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3) var(--s-5);
  padding-top: var(--s-5);
  border-top: 1px solid var(--line);
}

.share.has-photos .share__foot {
  position: sticky;
  bottom: 0;
  z-index: 8;
  margin: 0 calc(-1 * var(--card-pad)) calc(-1 * var(--card-pad));
  padding: var(--s-4) var(--card-pad) calc(var(--s-4) + env(safe-area-inset-bottom, 0px));
  border-radius: 0 0 var(--radius-l) var(--radius-l);
  background: var(--paper-raised);
  transition: box-shadow var(--dur-2);
}

.share.has-photos .share__foot.is-stuck {
  border-radius: 0;
  box-shadow: 0 -14px 28px -20px rgb(45 41 64 / 0.4);
}

.share__foot-sentinel {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.share__meter {
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 3px;
  overflow: hidden;
  opacity: 0;
  transition: opacity var(--dur-3);
}

.share__foot.is-running .share__meter {
  opacity: 1;
}

.share__meter span {
  display: block;
  height: 100%;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 300ms linear;
}

.share__summary {
  display: flex;
  flex: 1 1 14rem;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s-1) var(--s-4);
  min-width: 0;
}

.share__status {
  margin: 0;
  color: var(--ink-soft);
  font-size: var(--step--1);
  line-height: 1.45;
}

.share__status:empty {
  display: none;
}

.share__status.is-alert {
  color: var(--danger);
  font-weight: 500;
}

.share__foot .btn.is-busy[disabled] {
  opacity: 1;
  cursor: progress;
}

.share__foot .btn.is-busy .icon {
  animation: share-lift 0.9s var(--ease-in-out) infinite alternate;
}

@keyframes share-lift {
  to {
    transform: translateY(-3px);
  }
}

@media (max-width: 560px) {
  .share__foot .btn {
    flex: 1 1 100%;
  }
}

.share__done {
  display: grid;
  justify-items: center;
  gap: var(--s-3);
  padding: var(--s-6) var(--s-4);
  border-radius: var(--radius-m);
  background: var(--color-blush-light);
  text-align: center;
  animation: sheet-fade var(--dur-3) var(--ease-out);
}

.share__done:focus {
  outline: none;
}

.share__done-script {
  color: var(--handwriting);
  font-family: var(--font-script);
  font-size: 3.5rem;
  line-height: 1;
}

.share__done p:not(.share__done-script) {
  max-width: 48ch;
  color: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  .develop,
  .develop.is-done .print__caption,
  .develop.is-loading .print__photo::before,
  .develop.is-saving .develop__bar span,
  .share__foot .btn.is-busy .icon {
    animation: none;
  }
}

/* --- Gate (login): invitation card sliding out of its envelope --------------------------- */

.gate {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  min-height: 100svh;
  padding: clamp(1.5rem, 6vh, 4rem) var(--s-4) clamp(3rem, 10vh, 6rem);
  overflow: hidden;
  background:
    radial-gradient(70% 55% at 80% 10%, var(--color-blush-light), transparent 70%),
    radial-gradient(60% 50% at 10% 90%, color-mix(in srgb, var(--color-blush) 60%, transparent), transparent 70%),
    var(--paper);
}

.gate__backdrop {
  position: absolute;
  inset: 0;
  z-index: -1;
}

.gate__backdrop img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gate__backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgb(253 246 243 / 0.55), rgb(253 246 243 / 0.1) 45%, rgb(9 14 45 / 0.18));
}

.gate__stage {
  position: relative;
  width: min(31rem, 100%);
  padding-bottom: 3.5rem;
}

.envelope {
  position: absolute;
  inset: auto -5% 0;
  height: 46%;
  border-radius: 3px;
  background: var(--color-blush);
  box-shadow: var(--shadow-print);
  transform: rotate(-2.5deg);
}

.envelope::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgb(255 255 255 / 0.25), transparent 60%);
  clip-path: polygon(0 0, 50% 58%, 100% 0, 100% 100%, 0 100%);
}

.envelope::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(20deg, var(--color-blush-dark), var(--color-blush) 70%);
  clip-path: polygon(0 100%, 50% 42%, 100% 100%);
  opacity: 0.75;
}

.invite {
  position: relative;
  padding: clamp(2rem, 6vw, 3.25rem) clamp(1.5rem, 6vw, 3rem) clamp(1.75rem, 5vw, 2.5rem);
  background: var(--paper-raised);
  box-shadow: var(--shadow-lift);
  outline: 1px solid var(--line);
  outline-offset: -12px;
  text-align: center;
  animation: invite-out 1100ms var(--ease-out) 150ms both;
}

@keyframes invite-out {
  from {
    transform: translateY(70px);
  }
}

.invite__names {
  color: var(--names);
  font-family: var(--font-script);
  font-size: clamp(2.8rem, 2rem + 3.6vw, 4rem);
  line-height: 1;
}

.invite__title {
  margin-top: var(--s-6);
  font-size: var(--step-3);
}

.invite__text {
  max-width: 34ch;
  margin: var(--s-3) auto 0;
  color: var(--ink-soft);
  font-size: var(--step--1);
  line-height: 1.6;
}

.invite__notice {
  margin-top: var(--s-5);
  text-align: left;
}

.invite__form {
  display: grid;
  gap: var(--s-4);
  margin-top: var(--s-6);
  text-align: left;
}

.invite__form.has-error {
  animation: nudge 360ms var(--ease-in-out);
}

@keyframes nudge {
  25% { transform: translateX(-6px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

.password-field {
  position: relative;
}

.password-field .input {
  padding-right: 3.25rem;
}

.password-field__toggle {
  position: absolute;
  top: 50%;
  right: 0.25rem;
  margin-top: -1.375rem;
  color: var(--ink-soft);
}

.gate__demo {
  position: absolute;
  left: 50%;
  bottom: var(--s-4);
  width: min(36rem, 100% - 2rem);
  transform: translateX(-50%);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-pill);
  background: rgb(253 246 243 / 0.9);
  color: var(--ink);
  font-size: var(--step--2);
  text-align: center;
  line-height: 1.4;
}

.gate__demo strong {
  margin-right: 0.4em;
  color: var(--color-accent-text);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* --- Error page -------------------------------------------------------------------------- */

.error-page {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: var(--s-5);
  min-height: 100svh;
  padding: var(--s-6) var(--s-4);
  text-align: center;
}

.error-page__print {
  width: 10rem;
  --tilt: -4deg;
}

.error-page__print .print__photo {
  display: grid;
  place-items: center;
}

.error-page__code {
  color: var(--color-accent-dark);
  font-family: var(--font-heading);
  font-size: 2.4rem;
}

.error-page h1 {
  font-size: var(--step-4);
  max-width: 18ch;
}

.error-page__message {
  max-width: 46ch;
  color: var(--ink-soft);
}

@media (prefers-reduced-motion: reduce) {
  .hero__print-link,
  .invite {
    animation: none;
  }
}

/* Session expired toast */
.session-toast {
  position: fixed;
  left: 50%;
  top: var(--s-4);
  z-index: 60;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3) var(--s-4);
  width: min(34rem, 100% - 2rem);
  padding: var(--s-3) var(--s-3) var(--s-3) var(--s-5);
  border-radius: var(--radius-l);
  background: var(--room);
  color: var(--room-ink);
  box-shadow: var(--shadow-float);
  transform: translateX(-50%);
  font-size: var(--step--1);
}

.session-toast p {
  flex: 1 1 14rem;
}

