/* Theme variables (dark default) */
:root {
    --bg: #000000;
    --text: #00ff41;
    --text-alt: #008f11;
    --glow: rgba(0, 255, 65, 0.5);
    --scanline: rgba(18, 16, 16, 0.1);
}

/* Light theme */
[data-theme="light"] {
    --bg: #f5f5dc;
    --text: #1a4d2e;
    --text-alt: #2d5a27;
    --glow: rgba(26, 77, 46, 0.3);
    --scanline: rgba(0, 0, 0, 0.05);
}

/* Map variables to existing CSS variable names used in this file */
:root {
    --color-background: var(--bg);
    --color-on-background: var(--text);
    --color-outline: var(--text);
    --color-primary-container: var(--text);
}

[data-theme="light"] {
    --color-background: var(--bg);
    --color-on-background: var(--text);
}

/* -------------------------------------------------
   Base page styling & utilities
   ------------------------------------------------- */
body {
    background-color: var(--color-background, #131313);
    color: var(--color-on-background, #e2e2e2);
    font-family: 'Space Mono', monospace;
    margin: 0;
    overflow-x: hidden;
}

/* -------------------------------------------------
   Scanlines & vignette overlays (CRT effect)
   ------------------------------------------------- */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(
        to bottom,
        rgba(255,255,255,0),
        rgba(255,255,255,0) 50%,
        rgba(0,0,0,0.2) 50%,
        rgba(0,0,0,0.2)
    );
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.3;
}
.vignette {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle, rgba(0,0,0,0) 60%, rgba(0,0,0,0.8) 100%);
    pointer-events: none;
    z-index: 9998;
}

/* -------------------------------------------------
   Blinking cursor (used in header title)
   ------------------------------------------------- */
.blink {
    animation: blinker 1s step-start infinite;
}
@keyframes blinker {
    50% { opacity: 0; }
}

/* -------------------------------------------------
   Custom scrollbar (matches dark theme)
   ------------------------------------------------- */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #131313;
    border-left: 1px solid #3b4b37;
}
::-webkit-scrollbar-thumb {
    background: #00ff41;
}
::-webkit-scrollbar-thumb:hover {
    background: #69df5c;
}

/* -------------------------------------------------
   Fade‑in for terminal‑like sections
   ------------------------------------------------- */
.terminalFadeIn {
    animation: fadeIn 0.5s ease-in forwards;
    opacity: 0;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* -------------------------------------------------
   Header button styling (home & theme toggle)
   ------------------------------------------------- */
/* The btn-terminal class is no longer used – replaced by .theme-toggle */

/* -------------------------------------------------
   Card hover effects – unchanged
   ------------------------------------------------- */
.card-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.card-hover:hover {
    border-color: var(--color-primary-container, #00ff41);
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.2);
    transform: scale(1.05);
    z-index: 10;
}
.card-hover:hover .exp-label {
    transform: translateY(0);
}

/* --- Label (slides up on hover) --- */
.exp-label {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 20%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    color: #00ff41; /* bright green, always visible */
    transform: translateY(100%);
    transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    border-top: 1px solid #00ff41;
    font-weight: bold;
    letter-spacing: 0.05em;
}

/* Light theme override */
[data-theme="light"] .exp-label {
    background: rgba(255, 255, 255, 0.85);
    color: #1a4d2e; /* dark green for light theme */
    border-top-color: #1a4d2e;
}
/* Image grayscale → colour on hover */
.exp-box-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(100%);
    transition: filter 0.45s;
}
.card-hover:hover .exp-box-img {
    filter: grayscale(0%);
}

