/* Vedatom — Home in 3D (home3d.js). Adds depth to sections the page already has: lifted lab and
   "What you will gain" cards, essays on a lectern, the method as one prism (#method3d), the
   read → practise diptych, and the real books on a stand (mounted into the empty #homeshelf3d). */

/* ---------- 1 · lifted cards ---------- */
#labs > .gp-stack, [data-screen-label="What You Gain"] .gp-stack { perspective: 1400px; }
.hm3-tilt { position: relative; transform-style: preserve-3d;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateZ(var(--tz, 0px)) !important;
  transition: transform .5s cubic-bezier(.22,.61,.36,1), box-shadow .5s ease, border-color .4s ease, opacity .7s ease !important; }
.hm3-tilt.live { transition: transform .12s linear, box-shadow .4s ease, border-color .4s ease, opacity .7s ease !important; }
.hm3-tilt:hover { --tz: 18px; }
#labs > .gp-stack > a.hm3-tilt { box-shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 18px 38px -18px rgba(23,17,6,.55), 0 2px 0 #05070d; }
#labs > .gp-stack > a.hm3-tilt:hover { box-shadow: 0 1px 0 rgba(255,255,255,.08) inset, 0 42px 60px -24px rgba(23,17,6,.6), 0 2px 0 #05070d; border-color: rgba(236,196,95,.45) !important; }
#labs > .gp-stack > a.hm3-tilt > :nth-child(1) { transform: translateZ(14px); }
#labs > .gp-stack > a.hm3-tilt > :nth-child(2) { transform: translateZ(34px); transition: transform .5s cubic-bezier(.22,.61,.36,1);
  box-shadow: 0 22px 34px -14px rgba(0,0,0,.75); border-radius: 14px; }
#labs > .gp-stack > a.hm3-tilt:hover > :nth-child(2) { transform: translateZ(54px); }
.hm3-tilt::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0;
  background: radial-gradient(420px circle at var(--gx, 50%) var(--gy, 0%), rgba(255,236,190,.13), transparent 46%);
  transition: opacity .4s ease; transform: translateZ(1px); }
.hm3-tilt:hover::after { opacity: 1; }
[data-screen-label="What You Gain"] .hm3-tilt { box-shadow: 0 16px 34px -20px rgba(60,44,12,.45); }
[data-screen-label="What You Gain"] .hm3-tilt:hover { box-shadow: 0 36px 54px -26px rgba(60,44,12,.5); }
[data-screen-label="What You Gain"] .hm3-tilt > * { transform: translateZ(16px); }
[data-screen-label="What You Gain"] .hm3-tilt::after { background: radial-gradient(380px circle at var(--gx, 50%) var(--gy, 0%), rgba(236,196,95,.16), transparent 50%); }
@supports (animation-timeline: view()) {
  #labs > .gp-stack > a.hm3-tilt, [data-screen-label="What You Gain"] .gp-stack > div.hm3-tilt {
    animation: hm3rise linear both; animation-timeline: view(); animation-range: entry 0% cover 28%; transform-origin: 50% 100%; }
  @keyframes hm3rise { from { rotate: x 24deg; translate: 0 46px; } to { rotate: x 0deg; translate: 0 0; } }
}

/* ---------- 2 · essays on a lectern ---------- */
#knowledge [data-reveal]:has(> sc-for), #knowledge [data-reveal]:has(> a.kbhome) { perspective: 1100px; perspective-origin: 0% 40%; }
#knowledge a.kbhome { transform-style: preserve-3d; transform-origin: 0% 50%;
  transform: rotateY(-13deg) translateZ(calc(var(--i, 0) * -26px)) !important;
  transition: transform .55s cubic-bezier(.22,.61,.36,1), background .4s ease, border-color .4s ease !important;
  box-shadow: -1px 0 0 rgba(236,196,95,.55), 0 24px 40px -22px rgba(0,0,0,.9); background: linear-gradient(100deg, rgba(255,255,255,.07), rgba(255,255,255,.02)) !important; }
#knowledge a.kbhome:hover, #knowledge a.kbhome:focus-visible { transform: rotateY(-2deg) translateZ(30px) translateX(-6px) !important; border-color: rgba(236,196,95,.45) !important; }
#knowledge a.kbhome > span:nth-child(2) { transform: translateZ(12px); }

