/* ═══════════════════════════════════════════
   CREDENTIALS — #credentials-root
   Chứng chỉ có bằng chứng kiểm chứng được: ảnh + số chứng chỉ + nút Verify
═══════════════════════════════════════════ */
#credentials-root {
    position: relative;
    background: #000;
    color: #fff;
    font-family: var(--primary-font);
    padding: 90px 24px 110px;
    overflow: hidden;
}

#credentials-root,
#credentials-root *,
#credentials-root *::before,
#credentials-root *::after {
    box-sizing: border-box;
}

#credentials-root .cred-inner {
    max-width: 1100px;
    margin: 0 auto;
    text-align: center;
}

#credentials-root .cred-label {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.35em;
    color: rgba(160, 195, 255, 1);
    margin: 0 0 20px;
}

#credentials-root .cred-title {
    /* Dấu tiếng Việt: nền gradient (background-clip:text) chỉ tô trong hộp nội dung,
       dấu chồng (Ố, Ệ, Ậ…) vượt lên trên hộp nên bị mất màu → trông như bị cắt.
       Nới hộp bằng padding rồi bù margin âm: chữ đủ chỗ, bố cục không đổi. */
    padding-block: 0.22em 0.14em;
    margin-block-start: -0.22em;

    font-size: clamp(30px, 5vw, 48px);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin: 0 0 calc(30px - 0.14em);
    background: linear-gradient(180deg, #fff 30%, rgba(160, 195, 255, 0.7) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Hàng logo đơn vị cấp chứng chỉ — mặc định trắng, hover trả lại màu gốc */
#credentials-root .cred-logos {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 22px 46px;
    list-style: none;
    margin: 0 0 46px;
    padding: 0;
}

#credentials-root .cred-logos li {
    display: flex;
    align-items: center;
}

#credentials-root .cred-logos a {
    display: block;
    border-radius: 6px;
}

#credentials-root .cred-logos img {
    display: block;
    height: 30px;
    width: auto;
    /* brightness(0) làm mọi màu thành đen, invert(1) lật thành trắng đều */
    filter: brightness(0) invert(1);
    opacity: 0.7;
    transition: filter .35s ease, opacity .35s ease, transform .35s ease;
}

/* Logo chữ 1 dòng trông to hơn lockup 2 dòng của PACE ở cùng chiều cao → hạ bớt */
#credentials-root .cred-logos .logo-claude img { height: 25px; }

#credentials-root .cred-logos a:hover img,
#credentials-root .cred-logos a:focus-visible img {
    filter: none;
    opacity: 1;
    transform: translateY(-2px);
}

@media (max-width: 600px) {
    #credentials-root .cred-logos {
        gap: 18px 30px;
        margin-bottom: 34px;
    }
    #credentials-root .cred-logos img { height: 24px; }
    #credentials-root .cred-logos .logo-claude img { height: 20px; }
}

/* ═══════════════════════════════════════════
   LƯỚI CHỨNG CHỈ — 4 cột, mỗi thẻ đúng tỉ lệ A4 dọc (1 : 1.414)
   Mặt trước chỉ có ảnh; hover (chuột) hoặc chạm (mobile) thì lật ra mặt sau.
═══════════════════════════════════════════ */
#credentials-root .cred-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 22px;
    text-align: left;
}

#credentials-root .cred-card {
    position: relative;
    aspect-ratio: 1 / 1.414;      /* chuẩn A4 dọc — mọi thẻ bằng nhau tuyệt đối */
    perspective: 1400px;
    cursor: pointer;
    outline: none;
}

#credentials-root .cred-flip {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform .75s cubic-bezier(.22, 1, .36, 1);
}

/* Lật: hover trên máy có chuột · class .is-flipped do JS gắn khi chạm trên mobile
   · focus-within để người dùng bàn phím cũng đọc được mặt sau */
@media (hover: hover) and (pointer: fine) {
    #credentials-root .cred-card:hover .cred-flip { transform: rotateY(180deg); }
}
#credentials-root .cred-card.is-flipped .cred-flip,
#credentials-root .cred-card:focus-within .cred-flip { transform: rotateY(180deg); }

#credentials-root .cred-face {
    position: absolute;
    inset: 0;
    border-radius: 18px;
    overflow: hidden;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border: 1px solid rgba(255, 255, 255, 0.10);
}

/* ─── MẶT TRƯỚC: ảnh chứng chỉ ─── */
#credentials-root .cred-front {
    background: #0b0b0d;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ảnh không đúng tỉ lệ A4 (ngang, hoặc thiếu chiều cao) → phần trống được lấp
   bằng chính ảnh đó phóng to và làm mờ. Ảnh đúng tỉ lệ A4 thì lớp này bị che kín. */
/* LƯU Ý: biến --shot ở index.html PHẢI dùng đường dẫn tuyệt đối (/assets/...).
   url() trong custom property được trình duyệt giải tương đối với FILE CSS này,
   không phải với trang — viết 'assets/...' sẽ thành /assets/css/assets/... và 404. */
