/*
 * Shared layout, illustration motion and scroll effects for the service pages
 * (Explore/Service/Pharma.html, medical-device.html). Uses the tokens in molgenium.css.
 */
/* Same tokens and building blocks as the home page */
:root { --wrap: 1240px; }
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 140px; }
body { margin: 0; font: 400 16px/1.6 var(--font); }
img { max-width: 100%; display: block; }
h1, h2, h3, h4, p, ul { margin: 0; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 32px; }
.section { padding: 112px 0; }
.section--tint { background: var(--tint); }
.eyebrow { display: block; font: 600 13px/1.4 var(--font); letter-spacing: .12em; text-transform: uppercase; color: var(--brand); margin-bottom: 14px; }
.mg-hero .eyebrow, .cta .eyebrow { color: var(--brand-soft) !important; }
.h2 { font: 600 40px/1.15 var(--font); letter-spacing: -.02em; }
.h3 { font: 600 19px/1.3 var(--font); letter-spacing: -.01em; }
.lead { font: 400 19px/1.6 var(--font); color: var(--ink-2); max-width: 60ch; margin-top: 18px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 26px; border-radius: var(--radius); border: 1.5px solid transparent; font: 600 15px/1 var(--font); text-decoration: none; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.btn--primary { background: var(--brand); color: var(--white) !important; }
.btn--primary:hover { background: var(--brand-hover); }
.btn--light { border-color: rgba(255, 255, 255, .7); color: var(--white) !important; background: transparent; }
.btn--light:hover { background: var(--white); color: var(--deep) !important; }

/* Hero: photo banner from molgenium.css, plus jump links to the four practices */
.hero-copy { max-width: 780px; margin: 0 auto; text-align: center; }
.hero-copy .lead { margin: 18px auto 0; color: rgba(255, 255, 255, .85); }
.jump { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 36px; }
.jump a { display: inline-flex; align-items: center; gap: 10px; padding: 12px 18px; border: 1px solid rgba(255, 255, 255, .28); border-radius: var(--radius); background: rgba(255, 255, 255, .08); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); color: var(--white); font: 600 14.5px/1 var(--font); text-decoration: none; transition: background .15s, border-color .15s; }
.jump a:hover { background: rgba(255, 255, 255, .18); border-color: rgba(255, 255, 255, .6); }
.jump b { font-weight: 600; color: var(--brand-soft); }

/* Practice header: copy beside an animated illustration */
.practice-head { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: center; margin-bottom: 72px; }
.practice-head--flip .illo-box { order: -1; }
.num { display: inline-grid; place-items: center; width: 34px; height: 34px; margin-right: 10px; border-radius: 50%; background: var(--brand); color: var(--white); font: 600 13px/1 var(--font); letter-spacing: 0; vertical-align: middle; }
.illo-box { position: relative; }
.illo { width: 100%; height: auto; display: block; overflow: visible; }
.standards { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 28px; }
.standards span:first-child { font: 600 12px/1.4 var(--font); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin-right: 6px; }
.standards .std-chip { padding: 9px 14px; font-size: 13.5px; }