/* ---------- 3 · the method: one prism, three faces (#method3d) ---------- */
#method3d { width: 100%; margin-top: 26px; }
/* the faces are measured to the prism (300 x 330 with padding inside); the site does not set border-box */
.pm3, .pm3 *, .hm3-shelf, .hm3-shelf * { box-sizing: border-box; }
/* nav-menus.js caps anything that pokes past a phone screen at 100% of its parent (.gp-fit); a turning
   face hangs off a zero-width pivot, so that cap would crush it -- the 3D parts opt out */
.pm3 div, .pm3 h3, .pm3 p, .pm3 svg { max-width: none !important; }
.pm3-stage { position: relative; height: 560px; perspective: 1200px; perspective-origin: 50% 8%; touch-action: pan-y; cursor: grab; user-select: none; -webkit-user-select: none; }
.pm3-stage:active { cursor: grabbing; }
.pm3-fit { position: absolute; left: 50%; top: 0; width: 640px; height: 560px; margin-left: -320px; transform-origin: 50% 0; transform: scale(var(--fs, 1)); transform-style: preserve-3d; }
.pm3-floor { position: absolute; left: 50%; top: 452px; width: 560px; height: 140px; margin-left: -280px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(ellipse at 50% 50%, rgba(236,196,95,.2), rgba(236,196,95,.05) 45%, transparent 70%); filter: blur(6px); }
.pm3-prism { position: absolute; left: 50%; top: 290px; width: 0; height: 0; transform-style: preserve-3d; transform: rotateX(-12deg) rotateY(var(--a, 0deg)); }
.pm3-face { position: absolute; width: 300px; height: 330px; left: -150px; top: -165px; backface-visibility: hidden; -webkit-backface-visibility: hidden; opacity: 0; visibility: hidden;
  border-radius: 4px; padding: 30px 30px 26px; display: flex; flex-direction: column; gap: 14px; overflow: hidden; text-align: left;
  background: linear-gradient(170deg, rgba(30,38,56,.97), rgba(10,14,24,.98)); border: 1px solid rgba(236,196,95,.22); box-shadow: inset 0 1px 0 rgba(255,255,255,.06); }
.pm3-face::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, rgba(255,255,255,.07), transparent 38%, transparent 70%, rgba(236,196,95,.06)); }
.pm3-face .n { font: 800 11px/1 'Manrope', sans-serif; letter-spacing: .24em; text-transform: uppercase; color: rgba(236,196,95,.8); }
.pm3-face svg { width: 54px; height: 54px; flex: none; }
.pm3-face h3 { margin: 6px 0 0; font: 500 34px/1.05 'Cormorant Garamond', serif; color: #f2ecdd; }
.pm3-face p { margin: 0; font-size: 15px; line-height: 1.66; color: rgba(242,236,221,.76); text-wrap: pretty; }
.pm3-face .feeds { margin-top: auto; font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: rgba(242,236,221,.45); }
.pm3-face .feeds b { color: rgba(236,196,95,.85); font-weight: 800; }
.pm3-edge { position: absolute; width: 3px; height: 330px; left: -1.5px; top: -165px; border-radius: 3px; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,226,150,1), rgba(236,196,95,.55) 60%, rgba(236,196,95,.15));
  box-shadow: 0 0 14px rgba(236,196,95,.75), 0 0 34px rgba(236,196,95,.35); }
