/**
 * 08-components.css
 * Version: 4.3.0 - BREAKPOINT UNIFICATION & OWNERSHIP FIXES
 * Updated: April 2026
 *
 * CHANGES IN v4.3.0:
 * ✅ FIXED: All breakpoints unified to max-width:767px / min-width:768px.
 *           Previous values used max-width:768px which overlapped with
 *           min-width:768px, causing both mobile and desktop rules to apply
 *           simultaneously at exactly 768px (iPad Mini portrait).
 *           Affected: .services-grid, .portfolio-grid, .service-icon,
 *           .tag-label, and the main responsive block.
 *
 * ✅ FIXED: Removed max-width:1400px from .services-grid base rule.
 *           03-layout.css v4.3 constrains all content via the container
 *           (width: min(80%, 1400px)). A max-width on the grid inside the
 *           container was redundant — it never did any work.
 *
 * ✅ FIXED: Replaced non-standard min-width:1200px portfolio breakpoint with
 *           the codebase-standard min-width:1024px. The 1200px value was not
 *           part of the breakpoint scale used by 12-responsiveness.css and
 *           03-layout.css (600/768/1024/1440px). The max-width:1200px and
 *           auto-margin rules inside it were also removed — the container
 *           already handles centering and max-width.
 *
 * ✅ FIXED: Removed flex-direction:column from .service-header.
 *           09-page-specific.css (loaded after this file) defines
 *           .service-header as a horizontal flex row (icon left, heading right)
 *           which is the correct layout for index.php usage. The column
 *           direction here was misleading and overridden anyway.
 *
 * ✅ FIXED: Removed duplicate @keyframes spin definition and its
 *           prefers-reduced-motion override. Both this file and
 *           09-page-specific.css defined identical spin keyframes.
 *           09-page-specific.css is the canonical owner — this file's
 *           reduced-motion override of spin was inadvertently affecting
 *           the page-specific loading spinner too.
 *
 * PREVIOUS: v4.2.1 (February 8, 2026) - MOBILE FIXES:
 * ✅ Services grid mobile-first 1fr (no minmax overflow)
 * ✅ min-width:0 on grid items prevents overflow
 * ✅ word-wrap/overflow-wrap on all text elements
 * ✅ Touch targets verified WCAG 2.2 (48px minimum)
 *
 * Components: Service cards, tag clouds, icons, video portfolio
 * Theme: Dark glass v4.0 with neon glow accents
 * WCAG 2.2 AA compliant
 */

/* ============================================
   SERVICE CARDS — Neon Glow Edge
   Mobile-first grid, no minmax() at base level
   ============================================ */

.services-section {
    padding: 4rem 0;
}

/*
 * Base: single column on mobile.
 * FIXED v4.3.0: Removed max-width:1400px — the .container in 03-layout.css
 * already constrains width via min(80%, 1400px). A max-width on the grid
 * inside the container adds no constraint and implies false ownership.
 */
.services-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin: 0 auto;
}