/* -------------------------------------------------
   Modal overlay & box
   ------------------------------------------------- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backdrop-filter: blur(10px) brightness(0.6);
    background: rgba(0, 0, 0, 0.3);
    z-index: 200;
}
.modal-overlay.hidden { display: none; }
.modal-overlay.flex   { display: flex; align-items: center; justify-content: center; }

.modal-box {
    position: relative;
    max-width: 650px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    background: var(--color-background, #131313);
    border: 1px solid var(--color-outline-variant, #3b4b37);
    box-shadow: var(--color-outline-variant, #3b4b37), 0 0 15px var(--color-outline-variant, #3b4b37);
    padding: 2rem;
    box-sizing: border-box;
}

/* Close button */
.modal-close-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 30px;
    height: 30px;
    background: #ff3333;
    color: #ffffff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    font-size: 1rem;
    z-index: 10;
    line-height: 1;
    padding: 0;
}
.modal-close-btn:hover {
    filter: brightness(1.2);
}

/* Glowing text inside modal */
.glow-text {
    color: #ff6b6b;
    text-shadow: 0 0 5px rgba(255, 107, 107, 0.4);
}
html[data-theme="light"] .glow-text {
    color: #b30000;
    text-shadow: 0 0 5px rgba(179, 0, 0, 0.3);
}

/* Theme toggle button styling (image icons) */
.theme-toggle {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    border-radius: 0;
    box-shadow: none;
    transition: opacity 0.2s;
}
.theme-toggle img {
    width: 24px;
    height: 24px;
    display: block;
    filter: drop-shadow(0 0 2px var(--glow));
    transition: filter 0.2s, opacity 0.2s;
}
.theme-toggle:hover img {
    filter: drop-shadow(0 0 6px var(--glow)) brightness(1.3);
    opacity: 0.9;
}

/* Icon toggling based on theme */
html[data-theme="dark"] .theme-toggle .icon-light {
    display: none;
}
html[data-theme="light"] .theme-toggle .icon-dark {
    display: none;
}

/* -------------------------------------------------------------------
   Override Tailwind color utilities with CSS variables for theme sync
   ------------------------------------------------------------------- */
/* Background colors */
.bg-background,
.bg-surface-container,
.bg-surface-variant {
    background-color: var(--bg) !important;
}
/* Text colors */
.text-on-background,
.text-primary,
.text-primary-container,
.text-on-primary-container,
.text-outline-variant,
.text-on-surface,
.text-on-surface-variant {
    color: var(--text) !important;
}
/* Border colors */
.border-outline-variant,
.border-primary,
.border-primary-container,
.border {
    border-color: var(--text) !important;
}

/* --- Modal links: turn red on hover --- */
.modal-link:hover {
    color: #ff3333 !important; /* bright red */
}

/* ------------------------------------------------------------------
   Certification list styles (linear view)
   ------------------------------------------------------------------ */
.cert-company {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px dashed var(--text-alt);
}
.cert-company:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.cert-company-heading {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-family: 'Inter', sans-serif; /* new professional font */
    font-size: 3rem;
    font-weight: 700; /* bold */
    color: var(--text);
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em; /* slight tightening for professionalism */
}

.cert-company-logo-img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border: 1px solid var(--text);
    background: #c8e6c9; /* light green – works on both themes */
    padding: 6px;
    flex-shrink: 0;
}

.cert-company-name {
    color: var(--text);
    text-shadow: 0 0 8px var(--glow);
    /* font is inherited from .cert-company-heading */
}

.cert-list {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0 4rem; /* increased indent to align with the text start */
}

.cert-item {
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    color: var(--text);
    padding: 0.25rem 0;
    cursor: pointer;
    transition: color 0.2s, text-shadow 0.2s;
    position: relative;
}

.cert-item:hover {
    color: #ff3333;
    text-shadow: 0 0 8px #ff3333;
}

/* Optional: if you want a subtle indicator that it's clickable */
.cert-item::before {
    content: "› "; /* or use a small arrow */
    opacity: 0.6;
    transition: opacity 0.2s;
}

.cert-item:hover::before {
    opacity: 1;
}

