/* Site-wide motion layer. Safe to load on every page after site.css.
   Pure CSS plus /assets/js/motion.js. Everything is switched off for prefers-reduced-motion. */

/* Smooth cross-page transitions in browsers that support view transitions (no JS needed). */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out .28s cubic-bezier(.4,0,1,1) both; }
::view-transition-new(root) { animation: vt-in .42s cubic-bezier(0,0,.2,1) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }

/* Scroll reveal with stagger. motion.js adds .m-in when an element enters the viewport. */
.js [data-reveal] { opacity: 0; transform: translateY(26px); transition: opacity .8s cubic-bezier(.2,.7,.3,1), transform .8s cubic-bezier(.2,.7,.3,1); transition-delay: calc(var(--i, 0) * 70ms); }
.js [data-reveal="left"] { transform: translateX(-30px); }
.js [data-reveal="right"] { transform: translateX(30px); }
.js [data-reveal="zoom"] { transform: scale(.94); }
.js [data-reveal].m-in { opacity: 1; transform: none; }
.m-d1 { --i: 1; } .m-d2 { --i: 2; } .m-d3 { --i: 3; } .m-d4 { --i: 4; } .m-d5 { --i: 5; } .m-d6 { --i: 6; } .m-d7 { --i: 7; } .m-d8 { --i: 8; }

/* Buttons: lift, glow and a press effect, plus a ripple drawn by motion.js */
.btn-primary, .btn-outline, .btn-plain { position: relative; overflow: hidden; isolation: isolate; }
.btn-primary { box-shadow: 0 6px 18px rgba(196,151,58,.25); }
.btn-primary:hover { box-shadow: 0 10px 28px rgba(196,151,58,.38); }
.btn-primary:active, .btn-outline:active { transform: translateY(0) scale(.97); transition-duration: .08s; }
.btn-primary::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(110deg, transparent 25%, rgba(255,255,255,.45) 50%, transparent 75%); transform: translateX(-120%); transition: transform .7s ease; }
.btn-primary:hover::after { transform: translateX(120%); }
.m-ripple { position: absolute; border-radius: 50%; transform: scale(0); background: rgba(255,255,255,.55); pointer-events: none; animation: m-ripple .6s ease-out forwards; z-index: 0; }
.btn-outline .m-ripple { background: rgba(196,151,58,.35); }
@keyframes m-ripple { to { transform: scale(4); opacity: 0; } }

/* Nav links: animated gold underline */
.nav-links a { position: relative; }
.nav-links a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 2px; background: var(--gold); transform: scaleX(0); transform-origin: right; transition: transform .35s cubic-bezier(.2,.7,.3,1); }
.nav-links a:hover::after, .nav-links a[aria-current="page"]::after { transform: scaleX(1); transform-origin: left; }
.nav-links a[aria-current="page"] { color: var(--gold-light); }

/* Cards: lift with a soft gold edge glow that follows the pointer (motion.js sets --mx/--my) */
.m-glow { position: relative; }
.m-glow::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s; background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(196,151,58,.16), transparent 45%); }
.m-glow:hover::before { opacity: 1; }

