.gallery-page { min-height: 65vh; }
.gallery-page .gallery-heading h1 { margin: 0; font-size: clamp(2.4rem, 5vw, 4.6rem); line-height: 1.03; letter-spacing: -.055em; }
.gallery-lock { max-width: 540px; margin: 0 auto; padding: clamp(24px, 5vw, 42px); border: 1px solid rgba(24, 40, 43, .12); border-radius: 26px; background: #fffdf8; box-shadow: 0 16px 40px rgba(24, 40, 43, .09); }
.gallery-lock-icon { display: grid; place-items: center; width: 54px; height: 54px; margin-bottom: 18px; border-radius: 17px; background: #d9eee5; font-size: 1.5rem; }
.gallery-lock h2 { margin: 0 0 12px; font-size: 1.65rem; }
.gallery-lock p { color: var(--muted); line-height: 1.6; }
.gallery-unlock-form { display: grid; gap: 16px; margin-top: 24px; }
.gallery-unlock-form .button { justify-content: center; width: fit-content; }
.gallery-unlock-status { min-height: 1.5em; margin: 0; color: #ad3d32 !important; font-size: .9rem; font-weight: 700; }
.gallery-return-link { margin-top: 4px; }
.gallery-setup-notice { font-size: .88rem; }
.gallery-access-request { position: relative; margin-top: 22px; padding: 17px; overflow: hidden; border: 1px solid rgba(45, 108, 98, .2); border-radius: 18px; background: linear-gradient(135deg, rgba(217, 238, 229, .62), rgba(255, 253, 248, .88)); }
.gallery-access-request::before { position: absolute; z-index: 0; right: -11px; bottom: -14px; width: 112px; height: 85px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 72' fill='none'%3E%3Crect x='5' y='10' width='86' height='54' rx='9' fill='%23d9eee5' stroke='%232d6c62' stroke-width='3'/%3E%3Cpath d='m9 18 39 28 39-28M9 59l25-24M87 59 62 35' stroke='%232d6c62' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; content: ""; opacity: .19; pointer-events: none; transform: rotate(-8deg); }
.gallery-access-request > * { position: relative; z-index: 1; }
.gallery-access-request-heading { display: flex; align-items: flex-start; gap: 10px; }
.gallery-access-request-icon { display: grid; width: 30px; height: 30px; flex: 0 0 30px; place-items: center; border-radius: 10px; background: var(--deep-mint); color: #fffdf8; box-shadow: 0 3px 8px rgba(24, 40, 43, .12); }
.gallery-access-request-icon svg { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.gallery-access-request h3 { margin: 1px 0 3px; color: var(--ink); font-size: 1rem; line-height: 1.2; }
.gallery-access-request p { margin: 0; color: var(--muted); font-size: .83rem; line-height: 1.45; }
.gallery-access-email { color: var(--deep-mint); font-weight: 850; white-space: nowrap; }
.gallery-access-annotations { display: grid; gap: 8px; }
.gallery-access-request .gallery-access-policy { padding: 9px 10px; border: 1px dashed rgba(45, 108, 98, .3); border-radius: 11px; background: rgba(255,255,255,.48); color: #3a5f59; font-size: .76rem; font-weight: 650; line-height: 1.4; }
.gallery-access-policy strong { color: var(--deep-mint); font-weight: 900; }
.gallery-access-form { display: grid; gap: 10px; margin-top: 13px; }
.gallery-access-field { display: grid; gap: 5px; color: var(--ink); font-size: .78rem; font-weight: 850; }
.gallery-access-field textarea { width: 100%; min-height: 150px; box-sizing: border-box; resize: vertical; padding: 9px 10px; border: 1px solid rgba(24, 40, 43, .18); border-radius: 11px; background: rgba(255, 255, 255, .85); color: var(--ink); font: inherit; font-size: .84rem; font-weight: 500; line-height: 1.4; }
.gallery-access-field textarea:focus-visible { outline: 3px solid rgba(45, 108, 98, .3); outline-offset: 2px; border-color: var(--deep-mint); }
.gallery-access-signature-hint { color: var(--muted); font-size: .71rem; font-weight: 650; line-height: 1.3; }
.gallery-access-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px 12px; }
.gallery-access-actions .button { position: relative; isolation: isolate; padding: 9px 13px; overflow: hidden; font-size: .79rem; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, background-color .2s ease, background-position .35s ease, color .2s ease; }
.gallery-access-actions .button.button-secondary { border-color: rgba(45,108,98,.32); background: linear-gradient(135deg, #d8eee4 0%, #e7f4ec 46%, #fff0e6 100%); background-size: 165% 165%; background-position: 0 50%; box-shadow: 0 3px 8px rgba(33,78,70,.12); color: #245c53; }
.gallery-access-send-icon { position: relative; z-index: 1; display: inline-grid; width: 1.24em; place-items: center; font-size: 1.08em; transform-origin: 45% 58%; }
.gallery-access-send-icon svg { display: block; width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.gallery-access-send-icon::after { position: absolute; top: 50%; right: calc(100% + 1px); width: 7px; height: 1.5px; border-radius: 999px; background: currentColor; content: ""; opacity: 0; transform: translate(5px, -50%) scaleX(.3); transform-origin: right center; }
@media (hover: hover) {
  .gallery-access-actions .button:hover, .gallery-access-actions .button:focus-visible { background-position: 100% 50%; transform: translateY(-1px); box-shadow: 0 6px 12px rgba(24,40,43,.13); }
  .gallery-access-actions .button:hover .gallery-access-send-icon, .gallery-access-actions .button:focus-visible .gallery-access-send-icon { animation: gallery-access-envelope-send 1.05s cubic-bezier(.25,.8,.25,1); }
  .gallery-access-actions .button:hover .gallery-access-send-icon::after, .gallery-access-actions .button:focus-visible .gallery-access-send-icon::after { animation: gallery-access-envelope-trail 1.05s ease-out; }
}
.gallery-access-actions .button.is-sending .gallery-access-send-icon { animation: gallery-access-envelope-send .72s cubic-bezier(.25,.8,.25,1); }
.gallery-access-actions .button.is-sending .gallery-access-send-icon::after { animation: gallery-access-envelope-trail .72s ease-out; }
@keyframes gallery-access-envelope-send { 0% { opacity: 1; transform: translate(0, 0) rotate(0); } 20% { opacity: 1; transform: translate(-2px, 2px) rotate(-10deg); } 55% { opacity: 0; transform: translate(22px, -10px) rotate(9deg); } 72% { opacity: 0; transform: translate(0, 0) rotate(0); } 100% { opacity: 1; transform: translate(0, 0) rotate(0); } }
@keyframes gallery-access-envelope-trail { 0%, 14% { opacity: 0; transform: translate(6px, -50%) scaleX(.25); } 35% { opacity: .58; transform: translate(-4px, -50%) scaleX(1.1); } 58% { opacity: 0; transform: translate(-15px, -50%) scaleX(1.75); } 100% { opacity: 0; transform: translate(5px, -50%) scaleX(.25); } }
.gallery-access-note { color: var(--muted); font-size: .72rem; line-height: 1.3; }
.gallery-access-status { min-height: 1.2em; color: var(--deep-mint) !important; font-size: .76rem !important; font-weight: 800; }
.gallery-unlocked-actions { display: flex; justify-content: end; margin: 0 0 18px; }
.gallery-unlocked-actions .button { padding: 10px 18px; }
.gallery-bottom-actions { display: flex; justify-content: center; margin-top: 32px; }
.gallery-page [hidden] { display: none !important; }
.gallery-grid { grid-auto-flow: dense; }
.gallery-item:nth-child(n + 11) { grid-column: span 4; grid-row: span 6; }
.gallery-item:nth-child(20) { grid-column: span 12; grid-row: span 6; }
body.is-night .gallery-lock { border-color: rgba(255,255,255,.15); background: #203851; }
body.is-night .gallery-lock-icon { background: #33536d; }
body.is-night .gallery-lock p { color: rgba(255,255,255,.78); }
body.is-night .gallery-unlock-status { color: #ffc3ad !important; }
body.is-night .gallery-access-request { border-color: rgba(184, 229, 217, .26); background: linear-gradient(135deg, rgba(42, 83, 79, .8), rgba(32, 56, 81, .94)); }
body.is-night .gallery-access-request::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 72' fill='none'%3E%3Crect x='5' y='10' width='86' height='54' rx='9' fill='%23203a55' stroke='%23b8e5d9' stroke-width='3'/%3E%3Cpath d='m9 18 39 28 39-28M9 59l25-24M87 59 62 35' stroke='%23b8e5d9' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); opacity: .16; }
body.is-night .gallery-access-request-icon { background: #b8e5d9; color: #173b38; }
body.is-night .gallery-access-request h3, body.is-night .gallery-access-field { color: #fffdf8; }
body.is-night .gallery-access-request p, body.is-night .gallery-access-note { color: rgba(255,255,255,.74); }
body.is-night .gallery-access-email { color: #b8e5d9; }
body.is-night .gallery-access-request .gallery-access-policy { border-color: rgba(184,229,217,.34); background: rgba(9,29,47,.32); color: rgba(255,255,255,.82); }
body.is-night .gallery-access-policy strong { color: #b8e5d9; }
body.is-night .gallery-access-signature-hint { color: rgba(255,255,255,.7); }
body.is-night .gallery-access-field textarea { border-color: rgba(184,229,217,.3); background: rgba(10, 29, 47, .45); color: #fffdf8; }
body.is-night .gallery-access-status { color: #b8e5d9 !important; }
body.is-night .gallery-access-actions .button.button-secondary { border-color: rgba(184,229,217,.42); background: linear-gradient(135deg, #285c53 0%, #365a76 54%, #4d638c 100%); color: #fffdf8; box-shadow: 0 3px 8px rgba(5,16,31,.32); }
body.is-halloween .gallery-lock { border-color: rgba(255,190,110,.25); background: #2d193b; }
body.is-halloween .gallery-lock-icon { background: #52305e; }
body.is-halloween .gallery-lock p { color: rgba(255,244,231,.78); }
body.is-halloween .gallery-unlock-status { color: #ffca9e !important; }
body.is-halloween .gallery-access-request { border-color: rgba(255,190,110,.28); background: linear-gradient(135deg, rgba(93, 45, 73, .92), rgba(45, 25, 59, .96)); }
body.is-halloween .gallery-access-request::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 72' fill='none'%3E%3Crect x='5' y='10' width='86' height='54' rx='9' fill='%2343284d' stroke='%23ffcc87' stroke-width='3'/%3E%3Cpath d='m9 18 39 28 39-28M9 59l25-24M87 59 62 35' stroke='%23ffcc87' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); opacity: .18; }
body.is-halloween .gallery-access-request-icon { background: #ffb45e; color: #38203f; }
body.is-halloween .gallery-access-request h3, body.is-halloween .gallery-access-field { color: #fff4e7; }
body.is-halloween .gallery-access-request p, body.is-halloween .gallery-access-note { color: rgba(255,244,231,.76); }
body.is-halloween .gallery-access-email { color: #ffcc87; }
body.is-halloween .gallery-access-request .gallery-access-policy { border-color: rgba(255,190,110,.38); background: rgba(28,12,40,.28); color: rgba(255,244,231,.84); }
body.is-halloween .gallery-access-policy strong { color: #ffcc87; }
body.is-halloween .gallery-access-signature-hint { color: rgba(255,244,231,.7); }
body.is-halloween .gallery-access-field textarea { border-color: rgba(255,190,110,.3); background: rgba(28, 12, 40, .42); color: #fff4e7; }
body.is-halloween .gallery-access-status { color: #ffcc87 !important; }
body.is-halloween .gallery-access-actions .button.button-secondary { border-color: rgba(255,190,110,.48); background: linear-gradient(135deg, #4e2850 0%, #703753 52%, #a34a48 100%); color: #fff4e7; box-shadow: 0 3px 8px rgba(16,5,22,.36); }

@media (max-width: 620px) {
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: row; grid-auto-rows: auto; gap: 8px; }
  .gallery-item:nth-child(n), .gallery-item:nth-child(20) { grid-column: span 1; grid-row: span 1; aspect-ratio: 1 / 1; }
  .gallery-item img { display: block; }
  .gallery-caption { right: 10px; bottom: 10px; left: 10px; font-size: .74rem; line-height: 1.12; }
  .gallery-access-request { padding: 14px; }
  .gallery-access-request::before { right: -8px; bottom: -10px; width: 86px; height: 65px; }
  .gallery-access-field textarea { min-height: 170px; }
  .gallery-access-actions { align-items: flex-start; flex-direction: column; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-access-actions .button, .gallery-access-send-icon, .gallery-access-send-icon::after { animation: none !important; transition: none !important; }
}