/* --- Certification modal image --- */
.modal-cert-img {
    max-width: 100%;
    max-height: 400px;
    height: auto;
    border: 1px solid var(--text-alt);
    box-shadow: 0 0 12px var(--glow);
    display: block;
    margin: 0 auto;
}

/* -------------------------------------------------
   Windows XP-style modal loading screen
   ------------------------------------------------- */
.xp-loading {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border: 1px solid #0054e3;
    box-shadow: inset 0 0 0 1px #ffffff, 0 5px 20px rgba(0, 0, 0, 0.45);
}

.xp-loading.hidden {
    display: none;
}

.xp-loading-window {
    width: 82%;
    max-width: 340px;
    background: var(--bg);
    border: 1px solid #0054e3;
    border-radius: 4px 4px 0 0;
    box-shadow: 3px 3px 12px rgba(0, 0, 0, 0.35);
    font-family: 'Segoe UI', Tahoma, sans-serif;
    font-size: 14px;
    color: #000;
}

.xp-loading-titlebar {
    background: linear-gradient(90deg, #0054e3, #3a93ff);
    color: #fff;
    padding: 6px 10px;
    font-weight: bold;
    border-radius: 4px 4px 0 0;
    display: flex;
    align-items: center;
}

.xp-loading-body {
    padding: 16px;
}

.xp-loading-track {
    width: 100%;
    height: 20px;
    border: 1px solid #7f9db9;
    background: #fff;
    padding: 1px;
    box-sizing: border-box;
    overflow: hidden;
}

.xp-loading-fill {
    width: 0%;
    height: 100%;
    background: repeating-linear-gradient(
        90deg,
        #00c000 0px,
        #00c000 12px,
        #ffffff 12px,
        #ffffff 16px
    );
    transition: width 0.15s ease;
}

/* ------------------------------------------------------------------
   Other Certifications button — terminal/matrix quirk style
   ------------------------------------------------------------------ */
.other-cert-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    padding: 0.55rem 1.2rem 0.55rem 1.5rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text);
    background: linear-gradient(180deg, rgba(0, 255, 65, 0.08), rgba(0, 0, 0, 0));
    border: 1px solid var(--text);
    text-decoration: none;
    text-shadow: 0 0 6px var(--glow);
    box-shadow: inset 0 0 10px rgba(0, 255, 65, 0.15), 0 0 12px rgba(0, 255, 65, 0.2);
    transition: color 0.2s, border-color 0.2s, box-shadow 0.2s, text-shadow 0.2s,
                transform 0.1s, background 0.2s;
}

.other-cert-button::before {
    content: ">_";
    color: var(--text);
    font-weight: 700;
    opacity: 0.75;
    transition: color 0.2s, opacity 0.2s, text-shadow 0.2s;
}

.other-cert-button::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 2px;
    background: var(--text);
    opacity: 0;
    transition: opacity 0.2s;
}

/* Hover effect — only on devices that support hover */
@media (hover: hover) {
    .other-cert-button:hover {
        color: #ff3333;
        border-color: #ff3333;
        text-shadow: 0 0 10px rgba(255, 51, 51, 0.8);
        box-shadow: inset 0 0 14px rgba(255, 51, 51, 0.2),
                    0 0 18px rgba(255, 51, 51, 0.45);
        background: linear-gradient(180deg, rgba(255, 51, 51, 0.12), rgba(0, 0, 0, 0));
        animation: terminal-glitch 0.25s steps(2) infinite;
    }

    .other-cert-button:hover::before {
        content: ">>";
        color: #ff3333;
        opacity: 1;
        text-shadow: 0 0 8px rgba(255, 51, 51, 0.8);
    }

    .other-cert-button:hover::after {
        opacity: 1;
        background: #ff3333;
        box-shadow: 0 0 8px #ff3333;
    }
}

.other-cert-button:active {
    transform: scale(0.96);
    background: rgba(255, 51, 51, 0.15);
    box-shadow: inset 0 0 8px #ff3333;
}

