:root {
  color-scheme: light;
  --white: #fff;
  --surface: #f7f6fb;
  --line: #e9e6ef;
  --text: #20192b;
  --muted: #60596b;
  --accent: #6b3cb2;
  --accent-strong: #563092;
  --accent-soft: #f0e9fb;
  --focus: #7850ba;
  font-family: Inter, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--text); background: var(--white); }
a { color: inherit; text-decoration: none; }
h1, h2, p { margin: 0; }
h1, h2 { font-family: "Inter Tight", Inter, Arial, sans-serif; }
button, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .48; cursor: default; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

.shell { width: min(1240px, calc(100% - 72px)); margin-inline: auto; }
header { background: var(--white); border-bottom: 1px solid var(--line); }
.top {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: .875rem;
}
.brand {
  display: block;
  flex: 0 1 300px;
  min-width: 0;
}
.brand img {
  display: block;
  width: 100%;
  height: auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, .87fr) minmax(0, 1.13fr);
  align-items: center;
  gap: clamp(20px, 3.2vw, 48px);
  margin-top: 28px;
  padding: clamp(16px, 2.2vw, 28px);
  border: 1px solid var(--line);
  border-radius: 30px;
  background: linear-gradient(118deg, #fcfaff 0%, #faf8fd 68%, #f5f0fb 100%);
}
.intro { container-type: inline-size; padding: clamp(12px, 2.2vw, 32px); }
.eyebrow {
  margin-bottom: 17px;
  color: var(--accent);
  font-size: .875rem;
  font-weight: 700;
}
#shoot-date::before { content: " · "; }
h1 {
  font-size: clamp(2rem, 14cqi, 5.1rem);
  font-weight: 800;
  line-height: .96;
  letter-spacing: -.062em;
  overflow-wrap: anywhere;
}
h1 span, h2 span { color: var(--accent); }
#description {
  max-width: 39ch;
  margin-block: 20px 24px;
  color: var(--muted);
  line-height: 1.6;
}
.mosaic {
  display: grid;
  grid-template-columns: 1.42fr 1fr;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  height: clamp(270px, 32vw, 430px);
  gap: 9px;
}
.mosaic:empty { display: none; }
.mosaic > .cover-tile {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 15px;
  background: var(--surface);
}
.cover-tile img {
  position: absolute;
  display: block;
  width: var(--cover-size, 100%);
  height: var(--cover-size, 100%);
  left: var(--cover-left, 0%);
  top: var(--cover-top, 0%);
  max-width: none;
  object-fit: cover;
  object-position: var(--cover-x, 50%) var(--cover-y, 50%);
}
.mosaic > .cover-tile:first-child { grid-row: 1 / -1; }
.mosaic > .cover-tile:only-child { grid-column: 1 / -1; }
.mosaic > .cover-tile:nth-child(2):last-child { grid-row: 1 / -1; }

#album-premiere .mosaic {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: 15px;
  grid-template-columns: minmax(0, 1.42fr) minmax(0, 1fr);
}
#album-premiere[data-premiere-open="false"] .mosaic {
  grid-template-columns: minmax(0, 1.91fr) minmax(0, .09fr);
  gap: 4px;
}
#album-premiere[data-premiere-open="false"] .cover-tile:not(:first-child) {
  filter: brightness(.48);
}
#album-premiere[data-premiere-open="false"] .cover-tile:first-child img {
  transform: scale(1.055);
}
#album-premiere[data-premiere-motion="true"] .mosaic {
  transition: grid-template-columns 780ms cubic-bezier(.27,.77,.24,1), gap 640ms ease;
}
#album-premiere[data-premiere-motion="true"] .mosaic .cover-tile {
  transition: filter 820ms ease;
}
#album-premiere[data-premiere-motion="true"] .mosaic img {
  transition: transform 870ms cubic-bezier(.22,.74,.27,1);
}
#album-premiere[data-premiere-motion="true"] .mosaic::after {
  content: "";
  position: absolute;
  inset: -35% -37%;
  background: linear-gradient(108deg, transparent 37%, #aa79ef66 49%, #e0cafe99 51%, #a75bff00 60%);
  pointer-events: none;
  animation: album-premiere-light 870ms ease-out both;
}
@keyframes album-premiere-light {
  0% { opacity: 0; transform: translateX(-58%); }
  26% { opacity: .8; }
  94%, 100% { opacity: 0; transform: translateX(52%); }
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  color: var(--text);
  font-size: .875rem;
  font-weight: 650;
  text-align: center;
  transition: background-color .16s ease, border-color .16s ease;
}
.button:not(:disabled):hover { background: var(--surface); border-color: #d7cde3; }
.button.primary { color: white; background: var(--accent); border-color: var(--accent); }
.button.primary:not(:disabled):hover { background: var(--accent-strong); border-color: var(--accent-strong); }

.gift-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding: clamp(12px, 2vw, 18px);
  border: 1px solid #e4d7f4;
  border-radius: 16px;
  background: linear-gradient(120deg, #f1e7fb, #fbf8ff);
}
.gift-card h2 { color: var(--accent-strong); font-size: clamp(1.15rem, 2.4vw, 1.45rem); }
.gift-card p { margin-top: 4px; color: var(--muted); font-size: .875rem; line-height: 1.45; }
.gift-card .button { border-color: #dfcfee; color: var(--accent-strong); }

#photos { padding-block: 36px 64px; scroll-margin-top: 18px; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}
h2 { font-size: clamp(1.75rem, 3.3vw, 2.75rem); line-height: 1.1; letter-spacing: -.045em; }
#count { margin-top: 6px; color: var(--muted); font-size: .875rem; }
#review { color: var(--accent-strong); background: var(--accent-soft); border-color: #e5d8f6; }
#review:hover { background: #e8dbf8; }
#chosen-count {
  min-width: 24px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--white);
  color: var(--accent-strong);
}
.tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-block: 19px 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}
.tabs button {
  min-height: 38px;
  padding: 7px 13px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 650;
}
.tabs button:hover { color: var(--accent-strong); }
.tabs button[aria-pressed=true] {
  border-color: var(--line);
  background: var(--white);
  color: var(--accent-strong);
  box-shadow: 0 1px 3px #24163b0d;
}

