/* Product Catalogue page: flipbook stage, summary (behaviour in assets/js/catalogue.js) */

/* ---------- stage ---------- */
.fb-stage { position: relative; overflow: hidden; display: flex; flex-direction: column; min-height: 100vh; min-height: 100svh;
  padding: calc(var(--header-h) + 12px) 0 18px; color: var(--white); background-color: var(--dark);
  background-image: radial-gradient(70% 75% at 50% 58%, #4E3480 0%, #3F2A63 38%, #25232A 100%); }
.fb-stage::before { content: ""; position: absolute; inset: -25%; pointer-events: none;
  background: radial-gradient(26% 30% at 28% 42%, rgba(201, 165, 106, .2), transparent 70%), radial-gradient(30% 34% at 74% 62%, rgba(140, 116, 176, .3), transparent 70%);
  animation: fb-glow 18s ease-in-out infinite alternate; }
.fb-stage::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .45;
  background-image: radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px); background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(70% 70% at 50% 50%, transparent 40%, #000 100%); mask-image: radial-gradient(70% 70% at 50% 50%, transparent 40%, #000 100%); }
@keyframes fb-glow { from { transform: translate(-4%, -3%) rotate(0deg); } to { transform: translate(4%, 3%) rotate(10deg); } }
.fb-stage > * { position: relative; z-index: 1; }

.fb-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px 32px; }
.fb-titles { display: grid; gap: 4px; }
.fb-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 18px; }
.fb-kicker { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-head); font-size: 12px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: #E2D8EF; }
.fb-kicker::before { content: ""; width: 22px; height: 2px; background: var(--accent); }
.fb-head h1 { font-size: clamp(1.5rem, 2.3vw, 2rem); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; line-height: 1.15; }
/* catalogue edition switch: English / Français / Español */
.fb-eds { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.fb-eds-label { font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: rgba(255, 255, 255, .6); }
.fb-eds-btns { display: inline-flex; padding: 3px; border-radius: 99px; border: 1px solid rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .06);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.fb-eds-btns:empty { display: none; }
.fb-eds-btns button { min-height: 34px; padding: 0 16px; border: 0; border-radius: 99px; background: none; color: rgba(255, 255, 255, .82);
  font-family: var(--font-head); font-size: 14px; font-weight: 500; transition: background .2s, color .2s; }
.fb-eds-btns button:hover { color: var(--white); background: rgba(255, 255, 255, .1); }
.fb-eds-btns button[aria-pressed="true"] { background: var(--accent); color: var(--ink); }

/* ---------- the book ---------- */
.fb-area { position: relative; flex: 1 1 auto; height: clamp(380px, calc(100svh - var(--header-h) - 176px), 1000px); margin-top: 14px; perspective: 2600px;
  display: flex; align-items: center; justify-content: center; }
.fb { position: relative; transform-style: preserve-3d; transform: rotateX(var(--tx, 0deg)) rotateY(var(--ty, 0deg)); transition: transform .5s var(--ease);
  touch-action: pan-y; -webkit-user-select: none; user-select: none; cursor: grab; outline: none; }
.fb.dragging { cursor: grabbing; transition: none; }
.fb-book { position: relative; transform: translateX(var(--shift, 0px)); transition: transform .75s var(--ease), opacity .22s ease; }
.fb.swapping .fb-book { opacity: 0; transform: translateX(var(--shift, 0px)) scale(.985); }   /* changing edition */
.fb-book::before { content: ""; position: absolute; left: 6%; right: 6%; bottom: -34px; height: 40px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(50% 50% at 50% 50%, rgba(0, 0, 0, .5), transparent 72%); filter: blur(8px); }
.fb.closed .fb-book::before { left: 52%; right: 2%; }
.fb.single .fb-book::before, .fb.single.closed .fb-book::before { left: 6%; right: 6%; }
.fb-leaf { position: absolute; top: 0; height: 100%; transform-origin: left center; transform-style: preserve-3d; will-change: transform; }
.fb-face { position: absolute; inset: 0; overflow: hidden; background: var(--white); -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.fb-face.back { transform: rotateY(180deg); }
.fb-face img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.fb-blank { width: 100%; height: 100%; background: linear-gradient(135deg, var(--gray), var(--brand-tint)); }
/* fold shadow along the spine, like a bound book */
.fb-face::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.fb-face.front::after { background: linear-gradient(90deg, rgba(0, 0, 0, .24) 0%, rgba(0, 0, 0, .07) 2.5%, transparent 7%); }
.fb-face.back::after { background: linear-gradient(270deg, rgba(0, 0, 0, .24) 0%, rgba(0, 0, 0, .07) 2.5%, transparent 7%); }
.fb.single .fb-face.front::after { background: linear-gradient(90deg, rgba(0, 0, 0, .16) 0%, transparent 4%); }
/* light and shadow on a page while it turns */
.fb-shade { position: absolute; inset: 0; pointer-events: none; opacity: var(--lift, 0); }
.fb-face.front .fb-shade { background: linear-gradient(90deg, transparent 25%, rgba(0, 0, 0, .3) 100%); }
.fb-face.back .fb-shade { background: linear-gradient(270deg, rgba(255, 255, 255, .25) 0%, transparent 45%, rgba(0, 0, 0, .18) 100%); }
.fb-leaf.turning .fb-face { box-shadow: 0 0 34px rgba(0, 0, 0, calc(var(--lift, 0) * .45)); }
.fb-stage:not(.ready) .fb-area { opacity: 0; }
.fb-stage.ready .fb-area { animation: fb-in .9s var(--ease) both; }
@keyframes fb-in { from { opacity: 0; transform: translateY(24px) scale(.97); } to { opacity: 1; transform: none; } }

/* ---------- controls ---------- */
.fb-bar { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px 12px; margin-top: 14px; }
.fb-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .24);
  background: rgba(255, 255, 255, .07); color: var(--white); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: background .2s, border-color .2s, transform .2s var(--ease), opacity .2s; }
