/* ==========================================================================
   FreeDigitalHub Design System & Stylesheet
   Benchmark: Modern, Ultra-fast, SEO-friendly, Ad-optimized UI
   ========================================================================== */

:root {
    /* Brand Theme Colors */
    --primary: #1f4e79;
    --primary-dark: #143554;
    --primary-light: #eaf1f7;
    --primary-gradient: linear-gradient(135deg, #1f4e79 0%, #133a61 100%);
    
    --accent: #f59e0b;
    --accent-light: #fef3c7;
    --success: #10b981;
    --success-light: #d1fae5;
    
    /* Backgrounds & Canvas */
    --bg-page: #f8fafc;
    --bg-surface: #ffffff;
    --bg-alt: #f1f5f9;
    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    
    /* Typography */
    --font-heading: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    /* Border Radius System */
    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-full: 9999px;
    
    /* Elevation Shadows */
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.1);
    --shadow-xl: 0 20px 40px rgba(15, 23, 42, 0.14);
    
    /* Layout */
    --container-max: 1240px;
    --header-height: 72px;
}

/* Base Reset & Box Sizing */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    color: var(--text-main);
    background-color: var(--bg-page);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

img, svg {
    display: block;
    max-width: 100%;
    height: auto;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease, opacity 0.2s ease;
}

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
    outline: 3px solid #f59e0b;
    outline-offset: 3px;
}

.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;
}

.mobile-nav-drawer[hidden] {
    display: none;
}

button, input, select, textarea {
    font: inherit;
}

/* Container */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
}

/* Typography Helpers */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.25;
}

/* ==========================================================================
   Network Cross-Promotion Bar
   ========================================================================== */
.network-bar {
    background: #0f172a;
    color: #94a3b8;
    font-size: 0.8125rem;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.network-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.network-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: #cbd5e1;
}

.network-links {
    display: flex;
    align-items: center;
    gap: 18px;
    list-style: none;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 2px;
}

.network-link {
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: color 0.15s ease;
}

.network-link:hover {
    color: #ffffff;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.site-header {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    height: var(--header-height);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease;
}

/* Product detail page header is non-sticky per style reference */
body.page-product .site-header {
    position: relative !important;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    gap: 20px;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: var(--primary-gradient);
    color: #ffffff;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    box-shadow: 0 3px 8px rgba(31, 78, 121, 0.3);
}

.nav-desktop {
    display: flex;
    align-items: center;
    gap: 24px;
    list-style: none;
}

.nav-link {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-muted);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary);
    background: var(--primary-light);
}

.header-search {
    flex: 1;
    max-width: 320px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 9px 16px 9px 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    background: var(--bg-alt);
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(31, 78, 121, 0.12);
}

.search-icon-btn {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-light);
    pointer-events: none;
    font-size: 0.95rem;
}

.mobile-toggle-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--text-main);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    touch-action: manipulation;
}

/* ==========================================================================
   Mobile Nav Drawer (Rendered outside header to avoid stacking bugs)
   ========================================================================== */
.mobile-nav-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.mobile-nav-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.mobile-nav-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 290px;
    height: 100%;
    background: #ffffff;
    z-index: 1999;
    box-shadow: var(--shadow-xl);
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    padding: 24px;
    overflow-y: auto;
}

.mobile-nav-drawer.open {
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.drawer-close-btn {
    background: var(--bg-alt);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
}

.drawer-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.drawer-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    color: var(--text-main);
    background: var(--bg-page);
    transition: background 0.15s ease;
}