/* FIXED v4.3.0: min-width:768px (was 768px — no change needed here, correct) */
@media (min-width: 768px) {
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ============================================
   SERVICE CARD BASE — Neon Glow Theme
   ============================================ */

.service-card {
    background: rgba(15, 22, 35, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(183, 148, 246, 0.3);
    box-shadow:
        0 0 20px rgba(183, 148, 246, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    padding: 2rem;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    min-width: 0; /* CRITICAL: Prevents grid/flex item overflow */
}

.service-card:hover {
    background: rgba(21, 29, 45, 0.75);
    border-color: rgba(183, 148, 246, 0.5);
    box-shadow:
        0 0 30px rgba(183, 148, 246, 0.3),
        0 0 60px rgba(147, 51, 234, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transform: translateY(-4px);
}

/* Full-width card variant */
.service-card-wide {
    grid-column: 1 / -1;
}

@supports not (backdrop-filter: blur(6px)) {
    .service-card {
        background: rgba(15, 22, 35, 0.95);
    }

    .service-card:hover {
        background: rgba(21, 29, 45, 0.98);
    }
}

/* ============================================
   SERVICE HEADER
   FIXED v4.3.0: Removed flex-direction:column. 09-page-specific.css
   owns this component as a horizontal row (icon + heading side by side)
   which is the correct layout for all current usage. The column direction
   was never rendered — it was overridden by 09-page-specific.css.
   ============================================ */
.service-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

/* ============================================
   SERVICE ICON — Neon Glow Circle
   ============================================ */
.service-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    background: rgba(21, 29, 45, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(183, 148, 246, 0.3);
    box-shadow: 0 0 20px rgba(183, 148, 246, 0.2);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.service-icon svg {
    width: 32px;
    height: 32px;
    fill: none;
    stroke: #b794f6;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.service-card:hover .service-icon {
    background: rgba(183, 148, 246, 0.15);
    box-shadow: 0 0 30px rgba(183, 148, 246, 0.4);
    transform: scale(1.1);
}

/* FIXED v4.3.0: max-width:767px (was 768px) */
@media (max-width: 767px) {
    .service-icon {
        width: 56px;
        height: 56px;
    }

    .service-icon svg {
        width: 28px;
        height: 28px;
    }
}

/* ============================================
   SERVICE CARD TYPOGRAPHY
   ============================================ */
.service-card h3 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--color-text-primary, #e2e8f0);
    text-align: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.service-card h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem;
    color: var(--color-primary-400, #b794f6);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.service-card p {
    color: var(--color-text-secondary, rgba(226, 232, 240, 0.9));
    line-height: 1.7;
    margin-bottom: 1rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ============================================
   SERVICE LIST
   ============================================ */
.service-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem 0;
    flex-grow: 1;
}

.service-list li {
    position: relative;
    padding-left: 1.75rem;
    margin-bottom: 0.75rem;
    color: var(--color-text-secondary, rgba(226, 232, 240, 0.9));
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.service-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--color-primary-400, #b794f6);
    font-weight: 600;
    font-size: 1.125rem;
}

/* Service Card CTA Button */
.service-card .btn {
    margin-top: auto;
    width: 100%;
    text-align: center;
    min-height: 48px; /* WCAG 2.2 touch target */
}

/* ============================================
   TAG CLOUD
   ============================================ */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 2rem;
}

.tag-label {
    padding: 0.75rem 1.5rem;
    background: rgba(15, 22, 35, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(183, 148, 246, 0.2);
    border-radius: 2rem;
    font-size: 0.9375rem;
    color: var(--color-text-secondary, rgba(226, 232, 240, 0.9));
    transition: all 0.3s ease;
    white-space: nowrap;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.tag-label:hover {
    background: rgba(21, 29, 45, 0.75);
    border-color: rgba(183, 148, 246, 0.4);
    color: var(--color-text-primary, #e2e8f0);
    box-shadow: 0 0 15px rgba(183, 148, 246, 0.2);
    transform: translateY(-2px);
}

@supports not (backdrop-filter: blur(4px)) {
    .tag-label {
        background: rgba(15, 22, 35, 0.95);
    }
}

/* FIXED v4.3.0: max-width:767px (was 768px) */
@media (max-width: 767px) {
    .tag-label {
        font-size: 0.85rem;
        padding: 0.5rem 1rem;
        min-height: 48px;
    }
}

/* ============================================
   VIDEO PORTFOLIO COMPONENTS
   ============================================ */

.portfolio-intro {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 2rem;
    font-size: 1.125rem;
    line-height: 1.6;
}

/* ============================================
   PORTFOLIO FILTERS
   ============================================ */
.portfolio-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin: 2rem 0;
    padding: 1rem 0;
}

.filter-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 0.75rem 1.5rem;
    background: rgba(15, 22, 35, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(183, 148, 246, 0.25);
    border-radius: 2rem;
    color: #ddd6fe;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(183, 148, 246, 0.1);
}

.filter-btn:hover {
    background: rgba(21, 29, 45, 0.75);
    border-color: rgba(183, 148, 246, 0.5);
    box-shadow:
        0 0 20px rgba(183, 148, 246, 0.25),
        0 0 40px rgba(147, 51, 234, 0.15);
    transform: translateY(-2px);
}

.filter-btn.active {
    background: rgba(183, 148, 246, 0.2);
    border-color: rgba(183, 148, 246, 0.6);
    box-shadow:
        0 0 25px rgba(183, 148, 246, 0.35),
        0 0 50px rgba(147, 51, 234, 0.2);
}

.filter-btn:focus-visible {
    outline: 3px solid #f97316;
    outline-offset: 2px;
}

@supports not (backdrop-filter: blur(6px)) {
    .filter-btn {
        background: rgba(15, 22, 35, 0.95);
    }
}

/* ============================================
   PORTFOLIO GRID
   FIXED v4.3.0: Replaced non-standard 1200px breakpoint with codebase-
   standard 1024px. Removed max-width:1200px and auto-margin from inside
   that breakpoint — the container in 03-layout.css already handles
   centering and width constraint.
   ============================================ */
.portfolio-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

/* FIXED v4.3.0: min-width:768px (was 768px — no change needed, correct) */
@media (min-width: 768px) {
    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/*
 * FIXED v4.3.0: Changed from non-standard min-width:1200px to the
 * codebase-standard min-width:1024px. Removed max-width:1200px and
 * margin:auto — those are container responsibilities, not grid.
 */
@media (min-width: 1024px) {
    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   PORTFOLIO ITEM
   ============================================ */
.portfolio-item {
    background: rgba(15, 22, 35, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(183, 148, 246, 0.3);
    border-radius: 1rem;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow:
        0 0 20px rgba(183, 148, 246, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    min-width: 0; /* CRITICAL: Prevents grid item overflow */
}

.portfolio-item:hover {
    background: rgba(21, 29, 45, 0.75);
    border-color: rgba(183, 148, 246, 0.5);
    box-shadow:
        0 0 30px rgba(183, 148, 246, 0.3),
        0 0 60px rgba(147, 51, 234, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transform: translateY(-4px);
}

@supports not (backdrop-filter: blur(6px)) {
    .portfolio-item {
        background: rgba(15, 22, 35, 0.95);
    }
}

/* ============================================
   YOUTUBE FACADE
   ============================================ */
.video-facade {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    cursor: pointer;
    overflow: hidden;
    background: #000;
}

.facade-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.video-facade:hover .facade-img {
    transform: scale(1.05);
}

.video-facade:focus-visible {
    outline: 3px solid #f97316;
    outline-offset: 2px;
}

/* ============================================
   PLAY BUTTON
   ============================================ */
.play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: rgba(183, 148, 246, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    pointer-events: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.play-button svg {
    fill: #ffffff;
    width: 40px;
    height: 40px;
    margin-left: 4px; /* Visual centering of play triangle */
}

.video-facade:hover .play-button {
    background: rgba(147, 51, 234, 0.95);
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow:
        0 0 30px rgba(183, 148, 246, 0.6),
        0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Loading State */
.video-facade.loading {
    opacity: 0.7;
    cursor: wait;
}

.video-facade.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid rgba(183, 148, 246, 0.3);
    border-top-color: #b794f6;
    border-radius: 50%;
    /*
     * FIXED v4.3.0: @keyframes spin removed from this file.
     * 09-page-specific.css is the canonical owner of @keyframes spin.
     * Having it defined here too was causing the reduced-motion override
     * in this file's prefers-reduced-motion block to inadvertently
     * suppress the spinner in 09-page-specific.css as well.
     */
    animation: spin 1s linear infinite;
}

/* YouTube iframe (after facade click replaces thumbnail) */
.video-facade iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

/* ============================================
   PORTFOLIO ITEM INFO
   ============================================ */
.portfolio-item-info {
    padding: 1.5rem;
}

.portfolio-item-info h3 {
    font-size: 1.25rem;
    margin: 0 0 0.75rem;
    color: #ddd6fe;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.portfolio-item-info p {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.8);
    margin: 0 0 1rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.portfolio-category {
    display: inline-block;
    padding: 0.375rem 0.875rem;
    background: rgba(183, 148, 246, 0.15);
    border: 1px solid rgba(183, 148, 246, 0.3);
    border-radius: 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #ddd6fe;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   FIXED v4.3.0: max-width:767px throughout (was 768px)
   ============================================ */
@media (max-width: 767px) {
    .services-section {
        padding: 3rem 0;
    }

    .service-card {
        padding: 1.5rem;
    }

    .service-card h3 {
        font-size: 1.5rem;
    }

    .service-card h4 {
        font-size: 1rem;
    }

    .portfolio-filters {
        gap: 0.75rem;
    }

    .filter-btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.9375rem;
        min-width: 48px;
        min-height: 48px;
    }

    .play-button {
        width: 70px;
        height: 70px;
    }

    .play-button svg {
        width: 36px;
        height: 36px;
    }

    .portfolio-item-info h3 {
        font-size: 1.125rem;
    }

    .portfolio-item-info p {
        font-size: 0.875rem;
    }
}

/* Very small screens */
@media (max-width: 360px) {
    .service-card {
        padding: 1.25rem;
    }

    .service-card h3 {
        font-size: 1.375rem;
    }

    .portfolio-item-info {
        padding: 1.25rem;
    }
}

/* ============================================
   ACCESSIBILITY — FOCUS STATES
   ============================================ */
.service-card:focus-within {
    outline: 3px solid var(--color-primary-500, #9333ea);
    outline-offset: 2px;
}

/* ============================================
   ACCESSIBILITY — HIGH CONTRAST
   ============================================ */
@media (prefers-contrast: high) {
    .service-card {
        border-width: 2px;
        border-color: rgba(183, 148, 246, 0.6);
    }

    .service-card:hover {
        border-color: rgba(183, 148, 246, 0.9);
    }

    .service-icon {
        border-width: 2px;
    }

    .filter-btn {
        border-width: 2px;
    }

    .filter-btn.active {
        border-color: #ddd6fe;
        background: rgba(183, 148, 246, 0.4);
    }

    .portfolio-item {
        border-width: 2px;
    }

    .play-button {
        background: rgba(183, 148, 246, 1);
    }
}

/* ============================================
   ACCESSIBILITY — REDUCED MOTION
   NOTE: @keyframes spin is NOT redefined here.
   09-page-specific.css owns spin. Suppression of
   spin animation for reduced-motion is handled there.
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .service-card,
    .service-icon,
    .tag-label,
    .filter-btn,
    .portfolio-item,
    .facade-img,
    .play-button {
        transition: none;
    }

    .service-card:hover {
        transform: none;
    }

    .service-card:hover .service-icon {
        transform: none;
    }

    .video-facade:hover .facade-img {
        transform: none;
    }

    .video-facade:hover .play-button {
        transform: translate(-50%, -50%);
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .service-card {
        background: white;
        border: 1px solid #333;
        box-shadow: none;
        page-break-inside: avoid;
    }

    .service-icon {
        background: white;
        border: 1px solid #333;
    }

    .portfolio-filters {
        display: none;
    }

    .play-button {
        display: none;
    }

    .portfolio-item {
        break-inside: avoid;
        border: 1px solid #000;
        background: #fff;
    }

    .portfolio-item-info {
        color: #000;
    }
}