/* ===================================================================
   A.C. Pandey & Associates — Welcome intro + Bar Council of India
   (Rule 36) disclaimer gate. Loaded by index.html and team.html.
   =================================================================== */

/* Cover the page from the very first paint so nothing flashes before the intro mounts */
html.acpa-intro-pending::before {
    content: '';
    position: fixed;
    inset: 0;
    background: #040404;
    z-index: 2147483646;
}

html.acpa-intro-lock,
html.acpa-intro-lock body {
    overflow: hidden !important;
}

#acpa-intro {
    --gold: #C5A059;
    --gold-light: #E6C786;
    --ink: #040404;
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    background:
        radial-gradient(ellipse at 50% 38%, rgba(197, 160, 89, 0.14) 0%, transparent 55%),
        radial-gradient(circle at 15% 85%, rgba(197, 160, 89, 0.07) 0%, transparent 40%),
        radial-gradient(circle at 88% 12%, rgba(230, 196, 134, 0.06) 0%, transparent 38%),
        var(--ink);
    color: #F9F8F4;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* index.html ships a global `* { max-width: 100% }` that clamps the glow/ring layers to the seal width; neutralise it inside the intro */
#acpa-intro *,
#acpa-intro *::before,
#acpa-intro *::after { box-sizing: border-box; max-width: none; }

#acpa-intro .ai-dust {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.9;
}

/* ---------- Stage switching ---------- */
#acpa-intro .ai-stage {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    transition: opacity 0.9s ease, transform 0.9s cubic-bezier(0.22, 1, 0.36, 1), filter 0.9s ease;
}

#acpa-intro .ai-welcome { opacity: 1; }
#acpa-intro .ai-disclaimer {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(40px) scale(0.98);
}

#acpa-intro.is-disclaimer .ai-welcome {
    opacity: 0;
    transform: translateY(-30px) scale(1.04);
    filter: blur(6px);
    pointer-events: none;
}
#acpa-intro.is-disclaimer .ai-disclaimer {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
}

/* ---------- Welcome: the seal ---------- */
/* NOTE: no grid/place-items here. Absolutely-positioned children of a centred grid shrink-to-fit instead of
   stretching to their insets, which produced a clipped, hard-edged glow and mis-sized rings. */
#acpa-intro .ai-seal {
    position: relative;
    flex: 0 0 auto;
    width: clamp(120px, min(46vw, 31vh), 250px);
    aspect-ratio: 1;
    margin-bottom: clamp(16px, 4vmin, 34px);
}

#acpa-intro .ai-glow {
    position: absolute;
    inset: -45%;
    background: radial-gradient(circle, rgba(197, 160, 89, 0.34) 0%, rgba(197, 160, 89, 0.08) 38%, transparent 66%);
    opacity: 0;
    animation: ai-glow 3.2s ease-out 0.2s forwards, ai-breathe 4s ease-in-out 3.4s infinite;
}

#acpa-intro .ai-spin {
    position: absolute;
    inset: -5%;
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent 0 60%, rgba(230, 199, 134, 0.95) 85%, transparent 100%);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1px));
    opacity: 0;
    animation: ai-fade 1s ease 0.9s forwards, ai-rotate 5s linear 0.9s infinite;
}

#acpa-intro .ai-rings {
    position: absolute;
    left: -5%;
    top: -5%;
    width: 110%;
    height: 110%;
    overflow: visible;
}
#acpa-intro .ai-rings circle {
    fill: none;
    stroke: var(--gold);
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}
#acpa-intro .ai-rings .r1 {
    stroke-width: 1.2;
    stroke-dasharray: 302;
    stroke-dashoffset: 302;
    animation: ai-draw 1.9s cubic-bezier(0.65, 0, 0.25, 1) 0.35s forwards;
}
#acpa-intro .ai-rings .r2 {
    stroke-width: 0.6;
    opacity: 0.55;
    stroke-dasharray: 2 5;
    stroke-dashoffset: 0;
    animation: ai-fade 1s ease 1.6s forwards;
    opacity: 0;
}

