/* Rabin-Interiors & Woods: Bookmatch Studio. Themed through the --riw-* variables in core.css.
   The script draws the flitch and the matched panel on the two canvases; the window and the options are HTML. */

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

/* Flitch */
.riw-bm-flitch { background: var(--riw-card); border: 1px solid var(--riw-line); border-radius: var(--riw-radius); padding: 1.1rem 1.3rem 1.3rem; }
.riw .riw-bm-k { font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; font-weight: 600; color: var(--riw-muted); margin-bottom: .7rem; }
.riw-bm-fwrap { position: relative; cursor: grab; touch-action: pan-y; -webkit-user-select: none; user-select: none; border-radius: 8px; overflow: hidden; }
.riw-bm-fwrap:active { cursor: grabbing; }
.riw-bm-fc { display: block; width: 100%; height: clamp(64px, 13vw, 150px); object-fit: fill; } /* fill, not cover: the window's % position must match the whole flitch */
.riw-bm-win { position: absolute; top: 0; bottom: 0; border: 2px solid var(--riw-accent); border-radius: 6px; box-shadow: 0 0 0 9999px rgba(20,16,12,.5); }
.riw-bm-win::before, .riw-bm-win::after { content: ""; position: absolute; top: 50%; width: 6px; height: 28px; margin-top: -14px; background: var(--riw-accent); border-radius: 3px; }
.riw-bm-win::before { left: -4px; }
.riw-bm-win::after { right: -4px; }
.riw-bm-win:focus-visible { outline: 2px solid #fff; outline-offset: -5px; }

/* Wall and options */
.riw-bm-body { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, .65fr); gap: 20px; align-items: stretch; }
.riw-bm-wall { position: relative; display: grid; place-items: center; min-height: 440px; padding: 24px; border-radius: var(--riw-radius); background: linear-gradient(#2a2622, #1a1714); overflow: hidden; }
.riw-bm-wall::before { content: ""; position: absolute; inset: 0; background: radial-gradient(60% 50% at 50% 0%, rgba(255,220,170,.2), transparent 70%); pointer-events: none; }
.riw-bm-pc { position: relative; display: block; max-width: 100%; height: auto; border-radius: 3px; box-shadow: 0 30px 60px rgba(0,0,0,.55); }

.riw-bm-side { background: var(--riw-card); border: 1px solid var(--riw-line); border-radius: var(--riw-radius); padding: 1.5rem; display: flex; flex-direction: column; gap: 1.2rem; }
.riw .riw-bm-g h4 { font-family: var(--riw-font); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; font-weight: 600; color: var(--riw-muted); line-height: 1.4; margin-bottom: .55rem; }
.riw-bm-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.riw-bm-opts button { display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .85rem; border-radius: 999px; border: 1px solid var(--riw-line-strong); background: none; color: var(--riw-text); font-size: .8rem; font-weight: 600; line-height: 1.2; cursor: pointer; transition: all .25s; }
.riw-bm-opts button:hover { border-color: var(--riw-accent); }
.riw-bm-opts button i { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.riw-bm-opts button.is-on { background: var(--riw-ink); border-color: var(--riw-ink); color: #f6f1e9; }
.riw--dark .riw-bm-opts button.is-on { background: var(--riw-accent-soft); border-color: var(--riw-accent-soft); color: #1c1712; }

.riw-bm-desc { padding: 1rem 1.1rem; border-radius: 16px; border: 1px solid var(--riw-line); background: var(--riw-bg); }
.riw-bm-desc b { display: block; font-family: var(--riw-font-display); font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; margin-bottom: .3rem; }
.riw .riw-bm-desc p { font-size: .85rem; line-height: 1.55; color: var(--riw-muted); }
.riw-bm-side .riw-btn { justify-content: center; margin-top: auto; }
.riw .riw-bm-note { font-size: .72rem; color: var(--riw-dim); text-align: center; line-height: 1.5; margin-top: -.5rem; }

@media (max-width: 1100px) {
	.riw-bm-body { grid-template-columns: 1fr; }
	.riw-bm-wall { min-height: 360px; }
}
@media (max-width: 680px) {
	.riw-bm-flitch { padding: .9rem; }
	.riw-bm-wall { min-height: 300px; padding: 16px; }
	.riw-bm-side { padding: 1.2rem; }
}
@media (prefers-reduced-motion: reduce) {
	.riw-bm * { transition: none !important; }
}