.drawer-link:hover {
    background: var(--primary-light);
    color: var(--primary);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero-section {
    background: linear-gradient(180deg, #ffffff 0%, var(--bg-page) 100%);
    padding: 50px 0 35px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.hero-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--primary-light);
    color: var(--primary);
    padding: 6px 16px;
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    font-weight: 700;
    margin-bottom: 18px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hero-title {
    font-size: 2.75rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 14px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.hero-title span {
    color: var(--primary);
}

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 660px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 28px;
}

.hero-search-box {
    max-width: 580px;
    margin: 0 auto 28px;
    display: flex;
    background: #ffffff;
    border: 2px solid var(--border);
    border-radius: var(--radius-full);
    padding: 6px 8px 6px 20px;
    box-shadow: var(--shadow-md);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.hero-search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(31, 78, 121, 0.15);
}

.hero-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    color: var(--text-main);
}

.hero-search-btn {
    background: var(--primary-gradient);
    color: #ffffff;
    border: none;
    padding: 10px 24px;
    border-radius: var(--radius-full);
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.hero-search-btn:hover {
    opacity: 0.92;
}

.hero-perks {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 24px;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.hero-perk-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.hero-perk-icon {
    color: var(--success);
    font-weight: bold;
}

/* ==========================================================================
   Category Chips Horizontal Rail
   ========================================================================== */
.category-rail-section {
    padding: 24px 0;
}

.category-rail {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 4px 0 12px;
    scrollbar-width: thin;
}

.category-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 1px solid var(--border);
    padding: 9px 18px;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.category-chip:hover, .category-chip.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.category-chip .chip-count {
    background: rgba(0, 0, 0, 0.08);
    padding: 2px 7px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
}

.category-chip.active .chip-count {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

/* ==========================================================================
   Card Gallery Grid System (48 / 24 Formula)
   ========================================================================== */
.gallery-section {
    padding: 30px 0 50px;
}

.section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.section-title {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 4px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.product-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
    position: relative;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-hover);
}

.card-media {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #f1f5f9;
    overflow: hidden;
}

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

.product-card:hover .card-img {
    transform: scale(1.03);
}

.card-badge-top {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    gap: 6px;
    z-index: 2;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.badge-pdf {
    background: #e11d48;
    color: #ffffff;
}

.badge-image {
    background: #0284c7;
    color: #ffffff;
}

.badge-png {
    background: #7c3aed;
    color: #ffffff;
}

.badge-free {
    background: #10b981;
    color: #ffffff;
}

.card-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-category {
    font-size: 0.8125rem;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--bg-alt);
}

.card-downloads {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
}

.card-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.875rem;
    padding: 6px 12px;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    transition: background 0.15s ease;
}

.card-action-btn:hover {
    background: var(--primary);
    color: #ffffff;
}

/* ==========================================================================
   Product Detail Page (SEO & Ad Powerhouse)
   ========================================================================== */
.breadcrumbs-nav {
    padding: 16px 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.breadcrumbs-list {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
}

.breadcrumbs-separator {
    color: var(--text-light);
}

.category-filters {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
}

.category-filters label {
    display: grid;
    gap: 5px;
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 700;
}

.category-filters select {
    min-width: 150px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #ffffff;
    color: var(--text-main);
}

.product-layout {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 40px;
    align-items: start;
    margin-bottom: 40px;
}

.preview-container {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    text-align: center;
    position: relative;
}

.preview-image-wrap {
    max-height: 580px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-alt);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.preview-image-wrap img {
    max-height: 560px;
    width: auto;
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
}

.product-info-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.product-header-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary-light);
    color: var(--primary);
    padding: 5px 14px;
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    font-weight: 700;
    align-self: flex-start;
}

.product-h1 {
    font-size: 2.15rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.25;
}

.product-quick-stats {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Download Action Box */
.download-cta-card {
    background: #ffffff;
    border: 2px solid var(--primary-light);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.download-main-btn {
    background: #10b981;
    color: #ffffff;
    border: none;
    padding: 16px 24px;
    border-radius: var(--radius-md);
    font-size: 1.15rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
    transition: transform 0.15s ease, background 0.15s ease;
    width: 100%;
}

.download-main-btn:hover {
    background: #059669;
    transform: translateY(-2px);
}

.specs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    background: var(--bg-alt);
    padding: 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.spec-entry {
    display: flex;
    flex-direction: column;
}

.spec-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
}

.spec-val {
    font-weight: 700;
    color: var(--text-main);
}

.product-description-block {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 30px;
    margin-bottom: 40px;
}

.product-description-block h2 {
    font-size: 1.4rem;
    margin-bottom: 14px;
}

.product-description-block p {
    color: #334155;
    margin-bottom: 16px;
    font-size: 1rem;
    line-height: 1.7;
}

.features-list {
    margin: 16px 0 24px 20px;
    color: #334155;
}

.features-list li {
    margin-bottom: 8px;
}

.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
}

.tag-item {
    background: var(--bg-alt);
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    font-weight: 600;
    transition: background 0.15s ease;
}

.tag-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

/* ==========================================================================
   Ad Slots & Containers
   ========================================================================== */
.ad-slot-container {
    width: 100%;
    margin: 28px auto;
    text-align: center;
    overflow: hidden;
}

.ad-placeholder {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100px;
}

.ad-badge {
    background: #e2e8f0;
    color: #64748b;
    font-size: 0.6875rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: var(--radius-xs);
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.ad-desc {
    font-size: 0.875rem;
    color: #475569;
}

.ad-note {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 4px;
}

/* ==========================================================================
   Pagination Controls
   ========================================================================== */
.pagination-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 36px 0 20px;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 14px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-weight: 600;
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
    transition: all 0.15s ease;
}

.page-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.page-btn.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

/* ==========================================================================
   Footer & Network Ecosystem
   ========================================================================== */
.site-footer {
    background: #0f172a;
    color: #94a3b8;
    margin-top: auto;
    padding: 60px 0 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1.2fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-col-title {
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 18px;
}

.footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 0.9rem;
}

.footer-link:hover {
    color: #ffffff;
}

.footer-sister-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.15s ease;
}

.footer-sister-card:hover {
    background: rgba(255, 255, 255, 0.08);
}

.sister-card-icon {
    font-size: 1.4rem;
}

.sister-card-title {
    color: #ffffff;
    font-weight: 700;
    font-size: 0.9rem;
}

.sister-card-desc {
    color: #64748b;
    font-size: 0.75rem;
}

.footer-bottom {
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8125rem;
    flex-wrap: wrap;
    gap: 16px;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .product-layout {
        grid-template-columns: 1fr;
    }
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .nav-desktop, .header-search {
        display: none;
    }
    .mobile-toggle-btn {
        display: block;
    }
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }
    .hero-title {
        font-size: 2rem;
    }
    .footer-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.7rem;
    }
    .specs-grid {
        grid-template-columns: 1fr;
    }
}
