/* =============================================================================
   BrochureHub - Main Stylesheet (Refactored)

   Breakpoints:
   - Desktop large: > 1200px
   - Desktop: 901px - 1200px
   - Tablet: 601px - 900px
   - Mobile: <= 600px

   Touch devices get mobile-style buttons regardless of width
   ============================================================================= */

/* =============================================================================
   CSS Custom Properties
   ============================================================================= */
:root {
    /* Colors */
    --color-accent: #0078d4;
    --color-accent-hover: #005fa3;
    --color-success: #4caf50;
    --color-success-hover: #3d8f42;
    --color-danger: #c00;
    --color-dark: #2b2b2b;
    --color-light: #f7f7f7;
    --color-text: #222;
    --color-text-light: #ccc;
    --color-white: #fff;
    --color-overlay: rgba(0, 0, 0, 0.82);

    /* Sizing */
    --card-size: 200px;
    --card-size-featured: 340px;
    --header-height: 180px;
    --content-max-width: 1200px;
    --content-padding: 2rem;

    /* Spacing */
    --gap-large: 3rem;
    --gap-medium: 1.5rem;
    --gap-small: 1rem;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 300ms ease;
}

/* =============================================================================
   Base Reset & Body
   ============================================================================= */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    height: 100%;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--color-light);
    color: var(--color-text);
    line-height: 1.5;
    overflow-x: hidden;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* =============================================================================
   Header
   ============================================================================= */
.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: 200px 1fr 280px;
    align-items: center;
    gap: var(--gap-small);
    background: var(--color-dark);
    color: var(--color-white);
    padding: 0.75rem 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    height: var(--header-height);
}

.site-logo {
    height: 120px;
    width: auto;
    object-fit: contain;
}

.partner-logo {
    max-height: 90px;
    width: auto;
    object-fit: contain;
    display: block;
}

.header-title {
    justify-self: center;
    text-align: center;
    margin: 0;
    font-size: 2.6rem;
    font-weight: 700;
    color: var(--color-white);
    line-height: 1.3;
    max-width: min(70ch, 90%);
    word-break: break-word;
    overflow-wrap: anywhere;
    letter-spacing: 0.02em;
}

/* =============================================================================
   Main Content Layout
   ============================================================================= */
.content-row {
    display: grid;
    grid-template-columns: var(--card-size-featured) 1fr;
    align-items: start;
    gap: var(--gap-large);
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 2rem var(--content-padding) 0;
}

/* When no featured card, center the grid */
.content-row > .grid:only-child {
    grid-column: 1 / -1;
    justify-self: center;
}

/* =============================================================================
   Card Grid
   ============================================================================= */
.grid {
    display: grid;
    grid-template-columns: repeat(3, var(--card-size));
    gap: var(--gap-medium);
}

/* =============================================================================
   Card Base
   ============================================================================= */
.card {
    position: relative;
    width: var(--card-size);
    background: var(--color-white);
    border-radius: 8px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18);
}

.thumb {
    width: var(--card-size);
    height: var(--card-size);
    overflow: hidden;
    background: var(--color-white);
    transition: transform var(--transition-slow);
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.card .info {
    padding: 0.6rem 0.8rem 0.9rem;
    text-align: center;
    min-height: 3.2rem;
}

.card .card-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.2;
    word-break: break-word;
}

/* =============================================================================
   Featured Card
   ============================================================================= */
.featured-card {
    --card-size: var(--card-size-featured);
    position: relative;
    width: var(--card-size);
    z-index: 2;
}

.featured-card .thumb {
    width: var(--card-size-featured);
    height: var(--card-size-featured);
}

/* Featured ribbon */
.featured-card .ribbon {
    position: absolute;
    top: 0.6rem;
    left: -0.6rem;
    width: 120px;
    height: 120px;
    overflow: hidden;
    z-index: 4;
    pointer-events: none;
}

.featured-card .ribbon span {
    position: absolute;
    display: block;
    width: 170px;
    padding: 0.4rem 0;
    background: var(--color-danger);
    color: var(--color-white);
    text-align: center;
    font-weight: 800;
    text-transform: uppercase;
    transform: rotate(-45deg);
    top: 18px;
    left: -26px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

/* =============================================================================
   Desktop Hover Overlay
   ============================================================================= */
.overlay-side {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: var(--color-overlay);
    color: var(--color-white);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    padding: 0.6rem;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(12px);
    transition:
        opacity var(--transition-normal),
        transform var(--transition-normal),
        visibility 0s linear 250ms;
}

/* Regular card hover */
.card:not(.featured-card):hover .thumb {
    transform: translateX(-100%);
}

.card:not(.featured-card):hover .overlay-side {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0);
    transition-delay: 0s;
}