#acpa-intro .ai-logo-wrap {
    position: absolute;
    inset: 0;
}
#acpa-intro .ai-logo {
    /* Explicit box (not grid/auto) so the artwork and the shimmer mask line up exactly.
       The artwork is wider than tall (536x466) and its circle spans the full height, so a 109%-wide box
       makes the circle ~0.92 of the seal, leaving a clear gap inside the 1.06 ring. */
    position: absolute;
    left: -4.5%;
    top: -4.5%;
    width: 109%;
    height: 109%;
    max-width: none;
    object-fit: contain;
    mix-blend-mode: screen;   /* drops the PNG's faint near-black backing so no box shows on the dark page */
    opacity: 0;
    transform: scale(0.55) rotate(-8deg);
    filter: blur(14px);
    animation: ai-logo-in 1.6s cubic-bezier(0.16, 1, 0.3, 1) 0.7s forwards;
}
/* Gold light sweeping across the seal, clipped to the logo's own shape */
#acpa-intro .ai-shine {
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 35%, rgba(255, 244, 214, 0.95) 50%, transparent 65%);
    background-size: 260% 100%;
    background-position: 160% 0;
    -webkit-mask: var(--ai-logo-mask) center / 109% auto no-repeat;
    mask: var(--ai-logo-mask) center / 109% auto no-repeat;
    mix-blend-mode: screen;
    opacity: 0;
    animation: ai-shine 1.9s ease-in-out 2.1s forwards, ai-shine 1.9s ease-in-out 5.6s infinite;
}

/* ---------- Welcome: copy ---------- */
#acpa-intro .ai-eyebrow {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5em;
    text-transform: uppercase;
    color: var(--gold);
    padding-left: 0.5em;
    opacity: 0;
    transform: translateY(10px);
    animation: ai-rise 1s ease 1.5s forwards;
}

#acpa-intro .ai-title {
    font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    font-weight: 500;
    font-size: clamp(2rem, 6.4vmin, 4rem);
    line-height: 1.12;
    text-align: center;
    margin: 12px 0 0;
    color: #fff;
}
#acpa-intro .ai-title .w {
    display: inline-block;
    overflow: hidden;
    vertical-align: bottom;
    padding: 0 0.12em 0.14em;
    margin: 0 -0.12em -0.14em;
}
#acpa-intro .ai-title .w > span {
    display: inline-block;
    transform: translateY(115%);
    animation: ai-word 1.1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: calc(1.7s + var(--i) * 0.14s);
}
#acpa-intro .ai-title em {
    font-style: italic;
    background: linear-gradient(90deg, #C5A059, #F1D8A0, #C5A059);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: ai-gradient 4s linear infinite;
}

#acpa-intro .ai-rule {
    width: 0;
    height: 1px;
    margin: 20px auto 16px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    animation: ai-rule 1.4s cubic-bezier(0.65, 0, 0.25, 1) 2.5s forwards;
}

#acpa-intro .ai-tagline {
    font-size: clamp(0.78rem, 1.7vmin, 0.95rem);
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: #bdb6a6;
    font-weight: 300;
    padding-left: 0.32em;
    text-align: center;
    opacity: 0;
    animation: ai-rise 1s ease 2.9s forwards;
}
#acpa-intro .ai-sub {
    margin-top: 10px;
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #6f6a60;
    text-align: center;
    opacity: 0;
    animation: ai-rise 1s ease 3.2s forwards;
}

#acpa-intro .ai-loader {
    position: absolute;
    left: 50%;
    bottom: clamp(28px, 7vh, 64px);
    width: min(220px, 52vw);
    height: 2px;
    transform: translateX(-50%);
    background: rgba(197, 160, 89, 0.16);
    border-radius: 2px;
    overflow: hidden;
}
#acpa-intro .ai-loader::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    transform-origin: left center;
    transform: scaleX(0);
    animation: ai-load var(--ai-welcome-ms, 4600ms) cubic-bezier(0.4, 0, 0.2, 1) 0.2s forwards;
}

