/* portfolio.css — "Six Service Divisions" section on the home page.
   Animated gradient backdrop, scrolling division ticker, spotlight + tilt cards with a rotating
   accent border, count-up stats. All motion is off for prefers-reduced-motion. */

@property --ang { syntax: '<angle>'; initial-value: 0deg; inherits: false; }

.section-portfolio {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: 110px 40px 100px;
    background: #040406;
}
.pf-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.pf-grid {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(255,215,0,.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,215,0,.05) 1px, transparent 1px);
    background-size: 56px 56px;
    -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 25%, transparent 78%);
            mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 25%, transparent 78%);
    animation: pfGridDrift 40s linear infinite;
}
.pf-blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .5; will-change: transform; }
.pf-blob.b1 { width: 520px; height: 520px; top: -160px; left: -120px; background: radial-gradient(circle, rgba(255,215,0,.30), transparent 68%); animation: pfFloatA 22s ease-in-out infinite alternate; }
.pf-blob.b2 { width: 560px; height: 560px; bottom: -220px; right: -140px; background: radial-gradient(circle, rgba(123,53,194,.34), transparent 68%); animation: pfFloatB 26s ease-in-out infinite alternate; }
.pf-blob.b3 { width: 380px; height: 380px; top: 38%; left: 52%; background: radial-gradient(circle, rgba(100,181,246,.16), transparent 70%); animation: pfFloatA 30s ease-in-out infinite alternate-reverse; }
@keyframes pfGridDrift { to { background-position: 56px 56px, 56px 56px; } }
@keyframes pfFloatA { from { transform: translate3d(0,0,0) scale(1); } to { transform: translate3d(90px,60px,0) scale(1.15); } }
@keyframes pfFloatB { from { transform: translate3d(0,0,0) scale(1.1); } to { transform: translate3d(-80px,-70px,0) scale(.95); } }

.portfolio-inner { position: relative; max-width: 1240px; margin: 0 auto; }

