/* ═══════════════════════════════════════════
   HATLEY CASTLE — V4
   
   Restrained SVG. Intentional variety.
   Each technique used 1-2 times max.
   ═══════════════════════════════════════════ */

:root {
    --dark: #1e1b18;
    --paper: #f5f0e8;
    --sage-wash: #eef2eb;
    --pink-wash: #f5eeec;
    --terra-wash: #f3ede6;
    --ink: #2a2420;
    --ink-muted: rgba(42, 36, 32, .38);
    --ink-caption: rgba(42, 36, 32, .58);
    --cream: #f0e9dc;
    --cream-muted: rgba(240, 233, 220, .38);
    --cream-cap: rgba(240, 233, 220, .55);
    --sage: #7a8b6e;
    --sage-light: #8fa07f;
    --gold: #b89e6f;
    --display: 'Cormorant Garamond', Georgia, serif;
    --body: 'EB Garamond', Georgia, serif;
    --script: 'Pinyon Script', cursive;
    --pad: clamp(1.25rem, 5vw, 3.5rem);
    --gap: clamp(3rem, 9vh, 6rem);
    --ease: cubic-bezier(.16, 1, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; }
body { background: var(--dark); color: var(--ink); font: 400 clamp(.88rem, 2vw, .98rem)/1.85 var(--body); overflow-x: hidden; }
img { display: block; max-width: 100%; }

.grain { position: fixed; inset: 0; z-index: 9000; pointer-events: none; opacity: .04; background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E"); background-size: 150px; mix-blend-mode: overlay; }

/* ═══ PRELOADER ═══ */
#preloader { position: fixed; inset: 0; z-index: 9999; background: var(--dark); display: flex; align-items: center; justify-content: center; }
.pre-inner { text-align: center; color: var(--cream); }
.pre-wreath { width: clamp(70px, 18vw, 95px); height: auto; margin: 0 auto 1.25rem; opacity: 0; }
.wr-ring { stroke: var(--sage); fill: none; stroke-dasharray: 300; stroke-dashoffset: 300; }
.wr-leaf { stroke: var(--sage); fill: rgba(122,139,110,.15); stroke-dasharray: 60; stroke-dashoffset: 60; stroke-width: .5; }
.wr-bud { fill: var(--sage); opacity: 0; }
.wr-star { fill: var(--sage-light); opacity: 0; }
.pre-names { display: flex; align-items: baseline; justify-content: center; gap: .4em; opacity: 0; transform: translateY(12px); }
.pre-names .pn { font: 300 clamp(1.8rem, 7vw, 3.5rem)/1.1 var(--display); letter-spacing: .05em; }
.pre-names .pa { font: normal clamp(1rem, 3vw, 1.6rem) var(--script); color: var(--sage-light); margin: 0 .1em; }
.pre-where { font-size: .55rem; letter-spacing: .3em; text-transform: uppercase; color: var(--cream-muted); margin-top: .75rem; opacity: 0; }

/* ═══ HERO ═══ */
.hero { position: relative; height: 100svh; overflow: hidden; color: var(--cream); }
.hero-img-box { position: absolute; inset: 0; }
.hero-img { width: 100%; height: 100%; object-fit: cover; object-position: center center; animation: heroSettle 11s var(--ease) forwards; }
@keyframes heroSettle { from { transform: scale(1.05); } to { transform: scale(1); } }
.hero-shade { position: absolute; inset: 0; z-index: 1; background: linear-gradient(to top, var(--dark) 0%, rgba(30,27,24,.88) 14%, rgba(30,27,24,.3) 40%, rgba(30,27,24,.18) 100%); }
.hero-text { position: absolute; bottom: 0; left: 0; right: 0; z-index: 2; padding: 0 var(--pad) clamp(2.5rem, 7vh, 5rem); text-align: center; opacity: 0; transform: translateY(20px); }
.hero-kicker { font: 300 .55rem/1 var(--body); letter-spacing: .5em; text-transform: uppercase; color: var(--cream-muted); margin-bottom: .6rem; }
.hero-names { font: 300 clamp(2.6rem, 11vw, 6.5rem)/.9 var(--display); letter-spacing: .04em; }
.hero-date { font: italic 400 clamp(.65rem, 1.8vw, .78rem)/1 var(--body); color: var(--cream-muted); letter-spacing: .08em; margin-top: .9rem; }
.script-amp { font: normal clamp(1.2rem, 4.5vw, 2.8rem)/.9 var(--script); color: var(--sage-light); margin: 0 .12em; vertical-align: .08em; }

/* ═══ VINE ═══ */
main { position: relative; }
.vine-thread { position: absolute; left: 5px; top: 0; width: 20px; height: 100%; z-index: 5; pointer-events: none; }
.vine-stem { stroke: var(--sage); fill: none; stroke-dasharray: 6000; stroke-dashoffset: 6000; }
.vine-leaf { stroke: var(--sage); fill: rgba(122,139,110,.15); stroke-dasharray: 50; stroke-dashoffset: 50; }
.vine-bud { fill: var(--sage); opacity: 0; }

/* ═══ SECTIONS ═══ */
.sect { position: relative; z-index: 1; padding-bottom: var(--gap); }
.sect--paper { background: var(--paper); }
.sect--sage { background: var(--sage-wash); }
.sect--pink { background: var(--pink-wash); }
.sect--terra { background: var(--terra-wash); }
.sect--dark { background: var(--dark); color: var(--cream); }
.diagonal-top { clip-path: polygon(0 clamp(14px, 2.5vw, 26px), 100% 0, 100% 100%, 0 100%); margin-top: calc(-1 * clamp(14px, 2.5vw, 26px)); padding-top: calc(clamp(14px, 2.5vw, 26px) + 1rem); }

/* ═══ BRACKET QUOTES (technique #1) ═══ */
.epi { padding: var(--gap) var(--pad); display: flex; flex-direction: column; align-items: center; }
.bracket-quote { display: flex; align-items: stretch; gap: .75rem; }
.bracket { width: 10px; flex-shrink: 0; color: var(--sage); }
.bracket-line { stroke: currentColor; fill: none; stroke-dasharray: 150; stroke-dashoffset: 150; }
.bracket-quote blockquote { font: italic 400 clamp(.92rem, 2.6vw, 1.08rem)/2 var(--body); color: var(--ink-caption); text-align: center; opacity: 0; transform: translateY(12px); }

/* ═══ CHAPTERS ═══ */
.chapter { padding: 0; }
.ch-head { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: var(--gap) var(--pad) clamp(1.5rem, 4vh, 2.5rem); opacity: 0; }
.ch-head--light { color: var(--cream); }
.ch-orn { width: clamp(160px, 55vw, 240px); height: auto; color: var(--sage); }
.ch-orn--light { color: var(--sage-light); }
.orn-l { stroke: currentColor; fill: none; }
.orn-lf { stroke: currentColor; fill: rgba(122,139,110,.1); }
.orn-ring { stroke: currentColor; fill: none; }
.orn-num { font-family: var(--body); fill: currentColor; letter-spacing: .05em; }
.ch-title { font: italic 500 clamp(1.05rem, 3vw, 1.35rem)/1 var(--display); letter-spacing: .03em; }
.chapter-note { font: italic 400 clamp(.88rem, 2.5vw, 1rem)/2 var(--body); color: var(--ink-caption); text-align: center; max-width: 30ch; margin: 1rem auto var(--gap); padding: 0 var(--pad); opacity: 0; transform: translateY(10px); }
.dark-note { font: italic 300 clamp(.9rem, 2.5vw, 1.05rem)/2 var(--display); color: var(--cream-cap); text-align: center; max-width: 34ch; margin: 0 auto 2rem; padding: 0 var(--pad); opacity: 0; transform: translateY(10px); }

/* ═══ ALBUM PHOTOS ═══ */
.album-photo { position: relative; opacity: 0; transform: translateY(20px); }
.album-photo img { width: 100%; height: auto; aspect-ratio: 3/2; object-fit: cover; border-radius: 2px; box-shadow: 0 4px 20px rgba(0,0,0,.12), 0 1px 4px rgba(0,0,0,.08); filter: sepia(.35) saturate(.78) brightness(1.02); transition: filter 2s var(--ease); }
.album-photo img.in-view { filter: sepia(0) saturate(1) brightness(1); }
.album-photo .portrait-img { aspect-ratio: 2/3; }
.album--detail img { aspect-ratio: 1/1; }
.sect--dark .album-photo img { box-shadow: 0 6px 30px rgba(0,0,0,.5); }

/* ARCH — only on portrait-focus */
.arch img { border-radius: 999px 999px 6px 6px; }
.arch .mount { display: none; }

/* ARCH CROWN — properly centered over arch */
.arch-wrap { position: relative; }
.arch-crown { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); width: 80%; max-width: 240px; z-index: 3; color: var(--sage); }
.crown-line { stroke: currentColor; fill: none; stroke-dasharray: 250; stroke-dashoffset: 250; }
.crown-leaf { stroke: var(--sage); stroke-dasharray: 30; stroke-dashoffset: 30; }
.crown-bud { opacity: 0; }

/* CORNER MOUNTS */
.mount { position: absolute; width: 12px; height: 12px; border: solid var(--gold); border-width: 0; opacity: .25; z-index: 2; }
.mount.tl { top: -3px; left: -3px; border-top-width: 1px; border-left-width: 1px; }
.mount.tr { top: -3px; right: -3px; border-top-width: 1px; border-right-width: 1px; }
.mount.bl { bottom: -3px; left: -3px; border-bottom-width: 1px; border-left-width: 1px; }
.mount.br { bottom: -3px; right: -3px; border-bottom-width: 1px; border-right-width: 1px; }

/* BOTANICAL DIVIDERS — colored */
.botanical-break { display: flex; justify-content: center; padding: 1.5rem 0 0; }
.botan-div { width: clamp(80px, 35vw, 140px); height: auto; }
.bd-stem { stroke-dasharray: 150; stroke-dashoffset: 150; }
.bd-leaf { stroke-dasharray: 40; stroke-dashoffset: 40; }
.bd-bud { opacity: 0; }

/* CAKE SPRIG — colored botanical beside cake text */
.cake-text-area { display: flex; align-items: center; gap: .75rem; margin-top: 1.5rem; }
.cake-sprig { width: 28px; height: auto; flex-shrink: 0; opacity: 0; }
.sprig-stem { stroke-dasharray: 100; stroke-dashoffset: 100; }
.sprig-leaf { stroke-dasharray: 40; stroke-dashoffset: 40; }
.sprig-bud { opacity: 0; }

/* CINEMA ACCENT — colored floral SVG beside wallpaper portrait */
.cinema-with-accent { position: relative; padding: 0 var(--pad) 0 0; margin-bottom: var(--gap); }
.cinema-with-accent .cinema-img { margin-bottom: 0; }
.cinema-accent { position: absolute; right: calc(var(--pad) - 20px); bottom: -10px; width: 32px; height: auto; opacity: 0; }
.accent-stem { stroke-dasharray: 150; stroke-dashoffset: 150; }
.accent-leaf { stroke-dasharray: 40; stroke-dashoffset: 40; }
.accent-bud { opacity: 0; }

/* SIDE SPRIG — colored leaf sprig beside bridesmaids */
.solo-with-sprig { display: flex; align-items: flex-end; gap: 1rem; }
.solo-with-sprig .album-photo { flex: 1; width: auto; max-width: none; }
.side-sprig { width: 24px; flex-shrink: 0; height: auto; opacity: 0; }
.ssp-stem { stroke-dasharray: 120; stroke-dashoffset: 120; }
.ssp-leaf { stroke-dasharray: 40; stroke-dashoffset: 40; }
.ssp-bud { opacity: 0; }

/* CEREMONY BRANCH — colored branch between dark ceremony images */
.ceremony-branch { display: flex; justify-content: center; padding: .5rem 0; }
.ceremony-branch svg { width: clamp(100px, 40vw, 180px); height: auto; }
.cb-stem { stroke-dasharray: 200; stroke-dashoffset: 200; }
.cb-leaf { stroke-dasharray: 40; stroke-dashoffset: 40; }
.cb-bud { opacity: 0; }

/* BOKEH (technique #5 — used ONCE in ceremony) */
.bokeh-field { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.bokeh-orb { position: absolute; border-radius: 50%; background: radial-gradient(circle, rgba(184,158,111,.12) 0%, rgba(184,158,111,0) 70%); animation: bFloat linear infinite; }
.b1 { width: 100px; height: 100px; top: 10%; left: 12%; animation-duration: 18s; }
.b2 { width: 70px; height: 70px; top: 30%; right: 15%; animation-duration: 22s; animation-delay: -5s; }
.b3 { width: 50px; height: 50px; top: 55%; left: 30%; animation-duration: 16s; animation-delay: -8s; }
.b4 { width: 80px; height: 80px; top: 75%; right: 10%; animation-duration: 20s; animation-delay: -3s; }
@keyframes bFloat { 0% { transform: translate(0,0) scale(1); opacity: .25; } 25% { transform: translate(12px,-20px) scale(1.08); opacity: .4; } 50% { transform: translate(-8px,-40px) scale(.92); opacity: .25; } 75% { transform: translate(16px,-24px) scale(1.04); opacity: .35; } 100% { transform: translate(0,0) scale(1); opacity: .25; } }

/* ═══ SWIPE GALLERY ═══ */
.swipe-gallery { padding: 0 0 .5rem; margin-bottom: var(--gap); }
.swipe-track { display: flex; gap: .75rem; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; padding: 0 var(--pad) .5rem; scrollbar-width: none; }
.swipe-track::-webkit-scrollbar { display: none; }
.swipe-slide { flex: 0 0 85%; scroll-snap-align: center; }
.swipe-slide .album-photo { width: 100%; }
.swipe-dots { display: flex; justify-content: center; gap: 6px; padding: .6rem 0 0; }
.dot { width: 5px; height: 5px; border-radius: 50%; background: var(--ink-muted); transition: all .3s; cursor: pointer; }
.dot.active { background: var(--sage); transform: scale(1.3); }

/* ═══ LAYOUTS ═══ */
.spread { display: grid; gap: 1.5rem; padding: 0 var(--pad); margin-bottom: var(--gap); }
.spread .album-photo { width: 75%; max-width: 320px; }
.spread-text { opacity: 0; transform: translateY(10px); }
.spread-text p { font: italic 400 clamp(.88rem, 2.2vw, .98rem)/2 var(--body); color: var(--ink-caption); max-width: 26ch; }
.spread-note { font: italic 400 clamp(.88rem, 2.2vw, .98rem)/2 var(--body); color: var(--ink-caption); text-align: center; max-width: 26ch; margin-top: 1.5rem; opacity: 0; transform: translateY(10px); }
.spread--center { display: flex; flex-direction: column; align-items: center; padding: 0 var(--pad); margin-bottom: var(--gap); }
.spread--center .album-photo { width: 65%; max-width: 320px; }

.solo-wide { padding: 0 var(--pad); margin-bottom: var(--gap); }
.solo-wide .album-photo { width: 85%; max-width: 450px; }

.cake-moment { display: flex; flex-direction: column; align-items: center; padding: 0 var(--pad) var(--gap); }
.cake-moment .album-photo { width: 60%; max-width: 260px; }
.cake-note { font: italic 400 clamp(.88rem, 2.2vw, .98rem)/2 var(--body); color: var(--ink-caption); text-align: center; max-width: 26ch; opacity: 0; transform: translateY(10px); }

.ceremony-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; padding: 0 var(--pad); margin-bottom: var(--gap); }
.ceremony-pair .album-photo { width: 100%; }

.cinema-img { width: 100%; overflow: hidden; margin-bottom: var(--gap); }
.cinema-img img { width: 100%; aspect-ratio: 16/9; object-fit: cover; filter: sepia(.35) saturate(.78) brightness(1.02); transition: filter 2s var(--ease); }
.cinema-img img.in-view { filter: sepia(0) saturate(1) brightness(1); }
.cinema-img--paper { margin: 0 var(--pad) var(--gap); width: auto; }
.cinema-img--paper img { border-radius: 2px; box-shadow: 0 4px 20px rgba(0,0,0,.12); }

/* ═══ WIPE ═══ */
.wipe-wrap { position: relative; width: 100%; background: var(--dark); }
.wipe-inner { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 2rem var(--pad) 3rem; }
.wipe-frame { position: relative; width: 100%; max-width: 700px; aspect-ratio: 3/2; overflow: hidden; border-radius: 2px; box-shadow: 0 6px 35px rgba(0,0,0,.5); }
.wipe-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center center; box-shadow: none; filter: none; }
.wipe-bw { filter: grayscale(1) contrast(1.06) brightness(1.02) !important; }
.wipe-overlay { position: absolute; inset: 0; clip-path: polygon(0 0, 0 0, 0 100%, 0 100%); }