/* ---------- Disclaimer card ---------- */
#acpa-intro .ai-card {
    position: relative;
    width: min(760px, 100%);
    max-height: min(88vh, 760px);
    max-height: min(88dvh, 760px);
    display: flex;
    flex-direction: column;
    background: linear-gradient(160deg, rgba(22, 22, 22, 0.96) 0%, rgba(8, 8, 8, 0.98) 100%);
    border: 1px solid rgba(197, 160, 89, 0.38);
    border-radius: 18px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.85), 0 0 60px rgba(197, 160, 89, 0.12);
    overflow: hidden;
}
#acpa-intro .ai-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 12%;
    right: 12%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

#acpa-intro .ai-card-head {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 22px 26px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
#acpa-intro .ai-card-head img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    flex-shrink: 0;
}
#acpa-intro .ai-card-kicker {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--gold);
}
#acpa-intro .ai-card-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 500;
    color: #fff;
    line-height: 1.15;
    margin: 2px 0 0;
}

#acpa-intro .ai-card-body {
    padding: 18px 26px 6px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 13.5px;
    line-height: 1.7;
    color: #b9b3a6;
    font-weight: 300;
    scrollbar-width: thin;
    scrollbar-color: rgba(197, 160, 89, 0.4) transparent;
}
#acpa-intro .ai-card-body p { margin: 0 0 12px; }
#acpa-intro .ai-card-body strong { color: #e9e1cf; font-weight: 600; }
#acpa-intro .ai-card-body ol {
    list-style: none;
    margin: 4px 0 12px;
    padding: 0;
    counter-reset: ai;
}
#acpa-intro .ai-card-body li {
    counter-increment: ai;
    position: relative;
    padding: 0 0 0 34px;
    margin-bottom: 10px;
}
#acpa-intro .ai-card-body li::before {
    content: counter(ai);
    position: absolute;
    left: 0;
    top: 2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid rgba(197, 160, 89, 0.5);
    color: var(--gold);
    font-size: 11px;
    font-weight: 600;
    display: grid;
    place-items: center;
}
#acpa-intro .ai-note {
    font-size: 11.5px;
    color: #7c766a;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 10px;
    margin-top: 6px !important;
}

#acpa-intro .ai-card-foot {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    flex-wrap: wrap;
    padding: 16px 26px 22px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(0, 0, 0, 0.35);
}
#acpa-intro .ai-btn {
    appearance: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    padding: 13px 28px;
    border-radius: 9999px;
    white-space: nowrap;
    transition: all 0.3s ease;
}
#acpa-intro .ai-btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
#acpa-intro .ai-btn-gold {
    border: none;
    color: #000;
    background: linear-gradient(135deg, #C5A059 0%, #d9bb7c 50%, #C5A059 100%);
    box-shadow: 0 6px 24px rgba(197, 160, 89, 0.35);
}
#acpa-intro .ai-btn-gold:hover { transform: translateY(-2px); box-shadow: 0 10px 34px rgba(197, 160, 89, 0.55); }
#acpa-intro .ai-btn-ghost {
    background: transparent;
    color: #C5A059;
    border: 1.5px solid rgba(197, 160, 89, 0.5);
}
#acpa-intro .ai-btn-ghost:hover { background: rgba(197, 160, 89, 0.12); border-color: var(--gold); }

/* Declined state */
#acpa-intro .ai-declined { display: none; text-align: center; padding: 34px 26px 8px; }
#acpa-intro .ai-declined h3 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.7rem;
    font-weight: 500;
    color: #fff;
    margin: 0 0 8px;
}
#acpa-intro .ai-declined p { font-size: 13.5px; line-height: 1.7; color: #b9b3a6; font-weight: 300; margin: 0 auto 18px; max-width: 440px; }
#acpa-intro.is-declined .ai-declined { display: block; }
#acpa-intro.is-declined .ai-card-body,
#acpa-intro.is-declined .ai-card-head { display: none; }

/* Re-opened from the footer (read-only) */
#acpa-intro.is-reopen { background: rgba(4, 4, 4, 0.9); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
#acpa-intro.is-reopen .ai-welcome,
#acpa-intro.is-reopen .ai-dust { display: none; }

