/*
 * Prota Sample Projects — component styles.
 *
 * Fully scoped under .prota-sample-projects and .prota-gallery-*.
 * Does not override global theme typography or layout rules.
 */

/* -----------------------------------------------------------------------
   CSS custom properties (scoped to the component root)
------------------------------------------------------------------------ */

.prota-sample-projects {
    --sp-accent:        #E11B22;
    --sp-accent-hover:  #9F151A;
    --sp-accent-light:  rgba(225, 27, 34, 0.06);
    --sp-text:          #111827;
    --sp-text-body:     #374151;
    --sp-text-muted:    #6b7280;
    --sp-border:        #DCDDDE;
    --sp-surface:       #ffffff;
    --sp-white:         #ffffff;
    --sp-error-text:    #b91c1c;
    --sp-error-bg:      #fef2f2;
    --sp-error-border:  #fecaca;
    --sp-radius-sm:     2px;
    --sp-radius:        2px;
    --sp-radius-lg:     2px;
    --sp-shadow-card:   none;
    --sp-shadow-hover:  4px 4px 0 0 rgba(157, 158, 162, 1);
    --sp-ease:          cubic-bezier(0.4, 0, 0.2, 1);
}

/* -----------------------------------------------------------------------
   Root container
------------------------------------------------------------------------ */

.prota-sample-projects {
    width: 100%;
    box-sizing: border-box;
    color: var(--sp-text-body);
    font-family: 'Inter', system-ui, sans-serif;
}

.prota-sample-projects *,
.prota-sample-projects *::before,
.prota-sample-projects *::after {
    box-sizing: inherit;
}

/* -----------------------------------------------------------------------
   Section header
------------------------------------------------------------------------ */

.prota-sample-projects__header {
    margin-bottom: 40px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--sp-border);
}

.prota-sample-projects__header {
    display: none;
}

.prota-sample-projects__subheading {
    font-size: 0.9375rem;
    color: var(--sp-text-muted);
    margin: 0;
    max-width: 640px;
    line-height: 1.6;
}

/* -----------------------------------------------------------------------
   Category sections
------------------------------------------------------------------------ */

.prota-sample-projects__category {
    margin-bottom: 56px;
}

.prota-sample-projects__category:last-of-type {
    margin-bottom: 0;
}

.prota-sample-projects__category-title {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-family: 'Oxanium', sans-serif;
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--sp-text);
    margin: 0 0 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--sp-border);
}

.prota-sample-projects__category-count {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--sp-text-muted);
}

/* -----------------------------------------------------------------------
   Responsive grid — 3 col > 960px, 2 col 600–960px, 1 col < 600px
------------------------------------------------------------------------ */

.prota-sample-projects__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

@media (max-width: 960px) {
    .prota-sample-projects__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 599px) {
    .prota-sample-projects__grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* -----------------------------------------------------------------------
   Project card
------------------------------------------------------------------------ */

.prota-sample-projects__card {
    display: flex;
    flex-direction: column;
    background: var(--sp-white);
    border: 1px solid var(--sp-border);
    border-radius: var(--sp-radius);
    overflow: hidden;
    box-shadow: 4px 4px 0 0 rgba(157, 158, 162, 0);
    transition: box-shadow 0.2s var(--sp-ease);
}

.prota-sample-projects__card:hover {
    box-shadow: var(--sp-shadow-hover);
}

/* -----------------------------------------------------------------------
   Thumbnail — fixed 16 : 10 aspect ratio
------------------------------------------------------------------------ */

.prota-sample-projects__thumbnail {
    position: relative;
    width: 100%;
    padding-top: 62.5%; /* 10 / 16 = 0.625 */
    overflow: hidden;
    background: var(--sp-surface);
    flex-shrink: 0;
}

.prota-sample-projects__thumbnail img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s var(--sp-ease);
}

.prota-sample-projects__card:hover .prota-sample-projects__thumbnail img {
    transform: scale(1.04);
}

.prota-sample-projects__thumb-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(140deg, #f1f5f9 0%, #e2e8f0 100%);
}

.prota-sample-projects__thumb-icon {
    width: 48px;
    height: 48px;
    color: #94a3b8;
    opacity: 0.7;
}

/* -----------------------------------------------------------------------
   Card body
------------------------------------------------------------------------ */

.prota-sample-projects__body {
    padding: 18px 20px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.prota-sample-projects__title {
    font-family: 'Oxanium', sans-serif;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--sp-text);
    margin: 0;
    line-height: 1.45;
}

/* -----------------------------------------------------------------------
   Meta row — storeys and file size
------------------------------------------------------------------------ */

.prota-sample-projects__meta-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.prota-sample-projects__meta-item {
    font-size: 0.8125rem;
    color: var(--sp-text-muted);
    font-variant-numeric: tabular-nums;
}

.prota-sample-projects__meta-sep {
    font-size: 0.75rem;
    color: #d1d5db;
    line-height: 1;
}

/* -----------------------------------------------------------------------
   Code badges
------------------------------------------------------------------------ */

