/* =====================================================================
   Chiaia Real Weddings — infinite photo board (style of markclennon.com)
   with the tile hover of avagyanphoto.com. Scoped under #crw.
   ===================================================================== */

html:has(body.crw-page), body.crw-page { height: 100%; overflow: hidden; background: #000; overscroll-behavior: none; }
body.crw-page { margin: 0; }
body.crw-page .wpautoterms-footer { display: none; }

#crw {
	--ink: #000; --paper: #fff;
	--serif: "CRW Instrument Serif", "Times New Roman", serif;
	--sans: "CRW Inter", Arial, sans-serif;
	--gut: 4px;                       /* half of the 8px black seam between tiles */
	--ease: cubic-bezier(.2,.8,.2,1);
	--ab: 0px;                        /* height of the WordPress admin bar, when logged in */
	position: fixed; inset: 0; z-index: 1; background: var(--ink); color: var(--paper);
	font-family: var(--sans); font-size: 16px; line-height: normal; -webkit-font-smoothing: antialiased; text-align: left;
}
#crw *, #crw *::before, #crw *::after { box-sizing: border-box; margin: 0; padding: 0; }
#crw a, #crw a:hover, #crw a:focus { color: inherit; text-decoration: none; }
#crw button { font: inherit; color: inherit; background: none; border: 0; border-radius: 0; padding: 0; cursor: pointer; text-transform: inherit; letter-spacing: inherit; line-height: inherit; box-shadow: none; }
#crw button:hover, #crw button:focus { background: none; color: inherit; }
#crw h1, #crw h2, #crw p { color: inherit; font-family: inherit; margin: 0; }
#crw img { max-width: none; height: auto; border: 0; box-shadow: none; border-radius: 0; }
#crw ul { list-style: none; margin: 0; }
#crw :focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
#crw .crw-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ---------- the board ---------- */
#crw .stage { position: fixed; inset: 0; overflow: hidden; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
#crw .stage.dragging { cursor: grabbing; }
#crw .board { position: absolute; inset: 0; transition: opacity .55s ease; }
#crw .board.out { opacity: 0; }
#crw .tile { position: absolute; left: 0; top: 0; will-change: transform; padding: var(--gut); }
#crw .tile .in { position: relative; width: 100%; height: 100%; overflow: hidden; background: #111; transform-origin: 50% 50%; transition: transform .8s var(--ease); }
#crw .tile img, #crw .tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scale(1.05); pointer-events: none; -webkit-user-drag: none; opacity: 0; transition: opacity .5s ease; }
#crw .tile img.ok, #crw .tile video { opacity: 1; }   /* a clip shows its poster at once */
/* gallery = masonry: each tile has the photo's own proportions, nothing is cropped */
#crw .board.masonry .tile img, #crw .board.masonry .tile video { transform: none; }
#crw .board.masonry .tile .in { transition: transform .7s var(--ease); }
@media (hover: hover) and (pointer: fine) {
	#crw .board.masonry:not(.moving) .tile:hover .in { transform: scale(1.015, 1.02); }
}
/* trailer / reel tile: a play mark, click = full screen with sound */
#crw .tile .play { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border: 1px solid rgba(255,255,255,.85); border-radius: 50%; background: rgba(0,0,0,.25); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); pointer-events: none; transition: transform .5s var(--ease); }
#crw .tile .play::after { content: ""; position: absolute; left: 23px; top: 18px; border-left: 15px solid #fff; border-top: 10px solid transparent; border-bottom: 10px solid transparent; }
#crw .tile:hover .play { transform: scale(1.08); }
#crw .vlb { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.94); display: grid; place-items: center; padding: 70px 4vw 40px; opacity: 0; transition: opacity .35s ease; }
#crw .vlb.open { opacity: 1; }
#crw .vlb[hidden] { display: none; }
#crw .vlb video { width: 100%; height: 100%; max-height: calc(100vh - 110px); object-fit: contain; background: #000; }
#crw .vlb-x { position: absolute; top: calc(22px + var(--ab)); right: 30px; font: 500 11px/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; padding: 10px 14px; border: 1px solid rgba(255,255,255,.6); border-radius: 999px; }
#crw .vlb-x:hover { background: #fff; color: #000; }