/* Page hero: slow-moving route lines and a glowing "highway" stroke */
.page-hero, #hero { isolation: isolate; }
.m-hero-art { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.m-hero-art svg { position: absolute; right: -4%; top: 50%; width: min(760px, 70vw); height: auto; transform: translateY(-50%); opacity: .55; }
.m-hero-art .road { fill: none; stroke: rgba(196,151,58,.35); stroke-width: 1.4; stroke-dasharray: 1400; stroke-dashoffset: 1400; animation: m-draw 4.5s cubic-bezier(.4,0,.2,1) .3s forwards; }
.m-hero-art .road.r2 { animation-delay: .9s; stroke: rgba(232,194,122,.25); }
.m-hero-art .road.r3 { animation-delay: 1.5s; stroke: rgba(255,255,255,.12); }
.m-hero-art .car { fill: var(--gold-light); filter: drop-shadow(0 0 6px rgba(232,194,122,.9)); }
.m-hero-art .node { fill: var(--gold); opacity: 0; animation: m-pop .6s ease forwards, m-pulse 3s ease-in-out infinite; }
@keyframes m-draw { to { stroke-dashoffset: 0; } }
@keyframes m-pop { to { opacity: 1; } }
@keyframes m-pulse { 0%, 100% { r: 3.5; } 50% { r: 5.5; } }
.page-hero-inner, .hero-content { z-index: 1; }

/* Page-hero text entrance (the home hero already animates in site.css) */
.page-hero .hero-tag, .page-hero h1, .page-hero .page-lead, .page-hero .meta, .page-hero .hero-actions, .page-hero .hero-search, .page-hero .crumbs { animation: m-rise .8s cubic-bezier(.2,.7,.3,1) both; }
.page-hero .crumbs { animation-delay: .02s; }
.page-hero .hero-tag { animation-delay: .08s; }
.page-hero h1 { animation-delay: .16s; }
.page-hero .page-lead { animation-delay: .26s; }
.page-hero .meta, .page-hero .hero-actions, .page-hero .hero-search { animation-delay: .36s; }
@keyframes m-rise { from { opacity: 0; transform: translateY(18px); } }

/* Gold shimmer on headline accents: <span class="m-shimmer"> */
.m-shimmer { background: linear-gradient(90deg, var(--gold) 0%, var(--gold-light) 40%, #fff3d6 50%, var(--gold-light) 60%, var(--gold) 100%); background-size: 200% auto; -webkit-background-clip: text; background-clip: text; color: transparent; animation: m-shine 6s linear infinite; }
@keyframes m-shine { to { background-position: 200% center; } }

/* Counters: the number is in the HTML; motion.js only animates it up when visible. */
[data-count] { font-variant-numeric: tabular-nums; }

/* Section dividers that draw themselves */
.js .section-divider { transform: scaleX(0); transform-origin: left; transition: transform .9s cubic-bezier(.2,.7,.3,1) .15s; }
.js .m-in .section-divider, .js .section-divider.m-in { transform: scaleX(1); }

/* Back-to-top button (inserted by motion.js) */
.m-top { position: fixed; right: 20px; bottom: 84px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(196,151,58,.6); background: var(--navy); color: var(--gold-light); display: grid; place-items: center; cursor: pointer; opacity: 0; transform: translateY(12px) scale(.9); pointer-events: none; transition: opacity .3s, transform .3s, background .2s; z-index: 90; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.m-top.show { opacity: 1; transform: none; pointer-events: auto; }
.m-top:hover { background: var(--navy-mid); }
.m-top svg { width: 18px; height: 18px; }

/* Ticker band for headlines or market snapshot: <div class="m-ticker"><div class="m-ticker-track">...</div></div> */
.m-ticker { overflow: hidden; background: var(--navy); border-top: 1px solid rgba(196,151,58,.3); border-bottom: 1px solid rgba(196,151,58,.3); color: rgba(255,255,255,.85); font-size: .85rem; }
.m-ticker-track { display: flex; gap: 2.5rem; width: max-content; padding: .7rem 0; animation: m-ticker 45s linear infinite; }
.m-ticker:hover .m-ticker-track, .m-ticker:focus-within .m-ticker-track { animation-play-state: paused; }
.m-ticker-track span { white-space: nowrap; }
.m-ticker-track b { color: var(--gold-light); font-weight: 700; margin-right: .4rem; }
.m-ticker a { color: inherit; text-decoration: none; }
.m-ticker a:hover { text-decoration: underline; }
@keyframes m-ticker { to { transform: translateX(-50%); } }

/* Links in article bodies: underline grows from the left */
.article-body a { text-decoration: none; background-image: linear-gradient(var(--gold), var(--gold)); background-size: 0% 2px; background-position: 0 100%; background-repeat: no-repeat; transition: background-size .3s; border-bottom: 1px solid rgba(11,29,58,.25); }
.article-body a:hover { background-size: 100% 2px; border-bottom-color: transparent; }

/* Site assistant (inserted by motion.js). The button sits bottom-left so it never covers the resume or back-to-top buttons. */
.ai-wrap { position: fixed; left: 20px; bottom: 24px; z-index: 95; font-family: 'DM Sans', sans-serif; }
.ai-fab { position: relative; display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 18px 0 14px; border-radius: 999px; border: 1px solid rgba(196,151,58,.7); background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%); color: #fff; font: 700 .82rem/1 'DM Sans', sans-serif; letter-spacing: .04em; cursor: pointer; box-shadow: 0 8px 26px rgba(11,29,58,.35); transition: transform .25s cubic-bezier(.2,.7,.3,1), box-shadow .25s; animation: ai-in .7s cubic-bezier(.2,.7,.3,1) 1.2s both; }
.ai-fab::before { content: ''; position: absolute; inset: -4px; border-radius: inherit; border: 2px solid rgba(232,194,122,.55); opacity: 0; animation: ai-ring 2.8s ease-out 2s infinite; pointer-events: none; }
.ai-fab:hover, .ai-fab:focus-visible { transform: translateY(-3px); box-shadow: 0 12px 32px rgba(11,29,58,.45), 0 0 0 3px rgba(196,151,58,.25); }
.ai-fab:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 3px; }
.ai-fab svg { width: 20px; height: 20px; fill: var(--gold-light); animation: ai-twinkle 3.2s ease-in-out infinite; }
.ai-fab svg .s2 { fill: #fff; opacity: .85; }
.ai-tip { position: absolute; left: 0; bottom: calc(100% + 10px); white-space: nowrap; background: var(--gold); color: var(--navy); font-size: .78rem; font-weight: 700; padding: 7px 12px; border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.2); opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; pointer-events: none; }
.ai-tip::after { content: ''; position: absolute; left: 22px; top: 100%; border: 6px solid transparent; border-top-color: var(--gold); }
.ai-wrap:not(.open) .ai-fab:hover + .ai-tip, .ai-wrap:not(.open) .ai-fab:focus-visible + .ai-tip { opacity: 1; transform: none; }

html.ai-lock { overflow: hidden; }
.ai-scrim { position: fixed; inset: 0; z-index: 200; background: rgba(11,29,58,.45); backdrop-filter: blur(2px); opacity: 0; transition: opacity .3s; }
.ai-scrim.in { opacity: 1; }
.ai-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 201; width: min(420px, 100vw); display: flex; flex-direction: column; background: #fdfbf6; color: var(--navy); box-shadow: -24px 0 60px rgba(11,29,58,.3); transform: translateX(104%); transition: transform .42s cubic-bezier(.2,.8,.2,1); font-family: 'DM Sans', sans-serif; }
.ai-drawer.in { transform: none; }
.ai-drawer[hidden], .ai-scrim[hidden] { display: none; }
.ai-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 22px 22px 18px; background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%); color: #fff; border-bottom: 3px solid var(--gold); }
.ai-head h2 { font-family: 'Playfair Display', serif; font-size: 1.45rem; margin: .45rem 0 0; color: #fff; }
.ai-badge { display: inline-block; margin: 0; background: rgba(196,151,58,.22); color: var(--gold-light); font-weight: 700; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; animation: ai-glow 2.4s ease-in-out infinite; }
.ai-close { flex: none; width: 36px; height: 36px; border: 1px solid rgba(255,255,255,.25); border-radius: 50%; background: transparent; font-size: 1.4rem; line-height: 1; color: #fff; cursor: pointer; transition: background .2s, transform .2s; }
.ai-close:hover, .ai-close:focus-visible { background: rgba(255,255,255,.12); transform: rotate(90deg); }
.ai-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 6px 22px 28px; }
.ai-sec { padding: 18px 0; border-bottom: 1px solid #ebe5d8; }
.ai-drawer.in .ai-sec { animation: m-rise .5s cubic-bezier(.2,.7,.3,1) both; }
.ai-drawer.in .ai-sec:nth-child(2) { animation-delay: .06s; } .ai-drawer.in .ai-sec:nth-child(3) { animation-delay: .12s; } .ai-drawer.in .ai-sec:nth-child(4) { animation-delay: .18s; }
.ai-sec h3 { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-text); margin: 0 0 .7rem; }
.ai-sec p { font-size: .9rem; line-height: 1.55; margin: 0 0 .7rem; color: #33415c; }
.ai-search input { width: 100%; box-sizing: border-box; font: inherit; font-size: .95rem; padding: 12px 14px; border: 1.5px solid #d6cdb8; border-radius: 10px; background: #fff; color: var(--navy); transition: border-color .2s, box-shadow .2s; }
.ai-search input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(196,151,58,.2); }
.ai-results { list-style: none; margin: .6rem 0 0; padding: 0; }
.ai-results a { display: block; padding: 9px 10px; border-radius: 8px; text-decoration: none; color: var(--navy); font-weight: 600; font-size: .9rem; transition: background .15s; }
.ai-results a:hover, .ai-results a:focus-visible { background: rgba(196,151,58,.12); }
.ai-results .kind { display: inline-block; font-size: .66rem; letter-spacing: .08em; text-transform: uppercase; color: var(--gold-text); margin-right: 6px; }
.ai-results small { display: block; font-weight: 400; color: #5b6578; font-size: .8rem; margin-top: 2px; }
.ai-results .none { font-size: .85rem; color: #5b6578; padding: 6px 2px; }
.ai-title { font-family: 'Playfair Display', serif; font-size: 1.1rem !important; color: var(--navy) !important; margin-bottom: .35rem !important; }
.ai-toc, .ai-quick { list-style: none; margin: 0; padding: 0; }
.ai-toc li a { display: block; padding: 6px 0 6px 12px; border-left: 2px solid #e3dccb; color: var(--navy); text-decoration: none; font-size: .88rem; transition: border-color .2s, padding .2s; }
.ai-toc li a:hover, .ai-toc li a:focus-visible { border-left-color: var(--gold); padding-left: 16px; }
.ai-sub { font-weight: 700; color: var(--navy) !important; margin: 1rem 0 .4rem !important; }
.ai-faq details { border: 1px solid #ebe5d8; border-radius: 10px; background: #fff; margin-bottom: 8px; }
.ai-faq summary { cursor: pointer; padding: 10px 12px; font-weight: 600; font-size: .88rem; }
.ai-faq details p { padding: 0 12px 10px; font-size: .85rem; margin: 0; }
.ai-sum { margin-top: 1rem; padding: 14px; border-radius: 12px; background: rgba(196,151,58,.08); border: 1px dashed rgba(196,151,58,.5); }
.ai-sum-btn { font: inherit; font-weight: 700; font-size: .88rem; padding: 10px 14px; border-radius: 10px; border: 0; background: var(--navy); color: #fff; cursor: pointer; }
.ai-sum-btn:disabled { opacity: .6; cursor: progress; }
.ai-sum-note { font-size: .78rem !important; margin: .6rem 0 0 !important; }
.ai-sum-out ul { margin: .7rem 0 0; padding-left: 1.1rem; font-size: .88rem; line-height: 1.5; }
.ai-sum-warn { font-size: .75rem !important; color: #5b6578 !important; margin-top: .5rem !important; }
.ai-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ai-quick a { display: block; padding: 10px 12px; border-radius: 10px; background: #fff; border: 1px solid #ebe5d8; color: var(--navy); text-decoration: none; font-weight: 600; font-size: .86rem; transition: border-color .2s, transform .2s, box-shadow .2s; }
.ai-quick a:hover, .ai-quick a:focus-visible { border-color: var(--gold); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(11,29,58,.08); }
.ai-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ai-link { text-align: center; text-decoration: none; font-weight: 700; font-size: .86rem; color: var(--navy); border: 1.5px solid var(--navy); border-radius: 10px; padding: 10px 6px; transition: background .2s, color .2s, transform .2s; }
.ai-link:hover, .ai-link:focus-visible { background: var(--navy); color: #fff; transform: translateY(-2px); }
.ai-copied { min-height: 1em; font-size: .8rem !important; color: var(--gold-text) !important; margin: .5rem 0 0 !important; }
.ai-note { font-size: .76rem; line-height: 1.5; color: #5b6578; padding-top: 16px; margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@keyframes ai-in { from { opacity: 0; transform: translateY(24px) scale(.85); } }
@keyframes ai-ring { 0% { opacity: .9; transform: scale(1); } 70%, 100% { opacity: 0; transform: scale(1.35); } }
@keyframes ai-twinkle { 0%, 100% { transform: rotate(0) scale(1); } 50% { transform: rotate(15deg) scale(1.12); } }
@keyframes ai-glow { 50% { box-shadow: 0 0 0 4px rgba(196,151,58,.12); } }
@media (max-width: 600px) {
  .ai-wrap { left: 1.2rem; bottom: 1.2rem; }
  .ai-fab { width: 44px; height: 44px; padding: 0; justify-content: center; }
  .ai-fab-label { display: none; }
  .ai-tip { white-space: normal; width: 200px; }
}
@media print { .ai-wrap, .m-top { display: none !important; } }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .js [data-reveal] { opacity: 1; transform: none; }
  .m-hero-art .car { display: none; }
  .m-hero-art .road { stroke-dashoffset: 0; }
  .m-ticker-track { animation: none; flex-wrap: wrap; width: auto; padding: .7rem 16px; }
}