/* Top placement spacing */
.other-cert-button-top {
    align-self: flex-start;
    margin-bottom: 1rem !important;
}

.other-cert-button-top + .cert-company {
    margin-top: 2rem !important;
}

/* Matrix glitch keyframes */
@keyframes terminal-glitch {
    0% {
        text-shadow: 0 0 10px rgba(255, 51, 51, 0.8),
                     1px 0 #00ff41,
                     -1px 0 #00ff41;
    }
    25% {
        text-shadow: 0 0 10px rgba(255, 51, 51, 0.8),
                     -1px 0 #ff3333,
                     1px 0 #ff3333;
    }
    50% {
        text-shadow: 0 0 12px rgba(255, 51, 51, 1),
                     1px 0 #00ff41,
                     -1px 0 #ff3333;
    }
    75% {
        text-shadow: 0 0 10px rgba(255, 51, 51, 0.8),
                     -1px 0 #00ff41,
                     1px 0 #ff3333;
    }
    100% {
        text-shadow: 0 0 10px rgba(255, 51, 51, 0.8),
                     1px 0 #ff3333,
                     -1px 0 #00ff41;
    }
}

/* ------------------------------------------------------------------
   Refined certification archive
   ------------------------------------------------------------------ */
.top-nav-bar {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    min-height: 56px;
    gap: 0.5rem;
    background: color-mix(in srgb, var(--bg) 90%, transparent);
    border-bottom: 1px solid color-mix(in srgb, var(--text) 35%, transparent);
    backdrop-filter: blur(12px);
}

.top-nav-bar > .theme-toggle:first-child {
    grid-column: 1;
}

.top-nav-bar .header-title-slot {
    grid-column: 2;
    min-width: 0;
}

.top-nav-bar > .theme-toggle:last-child {
    grid-column: 3;
}

.top-nav-bar .header-title {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.certifications-main {
    min-height: 100vh;
    padding: 2.5rem 1.25rem 5rem;
}

.certifications-shell {
    width: min(1120px, 100%);
    margin: 0 auto;
}

.certifications-hero,
.other-certifications-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.8fr);
    align-items: center;
    min-height: 285px;
    padding: clamp(1.4rem, 4vw, 3rem);
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--text) 50%, transparent);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--text) 8%, transparent), transparent 58%),
        radial-gradient(circle at 90% 20%, color-mix(in srgb, var(--text) 14%, transparent), transparent 42%),
        var(--bg);
    box-shadow: 0 0 30px var(--glow), inset 0 0 25px color-mix(in srgb, var(--text) 5%, transparent);
}

.certifications-hero::before,
.certifications-hero::after,
.other-certifications-hero::before,
.other-certifications-hero::after {
    position: absolute;
    width: 28px;
    height: 28px;
    content: "";
    pointer-events: none;
}

.certifications-hero::before,
.other-certifications-hero::before {
    top: -1px;
    left: -1px;
    border-top: 2px solid var(--text);
    border-left: 2px solid var(--text);
}

.certifications-hero::after,
.other-certifications-hero::after {
    right: -1px;
    bottom: -1px;
    border-right: 2px solid var(--text);
    border-bottom: 2px solid var(--text);
}

.certifications-hero-copy,
.other-certifications-hero-copy {
    position: relative;
    z-index: 1;
}

.certifications-kicker,
.certifications-toolbar,
.certifications-stats,
.cert-item,
.other-cert-item {
    color: var(--text-alt);
    font-family: "Space Mono", "Courier New", monospace;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.certifications-kicker {
    margin: 0 0 0.8rem;
    color: var(--text);
    font-size: 0.68rem;
}

.certifications-hero h2,
.other-certifications-hero h2 {
    margin: 0;
    color: var(--text);
    font-family: "Courier Prime", "Courier New", monospace;
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: -0.07em;
    line-height: 0.95;
    text-shadow: 0 0 18px var(--glow);
}

.certifications-lede {
    max-width: 58ch;
    margin: 1.25rem 0 0;
    color: color-mix(in srgb, var(--text) 72%, var(--bg));
    font-size: 0.84rem;
    line-height: 1.8;
}

.certifications-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1.2rem;
    margin-top: 1.5rem;
    font-size: 0.62rem;
}