.pm3-cap { position: absolute; width: 400px; height: 400px; left: -200px; top: -200px; transform: translateY(-165px) rotateX(90deg); pointer-events: none; }
.pm3-cap svg { width: 100%; height: 100%; overflow: visible; }
.pm3-cap circle { filter: drop-shadow(0 0 6px #ecc45f); }
.pm3-flow { stroke-dasharray: 3 14; animation: pm3flow 1.6s linear infinite; filter: drop-shadow(0 0 4px #ecc45f); }
@keyframes pm3flow { to { stroke-dashoffset: -34; } }
.pm3-om { position: absolute; left: -60px; top: -300px; width: 120px; height: 90px; display: flex; align-items: center; justify-content: center; pointer-events: none;
  font: 64px/1 'Tiro Devanagari Sanskrit', serif; color: #ecc45f; text-shadow: 0 0 26px rgba(236,196,95,.9), 0 0 60px rgba(236,196,95,.45); }
.pm3-chips { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; position: relative; z-index: 2; }
.pm3-chip { display: inline-flex; align-items: center; gap: 10px; font: 800 12.5px/1 'Manrope', sans-serif; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap;
  color: #ecc45f; background: rgba(236,196,95,.06); border: 1.5px solid rgba(236,196,95,.45); border-radius: 999px; padding: 12px 20px; cursor: pointer;
  transition: background .3s ease, box-shadow .3s ease; }
.pm3-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; opacity: .45; transition: opacity .3s; }
.pm3-chip[aria-pressed="true"] { background: rgba(236,196,95,.2); box-shadow: 0 0 24px rgba(236,196,95,.25); }
.pm3-chip[aria-pressed="true"] .dot { opacity: 1; }
.pm3-chip:hover { background: rgba(236,196,95,.14); }
.pm3-chip:focus-visible { outline: 2px solid #ecc45f; outline-offset: 3px; }

/* ---------- 4 · read, then practise: a diptych that steps up ---------- */
#access .gp-stack { perspective: 1500px; align-items: end; }
#access .gp-stack > div { transform-style: preserve-3d; transition: transform .6s cubic-bezier(.22,.61,.36,1), box-shadow .5s ease, opacity .7s ease !important; }
#access .gp-stack > div:nth-child(1) { transform: rotateY(9deg) !important; transform-origin: 100% 50%;
  box-shadow: 10px 0 0 -2px #070a10, 0 30px 50px -28px rgba(0,0,0,.9); }
#access .gp-stack > div:nth-child(2) { transform: rotateY(-9deg) translateY(-34px) !important; transform-origin: 0% 50%;
  box-shadow: -10px 0 0 -2px #0c0904, 0 50px 70px -30px rgba(236,196,95,.22), 0 40px 60px -30px rgba(0,0,0,.9); }
#access .gp-stack > div:nth-child(1):hover, #access .gp-stack > div:nth-child(2):hover { transform: rotateY(0deg) translateY(-40px) !important; }
#access .gp-stack > div > * { transform: translateZ(10px); }
.hm3-step { grid-column: 1 / -1; height: 0; position: relative; }
.hm3-step::before { content: ''; position: absolute; left: 4%; right: 4%; top: 8px; height: 26px; border-radius: 50%;
  background: radial-gradient(ellipse at 50% 50%, rgba(236,196,95,.16), transparent 70%); filter: blur(6px); }

/* ---------- 5 · the library: the real books on a stand ----------
   Books rest at 66deg; the chosen one turns to 10deg and comes 30px forward while its neighbours
   part by 60px. Every book moves with the same timing, so no two ever pass through each other
   (checked numerically: 10px clearance or more at every point of every move). */
#homeshelf3d { width: 100%; }
/* the plank reaches 70px past the stand; between phone and desktop widths that poked 1px past the
   screen and allowed a sideways scroll. clip (not hidden) keeps the 3D and makes no scroll box */
#books { overflow-x: clip; }
.hm3-shelf { display: flex; flex-direction: column; align-items: center; gap: 14px; position: relative; }
.hm3-shelf div { max-width: none !important; }
.hm3-shelf img { max-width: none !important; height: 100% !important; }
.hm3-stage { position: relative; width: 470px; max-width: 100%; height: 300px; perspective: 1300px; perspective-origin: 50% 26%;
  cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: pan-y; }
.hm3-fit { position: absolute; left: 50%; top: 0; width: 470px; height: 300px; transform-origin: 50% 0; transform: translateX(-50%) scale(var(--fs, 1)); }
.hm3-set { position: absolute; inset: 0; transform-style: preserve-3d; transform: rotateX(-7deg) rotateY(var(--sway, 0deg)); }
.hm3-plank { position: absolute; left: -70px; right: -70px; bottom: 49px; height: 190px; transform-origin: 50% 100%;
  transform: translateZ(95px) rotateX(90deg); border-radius: 6px;
  background: radial-gradient(ellipse 60% 70% at 50% 85%, rgba(236,196,95,.16), transparent 70%), linear-gradient(0deg, rgba(42,33,22,.95), rgba(14,11,8,0) 92%); }
.hm3-lip { position: absolute; left: -70px; right: -70px; bottom: 39px; height: 10px; transform: translateZ(95px);
  background: linear-gradient(180deg, #3a2d1d, #1a140d); border-radius: 0 0 4px 4px; box-shadow: 0 14px 30px rgba(0,0,0,.55); }
.hm3-bk { position: absolute; left: 0; bottom: 50px; width: 128px; height: 198px; transform-style: preserve-3d; pointer-events: none;
  translate: calc(var(--x) + var(--dx, 0px)) var(--lift, 0px) var(--z, 0px); rotate: y var(--ry, 66deg);
  transition: translate .62s cubic-bezier(.33,.8,.3,1), rotate .62s cubic-bezier(.33,.8,.3,1); outline: none; }
.hm3-bk > span { position: absolute; display: block; backface-visibility: hidden; }
.hm3-bk .f { inset: 0; transform: translateZ(calc(var(--t) / 2)); border-radius: 1px 3px 3px 1px; overflow: hidden; background: #1a1a1a;
  box-shadow: inset 4px 0 6px -3px rgba(0,0,0,.55), inset -1px 0 0 rgba(255,255,255,.12); }
.hm3-bk .f img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hm3-bk .f::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, rgba(5,7,12,.5), rgba(5,7,12,.28));
  opacity: 0; transition: opacity .5s ease; }
.hm3-bk .f::before { content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0; transition: opacity .5s ease;
  background: linear-gradient(105deg, transparent 30%, rgba(255,246,220,.16) 46%, transparent 60%); }
.hm3-bk .s { top: 0; left: 0; height: 100%; width: var(--t); transform-origin: 0 50%;
  transform: translateZ(calc(var(--t) / 2)) rotateY(-90deg); background: var(--spine, #333);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.28), inset 2px 0 3px rgba(255,255,255,.14); }
.hm3-bk .p { top: 2px; right: 0; height: calc(100% - 4px); width: var(--t); transform-origin: 100% 50%;
  transform: translateZ(calc(var(--t) / 2)) rotateY(90deg); background: repeating-linear-gradient(90deg, #efe6cf 0 1px, #d6cbaf 1px 2px); }
.hm3-bk .tp { left: 0; top: 0; width: 100%; height: var(--t); transform-origin: 50% 0;
  transform: translateZ(calc(var(--t) / 2)) rotateX(90deg); background: #e9dfc6; }
.hm3-set.has-on .hm3-bk:not(.on) .f::after { opacity: 1; }
.hm3-bk.on { --ry: 10deg; --z: 30px; --lift: -12px; }
.hm3-bk.on .f::before { opacity: 1; }
.hm3-bk:focus-visible .f { outline: 2px solid #ecc45f; outline-offset: 3px; }
.hm3-cap { min-height: 54px; text-align: center; font-family: 'Manrope', sans-serif; transition: opacity .25s ease; }
.hm3-cap.fade { opacity: 0; }
.hm3-cap b { display: block; font: 500 24px/1.15 'Cormorant Garamond', serif; color: #f2ecdd; }
.hm3-cap span { display: block; margin-top: 5px; font-size: 11px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; color: rgba(236,196,95,.85); }
.hm3-cap .hint { color: rgba(242,236,221,.5); letter-spacing: .18em; }
@media (prefers-reduced-motion: reduce) { .hm3-bk { transition-duration: .01s; } }

/* phones: no hover-tilt, flatter diptych */
@media (max-width: 760px) {
  #access .gp-stack > div:nth-child(1), #access .gp-stack > div:nth-child(2) { transform: rotateX(8deg) !important; transform-origin: 50% 100%; box-shadow: 0 10px 0 -2px #06080d, 0 30px 50px -28px rgba(0,0,0,.9); }
  #access .gp-stack > div:nth-child(2) { transform: rotateX(8deg) translateY(-6px) !important; }
  #knowledge a.kbhome { transform: rotateY(-8deg) translateZ(calc(var(--i, 0) * -12px)) !important; }
}
@media (prefers-reduced-motion: reduce) {
  #labs > .gp-stack > a.hm3-tilt, [data-screen-label="What You Gain"] .gp-stack > div.hm3-tilt { animation: none !important; }
  .pm3-flow { animation: none; }
}
