/**
 * Portfolio / Case Studies — Enterprise Showcase
 */

/* ========== HERO ========== */
.pf-hero {
    min-height: 70vh;
    display: flex;
    align-items: center;
    padding: calc(var(--navbar-height) + 3rem) 0 4rem;
    position: relative;
    overflow: hidden;
}
.pf-hero-orbs {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.pf-hero-orbs::before,
.pf-hero-orbs::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
}
.pf-hero-orbs::before {
    width: 45%;
    height: 45%;
    top: -10%;
    right: -5%;
    background: var(--glow-blue);
}
.pf-hero-orbs::after {
    width: 35%;
    height: 35%;
    bottom: 0;
    left: -5%;
    background: var(--glow-cyan);
}
.pf-hero-inner {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 3rem;
    align-items: center;
}
.pf-hero-title {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.05;
    margin-bottom: 1.25rem;
}
.pf-hero-lead {
    font-size: 1.125rem;
    color: var(--text-secondary);
    line-height: 1.65;
    max-width: 32rem;
    margin-bottom: 2rem;
}
.pf-hero-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.pf-hero-nav a {
    font-size: 0.8125rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-subtle);
    border-radius: 100px;
    color: var(--text-secondary);
    transition: all 0.3s var(--ease-cinematic, ease);
}
.pf-hero-nav a:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    background: rgba(var(--accent-blue-rgb), 0.08);
}
.pf-hero-visual {
    position: relative;
    height: 320px;
}
.pf-float-card {
    position: absolute;
    padding: 1rem 1.25rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    animation: pfFloat 6s ease-in-out infinite;
}
.pf-float-card:nth-child(1) { top: 10%; left: 5%; animation-delay: 0s; }
.pf-float-card:nth-child(2) { top: 40%; right: 0; animation-delay: -2s; }
.pf-float-card:nth-child(3) { bottom: 5%; left: 20%; animation-delay: -4s; }
.pf-float-card strong {
    display: block;
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--accent-cyan);
}
.pf-float-card small {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
@keyframes pfFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* ========== KPI DASHBOARD ========== */
.pf-dashboard {
    padding: var(--section-pad, 5rem) 0;
    background: linear-gradient(180deg, transparent, rgba(var(--accent-blue-rgb), 0.04) 50%, transparent);
}
.pf-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
}
.pf-kpi {
    padding: 1.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    transition: border-color 0.3s, transform 0.3s;
}
.pf-kpi:hover {
    border-color: var(--accent-blue);
    transform: translateY(-3px);
}
.pf-kpi-value {
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
}
.pf-kpi-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    line-height: 1.4;
}
.pf-chart-widget {
    grid-column: span 2;
    grid-row: span 2;
    padding: 1.5rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
}
.pf-chart-widget h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 1rem;
}
.pf-bar-chart {
    flex: 1;
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    min-height: 120px;
}
.pf-bar {
    flex: 1;
    background: linear-gradient(180deg, var(--accent-blue), rgba(var(--accent-blue-rgb), 0.2));
    border-radius: 4px 4px 0 0;
    transform-origin: bottom;
    animation: pfBarGrow 1.2s var(--ease-cinematic, ease) forwards;
    opacity: 0;
}
.pf-bar:nth-child(1) { height: 55%; animation-delay: 0.1s; }
.pf-bar:nth-child(2) { height: 78%; animation-delay: 0.2s; }
.pf-bar:nth-child(3) { height: 45%; animation-delay: 0.3s; }
.pf-bar:nth-child(4) { height: 92%; animation-delay: 0.4s; }
.pf-bar:nth-child(5) { height: 68%; animation-delay: 0.5s; }
.pf-bar:nth-child(6) { height: 85%; animation-delay: 0.6s; }
@keyframes pfBarGrow {
    from { transform: scaleY(0); opacity: 0; }
    to { transform: scaleY(1); opacity: 1; }
}