.certifications-stats strong {
    display: block;
    color: var(--text);
    font-size: 1.15rem;
    letter-spacing: 0;
}

.certifications-ascii-art {
    justify-self: end;
    width: 100%;
    max-width: 480px;
    max-height: 225px;
    margin: 0;
    overflow: hidden;
    color: var(--text);
    font-family: "JetBrains Mono", "Courier New", monospace;
    font-size: clamp(9px, 0.52vw, 6px);
    line-height: 0.95;
    opacity: 0.72;
    text-align: center;
    text-shadow: 0 0 7px var(--glow);
    white-space: pre;
    user-select: none;
}

.certifications-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0 0.75rem;
    border-bottom: 1px dashed color-mix(in srgb, var(--text) 35%, transparent);
    font-size: 0.62rem;
}

.certifications-toolbar .terminal-status-dot {
    width: 7px;
    height: 7px;
    margin-right: 0.35rem;
}

.certification-directory,
.other-certifications-directory {
    margin-top: 1.5rem;
}

.certifications-section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.certifications-section-heading .certifications-kicker {
    margin: 0;
}

.certifications-section-heading h3 {
    margin: 0;
    color: var(--text);
    font-family: "Courier Prime", "Courier New", monospace;
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    letter-spacing: -0.04em;
    text-transform: uppercase;
}

.certification-directory {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.certification-directory > .certifications-section-heading {
    grid-column: 1 / -1;
}

.cert-company {
    min-width: 0;
    margin: 0;
    padding: 1.2rem;
    border: 1px solid color-mix(in srgb, var(--text) 38%, transparent);
    background: linear-gradient(135deg, color-mix(in srgb, var(--text) 7%, transparent), var(--bg));
    transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}

.certification-directory > .cert-company:last-child {
    padding-bottom: 1.2rem;
    border-bottom: 1px solid color-mix(in srgb, var(--text) 38%, transparent);
}

.cert-company:hover {
    border-color: var(--text);
    box-shadow: 0 0 22px color-mix(in srgb, var(--text) 20%, transparent);
    transform: translateY(-3px);
}

.cert-company-heading {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin: 0;
    padding-bottom: 0.9rem;
    border-bottom: 1px dashed color-mix(in srgb, var(--text) 30%, transparent);
    font-family: "Courier Prime", "Courier New", monospace;
    font-size: 1.45rem;
    letter-spacing: -0.04em;
}

.cert-company-logo-img {
    width: 42px;
    height: 42px;
    padding: 5px;
    border: 1px solid color-mix(in srgb, var(--text) 45%, transparent);
    background: #c8e6c9;
}

.cert-company-name {
    color: var(--text);
    text-shadow: 0 0 8px var(--glow);
}

.cert-list {
    display: grid;
    gap: 0.45rem;
    margin: 1rem 0 0;
    padding: 0;
}

.cert-item {
    position: relative;
    padding: 0.75rem 0.8rem;
    border: 1px solid transparent;
    color: var(--text);
    cursor: pointer;
    font-size: 0.72rem;
    line-height: 1.45;
    transition: color 0.2s, border-color 0.2s, background 0.2s, text-shadow 0.2s, transform 0.2s;
}

.cert-item:hover,
.cert-item:focus-visible {
    border-color: color-mix(in srgb, var(--text) 50%, transparent);
    background: color-mix(in srgb, var(--text) 9%, transparent);
    color: var(--text);
    text-shadow: 0 0 8px var(--glow);
    outline: none;
    transform: translateX(3px);
}

.other-cert-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.7rem 1.15rem;
    border: 1px solid var(--text);
    background: color-mix(in srgb, var(--text) 7%, transparent);
    color: var(--text);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-decoration: none;
    text-shadow: 0 0 6px var(--glow);
    transition: background 0.2s, box-shadow 0.2s, color 0.2s, transform 0.2s;
}

