/* =========================================================
   GetMadTools — page portals (design: Claude Design canvas, "Opening animations")
     store     → box opens: an indigo and a coral flap close, the name shows, the flaps swing open in 3D
     madconfig → network wakes up: rings ripple from the click, devices pop in and link up, a lavender sheet slides away
     madpdf    → page flips: a white page with a coral corner flies out, is signed, then turns over like a sheet
   Only transform / opacity / clip-path animate.
   ========================================================= */
html.pt-enter body::before, html.pt-intro body::before {
  content: ""; position: fixed; inset: 0; z-index: 9998; background: var(--pt-bg, #FFFFFF);
  animation: pt-failsafe .01s 4s forwards; /* never block the page if the script fails */
}
html.pt-live body::before { display: none; }
html.pt-enter, html.pt-intro { overflow: hidden; }
@keyframes pt-failsafe { to { opacity: 0; visibility: hidden; } }

.pt { position: fixed; inset: 0; z-index: 9999; pointer-events: none; overflow: hidden; }
.pt.block { pointer-events: auto; }

/* ---------- STORE · box opens ---------- */
.pt-store { perspective: 1800px; }
.pt-store .lid { position: absolute; top: 0; bottom: 0; width: 50.2%; will-change: transform; backface-visibility: hidden; }
.pt-store .lid.l { left: 0; background: #4F46E5; transform-origin: 0 50%; }
.pt-store .lid.r { right: 0; background: #FF6B4A; transform-origin: 100% 50%; }
.pt-store .lid::after { content: ""; position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(255,255,255,.35); }
.pt-store .lid.l::after { right: 0; } .pt-store .lid.r::after { left: 0; }
.pt-store .pt-word { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 12px; text-align: center; z-index: 2; }
.pt-store .pt-word b { font-family: "Bricolage Grotesque", system-ui, sans-serif; font-weight: 800; font-size: clamp(40px, 8vw, 110px); letter-spacing: -.04em; line-height: 1; color: #FFFFFF; }
.pt-store .pt-word b span { display: inline-block; }
.pt-store .pt-word b .c { color: #1F1147; }
.pt-store .pt-word small { font-family: Inter, system-ui, sans-serif; font-size: 13px; font-weight: 600; letter-spacing: .24em; text-transform: uppercase; color: rgba(255,255,255,.85); }

/* ---------- MADCONFIG · network wakes up ---------- */
.pt-mc { background: #FFFFFF; }
.pt-mc .grid { position: absolute; inset: 0; background-image: radial-gradient(#C7CBF5 1.2px, transparent 1.2px); background-size: 22px 22px; opacity: .8; }
.pt-mc .ring { position: absolute; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%; border: 2px solid #4F46E5; opacity: 0; }
.pt-mc .link { position: absolute; height: 2px; background: #C7CBF5; transform-origin: 0 50%; }
.pt-mc .node { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: #4F46E5; box-shadow: 0 0 0 6px rgba(79,70,229,.14); transform: scale(0); }
.pt-mc .node.c { background: #FF6B4A; box-shadow: 0 0 0 8px rgba(255,107,74,.18); width: 22px; height: 22px; margin: -11px 0 0 -11px; }
.pt-mc .pt-name { position: absolute; left: 0; right: 0; bottom: 12vh; text-align: center; font-family: "Bricolage Grotesque", system-ui, sans-serif; font-weight: 800; font-size: clamp(30px, 5vw, 60px); letter-spacing: -.04em; color: #111827; opacity: 0; }
.pt-mc .pt-name small { display: block; margin-top: 6px; font-family: Inter, system-ui, sans-serif; font-size: 14px; font-weight: 500; letter-spacing: 0; color: #4B5563; }
.pt-mc .pt-name b { color: #4F46E5; }
.pt-mc.arrive { background: transparent; }
.pt-mc.arrive > :not(.sheet) { display: none; }
.pt-mc .sheet { position: absolute; inset: 0; background: #EEF0FF; transform: translateY(100%); will-change: transform; }

/* ---------- MADPDF · page flips ---------- */
.pt-pdf { perspective: 2000px; }
.pt-pdf .desk { position: absolute; inset: 0; background: #FFEDE8; will-change: opacity; }
.pt-pdf .page { position: absolute; left: 50%; top: 50%; width: min(420px, 74vw); aspect-ratio: 1 / 1.32; margin: 0; transform: translate(-50%, -50%); transform-origin: 0 50%;
  background: #FFFFFF; border-radius: 10px; box-shadow: 0 40px 90px -30px rgba(154,52,18,.6); padding: 9% 9%; display: flex; flex-direction: column; gap: 4.5%; will-change: transform; box-sizing: border-box; backface-visibility: hidden; }
.pt-pdf .page .h { height: 7%; width: 52%; background: #312E81; border-radius: 4px; }
.pt-pdf .page .l { height: 2.6%; border-radius: 3px; background: #E5E7EB; transform-origin: 0 50%; }
.pt-pdf .page .l.a { background: #FFB4A2; }
.pt-pdf .page .sig { margin-top: auto; width: 55%; height: 18%; }
.pt-pdf .page .sig path { fill: none; stroke: #4F46E5; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 600; stroke-dashoffset: 600; }
.pt-pdf .page .corner { position: absolute; right: 0; bottom: 0; width: 22%; aspect-ratio: 1; background: #FF6B4A; clip-path: polygon(100% 0, 0 100%, 100% 100%); border-radius: 0 0 10px 0; }
.pt-pdf .page .nm { position: absolute; left: 9%; bottom: 7%; font-family: "Bricolage Grotesque", system-ui, sans-serif; font-weight: 800; font-size: clamp(16px, 2.6vw, 22px); letter-spacing: -.03em; color: #111827; opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  html.pt-enter body::before, html.pt-intro body::before { display: none; }
}
