/* ── Cert Gallery Frontend ── */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap');

:root {
    --cg-navy:   #003366;
    --cg-orange: #FF6600;
    --cg-bg:     #F5F7FA;
    --cg-gray:   #666666;
    --cg-light:  #999999;
}

.cg-section {
    padding: 40px 0;
    background: transparent;
    font-family: 'Nunito', sans-serif;
}

.cg-inner {
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
.cg-section-header {
    text-align: center;
    margin-bottom: 48px;
}
.cg-section-header h2 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--cg-navy);
    margin: 0 0 12px;
    line-height: 1.2;
}
.cg-section-header p {
    color: var(--cg-gray);
    max-width: 560px;
    margin: 0 auto;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Cover */
.cg-cover-wrap {
    max-width: 380px;
    margin: 0 auto 48px;
}
.cg-cover-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    overflow: hidden;
}
.cg-cover-card img {
    width: 100%;
    height: auto;
    display: block;
}
.cg-cover-label {
    background: linear-gradient(90deg, #003366, #004488);
    padding: 14px 16px;
    text-align: center;
}
.cg-cover-label p:first-child {
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    margin: 0;
}
.cg-cover-label p:last-child {
    color: rgba(255,255,255,0.8);
    font-size: 0.82rem;
    margin: 2px 0 0;
}

/* Grid */
.cg-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
@media (min-width: 640px)  { .cg-grid { grid-template-columns: repeat(3,1fr); gap: 20px; } }
@media (min-width: 960px)  { .cg-grid { grid-template-columns: repeat(4,1fr); gap: 24px; } }

/* Card */
.cg-card {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}
.cg-card:hover {
    box-shadow: 0 12px 32px rgba(0,0,0,0.18);
    transform: translateY(-4px);
}

/* Thumbnail */
.cg-thumb {
    position: relative;
    aspect-ratio: 3/4;
    overflow: hidden;
    background: #f0f0f0;
}
.cg-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}
.cg-card:hover .cg-thumb img { transform: scale(1.03); }

.cg-no-img-front {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    background: #eef2f8;
    font-size: 2.5rem;
}

/* Hover overlay */
.cg-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,51,102,0.9);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
}
.cg-card:hover .cg-overlay { opacity: 1; }
.cg-overlay-icon {
    width: 44px; height: 44px;
    border: 2px solid #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
}
.cg-overlay span {
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
}

/* Card info */
.cg-card-info {
    padding: 10px 12px;
    background: #fff;
}
.cg-title {
    font-size: 0.78rem;
    color: var(--cg-navy);
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0 0 2px;
}
.cg-patent {
    font-size: 0.75rem;
    color: var(--cg-navy);
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}
.cg-year {
    font-size: 0.72rem;
    color: var(--cg-light);
    margin: 2px 0 0;
}

/* Download All button removed */

/* ── Modal ── */
.cg-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.95);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.cg-modal-backdrop.cg-active {
    opacity: 1;
    pointer-events: all;
}

.cg-modal-container {
    position: relative;
    width: 100%;
    max-width: 900px;
}

.cg-modal-close {
    position: absolute;
    top: -52px; right: 0;
    width: 44px; height: 44px;
    background: rgba(255,255,255,0.1);
    border: none; border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
    color: #fff;
}
.cg-modal-close:hover { background: rgba(255,255,255,0.2); }
.cg-modal-close svg { width: 22px; height: 22px; }

.cg-modal-prev, .cg-modal-next {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    width: 44px; height: 44px;
    background: rgba(255,255,255,0.1);
    border: none; border-radius: 50%;
    cursor: pointer; z-index: 10;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
    color: #fff;
}
.cg-modal-prev { left: -18px; }
.cg-modal-next { right: -18px; }
@media (min-width: 700px) {
    .cg-modal-prev { left: -60px; }
    .cg-modal-next { right: -60px; }
}
.cg-modal-prev:hover, .cg-modal-next:hover { background: rgba(255,255,255,0.2); }
.cg-modal-prev svg, .cg-modal-next svg { width: 22px; height: 22px; }

.cg-modal-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}

.cg-modal-img-wrap {
    position: relative;
    background: #f8f8f8;
}
.cg-modal-img-wrap img {
    width: 100%;
    height: auto;
    max-height: 75vh;
    object-fit: contain;
    display: block;
}
.cg-modal-counter {
    position: absolute;
    top: 14px; right: 14px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    backdrop-filter: blur(4px);
    font-family: 'Nunito', sans-serif;
}

.cg-modal-footer {
    padding: 20px 24px;
    border-top: 1px solid #eee;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #fff;
}
@media (min-width: 560px) {
    .cg-modal-footer { flex-direction: row; align-items: center; }
}

.cg-modal-info h3 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--cg-navy);
    margin: 0 0 6px;
}
.cg-modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--cg-gray);
    font-family: 'Nunito', sans-serif;
}
.cg-modal-meta strong { color: var(--cg-navy); }

/* Download modal button removed */

.cg-modal-hint {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 18px;
    color: rgba(255,255,255,0.5);
    font-size: 0.82rem;
    font-family: 'Nunito', sans-serif;
}
@media (min-width: 640px) { .cg-modal-hint { display: flex; } }