#credentials-root .cred-front::before {
    content: "";
    position: absolute;
    inset: -12%;
    background-image: var(--shot);
    background-size: cover;
    background-position: center;
    filter: blur(34px) saturate(1.25) brightness(.62);
    transform: scale(1.08);
}

#credentials-root .cred-front img {
    position: relative;
    width: 100%;
    height: 100%;
    object-fit: contain;          /* ảnh luôn hiện trọn vẹn, không bị cắt */
    display: block;
}

/* Gợi ý nhỏ để người dùng biết thẻ lật được */
#credentials-root .cred-hint {
    position: absolute;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    padding: 6px 14px;
    border-radius: 100px;
    background: rgba(8, 12, 18, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.82);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    white-space: nowrap;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity .3s ease;
}

#credentials-root .cred-card:hover .cred-hint { opacity: 1; }
@media (hover: none) {
    #credentials-root .cred-hint { opacity: 1; }
}

/* ─── MẶT SAU: thông tin ─── */
#credentials-root .cred-back {
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    padding: 24px 20px;
    background:
        radial-gradient(120% 90% at 50% 0%, rgba(160, 195, 255, 0.14), transparent 70%),
        #0f1218;
    border-color: rgba(160, 195, 255, 0.28);
}

#credentials-root .cred-back .cred-name {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.28;
    color: #fff;
    margin: 0;
}

#credentials-root .cred-back .cred-org {
    font-size: 12.5px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.58);
    margin: 0;
}

#credentials-root .cred-back .cred-meta {
    display: grid;
    gap: 10px;
    margin: 2px 0;
    padding: 14px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.10);
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
    grid-template-columns: 1fr;
}

#credentials-root .cred-back .cred-meta div { display: flex; flex-direction: column; gap: 3px; }

#credentials-root .cred-back .cred-meta dt {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.38);
}

#credentials-root .cred-back .cred-meta dd {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

#credentials-root .cred-back .cred-meta dd.cred-code {
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: rgba(255, 255, 255, 0.74);
    word-break: break-all;
    line-height: 1.4;
}

#credentials-root .cred-actions { display: grid; gap: 8px; }

#credentials-root .cred-verify {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 14px;
    border-radius: 100px;
    background: rgba(160, 195, 255, 0.12);
    border: 1px solid rgba(160, 195, 255, 0.38);
    color: rgba(190, 215, 255, 1);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    text-decoration: none;
    transition: background .3s ease, color .3s ease;
}

#credentials-root .cred-verify:hover,
#credentials-root .cred-verify:focus-visible {
    background: rgba(160, 195, 255, 1);
    color: #000;
    outline: none;
}

#credentials-root .cred-verify svg { flex: none; }

#credentials-root .cred-full {
    text-align: center;
    font-size: 11.5px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.45);
    text-decoration: none;
    padding: 3px;
    transition: color .3s ease;
}

#credentials-root .cred-full:hover,
#credentials-root .cred-full:focus-visible { color: #fff; outline: none; }

/* Viền sáng khi thẻ được chọn bằng bàn phím */
#credentials-root .cred-card:focus-visible .cred-face { border-color: rgba(160, 195, 255, 0.75); }

@media (max-width: 900px) {
    #credentials-root .cred-list { grid-template-columns: repeat(2, 1fr); gap: 18px; }
}

/* Màn hẹp: thẻ 2 cột chỉ rộng ~165px, không đủ chỗ cho mọi trường.
   Giữ lại thứ cần nhất — tên chứng chỉ, ngày cấp, nút xác minh.
   Đơn vị cấp và mã số vẫn còn đầy đủ ở trang /portfolio/ và trong JSON-LD. */
@media (max-width: 620px) {
    #credentials-root .cred-list { gap: 14px; }
    #credentials-root .cred-face { border-radius: 14px; }
    #credentials-root .cred-back { padding: 16px 13px; gap: 8px; justify-content: center; }
    #credentials-root .cred-back .cred-name { font-size: 13.5px; line-height: 1.3; }
    #credentials-root .cred-back .cred-org { display: none; }
    #credentials-root .cred-back .cred-meta div:first-child { display: none; }   /* ẩn dòng mã số */
    #credentials-root .cred-back .cred-meta { padding: 9px 0; gap: 0; }
    #credentials-root .cred-back .cred-meta dd { font-size: 12px; }
    #credentials-root .cred-verify { font-size: 11.5px; padding: 9px 8px; gap: 5px; }
    #credentials-root .cred-verify .v-at { display: none; }                      /* "Xác minh" thay vì "Xác minh tại X" */
    #credentials-root .cred-full { font-size: 10.5px; }
    #credentials-root .cred-hint { font-size: 10.5px; padding: 5px 11px; bottom: 10px; }
}

/* Không lật 3D khi người dùng tắt hiệu ứng chuyển động — chỉ đổi mặt tức thì */
@media (prefers-reduced-motion: reduce) {
    #credentials-root .cred-flip { transition: none; }
}

@media (max-width: 768px) {
    #credentials-root { padding: 60px 20px 80px; }
}