.prota-sample-projects__codes {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: auto;
    padding-top: 4px;
}

.prota-sample-projects__badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--sp-white);
    border: 1px solid #DCDDDE;
    border-radius: 2px;
    padding: 4px 10px;
    font-size: 0.6875rem;
    line-height: 1.5;
    white-space: nowrap;
}

.prota-sample-projects__badge-label {
    font-family: 'Oxanium', sans-serif;
    color: var(--sp-text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.6rem;
}

.prota-sample-projects__badge-value {
    color: var(--sp-text);
    font-weight: 700;
}

/* -----------------------------------------------------------------------
   Card footer — buttons
------------------------------------------------------------------------ */

.prota-sample-projects__footer {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid #DCDDDE;
    background: var(--sp-white);
}

/* View Images (secondary) */
.prota-sample-projects__gallery-btn {
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 0 24px;
    background: transparent;
    color: var(--sp-text);
    border: 2px solid var(--sp-text);
    border-radius: 2px;
    font-family: 'Oxanium', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    white-space: nowrap;
    min-width: 120px;
    justify-content: center;
}

.prota-sample-projects__gallery-btn:hover {
    background: var(--sp-text);
    color: var(--sp-white);
}

.prota-sample-projects__gallery-btn:focus-visible {
    outline: 2px solid var(--sp-accent);
    outline-offset: 2px;
}

/* Download (primary) */
.prota-sample-projects__button {
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 0 24px;
    background: #E11B22;
    color: var(--sp-white);
    border: 2px solid #E11B22;
    border-radius: 2px;
    font-family: 'Oxanium', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
    white-space: nowrap;
    min-width: 120px;
    justify-content: center;
    text-decoration: none;
}

.prota-sample-projects__button:hover:not(:disabled) {
    background: #9F151A;
    border-color: #9F151A;
    color: var(--sp-white);
}

.prota-sample-projects__button:focus-visible {
    outline: 2px solid var(--sp-accent);
    outline-offset: 2px;
}

.prota-sample-projects__button.is-loading,
.prota-sample-projects__button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Inline download error */
.prota-sample-projects__download-error {
    width: 100%;
    font-size: 0.78rem;
    color: var(--sp-error-text);
    margin: 0;
    padding: 0;
}

/* -----------------------------------------------------------------------
   Empty / error states
------------------------------------------------------------------------ */

.prota-sample-projects--empty,
.prota-sample-projects__empty {
    padding: 40px 24px;
    border-radius: var(--sp-radius);
    text-align: center;
    font-size: 0.9375rem;
    background: var(--sp-surface);
    color: var(--sp-text-muted);
    border: 1px solid var(--sp-border);
}

.prota-sample-projects--error .prota-sample-projects__error,
.prota-sample-projects__error {
    padding: 14px 18px;
    border-radius: var(--sp-radius-sm);
    font-size: 0.875rem;
    background: var(--sp-error-bg);
    color: var(--sp-error-text);
    border: 1px solid var(--sp-error-border);
}

/* -----------------------------------------------------------------------
   Gallery modal — single-image lightbox with prev / next
------------------------------------------------------------------------ */

/* Body scroll lock — added by JS when modal opens */
body.prota-gallery-open {
    overflow: hidden;
}

.prota-gallery-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.prota-gallery-modal {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1000px;
    max-height: calc(100svh - 32px);
    outline: none;
}

/* Header bar: caption + counter + close */
.prota-gallery-modal__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px 10px 16px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--sp-radius) var(--sp-radius) 0 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: none;
    flex-shrink: 0;
}

.prota-gallery-modal__caption {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    text-transform: capitalize;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.prota-gallery-modal__counter {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.5);
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.prota-gallery-modal__close {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--sp-radius-sm);
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.125rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.prota-gallery-modal__close:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.prota-gallery-modal__close:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}

/* Body: prev button + image + next button */
.prota-gallery-modal__body {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-height: 0;
    background: rgba(0, 0, 0, 0.5);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    padding: 16px 8px;
}

.prota-gallery-modal__nav {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.375rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.prota-gallery-modal__nav:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

.prota-gallery-modal__nav:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.prota-gallery-modal__nav:disabled {
    opacity: 0.25;
    cursor: default;
}

.prota-gallery-modal__image-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.prota-gallery-modal__image {
    display: block;
    max-width: 100%;
    max-height: calc(100svh - 180px);
    object-fit: contain;
    border-radius: 2px;
}

/* Footer: caption text */
.prota-gallery-modal__footer {
    flex-shrink: 0;
    text-align: center;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 0 0 var(--sp-radius) var(--sp-radius);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: none;
}

.prota-gallery-modal__caption-text {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
    text-transform: capitalize;
}

/* Mobile adjustments */
@media (max-width: 599px) {
    .prota-gallery-modal__nav {
        width: 32px;
        height: 32px;
        font-size: 1.125rem;
    }

    .prota-gallery-modal__image {
        max-height: calc(100svh - 160px);
    }

    .prota-gallery-modal__body {
        gap: 4px;
        padding: 12px 4px;
    }
}