/* ---------- Exit: gold curtains part to reveal the site ---------- */
#acpa-intro .ai-curtain {
    position: absolute;
    left: 0;
    right: 0;
    height: 50%;
    background: #040404;
    z-index: 5;
    pointer-events: none;
    transform: scaleY(0);
    transition: transform 0.85s cubic-bezier(0.76, 0, 0.24, 1);
}
#acpa-intro .ai-curtain.top { top: 0; transform-origin: top center; border-bottom: 1px solid rgba(197, 160, 89, 0.7); }
#acpa-intro .ai-curtain.bottom { bottom: 0; transform-origin: bottom center; border-top: 1px solid rgba(197, 160, 89, 0.7); }

#acpa-intro.is-exit .ai-curtain { transform: scaleY(1); }
#acpa-intro.is-exit-open { background: transparent; }
#acpa-intro.is-exit-open > .ai-stage,
#acpa-intro.is-exit-open > .ai-dust { opacity: 0 !important; visibility: hidden; }
#acpa-intro.is-exit-open .ai-curtain { transform: scaleY(0); transition-duration: 1s; transition-delay: 0.1s; }
#acpa-intro.is-exit-open .ai-curtain.top { transform-origin: top center; }
#acpa-intro.is-exit-open .ai-curtain.top  { transform: translateY(-100%) scaleY(1); }
#acpa-intro.is-exit-open .ai-curtain.bottom { transform: translateY(100%) scaleY(1); }

/* ---------- Keyframes ---------- */
@keyframes ai-glow { 0% { opacity: 0; transform: scale(0.6); } 60% { opacity: 1; } 100% { opacity: 0.85; transform: scale(1); } }
@keyframes ai-breathe { 0%, 100% { opacity: 0.85; transform: scale(1); } 50% { opacity: 0.55; transform: scale(1.06); } }
@keyframes ai-fade { to { opacity: 1; } }
@keyframes ai-rotate { to { transform: rotate(360deg); } }
@keyframes ai-draw { to { stroke-dashoffset: 0; } }
@keyframes ai-logo-in {
    0% { opacity: 0; transform: scale(0.55) rotate(-8deg); filter: blur(14px); }
    60% { opacity: 1; }
    100% { opacity: 1; transform: scale(1) rotate(0); filter: blur(0); }
}
@keyframes ai-shine {
    0% { opacity: 1; background-position: 160% 0; }
    100% { opacity: 1; background-position: -60% 0; }
}
@keyframes ai-rise { to { opacity: 1; transform: none; } }
@keyframes ai-word { to { transform: translateY(0); } }
@keyframes ai-rule { to { width: min(260px, 60vw); } }
@keyframes ai-gradient { to { background-position: 200% 0; } }
@keyframes ai-load { to { transform: scaleX(1); } }

/* ---------- Small screens ---------- */
@media (max-width: 520px) {
    #acpa-intro .ai-card-head { padding: 16px 18px 12px; }
    #acpa-intro .ai-card-body { padding: 14px 18px 4px; font-size: 13px; }
    #acpa-intro .ai-card-foot { padding: 12px 18px 16px; }
    #acpa-intro .ai-card-foot .ai-btn { flex: 1 1 100%; text-align: center; }
    #acpa-intro .ai-eyebrow { letter-spacing: 0.34em; }
}

/* ---------- Reduced motion: no flourish, just the content ---------- */
@media (prefers-reduced-motion: reduce) {
    #acpa-intro .ai-dust,
    #acpa-intro .ai-spin,
    #acpa-intro .ai-shine,
    #acpa-intro .ai-glow { display: none; }
    #acpa-intro .ai-rings .r1 { animation: none; stroke-dashoffset: 0; }
    #acpa-intro .ai-logo,
    #acpa-intro .ai-eyebrow,
    #acpa-intro .ai-tagline,
    #acpa-intro .ai-sub { animation: none; opacity: 1; transform: none; filter: none; }
    #acpa-intro .ai-title .w > span { animation: none; transform: none; }
    #acpa-intro .ai-rule { animation: none; width: min(260px, 60vw); }
    #acpa-intro .ai-loader::after { animation: none; transform: scaleX(1); }
    #acpa-intro .ai-stage,
    #acpa-intro .ai-curtain { transition-duration: 0.01s; }
}
