:root {
  --cream: #f4efe7;
  --paper: #fffdf9;
  --ink: #171512;
  --soft: #6d655c;
  --gold: #a9824c;
  --gold-soft: #dcc7a9;
  --line: rgba(23, 21, 18, .14);
  --success: #356c4a;
  --danger: #8c3232;
  --shadow: 0 26px 80px rgba(32, 25, 17, .1);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: radial-gradient(circle at 90% 2%, rgba(169,130,76,.18), transparent 28rem), var(--cream); font: 16px/1.55 "DM Sans", sans-serif; }
button, input, textarea { font: inherit; }
button, a, label { -webkit-tap-highlight-color: transparent; }
.gallery-header { position: sticky; z-index: 30; top: 0; display: flex; align-items: center; justify-content: space-between; min-height: 78px; padding: 12px max(20px, calc((100vw - 1420px) / 2)); border-bottom: 1px solid var(--line); background: rgba(244,239,231,.9); backdrop-filter: blur(18px); }
.gallery-header form { margin: 0; }
.gallery-brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.gallery-brand > span { display: grid; width: 45px; height: 45px; place-items: center; border: 1px solid var(--gold); border-radius: 50%; color: var(--gold); font: italic 600 1.55rem "Playfair Display", serif; }
.gallery-brand div { display: grid; line-height: 1.05; }
.gallery-brand strong { font: 600 1.4rem "Playfair Display", serif; }
.gallery-brand small { margin-top: 5px; color: var(--soft); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; }
.header-link { padding: 8px 0; border: 0; color: var(--soft); background: none; cursor: pointer; font-size: .86rem; text-decoration: underline; text-underline-offset: 4px; }
.eyebrow { margin: 0; color: var(--gold); font-size: .75rem; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; }
.muted { color: var(--soft); }
h1, h2 { font-family: "Playfair Display", serif; }
h1 em, h2 em { color: var(--gold); font-weight: 600; }
.primary-button { min-height: 52px; padding: 12px 24px; border: 0; border-radius: 999px; color: #fff; background: var(--ink); cursor: pointer; font-weight: 600; transition: background .2s ease, transform .2s ease; }
.primary-button:hover { background: var(--gold); transform: translateY(-1px); }
.primary-button:disabled { opacity: .55; cursor: wait; transform: none; }

.login-layout { display: grid; grid-template-columns: minmax(0, .95fr) minmax(430px, .7fr); align-items: center; gap: clamp(30px, 7vw, 120px); width: min(1180px, calc(100% - 40px)); min-height: calc(100vh - 79px); margin: auto; padding: 60px 0; }
.login-intro { padding: clamp(10px, 4vw, 45px); }
.login-intro h1 { margin: 10px 0 24px; font-size: clamp(3.6rem, 7vw, 7rem); line-height: .9; letter-spacing: -.055em; }
.login-intro > p:not(.eyebrow) { max-width: 580px; color: var(--soft); font-size: 1.05rem; }
.selection-rule { display: grid; gap: 3px; margin-top: 35px; padding: 21px 24px; border-left: 3px solid var(--gold); border-radius: 0 13px 13px 0; background: rgba(255,253,249,.72); }
.selection-rule strong { font: 600 1.35rem "Playfair Display", serif; }
.selection-rule span { color: var(--soft); }
.login-card { padding: clamp(25px, 5vw, 50px); border: 1px solid var(--line); border-radius: 25px; background: rgba(255,253,249,.94); box-shadow: var(--shadow); }
.login-card h2 { margin: 7px 0 3px; font-size: clamp(2.1rem, 4vw, 3.2rem); }
.login-card > .muted { margin: 0 0 26px; }
.login-card form { display: grid; gap: 17px; }
.login-card label, .selection-notes { display: grid; gap: 7px; }
.login-card label span, .selection-notes span { font-size: .82rem; font-weight: 600; }
.login-card input, .selection-notes textarea { width: 100%; min-height: 51px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; outline: none; color: var(--ink); background: #fff; }
.login-card input:focus, .selection-notes textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(169,130,76,.13); }
.message { padding: 15px 17px; border: 1px solid; border-radius: 12px; }
.message.error { margin-bottom: 18px; border-color: rgba(140,50,50,.25); color: #722c2c; background: #f7e6e6; }
.message.success { border-color: rgba(53,108,74,.24); color: #28563a; background: #e4f0e7; }

.gallery-shell { width: min(1420px, calc(100% - 40px)); margin: 0 auto; padding: 48px 0 90px; }
.gallery-hero { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 35px; margin: 16px 0 40px; }
.gallery-hero h1 { margin: 9px 0 0; font-size: clamp(3.2rem, 6.4vw, 7.2rem); line-height: .9; letter-spacing: -.055em; }
.session-card { display: grid; min-width: 290px; gap: 4px; padding: 20px 22px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,253,249,.82); }
.session-card span, .session-card small { color: var(--soft); font-size: .78rem; }
.session-card strong { font: 600 1.3rem "Playfair Display", serif; }
.instructions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 28px; }
.instructions div { display: flex; align-items: flex-start; gap: 13px; padding: 17px 18px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,253,249,.75); }
.instructions span { display: grid; flex: 0 0 34px; width: 34px; height: 34px; place-items: center; border: 1px solid var(--gold); border-radius: 50%; color: var(--gold); font-size: .73rem; }
.instructions p { margin: 4px 0 0; color: var(--soft); font-size: .9rem; }
.instructions strong { color: var(--ink); }
.selection-confirmed { display: flex; align-items: center; justify-content: space-between; gap: 25px; margin-bottom: 28px; }
.selection-confirmed div { display: grid; }
.selection-confirmed > span { flex: 0 0 auto; font-weight: 600; }
.photo-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.photo-card { position: relative; display: block; overflow: hidden; aspect-ratio: 4 / 5; border: 2px solid transparent; border-radius: 12px; background: #ddd4c8; cursor: pointer; box-shadow: 0 8px 26px rgba(23,21,18,.06); transition: border-color .2s ease, opacity .2s ease, transform .2s ease; }
.photo-card:hover { transform: translateY(-2px); }
.photo-card:focus-within { outline: 3px solid rgba(169,130,76,.25); outline-offset: 2px; }
.photo-card.selected { border-color: var(--gold); }
.photo-card.not-selected { opacity: .38; }
.photo-card.not-selected:hover { opacity: .78; }
.photo-card img { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo-checkbox { position: absolute; z-index: 2; width: 1px; height: 1px; opacity: 0; }
.photo-number, .photo-kind, .selection-mark { position: absolute; z-index: 3; color: #fff; background: rgba(18,16,13,.72); backdrop-filter: blur(8px); }
.photo-number { top: 10px; left: 10px; padding: 5px 8px; border-radius: 999px; font-size: .7rem; }
.selection-mark { top: 10px; right: 10px; display: grid; width: 31px; height: 31px; place-items: center; border: 1px solid rgba(255,255,255,.65); border-radius: 50%; opacity: 0; }
.photo-card.selected .selection-mark { opacity: 1; color: var(--ink); background: #fff; }
.photo-kind { right: 10px; bottom: 10px; padding: 5px 9px; border-radius: 999px; font-size: .69rem; }
.photo-card.selected .photo-kind { color: var(--ink); background: #fff; }
.locked .photo-card { cursor: default; }
.locked .photo-card:hover { transform: none; }
.selection-footer { position: sticky; z-index: 20; bottom: 14px; display: grid; grid-template-columns: auto auto minmax(250px, 1fr) auto; align-items: end; gap: 18px; margin-top: 24px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,253,249,.95); box-shadow: 0 20px 60px rgba(23,21,18,.18); backdrop-filter: blur(18px); }
.selection-progress, .selection-price { display: grid; min-width: 150px; }
.selection-progress span, .selection-price span { color: var(--soft); font-size: .76rem; }
.selection-progress strong, .selection-price strong { font: 600 1.18rem "Playfair Display", serif; }
.selection-notes textarea { min-height: 62px; resize: vertical; }
.form-message { grid-column: 1 / -1; min-height: 0; margin: 0; color: var(--danger); font-size: .86rem; }
.form-message:empty { display: none; }
.empty-gallery { display: grid; min-height: 360px; place-items: center; align-content: center; padding: 40px; border: 1px dashed var(--line); border-radius: 20px; text-align: center; background: rgba(255,253,249,.55); }
.empty-gallery > span { display: grid; width: 64px; height: 64px; place-items: center; border: 1px solid var(--gold); border-radius: 50%; color: var(--gold); font: italic 600 2rem "Playfair Display", serif; }
.empty-gallery h2 { margin: 16px 0 4px; font-size: 2rem; }
.empty-gallery p { margin: 0; color: var(--soft); }
.extra-payment { display: grid; grid-template-columns: 1fr minmax(330px, .65fr); gap: 30px; margin-top: 28px; padding: clamp(24px, 4vw, 42px); border: 1px solid rgba(169,130,76,.35); border-radius: 20px; background: #f7eddf; }
.extra-payment.paid { border-color: rgba(53,108,74,.28); background: #e7f1e9; }
.extra-payment h2 { margin: 7px 0; font-size: clamp(2rem, 4vw, 3rem); }
.extra-payment p:not(.eyebrow) { max-width: 700px; margin: 0; color: var(--soft); }
.extra-payment dl { display: grid; gap: 8px; margin: 0; }
.extra-payment dl div { display: flex; justify-content: space-between; gap: 15px; padding-bottom: 7px; border-bottom: 1px solid var(--line); }
.extra-payment dt { color: var(--soft); }
.extra-payment dd { margin: 0; text-align: right; font-weight: 600; }

@media (max-width: 1050px) {
  .photo-grid { grid-template-columns: repeat(3, 1fr); }
  .selection-footer { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .selection-notes { grid-column: 1 / -1; }
  .selection-footer .primary-button { width: 100%; }
  .form-message { grid-column: 1 / -1; }
}
@media (max-width: 780px) {
  .gallery-header { min-height: 68px; padding: 10px 16px; }
  .gallery-brand > span { width: 39px; height: 39px; }
  .gallery-brand strong { font-size: 1.16rem; }
  .gallery-brand small { display: none; }
  .login-layout { grid-template-columns: 1fr; width: min(100% - 24px, 1180px); padding: 35px 0 60px; }
  .login-intro { padding: 10px 4px; }
  .login-intro h1 { font-size: clamp(3.4rem, 16vw, 5.5rem); }
  .gallery-shell { width: min(100% - 20px, 1420px); padding-top: 28px; }
  .gallery-hero { grid-template-columns: 1fr; align-items: start; margin-bottom: 26px; }
  .gallery-hero h1 { font-size: clamp(3.2rem, 14vw, 5.6rem); }
  .session-card { min-width: 0; width: 100%; }
  .instructions { grid-template-columns: 1fr; }
  .photo-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .selection-confirmed { align-items: flex-start; flex-direction: column; }
  .extra-payment { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .gallery-shell { width: min(100% - 12px, 1420px); }
  .login-card { padding: 24px 19px; border-radius: 18px; }
  .photo-grid { gap: 5px; }
  .photo-card { border-radius: 8px; }
  .photo-number { top: 6px; left: 6px; }
  .selection-mark { top: 6px; right: 6px; width: 28px; height: 28px; }
  .photo-kind { right: 6px; bottom: 6px; }
  .selection-footer { bottom: 5px; grid-template-columns: 1fr 1fr; gap: 12px; padding: 14px; border-radius: 14px; }
  .selection-progress, .selection-price { min-width: 0; }
  .selection-footer .primary-button, .selection-notes { grid-column: 1 / -1; }
  .extra-payment dl div { display: grid; gap: 1px; }
  .extra-payment dd { text-align: left; overflow-wrap: anywhere; }
}