/* ========== ARCHITECTURE DIAGRAM ========== */
.pf-arch {
    padding: var(--section-pad, 5rem) 0;
}
.pf-arch-canvas {
    position: relative;
    aspect-ratio: 16 / 9;
    max-height: 480px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    overflow: hidden;
}
.pf-arch-canvas.arch-ready .arch-node {
    animation: archNodeIn 0.6s var(--ease-cinematic, ease) backwards;
}
.pf-arch-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
.arch-line {
    stroke: rgba(var(--accent-blue-rgb), 0.25);
    stroke-width: 2;
    fill: none;
    transition: stroke 0.3s, opacity 0.3s;
}
.arch-line-lit {
    stroke: var(--accent-cyan);
    stroke-width: 2.5;
    filter: drop-shadow(0 0 6px var(--glow-cyan));
}
.arch-line-dim { opacity: 0.15; }
.arch-node {
    position: absolute;
    transform: translate(-50%, -50%);
    padding: 0.65rem 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 2;
    min-width: 100px;
}
.arch-node:hover,
.arch-node-active {
    border-color: var(--accent-blue);
    box-shadow: 0 0 24px var(--glow-blue);
    background: rgba(var(--accent-blue-rgb), 0.12);
}
.arch-node.arch-dimmed {
    opacity: 0.35;
}
.arch-node[data-type="user"] { border-color: var(--accent-cyan); }
.arch-node[data-type="database"] { border-color: var(--accent-purple); }
.arch-node[data-type="security"] { border-color: #c9a227; }
@keyframes archNodeIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.arch-node:nth-child(1) { animation-delay: 0.05s; }
.arch-node:nth-child(2) { animation-delay: 0.1s; }
.arch-node:nth-child(3) { animation-delay: 0.15s; }
.arch-node:nth-child(4) { animation-delay: 0.2s; }
.arch-node:nth-child(5) { animation-delay: 0.25s; }
.arch-node:nth-child(6) { animation-delay: 0.3s; }
.arch-node:nth-child(7) { animation-delay: 0.35s; }

/* ========== CASE STUDY BLOCKS ========== */
.pf-case-studies {
    padding: var(--section-pad, 5rem) 0;
}
.pf-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
}
.cs-block {
    margin-bottom: 5rem;
    padding-bottom: 5rem;
    border-bottom: 1px solid var(--border-subtle);
}
.cs-block:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.cs-block-header { margin-bottom: 2.5rem; max-width: 48rem; }
.cs-num {
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-blue);
    letter-spacing: 0.15em;
    margin-right: 0.75rem;
}
.cs-block-title {
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    margin: 0.75rem 0;
}
.cs-block-lead {
    font-size: 1.0625rem;
    color: var(--text-secondary);
    line-height: 1.65;
}
.cs-indicators {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}
.cs-indicator {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.25rem 0.65rem;
    border-radius: 100px;
    background: rgba(var(--accent-blue-rgb), 0.1);
    border: 1px solid rgba(var(--accent-blue-rgb), 0.2);
    color: var(--accent-blue);
}
.cs-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}
.cs-overview-grid dt {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}
.cs-overview-grid dd {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}
.cs-block-body {
    display: grid;
    grid-template-columns: 0.85fr 1.15fr;
    gap: 2.5rem;
    align-items: start;
}
.cs-mockup-stack {
    position: sticky;
    top: calc(var(--navbar-height) + 2rem);
}
.cs-device {
    background: var(--bg-void);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}
.cs-device-laptop {
    padding: 0.75rem;
}
.cs-device-bar {
    display: flex;
    gap: 5px;
    margin-bottom: 0.75rem;
}
.cs-device-bar span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-strong);
}
.cs-device-bar span:nth-child(1) { background: #e57373; }
.cs-device-bar span:nth-child(2) { background: #ffd54f; }
.cs-device-bar span:nth-child(3) { background: #81c784; }
.cs-device-mobile {
    width: 35%;
    height: 80px;
    margin: -2rem 0 0 auto;
    border-radius: 12px;
    position: relative;
    z-index: 2;
    background: linear-gradient(180deg, var(--bg-surface), var(--bg-void));
}
.cs-flow-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}
.cs-flow-card {
    padding: 1.25rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}
.cs-flow-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-cyan);
    margin-bottom: 0.75rem;
}
.cs-flow-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}
.cs-flow-card .cs-sub {
    margin-top: 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.cs-section-label {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}
.cs-impact-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}
.cs-impact-card {
    padding: 1.25rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    border-top: 2px solid var(--accent-blue);
}
.cs-impact-val {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-cyan);
}
.cs-impact-lbl {
    font-size: 0.8125rem;
    font-weight: 600;
    margin: 0.25rem 0 0.5rem;
}
.cs-impact-card p {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Before / After */
.cs-ba-slider {
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
    min-height: 160px;
    margin-bottom: 2rem;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}
.cs-ba-panel {
    grid-area: 1 / 1;
    padding: 1.5rem;
    transition: clip-path 0.1s linear;
}
.cs-ba-before {
    background: var(--bg-surface);
    z-index: 2;
    clip-path: inset(0 50% 0 0);
}
.cs-ba-after {
    background: linear-gradient(135deg, rgba(var(--accent-blue-rgb), 0.08), var(--bg-elevated));
}
.cs-ba-tag {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}
.cs-ba-before .cs-ba-tag { color: #c9a227; }
.cs-ba-after .cs-ba-tag { color: var(--accent-cyan); }
.cs-ba-panel h4 {
    font-size: 1rem;
    margin: 0.5rem 0;
}
.cs-ba-panel p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.55;
}
.cs-ba-divider {
    grid-area: 1 / 1;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.cs-ba-range {
    pointer-events: auto;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: ew-resize;
    position: absolute;
    inset: 0;
    margin: 0;
}

/* Timeline */
.cs-timeline-track {
    display: flex;
    gap: 0;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    margin-bottom: 2rem;
}
.cs-timeline-step {
    flex: 1;
    min-width: 140px;
    padding: 0 1rem 0 0;
    position: relative;
    border-left: 2px solid var(--border-subtle);
    padding-left: 1rem;
    margin-left: 0.5rem;
}
.cs-timeline-dot {
    position: absolute;
    left: -5px;
    top: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-blue);
    box-shadow: 0 0 8px var(--glow-blue);
}
.cs-timeline-phase {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-blue);
    display: block;
    margin-bottom: 0.35rem;
}
.cs-timeline-step p {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.45;
}

