/* ============================================================
   Master Build — Catalogs page (3D wall + page viewer), Florida Modern
   ============================================================ */
.cat-hero { text-align: left; }
.cat-title { font-size: var(--t-h1); }
.cat-sub { color: var(--mint); max-width: 60ch; }
.cat-hint { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; color: rgba(207,227,214,.75); font-size: .9rem; pointer-events: none; z-index: 3; }

.catalog-wall { position: relative; height: 620px; padding: 0; margin: 0; overflow: hidden; background-color: #0f2b24;
   background: radial-gradient(1100px 600px at 50% 18%, rgba(240,128,32,.14) 0%, rgba(22,58,49,.6) 42%, #0f2b24 78%, #0a1f1a 100%); }
.cat-scene { position: absolute; inset: 0; cursor: grab; }
.cat-scene:active { cursor: grabbing; }

/* Filter chips */
.cat-chips { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; z-index: 4; }
.chip {
  min-height: 44px; background: rgba(15,43,36,.7); color: #e8f1ec; border: 1px solid rgba(207,227,214,.3);
  padding: 0 16px; border-radius: 999px; font: inherit; font-size: .92rem; font-weight: 600; cursor: pointer;
  transition: background .16s, color .16s, border-color .16s;
}
.chip:hover { border-color: var(--mint); }
.chip--on, .chip--on:hover { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

.cat-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--mint); font-size: 15px; letter-spacing: .04em; z-index: 2; }

.catalog-wall[data-ready] .cat-loading { opacity: 0; pointer-events: none; transition: opacity .5s; }

.cat-3d-label { transition: opacity .2s; will-change: left, top; }

.cat-floor { position: absolute; left: 0; right: 0; bottom: 18px; text-align: center; color: rgba(255,255,255,.28); font-size: 12px; pointer-events: none; letter-spacing: .12em; text-transform: uppercase; }

/* ---------- Plain catalog list ---------- */
.cat-index { padding: 44px 0 8px; }
.cat-index h2 { font-size: 1.9rem; margin-bottom: 16px; }
.cat-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.cat-list button { width: 100%; display: flex; align-items: center; gap: 14px; padding: 10px 14px 10px 10px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; text-align: left; font: inherit; color: var(--ink); min-height: 64px; transition: border-color .16s, box-shadow .16s; }
.cat-list button:hover { border-color: var(--ink); box-shadow: var(--shadow-sm); }
.cat-list img { width: 40px; height: 56px; object-fit: cover; border-radius: 2px 4px 4px 2px; flex: 0 0 auto; }
.cat-list strong { display: block; font-weight: 700; }
.cat-list em { font-style: normal; color: var(--muted); font-size: .88rem; }

/* ---------- Below-wall face-out ---------- */
.cat-below { padding: 56px 0 80px; }
.cat-below-title { font-size: var(--t-h2); margin: 0 0 28px; }
.cat-below-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 32px; }
.cat-below-card { border-top: 2px solid var(--ink); padding-top: 20px; }
.cat-card-ico { color: var(--accent-ink); margin-bottom: 12px; }
.cat-card-ico .i { width: 30px; height: 30px; }
.cat-below-card h3 { font-size: var(--t-h3); margin: 0 0 8px; }
.cat-below-card p { color: var(--muted); margin: 0 0 18px; }

