/* Rabin-Interiors & Woods: Project Portfolio. Themed through the --riw-* variables in core.css.
   Masonry: once the script runs (.is-ready) the grid has 8px rows and each card spans as many as its height needs;
   without the script the cards simply sit in a grid. The project window is a <dialog>. */

.riw-pf { display: flex; flex-direction: column; gap: 20px; }

/* Filters */
.riw-pf-bar { display: flex; flex-direction: column; gap: 10px; }
.riw-pf-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.riw-pf-k { width: 64px; flex: none; font-size: .66rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--riw-muted); }
.riw-pf-row button { padding: .45rem .85rem; border-radius: 999px; border: 1px solid var(--riw-line-strong); background: var(--riw-card); color: var(--riw-text); font-size: .8rem; font-weight: 600; line-height: 1.2; cursor: pointer; transition: all .25s; }
.riw-pf-row button:hover { border-color: var(--riw-accent); }
.riw-pf-row button.is-on { background: var(--riw-ink); border-color: var(--riw-ink); color: #f6f1e9; }
.riw--dark .riw-pf-row button.is-on { background: var(--riw-accent-soft); border-color: var(--riw-accent-soft); color: #1c1712; }
.riw-pf-row sup { margin-left: 3px; font-size: .62rem; opacity: .6; }

/* Grid of cards */
.riw-pf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 16px; align-items: start; }
.riw-pf.is-ready .riw-pf-grid { grid-auto-rows: 8px; row-gap: 0; }
.riw-pf.is-ready .riw-pf-card { margin-bottom: 16px; }
.riw-pf-card { position: relative; display: block; width: 100%; padding: 0; border: 1px solid var(--riw-line); border-radius: calc(var(--riw-radius) * .7); overflow: hidden; background: var(--riw-bg-2); color: #fff; text-align: left; cursor: pointer; }
.riw-pf-card[hidden] { display: none; }
.riw-pf-media { display: block; overflow: hidden; }
.riw-pf-img, .riw-pf-draw, .riw-pf-draw svg { display: block; width: 100%; height: auto; }
.riw-pf-img, .riw-pf-draw { transition: transform .6s var(--riw-ease); }
.riw-pf-card:hover .riw-pf-img, .riw-pf-card:hover .riw-pf-draw { transform: scale(1.05); }
.riw-pf-cap { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; padding: 2.4rem .9rem .8rem; background: linear-gradient(transparent, rgba(0,0,0,.72)); }
.riw-pf-cap small { display: block; font-size: .62rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.75); line-height: 1.4; }
.riw-pf-cap b { display: block; font-family: var(--riw-font-display); font-size: 1.2rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin-top: .15rem; }
.riw-pf-badge { flex: none; padding: .3rem .55rem; border-radius: 999px; background: rgba(255,255,255,.9); color: #1c1712; font-size: .64rem; font-weight: 600; white-space: nowrap; }
.riw-pf-card:focus-visible { outline: 2px solid var(--riw-accent); outline-offset: 3px; }
.riw .riw-pf-empty { padding: 2.5rem; border: 1px dashed var(--riw-line-strong); border-radius: var(--riw-radius); text-align: center; color: var(--riw-muted); }

/* Project window */
.riw-pf-dialog { width: min(1100px, calc(100% - 32px)); max-width: none; max-height: calc(100% - 32px); padding: 0; border: 0; background: transparent; color: var(--riw-text); overflow: visible; }
.riw-pf-dialog::backdrop { background: rgba(10,8,6,.78); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.riw-pf-dialog[open] .riw-pf-box { animation: riw-pf-in .35s var(--riw-ease); }
@keyframes riw-pf-in { from { opacity: 0; transform: scale(.96); } }
html:has(.riw-pf-dialog[open]) { overflow: hidden; }
.riw-pf-box { display: grid; grid-template-columns: 1.5fr .5fr; max-height: calc(100vh - 32px); overflow: auto; border-radius: var(--riw-radius); background: var(--riw-card); }
.riw-pf-cmp { --pos: 50%; position: relative; aspect-ratio: 5 / 3; min-height: 100%; overflow: hidden; background: #b9b6b1; cursor: ew-resize; touch-action: pan-y; -webkit-user-select: none; user-select: none; }
.riw-pf-before, .riw-pf-after { position: absolute; inset: 0; }
.riw-pf-after { clip-path: inset(0 0 0 var(--pos)); }
.riw-pf-before > *, .riw-pf-after > * { display: block; width: 100%; height: 100%; object-fit: cover; }
.riw-pf-t { position: absolute; top: 12px; z-index: 2; padding: .35rem .65rem; border-radius: 999px; background: rgba(21,18,15,.62); color: #f6f1e9; font-size: .62rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; pointer-events: none; }
.riw-pf-t--l { left: 12px; }
.riw-pf-t--r { right: 12px; }
.riw-pf-knob { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px; background: #fff; z-index: 3; outline: none; }
.riw-pf-knob::after { content: "‹ ›"; position: absolute; top: 50%; left: 50%; width: 42px; height: 42px; transform: translate(-50%, -50%); border-radius: 50%; background: #fff; color: #1c1712; font-size: .95rem; font-weight: 700; line-height: 42px; text-align: center; box-shadow: 0 6px 20px rgba(0,0,0,.35); }
.riw-pf-knob:focus-visible::after { box-shadow: 0 0 0 3px var(--riw-accent), 0 6px 20px rgba(0,0,0,.35); }
.riw-pf-cmp.is-single { cursor: default; }
.riw-pf-cmp.is-single :is(.riw-pf-before, .riw-pf-t, .riw-pf-knob) { display: none; }
.riw-pf-cmp.is-single .riw-pf-after { clip-path: none; }

.riw-pf-info { display: flex; flex-direction: column; gap: 1rem; padding: 1.6rem; }
.riw-pf-info h3 { font-size: clamp(1.6rem, 2.4vw, 2.2rem); }
.riw-pf-desc { color: var(--riw-muted); font-size: .9rem; line-height: 1.6; }
.riw .riw-pf-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.riw-pf-facts div { padding: .65rem .8rem; border: 1px solid var(--riw-line-strong); border-radius: 12px; }
.riw-pf-facts dt { font-size: .6rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--riw-muted); }
.riw-pf-facts dd { margin: .15rem 0 0; font-size: .9rem; font-weight: 600; }
.riw-pf-link { color: var(--riw-accent); font-size: .85rem; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.riw-pf-link[hidden] { display: none; }
.riw-pf-nav { display: flex; gap: 6px; margin-top: auto; }
.riw-pf-nav .riw-btn { flex: 1; justify-content: center; }
.riw-pf-prev, .riw-pf-next { flex: none; width: 46px; border-radius: 999px; border: 1px solid var(--riw-line-strong); background: none; color: var(--riw-text); font-size: 1rem; cursor: pointer; }
.riw-pf-prev:hover, .riw-pf-next:hover { border-color: var(--riw-accent); }
.riw-pf-x { position: absolute; top: -14px; right: -14px; z-index: 4; width: 40px; height: 40px; border-radius: 50%; border: 0; background: #fff; color: #1c1712; font-size: 1.3rem; line-height: 1; cursor: pointer; box-shadow: 0 6px 20px rgba(0,0,0,.3); }

@media (max-width: 860px) {
	.riw-pf-box { grid-template-columns: 1fr; }
	.riw-pf-cmp { min-height: 0; }
	.riw-pf-x { top: 10px; right: 10px; }
}
@media (max-width: 680px) {
	.riw-pf-k { width: 100%; }
	.riw-pf-info { padding: 1.2rem; }
}
@media (prefers-reduced-motion: reduce) {
	.riw-pf *, .riw-pf-dialog * { transition: none !important; animation: none !important; }
}
