/* ═══════════════════════════════════════════════════════════
   PAGE-CERTIFICATES.CSS — a wall of achievements
   Hero with numbers · framed highlights · sticky category filter
   · certificates mounted on a mat (passe-partout) · viewer
   ═══════════════════════════════════════════════════════════ */

.crt-page { width: 100%; max-width: 1500px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
@media (min-width: 640px)  { .crt-page { padding-inline: 1.5rem; } }
@media (min-width: 1024px) { .crt-page { padding-inline: 2rem; } }

/* ── Hero ──────────────────────────────────────────────── */
.crt-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.9rem; padding: 1.25rem 0 2.25rem; }
.crt-h1 {
    font-size: clamp(2.3rem, 6.5vw, 4.4rem); font-weight: 800; letter-spacing: -0.04em; line-height: 1;
    display: flex; align-items: baseline; gap: 0.55rem; color: var(--color-gray-900);
}
.crt-h1-script { position: relative; display: inline-block; font-family: var(--font-designer); font-weight: 400; font-size: 1.1em; letter-spacing: 0; }
.crt-h1-script > span { position: relative; z-index: 1; }
.crt-h1-script svg { position: absolute; width: 108%; left: -4%; height: 42%; bottom: 6%; overflow: visible; }
.crt-lede { max-width: 42rem; color: var(--color-gray-600); font-weight: 500; line-height: 1.7; font-size: clamp(0.92rem, 1.5vw, 1.04rem); }
.crt-stats { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.45rem; margin-top: 0.3rem; max-width: 60rem; }
.crt-stats li {
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.42rem 0.85rem; border-radius: 999px; font-size: 0.76rem; font-weight: 600;
    background: rgba(255,255,255,0.8); border: 1px solid var(--color-gray-100); color: var(--color-gray-600);
}
.crt-stats li strong { font-weight: 800; color: var(--color-gray-900); }
.crt-stats li:first-child { background: var(--color-gray-900); color: #fff; border-color: var(--color-gray-900); }
.crt-stats li:first-child strong { color: var(--color-yellow); }
.crt-stats li[class*="cat-"] { background: var(--cat-bg, #fff); }

/* ── Shared: certificate mounted on a mat ──────────────── */
.crt {
    position: relative; display: flex; flex-direction: column; min-width: 0;
    border-radius: 1.25rem; background: #fff;
    border: 1px solid var(--color-gray-100);
    box-shadow: 0 6px 24px -14px rgba(17,24,39,0.18);
    transition: transform 0.45s cubic-bezier(0.22,1,0.36,1), box-shadow 0.45s ease;
    color: inherit; text-decoration: none;
}
.crt:hover { transform: translateY(-5px); box-shadow: 0 24px 44px -22px rgba(17,24,39,0.35); }
.crt-frame {
    position: relative; display: flex; align-items: center; justify-content: center;
    aspect-ratio: 4 / 3; margin: 0.6rem 0.6rem 0;
    border-radius: 0.85rem; overflow: hidden;
    /* the mat: warm paper with a faint inner bevel */
    background: linear-gradient(160deg, #f8f5ef 0%, #efe9df 100%);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.04), inset 0 2px 6px rgba(0,0,0,0.05);
}
.crt-frame img {
    max-width: 84%; max-height: 82%; width: auto; height: auto; object-fit: contain;
    border-radius: 2px;
    box-shadow: 0 1px 1px rgba(0,0,0,0.08), 0 10px 22px -8px rgba(0,0,0,0.35);
    transition: transform 0.6s cubic-bezier(0.22,1,0.36,1);
}
.crt--port .crt-frame img { max-height: 86%; }
.crt:hover .crt-frame img { transform: scale(1.045); }
.crt-frame::after { /* zoom hint */
    content: ''; position: absolute; right: 0.55rem; bottom: 0.55rem; width: 1.9rem; height: 1.9rem; border-radius: 999px;
    background: rgba(17,24,39,0.78) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.3-4.3M11 8v6M8 11h6'/%3E%3C/svg%3E") center/14px no-repeat;
    opacity: 0; transform: translateY(4px); transition: opacity 0.3s ease, transform 0.3s ease;
}
.crt:hover .crt-frame::after { opacity: 1; transform: none; }
@media (hover: none) { .crt-frame::after { opacity: 0.9; transform: none; } }
.crt--noimg .crt-frame::after { display: none; }
.crt-placeholder { width: 3.5rem; height: 3.5rem; border-radius: 1rem; display: flex; align-items: center; justify-content: center; }

.crt-body { display: flex; flex-direction: column; gap: 0.3rem; padding: 0.8rem 0.95rem 0.95rem; }
.crt-chip {
    align-self: flex-start; display: inline-flex; align-items: center; gap: 0.3rem;
    font-size: 0.62rem; font-weight: 700; letter-spacing: 0.02em; padding: 0.22rem 0.5rem; border-radius: 999px;
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.crt-title { font-size: 0.9rem; font-weight: 800; letter-spacing: -0.01em; line-height: 1.3; color: var(--color-gray-900); }
.crt-meta { font-size: 0.72rem; font-weight: 500; color: var(--color-gray-500); line-height: 1.45; display: flex; flex-wrap: wrap; gap: 0.1rem 0.45rem; }
.crt-date { color: var(--color-gray-400); font-weight: 700; }

/* ── Highlights: real frames on a wall ─────────────────── */
.crt-wall {
    margin: 0 0 3rem; padding: clamp(1.5rem, 4vw, 2.75rem) clamp(1rem, 3vw, 2.25rem) clamp(1.75rem, 4vw, 3rem);
    border-radius: 2rem;
    background:
        radial-gradient(ellipse 80% 60% at 50% 0%, rgba(255,255,255,0.9), transparent 70%),
        linear-gradient(180deg, #ece6db 0%, #e4ddd0 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 20px 50px -35px rgba(0,0,0,0.35);
}
.crt-h2 { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; color: rgba(17,24,39,0.55); text-align: center; margin-bottom: 1.5rem; }
.crt-wall-row { display: grid; gap: clamp(1rem, 2.5vw, 2rem); grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); align-items: start; }
.crt-hl { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 0.75rem; }
.crt-hl figcaption { text-align: center; font-size: 0.78rem; font-weight: 600; color: rgba(17,24,39,0.6); max-width: 18rem; line-height: 1.5; }
/* the framed variant: dark wooden frame + wide mat + a picture-hook shadow */
.crt--framed { width: 100%; background: transparent; border: 0; box-shadow: none; }
.crt--framed:hover { box-shadow: none; transform: translateY(-4px); }
.crt--framed .crt-frame {
    margin: 0; aspect-ratio: 4 / 3.2; border-radius: 4px;
    padding: 0; background: #fbf9f4;
    border: 10px solid #2a2320;
    box-shadow:
        inset 0 0 0 1px rgba(0,0,0,0.25),
        inset 0 0 18px rgba(0,0,0,0.12),
        0 2px 0 #4a3f3a,
        0 26px 40px -18px rgba(0,0,0,0.55);
}
.crt--framed .crt-frame img { max-width: 80%; max-height: 78%; box-shadow: 0 0 0 1px rgba(0,0,0,0.06), 0 4px 10px rgba(0,0,0,0.15); }
.crt--framed .crt-body { align-items: center; text-align: center; padding: 0.85rem 0 0; }
.crt--framed .crt-chip { align-self: center; }
.crt--framed .crt-title { font-size: 0.98rem; }
.crt--framed .crt-meta { justify-content: center; }

/* ── Filter + groups ───────────────────────────────────── */
.crt-filter { margin-bottom: 1.5rem; }
.crt-group { margin-bottom: 2.75rem; }
.crt-group[hidden] { display: none; }
.crt-group-head { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 1.1rem; }
.crt-group-icon { width: 2.3rem; height: 2.3rem; border-radius: 0.75rem; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.crt-group-title { font-size: clamp(1.1rem, 2.2vw, 1.4rem); font-weight: 800; letter-spacing: -0.02em; }
.crt-group-n { font-size: 0.72rem; font-weight: 800; padding: 0.2rem 0.55rem; border-radius: 999px; background: var(--color-gray-900); color: #fff; }
.crt-group-rule { flex: 1; height: 1px; background: linear-gradient(to right, var(--color-gray-200), transparent); }
.crt-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 760px)  { .crt-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1120px) { .crt-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem; } }
@media (max-width: 420px) { .crt-body { padding: 0.7rem 0.7rem 0.8rem; } .crt-title { font-size: 0.82rem; } }
.crt-textlist { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.crt-textlist li {
    display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; font-weight: 700;
    padding: 0.5rem 0.85rem; border-radius: 999px; background: #fff; border: 1px dashed var(--color-gray-300); color: var(--color-gray-700);
}
.crt-textlist li span { font-weight: 500; color: var(--color-gray-500); }

/* ── Viewer additions ──────────────────────────────────── */
.cert-view figcaption { display: flex; flex-direction: column; gap: 0.2rem; }
.cert-view figcaption strong { color: #fff; font-size: 0.95rem; }
.cert-view figcaption span { color: rgba(255,255,255,0.65); font-size: 0.8rem; font-weight: 500; }
.cert-view-count { color: rgba(255,255,255,0.75); font-size: 0.8rem; font-weight: 700; margin-right: auto; padding: 0 0.5rem; }
.pdf-topbar { left: 1rem; }
.cert-nav {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
    width: 3rem; height: 3rem; border-radius: 999px; border: 0; color: #fff; background: rgba(255,255,255,0.12);
    display: flex; align-items: center; justify-content: center; transition: background 0.2s ease;
}
.cert-nav:hover { background: rgba(255,255,255,0.25); }
.cert-nav[hidden] { display: none; }
.cert-prev { left: 1rem; } .cert-next { right: 1rem; }
@media (max-width: 640px) { .cert-nav { top: auto; bottom: 1rem; transform: none; } .cert-prev { left: calc(50% - 3.5rem); } .cert-next { right: calc(50% - 3.5rem); } .pdf-overlay { padding-bottom: 5rem; } }

/* Phones: numbers and highlights become swipeable rows instead of tall stacks */
@media (max-width: 640px) {
    .crt-stats { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; max-width: 100%; padding-bottom: 0.25rem; scrollbar-width: none; margin-inline: -1rem; padding-inline: 1rem; }
    .crt-stats::-webkit-scrollbar { display: none; }
    .crt-stats li { flex: 0 0 auto; }
    .crt-wall { margin-inline: -0.25rem; padding-inline: 0; }
    .crt-wall-row { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 1rem; padding: 0 1rem 0.5rem; scrollbar-width: none; }
    .crt-wall-row::-webkit-scrollbar { display: none; }
    .crt-hl { flex: 0 0 78%; scroll-snap-align: center; }
}

/* Phones: the category chip repeats the group heading and gets truncated — drop it inside groups */
@media (max-width: 640px) { .crt-grid .crt-chip { display: none; } }
