/* =========================================================
   FALOM AI: product book on a desk (Our products section)
   To remove the book, delete the line <script src="js/book.js"> in index.html.
   ========================================================= */

/* ---------- Product book on a desk: a small black book lies on dark wood under a spotlight.
   Click it: the view zooms in while it opens flat on the table, then each page turns to a product ---------- */
#products.has-book { padding-top: 0; padding-bottom: 0; } /* the desk fills the section edge to edge */
#products.has-book [data-products-cards] { display: none; } /* the book already shows each product */
.desk {
  position: relative; overflow: hidden; color: var(--white);
  padding: 200px 24px 56px;
  background:
    radial-gradient(ellipse 42% 46% at 50% 58%, rgba(255, 244, 228, 0.16), transparent 72%),
    radial-gradient(ellipse 75% 75% at 50% 55%, transparent 45%, rgba(0, 0, 0, 0.75) 100%),
    repeating-linear-gradient(177deg, rgba(255, 255, 255, 0.022) 0 1px, transparent 1px 6px),
    repeating-linear-gradient(183deg, rgba(0, 0, 0, 0.35) 0 2px, transparent 2px 17px),
    repeating-linear-gradient(179deg, rgba(255, 255, 255, 0.012) 0 3px, transparent 3px 41px),
    #17161a;
}
.desk-head { position: absolute; top: 72px; left: max(24px, calc((100% - var(--max)) / 2 + 24px)); z-index: 2; max-width: 480px; transition: opacity 0.6s, transform 0.6s var(--ease); }
.desk-head .eyebrow { color: var(--grey-500); }
.desk-head .title { font-size: clamp(30px, 3.6vw, 44px); margin-top: 6px; }
.desk-lead { color: var(--grey-300); font-size: 17px; margin-top: 10px; }
.desk-hint { color: var(--grey-500); font-size: 13px; margin-top: 10px; }
.desk.is-open .desk-head { opacity: 0; transform: translateY(-12px); pointer-events: none; }