/* Featured card hover - overlay fades in over entire card */
.featured-card .overlay-side {
    left: 0;
    transform: none;
    transition:
        opacity var(--transition-slow),
        visibility 0s linear 300ms;
}

.featured-card:hover .overlay-side {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
}

.featured-card:hover .thumb {
    transform: none;
}

/* Overlay button layout */
.overlay-side .button-group {
    width: 100%;
    max-width: 160px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    text-align: center;
}

.overlay-side .btn,
.overlay-side .btn-download {
    width: 100%;
    padding: 0.7rem 1rem;
    font-size: 0.95rem;
    text-align: center;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

/* =============================================================================
   Buttons
   ============================================================================= */
.btn {
    text-decoration: none;
    background: var(--color-accent);
    color: var(--color-white);
    padding: 1rem 2.2rem;
    border-radius: 10px;
    display: inline-block;
    font-size: 1.2rem;
    font-weight: 600;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
    transition: transform var(--transition-fast), background var(--transition-fast);
}

.btn:hover {
    background: var(--color-accent-hover);
    transform: scale(1.08);
}

.btn-download {
    background: var(--color-success);
}

.btn-download:hover {
    background: var(--color-success-hover);
}

/* =============================================================================
   Mobile Action Buttons (hidden by default)
   ============================================================================= */
.actions-mobile {
    display: none;
    padding: 0.6rem;
    gap: 0.6rem;
    justify-content: center;
    flex-wrap: wrap;
    align-items: center;
    text-align: center;
}

/* =============================================================================
   Banner
   ============================================================================= */
.banner-outer {
    margin-top: auto;
    display: flex;
    justify-content: flex-end;
    width: 100%;
    padding-right: 2rem;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.collection-banner {
    background: var(--color-danger);
    color: var(--color-white);
    padding: 1.2rem 1.5rem;
    border-radius: 8px;
    max-width: 420px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
}

.collection-banner h3 {
    margin: 0 0 0.3rem 0;
    font-size: 1.2rem;
    font-weight: 700;
}

.collection-banner p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

.collection-banner a {
    color: var(--color-white);
    font-weight: 700;
    text-decoration: underline;
}

.collection-banner a:hover {
    color: #ffefef;
}

/* =============================================================================
   Footer
   ============================================================================= */
.site-footer {
    text-align: center;
    color: var(--color-text-light);
    background: var(--color-dark);
    padding: 1.2rem 0.75rem;
    font-size: 0.9rem;
}

/* =============================================================================
   RESPONSIVE: Desktop Large (> 1200px)
   ============================================================================= */
@media (min-width: 1201px) {
    .header-title {
        font-size: 2.8rem;
        max-width: 75%;
    }
}

/* =============================================================================
   RESPONSIVE: Desktop XL (1440p+, > 1600px)
   ============================================================================= */
@media (min-width: 1601px) {
    :root {
        --card-size: 280px;
        --card-size-featured: 476px;
        --content-max-width: 1600px;
        --content-padding: 3rem;
    }

    .overlay-side .button-group {
        max-width: 220px;
        gap: 0.75rem;
    }

    .overlay-side .btn,
    .overlay-side .btn-download {
        padding: 1rem 1.8rem;
        font-size: 1.15rem;
    }
}

/* =============================================================================
   RESPONSIVE: Desktop XXL (4K, > 2200px)
   ============================================================================= */
@media (min-width: 2201px) {
    :root {
        --card-size: 320px;
        --card-size-featured: 544px;
        --content-max-width: 1900px;
        --content-padding: 4rem;
    }

    .overlay-side .button-group {
        max-width: 250px;
        gap: 1rem;
    }

    .overlay-side .btn,
    .overlay-side .btn-download {
        padding: 1.2rem 2rem;
        font-size: 1.25rem;
    }
}

/* =============================================================================
   RESPONSIVE: Desktop (901px - 1200px)
   ============================================================================= */
@media (min-width: 901px) and (max-width: 1200px) {
    :root {
        --content-padding: 2rem;
    }

    .content-row {
        gap: var(--gap-medium);
    }
}

/* =============================================================================
   RESPONSIVE: Tablet (601px - 900px)
   ============================================================================= */
@media (max-width: 900px) {
    :root {
        --header-height: 160px;
        --content-padding: 1.5rem;
    }

    .site-header {
        grid-template-columns: 180px 1fr 240px;
        height: var(--header-height);
    }

    .site-logo {
        height: 90px;
    }

    .partner-logo {
        max-height: 70px;
    }

    .header-title {
        font-size: 1.7rem;
        max-width: min(65ch, 90%);
    }

    /* Stack featured and grid vertically */
    .content-row {
        grid-template-columns: 1fr;
        justify-items: center;
        gap: var(--gap-medium);
    }

    .grid {
        grid-template-columns: repeat(2, var(--card-size));
        justify-content: center;
    }

    /* Banner centered below content on tablet */
    .banner-outer {
        justify-content: center;
        padding-right: 0;
    }
}

/* =============================================================================
   RESPONSIVE: Mobile (<= 600px)
   ============================================================================= */
@media (max-width: 600px) {
    :root {
        --card-size: 160px;
        --card-size-featured: 220px;
        --content-padding: 1rem;
    }

    .site-header {
        height: auto;
        padding: 0.5rem 1rem 1rem;
        grid-template-columns: auto 1fr auto;
        grid-template-rows: auto auto;
        grid-template-areas:
            "left . right"
            "title title title";
        row-gap: 0.5rem;
    }

    .site-logo {
        grid-area: left;
        height: 80px;
    }

    .partner-logo {
        grid-area: right;
        max-height: 60px;
        justify-self: end;
    }

    .header-title {
        grid-area: title;
        font-size: 1.35rem;
        max-width: 100%;
    }

    .content-row {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .featured-card {
        width: var(--card-size-featured);
    }

    .featured-card .thumb {
        width: var(--card-size-featured);
        height: var(--card-size-featured);
    }

    .grid {
        grid-template-columns: repeat(2, var(--card-size));
        gap: var(--gap-small);
    }

    .card {
        width: var(--card-size);
    }

    .thumb {
        width: var(--card-size);
        height: var(--card-size);
    }

    .banner-outer {
        justify-content: center;
    }

    .collection-banner {
        width: calc(100vw - 32px);
        max-width: none;
    }

    .btn,
    .actions-mobile .btn {
        font-size: 0.9rem;
        padding: 0.6rem 1.2rem;
        border-radius: 8px;
    }
}

/* =============================================================================
   RESPONSIVE: Touch Devices (show mobile buttons, hide hover overlay)
   ============================================================================= */
@media (hover: none), (pointer: coarse) {
    .overlay-side {
        display: none !important;
    }

    .actions-mobile {
        display: flex;
    }

    .card:hover .thumb {
        transform: none;
    }
}

/* Desktop with touch capability still needs mobile buttons hidden on non-touch */
@media (max-width: 900px) {
    .overlay-side {
        display: none !important;
    }

    .actions-mobile {
        display: flex;
    }
}

/* =============================================================================
   No Featured Card - Bigger cards on desktop
   ============================================================================= */
@media (min-width: 901px) {
    .content-row > .grid:only-child {
        grid-template-columns: repeat(3, 260px);
    }

    .content-row > .grid:only-child .card,
    .content-row > .grid:only-child .thumb {
        width: 260px;
        height: auto;
    }

    .content-row > .grid:only-child .thumb {
        height: 260px;
    }
}

@media (min-width: 1601px) {
    .content-row > .grid:only-child {
        grid-template-columns: repeat(3, 320px);
    }

    .content-row > .grid:only-child .card,
    .content-row > .grid:only-child .thumb {
        width: 320px;
        height: auto;
    }

    .content-row > .grid:only-child .thumb {
        height: 320px;
    }
}

@media (min-width: 2201px) {
    .content-row > .grid:only-child {
        grid-template-columns: repeat(3, 380px);
    }

    .content-row > .grid:only-child .card,
    .content-row > .grid:only-child .thumb {
        width: 380px;
        height: auto;
    }

    .content-row > .grid:only-child .thumb {
        height: 380px;
    }
}