.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--white);
}
.card[data-picked=true] { border-color: #a583d3; }
.image-button { display: block; width: 100%; padding: 0; border: 0; background: var(--surface); }
.image-button:focus-visible { outline-offset: -4px; }
.image-button img { display: block; width: 100%; aspect-ratio: 4 / 4.65; object-fit: cover; }
.card-body { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px; }
.card-body .button { min-height: 40px; padding-inline: 10px; }
.name { color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }
.card-body .button[aria-pressed=true] { color: var(--accent-strong); background: var(--accent-soft); border-color: #ddccf1; }
.empty { grid-column: 1 / -1; padding: 24px; border: 1px solid var(--line); border-radius: 17px; color: var(--muted); background: var(--surface); }
footer { display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); padding-block: 24px; color: var(--muted); font-size: .875rem; }
footer a:hover { color: var(--accent); text-decoration: underline; }

dialog {
  width: min(740px, calc(100% - 28px));
  max-height: 92dvh;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 16px;
  background: var(--white);
  color: var(--text);
  box-shadow: 0 22px 80px #23133230;
}
dialog::backdrop { background: #21162e80; }
.dialog-head, .photo-tools { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.dialog-head { margin-bottom: 13px; }
.dialog-head h2 { font-size: 1.4rem; overflow-wrap: anywhere; }
.photo-stage { position: relative; overflow: hidden; width: 100%; height: min(58vh, 580px); height: min(58dvh, 580px); border-radius: 12px; background: var(--surface); }
.photo-stage img { display: block; width: 100%; height: 100%; object-fit: contain; }
.photo-stage img + img { position: absolute; inset: 0; }
.photo-status { margin-top: 8px; color: var(--muted); font-size: .875rem; }
.pick-feedback { margin-top: 10px; color: var(--accent-strong); font-size: .875rem; }
.pick-feedback:empty, .note-status:empty, .card-note:empty { display: none; }
.card-note { flex-basis: 100%; width: 100%; }
.note-editor { display: grid; gap: 5px; width: 100%; }
.note-editor label { display: grid; gap: 6px; color: var(--muted); font-size: .875rem; }
.note-editor textarea { width: 100%; min-width: 0; resize: vertical; border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; background: var(--surface); color: var(--text); font-size: 1rem; }
.note-editor .note-status { color: var(--muted); font-size: .8125rem; }
.note-editor .note-retry { justify-self: start; }
#detail-note:not(:empty) { margin-top: 10px; }
#detail:has(.note-editor) .photo-stage { height: min(42vh, 480px); height: min(42dvh, 480px); }
.selection-intro { color: var(--muted); line-height: 1.5; }
.selection-row-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; overflow-wrap: anywhere; }
.photo-tools { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr) auto; gap: 6px; padding-top: 10px; }
.photo-tools #prev, .photo-tools #next { min-width: 40px; padding-inline: 8px; }
.photo-tools #next { grid-column: 4; }
.photo-tools:has(#detail-pick[hidden]) #download { grid-column: 2 / 4; }
.selection-row { display: grid; gap: 8px; border-bottom: 1px solid var(--line); padding: 12px 0 16px; }
.selection-row textarea { resize: vertical; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface); color: var(--text); }
.dialog-foot { margin-top: 14px; }
#result { margin-top: 8px; color: var(--accent-strong); }

@media (max-width: 950px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 660px) {
  #detail { padding: 12px; }
  .photo-tools .button { padding-inline: 6px; }
  .shell { width: calc(100% - 32px); }
  .top { min-height: 58px; }
  .brand { flex-basis: 246px; }
  .top > span { max-width: 11ch; text-align: right; line-height: 1.2; }
  .hero { grid-template-columns: 1fr; gap: 16px; margin-top: 16px; padding: 12px; border-radius: 21px; }
  .intro { padding: 10px 7px 0; }
  .eyebrow { margin-bottom: 10px; }
  #description { margin-block: 12px 15px; }
  .mosaic { height: clamp(180px, 52vw, 290px); gap: 6px; }
  .mosaic > .cover-tile { border-radius: 10px; }
  #photos { padding-block: 28px 40px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card-body { padding: 8px; }
  .card-body .button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .button { transition: none; }
  #album-premiere .mosaic, #album-premiere .mosaic *, #album-premiere .mosaic::after {
    transition: none !important; animation: none !important;
  }
}