#crw .board.small .txt, #crw .board.small .shade { display: none; }

/* photo lightbox (gallery): black like the board; click outside the photo = back */
#crw .plb { position: fixed; inset: 0; z-index: 60; background: #000; opacity: 0; transition: opacity .3s ease; touch-action: none; user-select: none; -webkit-user-select: none; overflow: hidden; }
#crw .plb.open { opacity: 1; }
#crw .plb[hidden] { display: none; }
#crw .plb-frame { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 64px 72px 52px; }
#crw .plb-frame.from-r { animation: crw-in-r .35s var(--ease); }
#crw .plb-frame.from-l { animation: crw-in-l .35s var(--ease); }
@keyframes crw-in-r { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes crw-in-l { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: none; } }
#crw .plb img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; opacity: 0; transition: opacity .3s ease; transform-origin: 50% 50%; cursor: zoom-in; -webkit-user-drag: none; will-change: transform; }
#crw .plb img.ok { opacity: 1; }
#crw .plb img.anim { transition: opacity .3s ease, transform .35s var(--ease); }
#crw .plb.zoomed img { cursor: grab; }
#crw .plb.zoomed .plb-nav, #crw .plb.zoomed .plb-n { opacity: 0; pointer-events: none; }
#crw .plb-nav { position: absolute; top: 50%; width: 56px; height: 56px; margin-top: -28px; transition: opacity .3s; opacity: .75; }
#crw .plb-nav:hover { opacity: 1; }
#crw .plb-nav::before { content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; border: solid #fff; border-width: 0 0 1.5px 1.5px; }
#crw .plb-prev { left: 10px; } #crw .plb-prev::before { transform: translate(-30%, -50%) rotate(45deg); }
#crw .plb-next { right: 10px; } #crw .plb-next::before { transform: translate(-70%, -50%) rotate(-135deg); }
#crw .plb-n { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); font: 500 10.5px/1 var(--sans); letter-spacing: .2em; opacity: .7; transition: opacity .3s; pointer-events: none; }
#crw .plb .vlb-x { z-index: 2; }
@media (hover: none), (pointer: coarse) {
	#crw .plb-nav { display: none; }
	#crw .plb-frame { padding: 56px 0 44px; }
}

/* hover (Avagyan): the tile swells more in height than in width, a shade rises
   on the lower half, the names slide up, the place fades in */
#crw .shade { position: absolute; left: 0; right: 0; bottom: 0; height: 50%; pointer-events: none; background: linear-gradient(0deg, rgba(0,0,0,.7) 0%, rgba(0,0,0,0) 100%); opacity: 0; transition: opacity .6s ease; }
#crw .txt { position: absolute; left: 0; right: 0; bottom: 0; padding: clamp(10px, calc(var(--tw, 390px) * .066), 26px); pointer-events: none; }
#crw .mask { overflow: hidden; }
#crw .nm { font-family: var(--serif); font-weight: 400; font-size: clamp(17px, calc(var(--tw, 390px) * .085), 34px); line-height: 1.05; letter-spacing: -.005em; transform: translateY(105%); transition: transform .8s var(--ease); }
#crw .loc { margin-top: 6px; font-weight: 400; font-size: clamp(11px, calc(var(--tw, 390px) * .04), 16px); opacity: 0; transition: opacity .6s ease .08s; }
@media (hover: hover) and (pointer: fine) {
	#crw .board:not(.moving) .tile:hover { z-index: 3; }
	#crw .board:not(.moving) .tile:hover .in { transform: scale(1.022, 1.033); }
	#crw .board:not(.moving) .tile:hover .shade { opacity: 1; }
	#crw .board:not(.moving) .tile:hover .nm { transform: none; }
	#crw .board:not(.moving) .tile:hover .loc { opacity: .9; }
}
@media (hover: none), (pointer: coarse) {
	#crw .shade { opacity: 1; height: 45%; }
	#crw .nm { transform: none; }
	#crw .loc { opacity: .9; }
}