/* ═══ CLOSING ═══ */
.closing { background: var(--dark); color: var(--cream); display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 50vh; padding: var(--gap) var(--pad) clamp(3rem, 8vh, 5rem); text-align: center; }
.close-seal { width: clamp(50px, 13vw, 70px); height: auto; color: var(--sage); opacity: 0; }
.seal-ring { stroke: currentColor; fill: none; stroke-dasharray: 250; stroke-dashoffset: 250; }
.seal-leaf { stroke: currentColor; fill: rgba(122,139,110,.15); stroke-dasharray: 50; stroke-dashoffset: 50; }
.seal-star { fill: var(--sage-light); opacity: 0; }
.close-line { font: italic 300 clamp(1.4rem, 5vw, 2.3rem)/1.35 var(--display); margin: 1.5rem 0; opacity: 0; transform: translateY(12px); }
.close-rule { width: 0; height: 1px; background: var(--sage); margin: 0 auto 1.25rem; opacity: .4; }
.close-names { font: 300 clamp(1rem, 3.5vw, 1.3rem)/1 var(--display); letter-spacing: .06em; opacity: 0; }
.close-date { font-size: .55rem; letter-spacing: .3em; text-transform: uppercase; color: var(--cream-muted); margin-top: .6rem; opacity: 0; }