/* ---------- Viewer overlay ---------- */
.cat-viewer { position: fixed; inset: 0; z-index: 100; background: rgba(8,20,17,.94); display: grid; place-items: center; padding: 24px; animation: fadeIn .25s ease; }
.cat-viewer[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

.viewer-shell { width: min(980px, 100%); height: min(90vh, 760px); display: flex; flex-direction: column; background: var(--palm-deep); border-radius: var(--radius-lg); box-shadow: 0 30px 90px rgba(0,0,0,.5); overflow: hidden; }
.viewer-top { display: flex; justify-content: flex-end; padding: 8px 10px 0; }
.viewer-close { width: 48px; height: 48px; background: rgba(255,255,255,.08); border: 0; border-radius: 50%; color: #fff; font-size: 30px; line-height: 1; cursor: pointer; }
.viewer-close:hover { color: #fff; }

.viewer-stage { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 0; padding: 8px; }
.viewer-img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: 6px; background: #1b1e23; box-shadow: 0 10px 40px rgba(0,0,0,.45); }
.flip {
  flex: 0 0 auto; width: 48px; height: 64px; border: 1px solid rgba(207,227,214,.3); background: rgba(255,255,255,.04);
  color: #e6e9ed; font-size: 26px; border-radius: 8px; cursor: pointer; display: grid; place-items: center;
  transition: background .2s, border-color .2s;
}
.flip:hover { background: rgba(240,128,32,.2); border-color: var(--accent); }
.flip[disabled] { opacity: .3; cursor: default; pointer-events: none; }

.viewer-toolbar { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-top: 1px solid rgba(207,227,214,.18); color: var(--mint); }
.viewer-name { font-weight: 700; color: #fff; }
.pager { color: var(--mint); font-variant-numeric: tabular-nums; }
.viewer-progress { flex: 1; height: 4px; background: rgba(207,227,214,.2); border-radius: 4px; overflow: hidden; }
.viewer-progress span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 4px; transition: width .2s; }

@media (max-width: 640px) {
  .catalog-wall { height: 460px; }
  .flip { width: 46px; height: 52px; font-size: 28px; background: rgba(255,255,255,.07); }
  .viewer-stage { padding: 4px; gap: 4px; }
  .viewer-img { max-height: 62vh; }
  .viewer-toolbar { flex-wrap: wrap; gap: 10px; }
  .viewer-name { width: 100%; }
  .cat-below-grid { grid-template-columns: 1fr; gap: 28px; }
  .cat-chips { top: 10px; width: calc(100% - 20px); }
  .cat-below { padding: 44px 0 52px; }
}
/* Swipe hint on touch devices (shown inside the viewer on phones) */
.swipe-hint { display: none; text-align: center; color: rgba(255,255,255,.55); font-size: 13px; padding: 4px 0 8px; letter-spacing: .02em; }
@media (max-width: 640px) and (hover: none) { .swipe-hint { display: block; } }
@media (max-width: 640px) {
  .cat-chips { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; left: 0; right: 0; width: auto; transform: none; padding: 0 12px; scrollbar-width: none; }
  .cat-chips::-webkit-scrollbar { display: none; }
  .chip { flex: 0 0 auto; }
}
/* viewer never lets the page image cover the close button (small phones) */
.viewer-top { position: relative; z-index: 2; flex: 0 0 auto; }
.viewer-stage { position: relative; overflow: hidden; }
.viewer-img { max-height: 100%; }
.viewer-toolbar, .swipe-hint { flex: 0 0 auto; }
@media (max-width: 640px) {
  .cat-viewer { padding: 0; }
  .viewer-shell { width: 100%; height: 100vh; height: 100dvh; border-radius: 0; }
  .viewer-img { max-height: 100%; }
}
.cat-list li { display: flex; }
.cat-list button { height: 100%; }
.cat-hint { color: #fff; text-shadow: 0 1px 8px rgba(0,0,0,.8); font-weight: 600; }
.cat-below-card p { text-wrap: pretty; }

/* =====================================================================
   CATALOG v2: compact header, taller wall, FLIPBOOK viewer, saved picks
   ===================================================================== */
.cat-hero.page-hero { padding-block: 34px 26px; }
.cat-title { font-size: clamp(1.9rem, 3.6vw, 2.9rem); }
.catalog-wall { height: clamp(520px, 74vh, 760px); }

.viewer-shell { width: min(1180px, 100%); height: min(94vh, 880px); }
.viewer-top { display: flex; align-items: center; gap: 12px; justify-content: flex-start; padding: 8px 12px; }
.viewer-top .viewer-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.05rem; }
.viewer-top .pager { white-space: nowrap; }
.picks-chip { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.08); color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.picks-chip:hover { background: rgba(255,255,255,.18); }
.picks-chip b { background: var(--accent); color: #1a1005; border-radius: 999px; min-width: 22px; padding: 0 6px; text-align: center; font-variant-numeric: tabular-nums; }
.viewer-stage { padding: 4px 10px; gap: 8px; }

.book { position: relative; flex: 1; min-width: 0; height: 100%; perspective: 2800px; touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: grab; }
.book.dragging { cursor: grabbing; }
.book-in { position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform-style: preserve-3d; transition: transform .9s cubic-bezier(.45,0,.2,1); }
.leaf { position: absolute; left: 0; top: 0; width: var(--pw); height: var(--ph); transform-origin: 0 50%; transform-style: preserve-3d; transition: transform .9s cubic-bezier(.45,0,.2,1), opacity .4s ease; }
.leaf.gone { opacity: 0; pointer-events: none; transition: transform .9s cubic-bezier(.45,0,.2,1), opacity .45s ease .3s; }
.face { position: absolute; inset: 0; background: #f4f1ea; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: 0 18px 40px -18px rgba(0,0,0,.6); }
.face--front { border-radius: 0 6px 6px 0; }
.face--back { transform: rotateY(180deg); border-radius: 6px 0 0 6px; }
.face--blank { background: #e6e1d6; }
.face::after { content: ''; position: absolute; inset: 0; pointer-events: none; }
.face--front::after { background: linear-gradient(90deg, rgba(0,0,0,.42), rgba(0,0,0,.12) 4%, rgba(0,0,0,0) 12%); }
.face--back::after { background: linear-gradient(270deg, rgba(0,0,0,.42), rgba(0,0,0,.12) 4%, rgba(0,0,0,0) 12%); }
.face img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; -webkit-user-drag: none; }
.is-single .face--front { border-radius: 6px; }
.heart { position: absolute; z-index: 3; top: 14px; right: 14px; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgba(15,43,36,.78); color: #fff; cursor: pointer; transition: transform .2s cubic-bezier(.34,1.56,.64,1), background-color .2s ease; }
.face--back .heart { right: auto; left: 14px; }
.heart svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.heart:hover { transform: scale(1.1); }
.heart:active { transform: scale(.92); }
.heart.on { background: var(--accent); color: #1a1005; }
.heart.on svg { fill: currentColor; }
.heart:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.viewer-strip { flex: 0 0 auto; display: flex; gap: 6px; overflow-x: auto; padding: 8px 14px; scrollbar-width: thin; justify-content: safe center; border-top: 1px solid rgba(207,227,214,.14); }
.viewer-strip button { flex: none; position: relative; width: 48px; height: 66px; padding: 0; border: 2px solid transparent; border-radius: 5px; background: #1b1e23; cursor: pointer; opacity: .6; transition: opacity .2s ease, border-color .2s ease, transform .2s ease; overflow: hidden; }
.viewer-strip button:hover { opacity: 1; transform: translateY(-2px); }
.viewer-strip button.on { opacity: 1; border-color: var(--accent); }
.viewer-strip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.viewer-strip i { display: none; position: absolute; top: 3px; right: 3px; width: 11px; height: 11px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; }
.viewer-strip button.picked i { display: block; }
.viewer-tip { color: rgba(207,227,214,.8); font-size: .88rem; }
.viewer-toolbar { padding: 10px 16px; }
.viewer-toolbar .viewer-progress { flex: 0 1 140px; }
.viewer-toolbar .viewer-tip { flex: 1; }
.flip { width: 44px; height: 72px; }

/* saved picks */
.cat-picks { padding: 40px 0 8px; background: var(--stone); }
.picks-head h2 { font-size: 1.9rem; margin-bottom: 4px; }
.picks-head p { color: var(--muted); margin-bottom: 18px; }
.picks-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-bottom: 20px; }
.picks-list li { position: relative; display: flex; }
.pick-open { flex: 1; display: flex; align-items: center; gap: 14px; padding: 10px 52px 10px 10px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; text-align: left; font: inherit; color: var(--ink); min-height: 76px; transition: box-shadow .2s ease, transform .2s ease; }
.pick-open:hover { box-shadow: var(--shadow-lift); transform: translateY(-2px); }
.pick-open img { width: 48px; height: 66px; object-fit: cover; border-radius: 3px; flex: none; }
.pick-open strong { display: block; } .pick-open em { font-style: normal; color: var(--muted); font-size: .9rem; }
.pick-x { position: absolute; right: 6px; top: 50%; translate: 0 -50%; width: 44px; height: 44px; border: 0; background: none; font-size: 1.6rem; color: var(--muted); cursor: pointer; border-radius: 50%; }
.pick-x:hover { background: var(--stone); color: var(--ink); }
.picks-actions { display: flex; flex-wrap: wrap; gap: 12px; padding-bottom: 40px; }

@media (max-width: 640px) {
  .catalog-wall { height: clamp(440px, 68vh, 560px); }
  .viewer-shell { height: 100dvh; }
  .viewer-top { gap: 8px; padding: 6px 8px; }
  .viewer-top .pager { font-size: .85rem; }
  .flip { width: 34px; height: 60px; font-size: 24px; }
  .viewer-stage { padding: 2px 4px; gap: 2px; }
  .viewer-tip { display: none; }
  .viewer-toolbar .viewer-progress { flex: 1; }
  .viewer-strip button { width: 40px; height: 56px; }
}
@media (prefers-reduced-motion: reduce) { .book-in, .leaf, .leaf.gone { transition: none !important; } }
@media (min-width: 901px) {
  .cat-hero.page-hero { padding-block: 18px 12px; }
  .cat-hero .breadcrumb { margin-bottom: 4px; }
  .cat-title { font-size: clamp(1.7rem, 2.6vw, 2.2rem); margin-bottom: 4px; }
  .cat-sub { max-width: none; font-size: .98rem; margin: 0; }
  .catalog-wall { height: clamp(520px, calc(100vh - 250px), 760px); }
}


.cb-photo { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: var(--radius); margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.cat-below-card { border-top: 0; padding-top: 0; }
.cat-below-card h3 { margin-top: 2px; }


/* ---------- Shop the room ---------- */
.cat-shop { padding: 56px 0 30px; background: var(--stone); }
.shop-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 32px; margin-bottom: 20px; }
.shop-head h2 { font-size: clamp(1.8rem, 3.2vw, 2.5rem); margin-bottom: 6px; }
.shop-head p { color: var(--muted); max-width: 54ch; }
.shop-tabs { display: flex; gap: 6px; padding: 5px; background: var(--paper); border-radius: 999px; box-shadow: var(--shadow-sm); }
.shop-tab { min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px; background: transparent; color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; transition: background-color .25s ease, color .25s ease; }
.shop-tab:hover { background: var(--stone); }
.shop-tab.on { background: var(--palm); color: #fff; }
.shop-stage { position: relative; aspect-ratio: 1376 / 768; border-radius: var(--radius-lg); overflow: hidden; background: #0a1f1a; box-shadow: var(--shadow-float); border: 6px solid var(--paper); isolation: isolate; }
.shop-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity .25s ease, transform 1.2s cubic-bezier(.16,1,.3,1); }
.shop-stage.swap .shop-img { opacity: 0; transform: scale(1.04); }
.shop-stage.swap .shop-pins { opacity: 0; }
.shop-pins { position: absolute; inset: 0; transition: opacity .2s ease; }
.shop-pin { position: absolute; translate: -50% -50%; display: flex; align-items: center; gap: 8px; padding: 0; border: 0; background: none; cursor: pointer; color: #fff; font: inherit; }
.shop-pin > span { position: relative; width: 44px; height: 44px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(255,255,255,.9), 0 8px 20px rgba(0,0,0,.45); animation: shopPulse 2.4s ease-out infinite; display: grid; place-items: center; }
.shop-pin > span::before { content: ''; width: 16px; height: 2.5px; background: #1a1005; border-radius: 2px; box-shadow: 0 0 0 0 #1a1005; }
.shop-pin > span::after { content: ''; position: absolute; width: 2.5px; height: 16px; background: #1a1005; border-radius: 2px; transition: transform .3s cubic-bezier(.16,1,.3,1); }
.shop-pin.on > span::after { transform: scaleY(0); }
.shop-pin i { font-style: normal; font-weight: 700; font-size: .9rem; padding: 6px 12px; border-radius: 999px; background: rgba(10,31,26,.85); white-space: nowrap; transition: background-color .2s ease, color .2s ease; }
.shop-pin:hover i, .shop-pin.on i { background: #fff; color: var(--palm); }
.shop-pin:focus-visible { outline: 3px solid var(--gold); outline-offset: 6px; border-radius: 999px; }
@keyframes shopPulse { 0% { box-shadow: 0 0 0 4px rgba(255,255,255,.9), 0 0 0 4px rgba(240,128,32,.6); } 70%, 100% { box-shadow: 0 0 0 4px rgba(255,255,255,.9), 0 0 0 20px rgba(240,128,32,0); } }
.shop-pop { position: absolute; z-index: 5; left: var(--px); top: var(--py); width: min(320px, 82%); padding: 16px; border-radius: var(--radius); background: var(--paper); color: var(--ink); box-shadow: var(--shadow-float); translate: 34px -20px; animation: popIn .35s cubic-bezier(.16,1,.3,1); }
.shop-pop[hidden] { display: none; }
.shop-pop.flip-x { translate: calc(-100% - 34px) -20px; }
.shop-pop.flip-y { translate: 34px calc(-100% + 20px); }
.shop-pop.flip-x.flip-y { translate: calc(-100% - 34px) calc(-100% + 20px); }
@keyframes popIn { from { opacity: 0; scale: .94; } }
.shop-pop strong { display: block; font-size: 1.15rem; margin-bottom: 4px; padding-right: 36px; }
.shop-pop p { color: var(--muted); font-size: .95rem; margin-bottom: 12px; }
.pop-x { position: absolute; right: 4px; top: 4px; width: 44px; height: 44px; border: 0; background: none; font-size: 1.6rem; cursor: pointer; color: var(--muted); border-radius: 50%; }
.pop-x:hover { background: var(--stone); color: var(--ink); }
.pop-cat { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px; margin-top: 6px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); text-align: left; font: inherit; color: var(--ink); cursor: pointer; transition: border-color .2s ease, background-color .2s ease, transform .2s ease; }
.pop-cat:hover { border-color: var(--accent); background: var(--stone); transform: translateX(3px); }
.pop-cat img { width: 40px; height: 56px; object-fit: cover; border-radius: 2px 4px 4px 2px; flex: none; box-shadow: 3px 4px 8px -2px rgba(0,0,0,.4); }
.pop-cat b { display: block; font-size: .95rem; } .pop-cat em { font-style: normal; color: var(--accent-ink); font-size: .85rem; font-weight: 600; }
.shop-note { position: absolute; left: 12px; bottom: 10px; padding: 3px 9px; border-radius: 999px; background: rgba(10,31,26,.7); color: rgba(255,255,255,.85); font-size: .72rem; font-weight: 600; pointer-events: none; }
.shelf-title { font-size: 1.15rem; margin: 34px 0 12px; }
.shop-shelf { list-style: none; display: grid; grid-template-columns: repeat(7, 1fr); gap: 14px; padding: 0; margin: 0 0 8px; }
.shop-shelf li { transition: opacity .35s ease, filter .35s ease; }
.shop-shelf li.is-dim { opacity: .3; filter: grayscale(.8); }
.shop-shelf button { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 0; border: 0; background: none; text-align: left; font: inherit; color: var(--ink); cursor: pointer; }
.shop-shelf img { width: 100%; height: auto; aspect-ratio: 5 / 7; object-fit: cover; border-radius: 3px 8px 8px 3px; box-shadow: 6px 10px 18px -8px rgba(0,0,0,.5), -2px 0 0 rgba(255,255,255,.35) inset; transition: transform .4s cubic-bezier(.34,1.56,.64,1), box-shadow .3s ease; }
.shop-shelf button:hover img { transform: translateY(-8px) rotate(-2deg); box-shadow: 10px 18px 26px -10px rgba(0,0,0,.55), -2px 0 0 rgba(255,255,255,.35) inset; }
.shop-shelf button:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; border-radius: 6px; }
.shop-shelf strong { font-size: .88rem; line-height: 1.2; } .shop-shelf em { font-style: normal; color: var(--muted); font-size: .8rem; }
@media (max-width: 900px) {
  .shop-shelf { grid-template-columns: repeat(4, 1fr); gap: 12px; }
  .shop-stage { border-width: 4px; }
}
@media (max-width: 640px) {
  .shop-tabs { width: 100%; } .shop-tab { flex: 1; padding: 0 8px; }
  .shop-stage { aspect-ratio: 4 / 3; }
  .shop-pin i { display: none; }
  .shop-pin > span { width: 40px; height: 40px; }
  .shop-pop, .shop-pop.flip-x, .shop-pop.flip-y, .shop-pop.flip-x.flip-y { left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; translate: none; }
  .shop-shelf { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .shop-pin > span { animation: none; } .shop-pop { animation: none; } .shop-img { transition: none; } }
