/* themes/unpack-theme/static/css/global.css */

/* ==========================================================================
   CSS CUSTOM PROPERTIES - SWISS DESIGN SYSTEM
   ========================================================================== */
:root {
    /* Colors */
    --swiss-red: #FF3B30;
    --swiss-black: #111111;
    --swiss-off-white: #F5F5F0;
    --swiss-grid-color: rgba(0, 0, 0, 0.06);
    
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
    
    /* Spacing Scale */
    --spacing-1: 0.25rem;
    --spacing-2: 0.5rem;
    --spacing-3: 0.75rem;
    --spacing-4: 1rem;
    --spacing-5: 1.25rem;
    --spacing-6: 1.5rem;
    --spacing-8: 2rem;
    --spacing-10: 2.5rem;
    --spacing-12: 3rem;
    --spacing-16: 4rem;
    --spacing-20: 5rem;
    --spacing-24: 6rem;
    
    /* Container */
    --container-max: 1400px;
    --container-padding: 1.5rem;
}

@media (min-width: 768px) {
    :root {
        --container-padding: 2rem;
    }
}

@media (min-width: 1280px) {
    :root {
        --container-padding: 3rem;
    }
}

body {
    font-family: var(--font-sans);
    background-color: white;
    color: var(--swiss-black);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   CONTAINER - WIDER
   ========================================================================== */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding-left: var(--container-padding);
    padding-right: var(--container-padding);
}

/* Narrower container for reading content */
.container--narrow {
    max-width: 900px;
}

/* Full width container */
.container--wide {
    max-width: 1600px;
}

main {
    flex: 1;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--swiss-black);
    font-weight: 700;
    line-height: 1.2;
}

a {
    color: var(--swiss-black);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--swiss-red);
}

/* ==========================================================================
   MOBILE OVERFLOW FIX
   ========================================================================== */
html, body {
    overflow-x: clip;
    max-width: 100vw;
}

* {
    box-sizing: border-box;
}

img, video, iframe, embed, object {
    max-width: 100%;
    height: auto;
}

pre, code {
    max-width: 100%;
    overflow-x: auto;
    word-wrap: break-word;
}

table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ==========================================================================
   SMOOTH SCROLLING
   ========================================================================== */
html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.text-center {
    text-align: center;
}