/* ═══ SCROLLBAR ═══ */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: var(--paper); }
::-webkit-scrollbar-thumb { background: rgba(122,139,110,.3); border-radius: 10px; }
::selection { background: var(--sage); color: var(--paper); }

/* ═══ DESKTOP ═══ */
@media (min-width: 768px) {
    .hero-text { text-align: left; padding-left: clamp(3rem, 7vw, 5.5rem); }
    .vine-thread { left: 12px; width: 24px; }
    .spread { grid-template-columns: 1.2fr 1fr; align-items: end; gap: 2.5rem; }
    .spread .album-photo { width: 100%; max-width: 420px; }
    .spread-text { padding-bottom: 1.5rem; }
    .spread--right { grid-template-columns: 1fr 1.2fr; }
    .spread--right .album-photo { order: 2; }
    .spread--right .spread-text { order: 1; text-align: right; }
    .spread--right .spread-text p { margin-left: auto; }
    .spread--center { flex-direction: row; justify-content: center; gap: 3rem; }
    .spread--center .album-photo { width: 38%; max-width: 340px; }
    .spread-note { margin-top: 0; text-align: left; align-self: center; }
    .solo-wide .album-photo { max-width: 500px; }
    .swipe-track { overflow: visible; flex-wrap: wrap; padding: 0 var(--pad); }
    .swipe-slide { flex: 0 0 calc(50% - .375rem); scroll-snap-align: none; }
    .swipe-dots { display: none; }
    .cinema-img img { aspect-ratio: 21/9; }
    .cinema-img--paper img { aspect-ratio: 16/9; }
    .ceremony-pair { gap: 2rem; }
    .cake-moment { flex-direction: row; justify-content: center; gap: 3rem; }
    .cake-moment .album-photo { width: 35%; max-width: 300px; }
    .cake-text-area { margin-top: 0; align-self: center; }
    .cake-note { text-align: left; }
    .wipe-frame { max-width: 800px; }
    .cinema-accent { right: calc(var(--pad) - 30px); width: 38px; }
    .solo-with-sprig .album-photo { max-width: 500px; }
    .side-sprig { width: 30px; }
}

@media (min-width: 1100px) {
    .sect > .chapter, .ch-head, .spread, .swipe-gallery, .cake-moment, .ceremony-pair, .solo-wide { max-width: 1050px; margin-left: auto; margin-right: auto; }
    .cinema-img { max-width: 1200px; margin-left: auto; margin-right: auto; }
    .cinema-img--paper { max-width: 900px; }
    .wipe-frame { max-width: 900px; }
    #ch-details .swipe-slide { flex: 0 0 calc(25% - .5625rem); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