/* Desk props, drawn with CSS */
.prop { position: absolute; pointer-events: none; z-index: 0; }
.prop-cup { right: 9%; top: 26%; width: 150px; height: 150px; border-radius: 50%;
  background: radial-gradient(circle, #f2f0ec 55%, #d6d3cd 70%, #bdb9b2 71%);
  box-shadow: 18px 26px 40px rgba(0, 0, 0, 0.6); }
.prop-cup i { position: absolute; inset: 27px; border-radius: 50%;
  background: radial-gradient(circle at 50% 55%, #f7efe3 0 16%, #c9925f 17% 44%, #6b3d1f 60%);
  box-shadow: 0 0 0 7px #fbfaf8, 0 0 0 8px #cfcbc4; }
.prop-cup b { position: absolute; width: 72px; height: 7px; border-radius: 4px; background: linear-gradient(#e8e8ea, #9b9ba0);
  right: -34px; bottom: 30px; transform: rotate(-28deg); }
.prop-pen { left: 15%; top: 64%; width: 200px; height: 7px; border-radius: 4px; transform: rotate(-58deg);
  background: linear-gradient(90deg, #d9d9dc 0 8%, #1c1c20 8% 92%, #9a9aa0 92%); box-shadow: 10px 14px 18px rgba(0, 0, 0, 0.6); }
.prop-dish { left: 7%; top: 50%; width: 80px; height: 80px; border-radius: 50%;
  background: radial-gradient(circle, #6f8e88 0 30%, #44605b 45%, #2a2c30 48% 60%, #8c8c92 62% 70%, #3a3a3f 72%);
  box-shadow: 10px 16px 26px rgba(0, 0, 0, 0.65); }
.prop-dish i { position: absolute; inset: 24px; border-radius: 50%;
  background: repeating-conic-gradient(#9fc4bb 0 8deg, #5d817a 8deg 20deg); opacity: 0.85; }
.prop-note { right: 13%; bottom: 17%; width: 92px; height: 70px; transform: rotate(-12deg) skewX(-8deg);
  background: linear-gradient(135deg, #f4f4f2 0 58%, #c8c8c6 58% 62%, #e9e9e7 62%);
  box-shadow: 10px 14px 22px rgba(0, 0, 0, 0.55); }

/* The book */
.book-wrap { --d: 10px; position: relative; z-index: 1; perspective: 1500px; perspective-origin: 50% 20%; }
.book {
  position: relative; width: min(980px, 100%); aspect-ratio: 1.95 / 1; margin: 0 auto;
  transform-style: preserve-3d;
  transform: translateX(-25%) translateY(4%) rotateX(36deg) rotateZ(-4deg) scale(0.42);
  transition: transform 1.4s var(--ease);
}
.book.is-open { transform: translateY(-8%) rotateX(22deg) scale(1); }
.book:not(.is-open) .leaf:first-of-type { cursor: zoom-in; }
.book .leaf, .book-base, .book-block { position: absolute; top: 0; left: 50%; width: 50%; height: 100%; }

/* Pages: stacked 1px apart so the 3D view always knows which is on top */
.book .leaf {
  --zu: 1px; --zf: 1px;
  transform-origin: left center; transform-style: preserve-3d; cursor: pointer;
  transform: rotateY(0deg) translateZ(var(--zu));
  transition: transform 1.2s var(--ease);
}
.book .leaf.flipped { transform: rotateY(-180deg) translateZ(calc(var(--zf) * -1)); }
.book .face {
  position: absolute; inset: 0; overflow: hidden; border-radius: 2px 8px 8px 2px;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  display: flex; flex-direction: column; padding: 30px 34px;
}
.book .face.back { transform: rotateY(180deg); border-radius: 8px 2px 2px 8px; }
/* Paper fold along the spine */
.book .face::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.38), rgba(255, 255, 255, 0.04) 4%, transparent 11%);
}
.book .face.back::after { background: linear-gradient(to left, rgba(0, 0, 0, 0.38), rgba(255, 255, 255, 0.04) 4%, transparent 11%); }

/* Page block: paper edges, the spine and the back cover with its shadow on the desk */
.book-block { transform-style: preserve-3d; pointer-events: none; }
.book-block i { position: absolute; display: block; }
.book-block .edge-top, .book-block .edge-bottom { left: 0; right: 0; height: var(--d); background: repeating-linear-gradient(0deg, #3b3a40 0 1px, #24232a 1px 2px); }
.book-block .edge-top { top: 0; transform-origin: top; transform: rotateX(-90deg); }
.book-block .edge-bottom { bottom: 0; transform-origin: bottom; transform: rotateX(90deg); }
.book-block .edge-right, .book-block .edge-left { top: 0; bottom: 0; width: var(--d); background: repeating-linear-gradient(90deg, #3b3a40 0 1px, #24232a 1px 2px); }
.book-block .edge-right { right: 0; transform-origin: right; transform: rotateY(-90deg); }
.book-block .edge-left { left: 0; transform-origin: left; transform: rotateY(90deg); }
.book-block .edge-spine { top: 0; bottom: 0; left: 0; width: var(--d); transform-origin: left; transform: rotateY(90deg); background: #0c0c0e; transition: opacity 0.6s; }
.book-block .block-back {
  inset: 0; border-radius: 2px 8px 8px 2px; background: #0b0b0d; transform: translateZ(calc(var(--d) * -1));
  box-shadow: 0 40px 70px rgba(0, 0, 0, 0.8), 0 8px 16px rgba(0, 0, 0, 0.6);
}
.book-block-left { left: 0; }
.book-block-left .block-back { border-radius: 8px 2px 2px 8px; }
.book-block-left i { opacity: 0; transition: opacity 0.5s; }
.book.is-open .book-block-left i { opacity: 1; transition-delay: 0.35s; }
.book.is-open .book-block-right .edge-spine { opacity: 0; }

/* Cover: matte black with the FALOM name */
.book-cover {
  flex-direction: row; align-items: center; justify-content: center; gap: 18px;
  background:
    radial-gradient(ellipse 70% 60% at 35% 20%, rgba(255, 255, 255, 0.08), transparent 65%),
    linear-gradient(160deg, #1d1d22 0%, #0b0b0e 60%, #060607 100%);
}
.book .book-cover::after { background: linear-gradient(to right, rgba(0, 0, 0, 0.6) 0, rgba(255, 255, 255, 0.07) 2.5%, transparent 5%); }
.book-cover-mark { width: 92px; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6)); }
.book-cover-title { font-family: "Orbitron", var(--font); font-size: 46px; letter-spacing: 0.14em; color: #ececf0; }
.book-cover-title span { font-size: 0.45em; color: var(--grey-500); }

/* Magazine pages: product cover (left) */
.pg-hero { justify-content: flex-end; color: var(--white); }
.pg-hero-logo { width: 120px; border-radius: 24%; margin-bottom: auto; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45); }
.pg-hero h3 { font-size: 92px; font-weight: 800; letter-spacing: -0.05em; line-height: 0.95; margin-top: 10px; padding-bottom: 0.1em; }
.pg-hero-line { font-size: 21px; line-height: 1.3; margin-top: 16px; max-width: 400px; }
.product-card-relix.pg-hero h3 { background: linear-gradient(120deg, #fff 30%, #b9a6ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.product-card-restaulix.pg-hero h3 { background: linear-gradient(120deg, #fff 30%, #ffd23f); -webkit-background-clip: text; background-clip: text; color: transparent; }
.product-card-legalix.pg-hero h3 { background: linear-gradient(120deg, #fff 30%, #ffb35c); -webkit-background-clip: text; background-clip: text; color: transparent; }
.book-falom { justify-content: center; align-items: center; text-align: center; background: linear-gradient(160deg, #1d1d22, #0b0b0e); }
.book-falom .pg-hero-logo { margin: 0 0 24px; box-shadow: none; }
.book-falom h3 { font-size: 46px; }

/* Magazine pages: how it works (right) */
.pg-run { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; letter-spacing: 0.04em; opacity: 0.9; margin-bottom: 12px; }
.pg-run img { width: 26px; border-radius: 24%; }
.pg-steps h4 { font-size: 22px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; margin-top: 6px; }
.pg-steps ol { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 22px; margin-top: 14px; }
.pg-steps li span { display: block; font-size: 12px; font-weight: 700; opacity: 0.55; }
.pg-steps li b { display: block; font-size: 16px; margin-top: 1px; }
.book .pg-steps li p { font-size: 12px; line-height: 1.35; margin-top: 3px; max-width: none; }
.book-actions { margin-top: auto; padding-top: 12px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* Last page */
.book-base {
  border-radius: 2px 8px 8px 2px; padding: 36px 38px; display: flex; flex-direction: column; justify-content: center;
  background: linear-gradient(160deg, #f4f2ee, #e4e0d8); color: var(--grey-900);
}
.book-base h3 { font-size: 44px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; margin-top: 8px; }
.book-base p:not(.eyebrow) { color: var(--grey-500); font-size: 18px; margin-top: 14px; max-width: 360px; }
.book-base .book-actions { margin-top: 28px; }

/* Arrows and page number */
.book-controls { display: flex; align-items: center; justify-content: center; gap: 20px; margin-top: 8px; opacity: 0; transition: opacity 0.6s 0.6s; }
.desk.is-open .book-controls { opacity: 1; }
.book-btn {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.22); background: rgba(0, 0, 0, 0.3);
  color: var(--white); font-size: 22px; line-height: 1; cursor: pointer; transition: opacity 0.3s, transform 0.3s var(--ease);
}
.book-btn:hover:not(:disabled) { transform: scale(1.08); }
.book-btn:disabled { opacity: 0.25; cursor: default; }
.book-count { min-width: 48px; text-align: center; font-size: 14px; color: var(--grey-500); font-variant-numeric: tabular-nums; }

/* Narrower screens: smaller pages */
@media (max-width: 1000px) {
  .book .face, .book-base { padding: 26px 26px; }
  .pg-hero h3 { font-size: 64px; }
  .pg-hero-line { font-size: 17px; }
  .pg-hero-logo { width: 84px; }
  .pg-steps h4 { font-size: 22px; }
  .book .pg-steps li p { display: none; }
  .book-cover-title { font-size: 34px; }
  .book-cover-mark { width: 70px; }
  .prop-dish, .prop-note { display: none; }
}

/* Phones: one tall page at a time; turned pages fold away to the left */
@media (max-width: 640px) {
  .desk { padding: 48px 20px 40px; }
  .desk-head { position: static; margin-bottom: 8px; }
  .prop-pen { display: none; }
  .prop-cup { width: 96px; height: 96px; right: -24px; top: 30px; }
  .prop-cup i { inset: 17px; }
  .prop-cup b { display: none; }
  .book-wrap { --d: 8px; }
  .book { width: min(380px, 100%); aspect-ratio: 380 / 540; transform: translateY(2%) rotateX(30deg) rotateZ(-4deg) scale(0.62); }
  .book.is-open { transform: rotateX(10deg); }
  .book .leaf, .book-base, .book-block { left: 0; width: 100%; }
  .book-block-left { display: none; }
  .book .face.back { visibility: hidden; }
  .book .turn-back > .face.back { visibility: inherit; } /* while turning, the page sweeps off to the left */
  .book-cover { flex-direction: column; }
  .desk.is-open .desk-head { opacity: 1; transform: none; }
}

/* ---------- Bending page turn (drawn by js/book.js while a page turns) ---------- */
.leaf-turn { position: absolute; transform-style: preserve-3d; pointer-events: none; }
.turn-strip { position: absolute; top: 0; height: 100%; transform-origin: left center; transform-style: preserve-3d; will-change: transform; }
/* Each strip overlaps its neighbour by a pixel, so no hairline gaps open while the page bends */
.turn-side { position: absolute; top: 0; bottom: 0; left: -0.75px; right: -0.75px; overflow: hidden; -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.turn-side > .face { margin-left: 0.75px; }
.turn-back { transform: rotateY(180deg); }
/* Only the solid page content overlaps (by a pixel, so no gaps open between strips). The
   see-through paper layers are left off the turning copy: drawn twice in the overlap they would
   show as thin lines at every join. Shading is done by darkening the content (js/book.js). */
.turn-side .face::before, .turn-side .face::after { display: none; }
.leaf-turn.is-idle { visibility: hidden; } /* kept drawn but invisible, so a turn starts instantly */

/* ---------- Realistic paper ---------- */
/* Fine paper grain and a soft sheen across every page */
.book .face::before, .book-base::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background:
    linear-gradient(100deg, transparent 35%, rgba(255, 255, 255, 0.05) 52%, transparent 68%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5  0 0 0 0 0.5  0 0 0 0 0.5  0 0 0 0.09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
/* Deeper fold at the spine and a slight darkening at the outer edge, as if the paper curves */
.book .face::after { z-index: 1;
  background:
    linear-gradient(to right, rgba(0, 0, 0, 0.5) 0, rgba(0, 0, 0, 0.18) 3%, rgba(255, 255, 255, 0.06) 6.5%, transparent 15%),
    linear-gradient(to left, rgba(0, 0, 0, 0.22) 0, transparent 5%);
}
.book .face.back::after {
  background:
    linear-gradient(to left, rgba(0, 0, 0, 0.5) 0, rgba(0, 0, 0, 0.18) 3%, rgba(255, 255, 255, 0.06) 6.5%, transparent 15%),
    linear-gradient(to right, rgba(0, 0, 0, 0.22) 0, transparent 5%);
}
.book .book-cover::before { background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.06) 50%, transparent 66%); }
.book-base { position: absolute; }
.book-base::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1; border-radius: inherit;
  background:
    linear-gradient(to right, rgba(0, 0, 0, 0.3) 0, rgba(0, 0, 0, 0.08) 3%, rgba(255, 255, 255, 0.4) 6.5%, transparent 15%),
    linear-gradient(to left, rgba(0, 0, 0, 0.1) 0, transparent 5%);
}
.book-base > *, .book .face > * { position: relative; z-index: 2; }
.book .face > .pg-hero-logo { z-index: 2; }

/* ---------- Left-page logos follow the cursor ---------- */
.pg-hero-logo { transition: transform 0.35s ease-out; will-change: transform; }

/* ---------- 3D book (js/book3d.js): the regular book stays in the page, invisible, as its source ---------- */
.book3d-canvas { position: absolute; top: 0; left: 0; z-index: 1; display: block; }
.desk.is-3d .book-wrap { pointer-events: none; }
.desk.is-3d .book { visibility: hidden; }
.desk.is-3d .book-controls { position: relative; z-index: 3; pointer-events: auto; }
/* When the book opens, the desk objects drift outward and grow, as if the camera zooms in */
.desk.is-3d .prop { transition: transform 1.5s cubic-bezier(0.45, 0, 0.55, 1); }
.desk.is-3d.is-open .prop-cup { transform: translate(9vw, -4vh) scale(1.3); }
.desk.is-3d.is-open .prop-note { transform: translate(8vw, 8vh) rotate(-12deg) skewX(-8deg) scale(1.3); }
.desk.is-3d.is-open .prop-pen { transform: translate(-9vw, 6vh) rotate(-58deg) scale(1.3); }
.desk.is-3d.is-open .prop-dish { transform: translate(-6vw, 0) scale(1.3); }
/* The 3D book brings its own desk, lamp light and objects */
.desk.is-3d .prop { display: none; }
/* While the 3D book gets ready: a lamp-lit wooden desk tone instead of the regular book, then the
   3D desk fades in over it, so nothing visibly swaps */
.desk.is-3d-pending .book, .desk.is-3d-pending .prop, .desk.is-3d-pending .book-controls { visibility: hidden; }
.desk.is-3d-pending, .desk.is-3d {
  background:
    radial-gradient(ellipse 42% 50% at 50% 56%, #3d2f24 0%, #241a12 40%, #0e0907 75%, #060403 100%);
}
.book3d-canvas { opacity: 0; transition: opacity 0.9s ease; }
.desk.is-3d-ready .book3d-canvas { opacity: 1; }

/* "How it works" pages: more about each product, scrolling inside the page
   (the .pg-more blocks in index.html; delete them to go back to the steps only) */
.book .pg-steps { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.25) transparent; }
.pg-steps .book-actions { margin-top: 18px; }
.pg-more { margin-top: 22px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,0.12); }
.pg-more .eyebrow { margin-top: 22px; }
.pg-more-lead { font-size: 15px; line-height: 1.4; font-weight: 600; color: #fff; max-width: none; }
.pg-more h5 { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; margin-top: 6px; }
.pg-check { list-style: none; margin-top: 12px; display: grid; gap: 6px; font-size: 13px; }
.pg-check li::before { content: "✓  "; font-weight: 700; }
.pg-cards { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.pg-cards li { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); border-radius: 12px; padding: 12px; }
.pg-cards i { font-style: normal; display: block; font-size: 16px; opacity: 0.8; }
.pg-cards b { display: block; font-size: 14px; margin-top: 4px; }
.book .pg-cards p { font-size: 12px; line-height: 1.35; margin-top: 3px; max-width: none; }
.pg-stats { list-style: none; display: flex; gap: 22px; margin-top: 10px; flex-wrap: wrap; }
.pg-stats strong { display: block; font-size: 26px; font-weight: 700; letter-spacing: -0.03em; }
.pg-stats span { font-size: 12px; opacity: 0.7; }

/* "Click to open" hint under the closed 3D book (js/book3d.js places it and fades it out once the book opens) */
.book3d-hint {
  position: absolute; top: 0; left: 0; z-index: 2; opacity: 0; pointer-events: none;
  display: inline-flex; align-items: center; gap: 9px; padding: 7px 15px 7px 11px; border-radius: 999px;
  font: inherit; font-size: 13px; font-weight: 500; letter-spacing: 0.02em; white-space: nowrap; cursor: pointer;
  color: rgba(255, 255, 255, 0.85); background: rgba(18, 18, 22, 0.45); border: 1px solid rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: opacity 0.6s ease;
}
.book3d-hint.show { opacity: 1; pointer-events: auto; }
.book3d-hint:hover { color: #fff; border-color: rgba(255, 255, 255, 0.3); }
.book3d-hint-dot { width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: book3dHintPulse 1.8s ease-out infinite; }
@keyframes book3dHintPulse { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.55); } 100% { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); } }

/* The 3D desk fades into black at the top of the section (the darkness around the lamp light is in the 3D scene itself) */
.desk.is-3d-pending::after, .desk.is-3d::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.85) 6%, rgba(0, 0, 0, 0.4) 16%, rgba(0, 0, 0, 0) 30%);
}

/* ---------- When the 3D book is off (phones, tablets, "reduce motion"): the same look as the 3D desk ----------
   no drawn props (cup, pen…), the dark lacquered wood from the 3D desk under a warm lamp glow, fading in
   from black at the top like the computer version */
.desk:not(.is-3d):not(.is-3d-pending) .prop { display: none; }
.desk:not(.is-3d):not(.is-3d-pending) {
  background:
    linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.85) 8%, rgba(0, 0, 0, 0.35) 22%, rgba(0, 0, 0, 0) 38%),
    radial-gradient(ellipse 70% 45% at 45% 62%, rgba(255, 228, 190, 0.18), transparent 70%),
    radial-gradient(ellipse 90% 80% at 50% 60%, transparent 40%, rgba(0, 0, 0, 0.7) 100%),
    url("../assets/desk-wood-grain.jpg") center / 520px auto,
    #120c08;
}