.other-cert-button:hover,
.other-cert-button:focus-visible {
    background: var(--text);
    color: var(--bg);
    box-shadow: 0 0 16px var(--glow);
    outline: none;
    transform: translateY(-2px);
}

.modal-overlay {
    inset: 0;
    z-index: 1100;
    padding: clamp(0.7rem, 4vw, 3rem);
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.72);
}

.modal-overlay.flex {
    display: flex;
    align-items: center;
    justify-content: center;
}

html[data-theme="light"] .modal-overlay {
    background: rgba(245, 245, 220, 0.72);
}

.modal-box {
    width: min(820px, 100%);
    max-width: none;
    max-height: min(88vh, 900px);
    margin: auto;
    overflow-y: auto;
    background: var(--bg);
    border-color: color-mix(in srgb, var(--text) 55%, transparent);
    box-shadow: 0 0 40px color-mix(in srgb, var(--text) 22%, transparent);
}

.modal-heading {
    position: sticky;
    top: 0;
    z-index: 2;
    min-height: 52px;
    padding-left: 3.5rem !important;
    background: color-mix(in srgb, var(--bg) 94%, transparent);
    backdrop-filter: blur(10px);
}

.modal-close-btn {
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}

.modal-close-btn:hover,
.modal-close-btn:focus-visible {
    background: #ff5555;
    box-shadow: 0 0 12px rgba(255, 51, 51, 0.65);
    outline: none;
    transform: scale(1.05);
}

.modal-cert-img {
    max-width: min(100%, 680px);
    max-height: 420px;
    margin: 0 auto;
    object-fit: contain;
}

@media (max-width: 768px) {
    html,
    body {
        min-height: 100%;
        height: auto !important;
        overflow-y: auto !important;
    }

    html {
        overflow-x: clip !important;
    }

    body {
        overflow: visible !important;
    }

    body.certification-modal-open .top-nav-bar {
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
    }

    .top-nav-bar {
        position: sticky !important;
        top: 0;
        grid-template-columns: 40px minmax(0, 1fr) 40px;
        padding: 0.75rem 1rem;
    }

    .top-nav-bar .header-title {
        font-size: 0.75rem !important;
        letter-spacing: 0.05em;
    }

    .certifications-main {
        padding: 2rem 0.8rem 3rem;
    }

    .certifications-hero,
    .other-certifications-hero {
        display: block;
        min-height: 0;
        padding: 1.25rem;
    }

    .certifications-hero h2,
    .other-certifications-hero h2 {
        font-size: clamp(1.8rem, 10vw, 2.7rem);
    }

    .certifications-lede {
        font-size: 0.76rem;
    }

    .certifications-ascii-art {
        max-width: 100%;
        max-height: 165px;
        margin-top: 1.5rem;
        font-size: 3px;
        opacity: 0.5;
    }

    .certifications-toolbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.55rem;
    }

    .other-cert-button {
        min-height: 44px;
        padding: 0.7rem 1rem;
        font-size: 0.72rem;
    }

    .certification-directory {
        grid-template-columns: 1fr;
    }

    .certification-directory > .certifications-section-heading {
        grid-column: auto;
    }

    .certifications-section-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.4rem;
    }

    .cert-company-heading {
        font-size: 1.2rem;
    }

    .cert-item {
        padding: 0.8rem 0.65rem;
        font-size: 0.68rem;
    }

    .modal-overlay {
        padding: 0.6rem;
    }

    .modal-box {
        max-height: 94vh;
        padding: 1rem;
    }

    .modal-heading {
        margin: -1rem -1rem 0;
        padding-left: 3rem !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cert-company,
    .cert-item,
    .other-cert-button,
    .modal-close-btn {
        transition: none;
    }
}