/* ---------- header ---------- */
/* logged in: the WordPress admin bar sits on top of everything, keep menu and close buttons below it */
body.admin-bar #crw { --ab: 32px; }
@media (max-width: 782px) { body.admin-bar #crw { --ab: 46px; } }
#crw .hd { position: fixed; left: 0; right: 0; top: var(--ab); z-index: 20; display: flex; justify-content: space-between; align-items: flex-start; padding: 22px 30px; pointer-events: none; background: linear-gradient(180deg, rgba(0,0,0,.35), rgba(0,0,0,0)); }
#crw .hd * { pointer-events: auto; }
/* the studio's real wordmark (CHIAIA WEDDING STUDIO): black PNG turned white */
#crw .logo { display: block; line-height: 0; margin-top: 4px; }
#crw .logo img { display: block; height: clamp(18px, 2.1vw, 34px); width: auto; filter: invert(1); }
#crw .nav { display: flex; gap: 34px; font-family: var(--serif); font-size: clamp(16px, 1.25vw, 20px); text-transform: uppercase; letter-spacing: .02em; }
/* bigger tap areas (padding with negative margin: same look, easier to hit on a phone) */
#crw .logo { padding: 10px; margin: -6px -10px -10px; }
#crw .nav a { transition: opacity .3s; padding: 10px 8px; margin: -10px -8px; touch-action: manipulation; }
#crw .nav a:hover { opacity: .6; }
#crw .nav .lang { opacity: .7; }

/* ---------- captions ---------- */
#crw .hint { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 20; font: 500 10px/1 var(--sans); letter-spacing: .24em; text-transform: uppercase; padding: 10px 14px; border: 1px solid rgba(255,255,255,.55); border-radius: 999px; background: rgba(0,0,0,.25); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: opacity .8s; pointer-events: none; }
#crw .hint.gone { opacity: 0; }
#crw .cap { position: fixed; left: 0; bottom: 0; z-index: 20; padding: 0 30px 26px; max-width: min(760px, 92vw); pointer-events: none; }
#crw .cap::before { content: ""; position: fixed; left: 0; bottom: 0; width: min(900px, 100vw); height: 280px; z-index: -1; background: radial-gradient(120% 100% at 0% 100%, rgba(0,0,0,.65), rgba(0,0,0,0) 70%); }
#crw .cap .back { pointer-events: auto; display: inline-block; margin-bottom: 14px; font: 500 10.5px/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; opacity: .85; }
#crw .cap .back:hover { opacity: 1; }
#crw .cap-title { font-family: var(--serif); font-weight: 400; font-size: clamp(44px, 6.4vw, 104px); line-height: .92; letter-spacing: -.01em; }
#crw .cap-meta { margin-top: 12px; font-weight: 400; font-size: clamp(12px, 1.05vw, 15px); letter-spacing: .02em; opacity: .85; }
#crw .count { position: fixed; right: 30px; bottom: 26px; z-index: 20; font: 500 10.5px/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; opacity: .85; }

@media (max-width: 760px) {
	#crw .hd { padding: 16px; }
	#crw .nav { gap: 16px; font-size: 14px; }
	#crw .nav .hide-m { display: none; }
	#crw .cap { padding: 0 16px 18px; }
	#crw .count { right: 16px; bottom: 18px; }
	#crw .hint { bottom: 52px; }
}
@media (prefers-reduced-motion: reduce) {
	#crw .tile .in, #crw .nm, #crw .loc, #crw .shade { transition: none; }
}