/* Tech depth */
.cs-tech-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}
.cs-tech-card {
    padding: 1.25rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}
.cs-tech-wide { grid-column: 1 / -1; }
.cs-tech-card h4 {
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--accent-cyan);
}
.cs-tech-card ul {
    list-style: none;
    padding: 0;
}
.cs-tech-card li {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    padding: 0.35rem 0;
    padding-left: 1rem;
    position: relative;
}
.cs-tech-card li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--accent-blue);
    font-size: 0.75rem;
}
.cs-tech-card p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

/* Accordions */
.cs-accordions { margin-bottom: 2rem; }
.cs-accordion {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    background: var(--bg-surface);
    overflow: hidden;
}
.cs-accordion summary {
    padding: 1rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.2s;
}
.cs-accordion summary::-webkit-details-marker { display: none; }
.cs-accordion summary::after {
    content: '+';
    font-size: 1.25rem;
    color: var(--accent-blue);
    transition: transform 0.2s;
}
.cs-accordion[open] summary::after { transform: rotate(45deg); }
.cs-accordion summary:hover { background: var(--bg-surface-hover); }
.cs-accordion p {
    padding: 0 1.25rem 1.25rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.65;
}

.cs-block-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-subtle);
}

/* ========== PHILOSOPHY ========== */
.pf-philosophy {
    padding: var(--section-pad, 5rem) 0;
    background: linear-gradient(180deg, transparent, rgba(var(--accent-cyan-rgb), 0.04) 50%, transparent);
}
.pf-philosophy-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}
.pf-philo-card {
    padding: 2rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    transition: border-color 0.3s, transform 0.3s;
}
.pf-philo-card:hover {
    border-color: var(--accent-blue);
    transform: translateY(-4px);
}
.pf-philo-card h3 {
    font-family: var(--font-display);
    font-size: 1.0625rem;
    margin-bottom: 0.75rem;
}
.pf-philo-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ========== INDEX GRID (compact) ========== */
.pf-index-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}
.pf-index-card {
    padding: 1.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    transition: all 0.3s;
}
.pf-index-card:hover {
    border-color: var(--accent-blue);
    box-shadow: var(--shadow-md);
}
.pf-index-card h3 {
    font-family: var(--font-display);
    font-size: 1.125rem;
    margin: 0.5rem 0;
}
.pf-index-card p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* ========== DETAIL PAGE ========== */
.pf-detail-hero {
    padding: calc(var(--navbar-height) + 3rem) 0 2rem;
}
.pf-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
    .pf-hero-inner,
    .cs-block-body,
    .pf-detail-grid { grid-template-columns: 1fr; }
    .pf-dashboard-grid { grid-template-columns: repeat(3, 1fr); }
    .pf-chart-widget { grid-column: span 3; grid-row: span 1; }
    .cs-mockup-stack { position: static; }
    .cs-flow-grid,
    .cs-impact-cards,
    .cs-tech-grid,
    .pf-philosophy-grid { grid-template-columns: 1fr; }
    .pf-index-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .pf-dashboard-grid { grid-template-columns: repeat(2, 1fr); }
    .pf-chart-widget { grid-column: span 2; }
    .pf-hero-visual { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .pf-float-card, .pf-bar, .arch-node { animation: none !important; }
    .pf-bar { opacity: 1; }
}