.text-uppercase {
    text-transform: uppercase;
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
.toast-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 14px 20px;
    background: var(--swiss-black);
    color: white;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.toast-notification--visible {
    transform: translateY(0);
    opacity: 1;
}

.toast-notification--success {
    background: #059669;
}

.toast-notification--error {
    background: var(--swiss-red);
}

.toast-notification svg {
    flex-shrink: 0;
}

/* ==========================================================================
   READING PROGRESS BAR
   ========================================================================== */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.reading-progress__bar {
    height: 100%;
    background: var(--swiss-red);
    width: 0;
    transition: width 0.1s linear;
}

/* ==========================================================================
   SCROLL TO TOP BUTTON
   ========================================================================== */
.scroll-to-top {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 48px;
    height: 48px;
    background: var(--swiss-black);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 999;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.scroll-to-top:hover {
    background: var(--swiss-red);
    transform: translateY(-2px);
}

.scroll-to-top--visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ==========================================================================
   TABLE OF CONTENTS ENHANCEMENTS
   ========================================================================== */
.swiss-toc {
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--swiss-grid-color) transparent;
}

.swiss-toc::-webkit-scrollbar {
    width: 4px;
}

.swiss-toc::-webkit-scrollbar-thumb {
    background: var(--swiss-grid-color);
    border-radius: 2px;
}

.swiss-toc__link {
    display: block;
    padding: 8px 0;
    color: #666;
    font-size: 14px;
    border-left: 2px solid transparent;
    padding-left: 16px;
    margin-left: -2px;
    transition: all 0.2s ease;
}

.swiss-toc__link:hover {
    color: var(--swiss-black);
}

.swiss-toc__link--active,
.swiss-toc__item--active > a {
    color: var(--swiss-red) !important;
    border-left-color: var(--swiss-red);
    font-weight: 600;
}

/* ==========================================================================
   CONTENT HIGHLIGHTING
   ========================================================================== */
.content-highlight {
    background: linear-gradient(to right, rgba(255, 59, 48, 0.05), transparent);
    border-left: 2px solid var(--swiss-red);
    margin-left: -16px;
    padding-left: 14px;
    transition: all 0.2s ease;
}

.heading-animated {
    opacity: 0;
    transform: translateX(-20px);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.heading-visible {
    opacity: 1;
    transform: translateX(0);
}

/* ==========================================================================
   CODE BLOCK ENHANCEMENTS
   ========================================================================== */
.code-block-wrapper {
    margin: 1.5rem 0;
    border-radius: 8px;
    overflow: hidden;
    background: #1a1a1a;
    border: 1px solid rgba(255,255,255,0.1);
}

.code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: #111;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.code-block-lang {
    font-size: 12px;
    font-family: var(--font-mono);
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.code-block-copy {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 12px;
    font-family: var(--font-sans);
    color: #888;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.code-block-copy:hover {
    color: white;
    border-color: rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
}

.code-block-wrapper pre {
    margin: 0;
    padding: 16px;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
}

.code-block-wrapper code {
    font-size: 14px;
    line-height: 1.6;
}

/* ==========================================================================
   LIGHTBOX
   ========================================================================== */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.lightbox--active {
    opacity: 1;
    visibility: visible;
}

.lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
}

.lightbox__content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.lightbox__content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.lightbox--active .lightbox__content img {
    transform: scale(1);
}

.lightbox__close {
    position: absolute;
    top: -50px;
    right: 0;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.lightbox__close:hover {
    background: var(--swiss-red);
    transform: rotate(90deg);
}

/* ==========================================================================
   READING MODE
   ========================================================================== */
body.reading-mode {
    background: #fefefe;
}

body.reading-mode .swiss-nav,
body.reading-mode .swiss-footer,
body.reading-mode .swiss-toc,
body.reading-mode .post-actions,
body.reading-mode .ads-banner,
body.reading-mode .announcement-bar {
    display: none !important;
}

body.reading-mode .swiss-post-content {
    max-width: 700px;
    margin: 0 auto;
    font-size: 1.15rem;
    line-height: 1.9;
}

body.reading-mode .container {
    max-width: 800px;
}

/* ==========================================================================
   FORM STYLES
   ========================================================================== */
.input--error {
    border-color: var(--swiss-red) !important;
    box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.1);
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   ANIMATION ON SCROLL
   ========================================================================== */
.swiss-feature-card,
.swiss-tool-card,
.swiss-process-step,
.swiss-testimonial-card {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.swiss-feature-card.animated,
.swiss-tool-card.animated,
.swiss-process-step.animated,
.swiss-testimonial-card.animated {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   POST ACTION BUTTON ACTIVE STATE
   ========================================================================== */
.post-action-btn--active {
    background: var(--swiss-red) !important;
    color: white !important;
    border-color: var(--swiss-red) !important;
}

/* ==========================================================================
   MARQUEE / MOVING BANNER
   ========================================================================== */
.marquee-banner {
    background: var(--swiss-black);
    color: white;
    overflow: hidden;
    padding: 12px 0;
    position: relative;
    width: 100%;
}

.marquee-banner__track {
    display: flex;
    flex-direction: row;
    animation: marquee 30s linear infinite;
    width: fit-content;
}

.marquee-banner__content {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 60px;
    padding-right: 60px;
    white-space: nowrap;
    flex-shrink: 0;
}

.marquee-banner__item {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.marquee-banner__item svg {
    color: var(--swiss-red);
    flex-shrink: 0;
}

@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.marquee-banner:hover .marquee-banner__track {
    animation-play-state: paused;
}

/* ==========================================================================
   LEAD GENERATION FORM
   ========================================================================== */
.lead-section {
    background: linear-gradient(135deg, var(--swiss-black) 0%, #1a1a1a 100%);
    padding: var(--spacing-16) 0;
    position: relative;
    overflow: hidden;
}

.lead-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 60%;
    height: 200%;
    background: var(--swiss-red);
    opacity: 0.05;
    transform: rotate(-15deg);
}

.lead-form-wrapper {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    position: relative;
    z-index: 1;
}

.lead-form-wrapper h2 {
    color: white;
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    margin-bottom: var(--spacing-4);
}

.lead-form-wrapper p {
    color: rgba(255,255,255,0.7);
    font-size: 1.1rem;
    margin-bottom: var(--spacing-8);
}

.lead-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-4);
}

.lead-form__row {
    display: flex;
    gap: var(--spacing-4);
}

.lead-form input {
    flex: 1;
    padding: 16px 20px;
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 4px;
    background: rgba(255,255,255,0.05);
    color: white;
    font-size: 16px;
    transition: all 0.2s ease;
}

.lead-form input::placeholder {
    color: rgba(255,255,255,0.5);
}

.lead-form input:focus {
    outline: none;
    border-color: var(--swiss-red);
    background: rgba(255,255,255,0.1);
}

.lead-form button {
    padding: 16px 40px;
    background: var(--swiss-red);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lead-form button:hover {
    background: #e5352b;
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(255, 59, 48, 0.3);
}

.lead-form__note {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    margin-top: var(--spacing-4);
}

@media (max-width: 640px) {
    .lead-form__row {
        flex-direction: column;
    }
}

/* ==========================================================================
   ADS BANNER
   ========================================================================== */
.ads-banner {
    background: linear-gradient(135deg, #f8f8f8 0%, #fff 100%);
    border: 2px solid var(--swiss-grid-color);
    border-radius: 8px;
    padding: var(--spacing-6);
    margin: var(--spacing-8) 0;
    position: relative;
    overflow: hidden;
}

.ads-banner::before {
    content: 'SPONSORED';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 10px;
    font-weight: 600;
    color: #999;
    letter-spacing: 1px;
}

.ads-banner__content {
    display: flex;
    align-items: center;
    gap: var(--spacing-6);
}

.ads-banner__icon {
    width: 60px;
    height: 60px;
    background: var(--swiss-red);
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ads-banner__text h4 {
    font-size: 1.1rem;
    margin-bottom: var(--spacing-2);
}

.ads-banner__text p {
    font-size: 14px;
    color: #666;
    margin: 0;
}

.ads-banner__cta {
    margin-left: auto;
    padding: 12px 24px;
    background: var(--swiss-black);
    color: white;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.ads-banner__cta:hover {
    background: var(--swiss-red);
    color: white;
}

@media (max-width: 768px) {
    .ads-banner__content {
        flex-direction: column;
        text-align: center;
    }
    
    .ads-banner__cta {
        margin-left: 0;
        width: 100%;
        text-align: center;
    }
}

/* ==========================================================================
   COMPREHENSIVE MOBILE RESPONSIVE FIXES
   ========================================================================== */
@media (max-width: 768px) {
    /* Global mobile fixes */
    html, body {
        overflow-x: hidden !important;
        width: 100%;
        position: relative;
    }
    
    .container {
        padding-left: 16px;
        padding-right: 16px;
    }
    
    /* Post actions mobile */
    .post-actions-bar {
        flex-direction: column;
        gap: 12px;
        padding: 16px;
    }
    
    .post-actions-bar__actions {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        width: 100%;
    }
    
    .post-action-btn {
        padding: 10px 12px;
        font-size: 12px;
        justify-content: center;
    }
    
    .post-action-btn span {
        display: none;
    }
    
    /* Guide info mobile */
    .swiss-guide-info__grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    /* TOC sidebar mobile - hide on small screens */
    .swiss-toc-sidebar {
        display: none;
    }
    
    /* Post layout mobile */
    .swiss-post-layout {
        display: block;
    }
    
    .swiss-post-content {
        padding: 0;
    }
    
    /* Hero section mobile */
    .swiss-hero {
        padding: 60px 0;
    }
    
    .hero__title {
        font-size: clamp(2rem, 10vw, 3rem);
    }
    
    .hero__inner {
        flex-direction: column;
        gap: 40px;
    }
    
    .hero__visual {
        display: none;
    }
    
    .hero__stats {
        flex-direction: column;
        gap: 16px;
    }
    
    /* Section headers mobile */
    .swiss-section__title {
        font-size: clamp(1.5rem, 6vw, 2.5rem);
    }
    
    /* Features grid mobile */
    .swiss-features-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    /* Process grid mobile */
    .swiss-process-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    /* Tools grid mobile */
    .swiss-tools-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    /* Page header mobile */
    .swiss-page-header {
        padding: 40px 0;
    }
    
    .swiss-page-header__title {
        font-size: clamp(1.75rem, 7vw, 2.5rem);
    }
    
    /* Scroll to top mobile position */
    .scroll-to-top {
        bottom: 150px;
        left: 10px;
        width: 44px;
        height: 44px;
    }
    
    /* Toast notification mobile */
    .toast-notification {
        left: 16px;
        right: 16px;
        bottom: 16px;
        width: auto;
    }
    
    /* Lead section mobile */
    .lead-section {
        padding: var(--spacing-12) 0;
    }
    
    .lead-form-wrapper h2 {
        font-size: 1.5rem;
    }
    
    .lead-form button {
        padding: 14px 24px;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .swiss-tools-grid {
        grid-template-columns: 1fr;
    }
    
    .swiss-guide-info__grid {
        grid-template-columns: 1fr;
    }
    
    .post-actions-bar__actions {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .post-action-btn {
        padding: 12px;
    }
    
    /* Related posts mobile */
    .swiss-related-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   POST ACTIONS BAR STYLES
   ========================================================================== */
.post-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--swiss-off-white);
    border-radius: 8px;
    margin-bottom: var(--spacing-8);
    flex-wrap: wrap;
    gap: 16px;
}

.post-actions-bar__label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #666;
}

.post-actions-bar__actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.post-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: white;
    border: 1px solid var(--swiss-grid-color);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--swiss-black);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-sans);
}

.post-action-btn:hover {
    border-color: var(--swiss-black);
    background: var(--swiss-black);
    color: white;
}

.post-action-btn svg {
    flex-shrink: 0;
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */
@media print {
    .swiss-nav,
    .swiss-footer,
    .post-actions-bar,
    .swiss-toc-sidebar,
    .scroll-to-top,
    .toast-notification,
    .ads-banner,
    .lead-section,
    .marquee-banner,
    .announcement-bar,
    .search-modal {
        display: none !important;
    }
    
    .swiss-post-content {
        max-width: 100%;
        padding: 0;
    }
    
    body {
        background: white;
        color: black;
    }
    
    a {
        color: black;
        text-decoration: underline;
    }
}