/* Service cards */
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.svc { position: relative; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 28px; transition: box-shadow .25s, transform .25s, border-color .25s; }
.section--tint .svc { border-color: transparent; box-shadow: var(--shadow-card); }
.svc:hover { box-shadow: var(--shadow-lift); transform: translateY(-4px); border-color: var(--brand-soft); }
.svc .ico { width: 52px; height: 52px; border-radius: var(--radius-card); background: var(--tint); color: var(--brand); display: grid; place-items: center; margin-bottom: 20px; transition: background .25s, color .25s; }
.section--tint .svc .ico { background: #efe8fc; }
.svc:hover .ico { background: var(--brand); color: var(--white); }
.svc .ico svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.svc h3 { margin-bottom: 8px; }
.svc p { color: var(--ink-2); font-size: 15.5px; }
.svc .tags { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.svc .tags li { padding: 5px 10px; border-radius: 999px; background: var(--tint); color: var(--deep-2); font: 600 12px/1.3 var(--font); }
.section--tint .svc .tags li { background: #efe8fc; }
.svc .spec-btn { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; padding: 0; border: 0; background: none; font: 600 14.5px/1.3 var(--font); color: var(--brand); cursor: pointer; }
.svc .spec-btn::after { content: "→"; transition: transform .15s; }
.svc .spec-btn:hover::after { transform: translateX(4px); }
.svc:has(.spec-btn) { cursor: pointer; }

/* CMC journey: numbered steps joined by a line that fills as you scroll */
.journey { position: relative; }
.journey .grid3 { row-gap: 56px; }
.journey .svc { padding-top: 36px; }
.step-no { position: absolute; top: -17px; left: 28px; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--white); border: 2px solid var(--brand); color: var(--brand); font: 600 13px/1 var(--font); }
.journey-track { position: absolute; left: 0; right: 0; height: 2px; background: var(--line); }
.journey-track i { display: block; height: 100%; width: 0; background: var(--brand); }

/* CMC deep dives */
.deep { margin-top: 80px; display: grid; grid-template-columns: 4fr 8fr; gap: 56px; align-items: start; }
.deep-list { display: grid; gap: 12px; }
.deep-list details { background: var(--white); border: 1px solid var(--line); border-left: 3px solid transparent; border-radius: var(--radius-card); transition: border-color .2s, box-shadow .2s; }
.deep-list details[open] { border-left-color: var(--brand); box-shadow: var(--shadow-card); }
.deep-list summary { list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 20px 24px; font: 600 17px/1.35 var(--font); cursor: pointer; }
.deep-list summary::-webkit-details-marker { display: none; }
.deep-list summary::after { content: "+"; flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--tint); color: var(--brand); font-weight: 400; font-size: 20px; transition: transform .25s; }
.deep-list details[open] summary::after { transform: rotate(45deg); }
.deep-list details p { padding: 0 24px 22px; color: var(--ink-2); }

/* Call to action band */
.cta { position: relative; overflow: hidden; color: var(--white); background: var(--deep); }
.cta > img { position: absolute; left: 0; top: -15%; width: 100%; height: 130%; object-fit: cover; opacity: .28; will-change: transform; }
.cta .wrap { position: relative; padding-top: 104px; padding-bottom: 104px; display: flex; justify-content: space-between; align-items: center; gap: 40px; }
.cta .h2 { color: var(--white); max-width: 640px; }
.cta p { color: rgba(255, 255, 255, .8); max-width: 580px; margin-top: 16px; }
.cta .actions { display: flex; gap: 12px; flex-wrap: wrap; flex: none; }

/* ---------- Illustration motion ---------- */
.illo .spin { transform-box: fill-box; transform-origin: center; animation: spin 18s linear infinite; }
.illo .spin--fast { animation-duration: 9s; }
.illo .bob { animation: bob 4s ease-in-out infinite; }
.illo .bob--2 { animation-delay: -2s; }
.illo .wave { animation: wave 3s linear infinite; }
.illo .bubble { animation: rise 3.2s ease-in infinite; opacity: 0; }
.illo .vial { animation: belt 8s linear infinite; }
.illo .belt { stroke-dasharray: 6 14; animation: beltline 1s linear infinite; }
.illo .beam { animation: beam 2s ease-in-out infinite; }
.illo .tick { transform-box: fill-box; transform-origin: center; }
.illo .pop { transform-box: fill-box; transform-origin: center; animation: pop 4s ease-in-out infinite; }
.illo .sweep { transform-origin: 220px 175px; animation: spin 5s linear infinite; }
.illo .ping { transform-box: fill-box; transform-origin: center; animation: ping 2.5s ease-out infinite; }
.illo .ecg { stroke-dasharray: 1; animation: ecg 3.4s linear infinite; }
.illo .alert { animation: alert 1.6s ease-in-out infinite; }
/* Device page illustrations */
.illo .draw { stroke-dasharray: 1; animation: drawloop 6s ease-in-out infinite; }
.illo .orbit { transform-origin: 220px 175px; animation: spin 10s linear infinite; }
.illo .tick { opacity: 0; animation: tick 6s ease-out infinite; }
.illo .scan { animation: scan 6s ease-in-out infinite; }
@keyframes drawloop { 0% { stroke-dashoffset: 1; } 45%, 85% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -1; } }
@keyframes tick { 0% { opacity: 0; transform: scale(.4); } 8%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes scan { 0%, 100% { transform: translate(0, 0); } 33% { transform: translate(-20px, 52px); } 66% { transform: translate(10px, 104px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bob { 50% { transform: translateY(-8px); } }
@keyframes wave { to { transform: translateX(-80px); } }
@keyframes rise { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: .9; } 100% { transform: translateY(-110px); opacity: 0; } }
@keyframes belt { 0% { transform: translateX(0); opacity: 0; } 6% { opacity: 1; } 94% { opacity: 1; } 100% { transform: translateX(400px); opacity: 0; } }
@keyframes beltline { to { stroke-dashoffset: -20; } }
@keyframes beam { 50% { opacity: .38; } }
@keyframes pop { 0%, 40% { transform: scale(.85); } 50% { transform: scale(1.08); } 60%, 100% { transform: scale(1); } }
@keyframes ping { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(3.4); opacity: 0; } }
@keyframes ecg { 0% { stroke-dashoffset: 1; } 70%, 100% { stroke-dashoffset: 0; } }
@keyframes alert { 50% { opacity: .35; } }

/* Scroll reveal and self-drawing icons */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease-out, transform .7s ease-out; }
.js .reveal.in { opacity: 1; transform: none; }
.js .svc .ico svg > * { stroke-dasharray: 1; stroke-dashoffset: 1; }
.js .svc.in .ico svg > * { animation: draw 1.4s ease-out var(--d, 0ms) forwards; }
.js .svc.in:hover { transform: translateY(-4px); }
@keyframes draw { to { stroke-dashoffset: 0; } }

@media (max-width: 1023px) {
    .grid3 { grid-template-columns: 1fr 1fr; }
    .deep { grid-template-columns: 1fr; gap: 28px; }
    .journey-track { display: none; }
}
@media (max-width: 860px) {
    .practice-head { grid-template-columns: 1fr; gap: 40px; margin-bottom: 56px; }
    .practice-head--flip .illo-box { order: 0; }
    .illo-box { max-width: 460px; }
    .cta .wrap { flex-direction: column; align-items: start; }
    .h2 { font-size: 32px; }
}
@media (max-width: 600px) {
    .wrap { padding: 0 16px; }
    .section { padding: 80px 0; }
    .grid3 { grid-template-columns: 1fr; }
    .jump a { flex: 1 1 calc(50% - 10px); justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
    .illo * { animation: none !important; }
    .illo .bubble { opacity: .7; }
    .js .reveal { opacity: 1; transform: none; transition: none; }
    .js .svc .ico svg > * { stroke-dashoffset: 0; animation: none !important; }
    .svc, .svc:hover { transition: none; transform: none; }
}