.fb-btn svg { width: 20px; height: 20px; }
.fb-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .18); border-color: rgba(255, 255, 255, .5); transform: translateY(-1px); }
.fb-btn:disabled { opacity: .35; cursor: default; }
.fb-btn[aria-expanded="true"] { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.fb-prev, .fb-next { width: 50px; height: 50px; }
.fb-count { min-width: 88px; text-align: center; font-family: var(--font-head); font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.fb-range { width: min(300px, 34vw); accent-color: var(--accent); cursor: pointer; }
@media (pointer: coarse) { .fb-range { height: 32px; } }   /* easier to grab with a finger */
.fb-sep { width: 1px; height: 26px; background: rgba(255, 255, 255, .2); margin: 0 4px; }
.fb-thumbs[hidden] { display: none; }
.fb-thumbs { display: flex; gap: 10px; margin-top: 14px; padding: 6px 4px 12px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: thin; }
.fb-thumbs button { position: relative; flex: none; width: 66px; padding: 0; border: 2px solid transparent; border-radius: 3px; background: none; opacity: .62;
  scroll-snap-align: center; transition: opacity .2s, border-color .2s, transform .2s var(--ease); }
.fb-thumbs button:hover { opacity: 1; transform: translateY(-2px); }
.fb-thumbs button[aria-current="true"] { opacity: 1; border-color: var(--accent); }
.fb-thumbs img { display: block; width: 100%; height: auto; }
.fb-thumbs span { position: absolute; left: 3px; bottom: 3px; padding: 0 5px; border-radius: 99px; background: rgba(37, 35, 42, .82); color: var(--white); font-size: 10px; font-family: var(--font-head); }
.fb-hint { font-size: 13px; color: rgba(255, 255, 255, .62); }
.fb-hint::before { content: "\2194"; display: inline-block; margin-right: 8px; color: var(--accent); animation: fb-nudge 1.6s ease-in-out infinite; }
@keyframes fb-nudge { 50% { transform: translateX(4px); } }

/* full screen: the book takes the whole screen */
.fb-stage.thumbs-open .fb-area { height: clamp(320px, calc(100svh - var(--header-h) - 294px), 880px); }
.fb-stage.is-fs { padding-top: 18px; }
.fb-stage.is-fs .fb-head, .fb-stage.is-fs .fb-hint { display: none; }
.fb-stage.is-fs .fb-area { height: calc(100vh - 140px); margin-top: 0; }
.fb-stage.is-fs .fb-fs { background: var(--accent); border-color: var(--accent); color: var(--ink); }

/* ---------- summary and figures ---------- */
.cat-info { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 84px); align-items: center; }
.cat-text { display: grid; gap: 16px; align-content: start; }
.cat-text > p { color: #3F3B46; font-size: 16.5px; max-width: 56ch; }
.cat-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; }
.cat-actions svg { width: 18px; height: 18px; }
.cat-text > p.cat-meta { font-size: 13px; letter-spacing: .08em; color: var(--muted); }
.cat-text > p.cat-note { font-size: 13px; font-style: italic; color: var(--muted); }
.cat-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.cat-stats div { display: grid; gap: 6px; align-content: start; padding: 26px 24px; background: var(--white); }
.cat-stats strong { font-family: var(--font-head); font-size: clamp(2.2rem, 4vw, 3.1rem); font-weight: 600; line-height: 1; color: var(--brand); font-variant-numeric: tabular-nums; }
.cat-stats span { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }


/* ---------- phones and small screens ---------- */
@media (max-width: 900px) { .cat-info { grid-template-columns: 1fr; } }
@media (max-width: 759px) {
  .fb-stage { min-height: 0; padding-bottom: 30px; }
  .fb-head { flex-direction: column; align-items: center; text-align: center; }
  .fb-title-row { justify-content: center; }
  .fb-hint { display: none; }   /* mouse and keyboard tips; on a phone you just swipe */
  .fb-area { height: auto; aspect-ratio: 8.5 / 11; width: min(100% - 24px, 560px); max-height: 80svh; margin: 16px auto 0; flex: none; }
  .fb-bar { margin-top: 22px; gap: 10px 8px; }
  .fb-count { min-width: 64px; }
  .fb-eds { justify-content: center; margin-top: 6px; }
  .fb-range { order: 5; width: 100%; }
  .fb-sep { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .fb-stage::before, .fb-hint::before { animation: none; }
  .fb, .fb-book { transition: none; }
}