/* ── heading ───────────────────────────────────────────── */
.portfolio-header { max-width: 720px; margin: 0 auto 44px; text-align: center; }
.portfolio-eyebrow {
    display: inline-flex; align-items: center; gap: 14px;
    font-size: 11px; letter-spacing: 5px; text-transform: uppercase; color: var(--gold);
}
.portfolio-eyebrow::before, .portfolio-eyebrow::after {
    content: ''; width: 46px; height: 1px;
}
.portfolio-eyebrow::before { background: linear-gradient(to right, transparent, var(--gold-d)); }
.portfolio-eyebrow::after  { background: linear-gradient(to left,  transparent, var(--gold-d)); }
.portfolio-title {
    margin: 16px 0 14px;
    font-size: clamp(30px, 5vw, 54px); font-weight: 700; line-height: 1.1; letter-spacing: 2px; color: #fff;
}
.portfolio-title span {
    background: linear-gradient(100deg, #fff 0%, var(--gold) 45%, #fff 90%);
    background-size: 220% 100%;
    -webkit-background-clip: text; background-clip: text; color: transparent;
    animation: pfShine 6s linear infinite;
}
@keyframes pfShine { to { background-position: -220% 0; } }
.portfolio-sub { font-size: 14px; line-height: 1.95; color: var(--silver); }

/* ── ticker ────────────────────────────────────────────── */
.pf-marquee {
    position: relative; overflow: hidden; margin: 0 -40px 52px; padding: 14px 0;
    border-block: 1px solid rgba(255,215,0,.14);
    background: rgba(255,215,0,.025);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
            mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.pf-track { display: flex; width: max-content; animation: pfScroll 38s linear infinite; }
.pf-marquee:hover .pf-track { animation-play-state: paused; }
.pf-track span {
    display: inline-flex; align-items: center; gap: 28px; padding-right: 28px; white-space: nowrap;
    font-size: 13px; font-weight: 700; letter-spacing: 5px; text-transform: uppercase; color: rgba(255,255,255,.55);
}
.pf-track span::after { content: '\25C6'; font-size: 9px; color: var(--gold-d); }
@keyframes pfScroll { to { transform: translateX(-50%); } }

/* ── cards ─────────────────────────────────────────────── */
.portfolio-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; perspective: 1400px; }

.div-card {
    --mx: 50%; --my: 50%; --rx: 0deg; --ry: 0deg;
    position: relative; isolation: isolate; overflow: hidden;
    display: flex; flex-direction: column; gap: 14px;
    min-width: 0; padding: 30px 28px 26px;
    border-radius: 18px; text-decoration: none; color: inherit;
    background: linear-gradient(160deg, rgba(20,20,26,.92), rgba(8,8,12,.92));
    border: 1px solid rgba(255,255,255,.07);
    box-shadow: 0 18px 40px rgba(0,0,0,.45);
    transform: translateY(24px) rotateX(var(--rx)) rotateY(var(--ry));
    transform-style: preserve-3d;
    transition: opacity var(--fade-dur) ease calc(var(--i, 0) * 90ms), transform .45s cubic-bezier(.2,.8,.2,1), border-color .35s, box-shadow .35s;
}
.div-card.visible { transform: rotateX(var(--rx)) rotateY(var(--ry)); }
.div-card:hover { border-color: rgba(var(--ac), .45); box-shadow: 0 26px 60px rgba(0,0,0,.6), 0 0 44px rgba(var(--ac), .16); }

/* rotating accent border (masked ring) */
.div-card::before {
    content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; z-index: 2; pointer-events: none;
    background: conic-gradient(from var(--ang), transparent 0 62%, rgba(var(--ac), .95) 80%, transparent 100%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    opacity: 0; transition: opacity .35s; animation: pfSpin 4.5s linear infinite;
}
.div-card:hover::before, .div-card:focus-visible::before { opacity: 1; }
@keyframes pfSpin { to { --ang: 360deg; } }

/* cursor-following spotlight */
.div-card-glow {
    position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: 0; transition: opacity .3s;
    background: radial-gradient(420px circle at var(--mx) var(--my), rgba(var(--ac), .17), transparent 62%);
}
.div-card:hover .div-card-glow { opacity: 1; }

/* top accent bar grows in */
.div-card::after {
    content: ''; position: absolute; left: 0; top: 0; height: 3px; width: 0; z-index: 3;
    background: linear-gradient(90deg, rgba(var(--ac), 1), rgba(var(--ac), 0));
    transition: width .6s cubic-bezier(.2,.8,.2,1);
}
.div-card:hover::after, .div-card.visible::after { width: 100%; }
.div-card.visible:not(:hover)::after { width: 38%; }

.div-card > * { position: relative; z-index: 1; }
.div-card > .div-card-glow { position: absolute; z-index: 0; }

.div-card-watermark {
    position: absolute !important; right: 14px; bottom: -22px; z-index: 0 !important;
    font-size: 150px; font-weight: 700; line-height: 1; letter-spacing: 4px; pointer-events: none;
    color: rgba(var(--ac), .05); transition: color .4s, transform .6s cubic-bezier(.2,.8,.2,1);
    animation: pfBob 7s ease-in-out infinite alternate;
}
.div-card:hover .div-card-watermark { color: rgba(var(--ac), .12); transform: translateY(-10px) scale(1.06); }
@keyframes pfBob { from { transform: translateY(0); } to { transform: translateY(-8px); } }

.div-card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.div-roman {
    display: grid; place-items: center; min-width: 42px; height: 42px; padding: 0 10px;
    font-size: 15px; font-weight: 700; letter-spacing: 1px; color: rgba(var(--ac), 1);
    border: 1px solid rgba(var(--ac), .4); border-radius: 12px; background: rgba(var(--ac), .08);
    transition: background .3s, color .3s, transform .4s cubic-bezier(.2,.8,.2,1);
}
.div-card:hover .div-roman { background: rgba(var(--ac), 1); color: #050505; transform: rotate(-6deg) scale(1.06); }
.div-category { font-size: 10px; letter-spacing: 2.5px; text-transform: uppercase; text-align: right; color: rgba(255,255,255,.45); line-height: 1.5; }

.div-card-name { margin-top: 6px; font-size: 24px; font-weight: 700; letter-spacing: 1px; color: #fff; line-height: 1.2; transition: color .3s; }
.div-card:hover .div-card-name { color: rgba(var(--ac), 1); }
.div-card-desc { flex: 1; font-size: 13px; line-height: 1.9; color: rgba(255,255,255,.62); }

.div-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.08); }
.div-tags { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.div-tags span {
    font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase; padding: 4px 10px; border-radius: 99px;
    color: rgba(255,255,255,.6); border: 1px solid rgba(255,255,255,.14); transition: border-color .3s, color .3s;
}
.div-card:hover .div-tags span { color: rgba(var(--ac), 1); border-color: rgba(var(--ac), .4); }
.div-arrow {
    flex: 0 0 38px; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%;
    border: 1px solid rgba(var(--ac), .4); background: rgba(var(--ac), .08);
    transition: background .3s, transform .35s cubic-bezier(.2,.8,.2,1);
}
.div-arrow svg { width: 18px; height: 18px; fill: rgba(var(--ac), 1); transition: fill .3s; }
.div-card:hover .div-arrow { background: rgba(var(--ac), 1); transform: translateX(4px); }
.div-card:hover .div-arrow svg { fill: #050505; }
.div-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ── stats ─────────────────────────────────────────────── */
.portfolio-stats {
    display: grid; grid-template-columns: repeat(3, 1fr); align-items: stretch;
    margin-top: 40px; overflow: hidden; border-radius: 18px;
    border: 1px solid rgba(255,215,0,.16); background: rgba(255,255,255,.025);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.pstat { position: relative; padding: 30px 20px; text-align: center; transition: background .3s; }
.pstat + .pstat { border-left: 1px solid rgba(255,215,0,.12); }
.pstat:hover { background: rgba(255,215,0,.04); }
.pstat-num { font-size: clamp(22px, 3vw, 34px); font-weight: 700; letter-spacing: 2px; color: var(--gold); text-shadow: 0 0 22px rgba(255,215,0,.3); font-variant-numeric: tabular-nums; }
.pstat-label { margin-top: 8px; font-size: 11px; letter-spacing: 3px; text-transform: uppercase; color: rgba(255,255,255,.5); }
.pstat-rule { display: none; }

/* ── responsive ────────────────────────────────────────── */
@media (max-width: 1040px) {
    .section-portfolio { padding: 90px 28px 84px; }
    .pf-marquee { margin-inline: -28px; }
    .portfolio-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
}
@media (max-width: 680px) {
    .section-portfolio { padding: 70px 16px 64px; }
    .pf-marquee { margin: 0 -16px 36px; padding: 11px 0; }
    .pf-track span { font-size: 11px; letter-spacing: 3px; gap: 20px; padding-right: 20px; }
    .portfolio-header { margin-bottom: 30px; }
    .portfolio-eyebrow { font-size: 10px; letter-spacing: 4px; gap: 10px; }
    .portfolio-eyebrow::before, .portfolio-eyebrow::after { width: 26px; }
    .portfolio-sub { font-size: 13px; line-height: 1.85; }
    .portfolio-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; perspective: none; }
    .div-card { padding: 26px 22px 22px; border-radius: 16px; transform: translateY(20px); }
    .div-card.visible { transform: none; }
    .div-card-name { font-size: 21px; }
    .div-card-watermark { font-size: 110px; }
    .portfolio-stats { grid-template-columns: 1fr; border-radius: 14px; margin-top: 28px; }
    .pstat { padding: 22px 16px; }
    .pstat + .pstat { border-left: 0; border-top: 1px solid rgba(255,215,0,.12); }
}

@media (hover: none) { .div-card:hover { box-shadow: 0 18px 40px rgba(0,0,0,.45); } }
@media (prefers-reduced-motion: reduce) {
    .pf-grid, .pf-blob, .pf-track, .portfolio-title span, .div-card::before, .div-card-watermark { animation: none !important; }
    .div-card, .div-card.visible { transform: none !important; transition: border-color .2s, box-shadow .2s; }
    .pf-marquee { overflow-x: auto; }
}
