* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: #F9FAFB;
    color: #111827;
}

/* ================= HEADER ================= */

.header {
    background: white;
    border-bottom: 1px solid #E5E7EB;
    padding: 16px 28px;
}

.header-inner {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Company logo */
.company-logo {
    height: 48px;
}

/* Personal profile block */
.personal-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Avatar */
body.personal-mode .avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #E5E7EB;
}

/* Name */
.personal-name {
    font-size: 22px;
    font-weight: 700;
}

/* Nav */
.nav {
    display: flex;
    gap: 34px;
}

.nav a {
    text-decoration: none;
    color: #6B7280;
    font-size: 15px;
    font-weight: 500;
}

.nav a:hover {
    color: #111827;
}

/* ================= GRID ================= */

.grid {
    width: 100%;
    padding: 28px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 24px;
}

/* ================= CARD ================= */

.card {
    background: white;
    border-radius: 18px;
    padding: 22px;
    border: 1px solid #E5E7EB;
    transition: all 0.25s ease;
    cursor: pointer;
}

.card:hover {
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.card-top {
    display: flex;
    gap: 16px;

    /* prevents logo shift when title grows */
    align-items: flex-start;
}

.app-icon {
    width: 82px;
    height: 82px;
    border-radius: 16px;
    background: #F3F4F6;
    display: flex;
    align-items: center;
    justify-content: center;

    /* removes inline spacing */
    line-height: 0;

    /* prevents tiny Safari gap */
    overflow: hidden;

    /* ✅ fixed width in flex row */
    flex: 0 0 82px;

    /* ✅ prevents shrinking */
    flex-shrink: 0;
}

.app-icon img {
    width: 100%;
    height: 100%;

    /* removes inner white gap */
    object-fit: cover;

    /* important */
    display: block;
}

.card-content {
    display: flex;
    flex-direction: column;
    gap: 4px;

    /* Prevent text from shrinking icon & allow ellipsis */
    min-width: 0;
    flex: 1;
}

.card h3 {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.25;

    /* max 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* tags wrap to next line automatically */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 2px;
}

.tag {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #F3F4F6;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 400;
    color: #374151;
}

.tag svg {
    width: 14px;
    height: 14px;
}

.card p {
    color: #6B7280;
    font-size: 14px;
    margin-top: 10px;
    line-height: 1.6;
}

/* ================= MODE SWITCH ================= */

.company-mode .personal-profile {
    display: none;
}

.personal-mode .company-logo {
    display: none;
}

/* ================= MOBILE ================= */

@media(max-width:768px) {
    .grid {
        grid-template-columns: 1fr;
    }
}

@media(max-width:480px) {
    .tag {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* ================= MODE TOGGLE (HEADER) ================= */

/* default: hide both until JS sets mode (prevents flicker) */
.company-logo,
.personal-profile {
    display: none;
}

/* company mode */
body.company-mode .company-logo {
    display: block;
}

body.company-mode .personal-profile {
    display: none;
}

/* personal mode */
body.personal-mode .company-logo {
    display: none;
}

body.personal-mode .personal-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Desktop nav visible by default */
.nav--desktop {
    display: flex;
    gap: 18px;
    align-items: center;
}

/* Hamburger hidden on desktop */
.hamburger {
    display: none;
    width: 44px;
    height: 44px;
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 12px;
    padding: 10px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    gap: 5px;
    position: relative;
    z-index: 20;
}

.hamburger-icon {
    width: 22px;
    height: 22px;
    color: #111827;
}

/* ================= MOBILE BREAKPOINT ================= */
@media (max-width: 550px) {

    /* Hide Portfolio + Contact (desktop nav) */
    .nav--desktop {
        display: none !important;
    }

    /* Show hamburger */
    .hamburger {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }
}


/* ================= MOBILE MENU (ANIMATED) ================= */

.mobile-menu {
    position: fixed;
    inset: 0;
    z-index: 10000;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transition: opacity 220ms ease, visibility 0s linear 220ms;
}

.mobile-menu.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;

    transition: opacity 220ms ease, visibility 0s linear 0s;
}

.mobile-menu__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

/* Drawer panel */
.mobile-menu__panel {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;

    /* 40% width */
    width: 40vw;
    min-width: 240px;
    max-width: 360px;

    background: #fff;
    border-left: 1px solid #e5e7eb;
    padding: 18px;

    display: flex;
    flex-direction: column;
    gap: 12px;

    transform: translate3d(100%, 0, 0);
    transition: transform 220ms ease;
    will-change: transform;
}

.mobile-menu.is-open .mobile-menu__panel {
    transform: translate3d(0, 0, 0);
}

.mobile-menu__close {
    align-self: flex-end;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #fff;
    cursor: pointer;
    font-size: 18px;
}

.mobile-menu__link {
    display: block;
    padding: 12px 10px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    color: #111827;
    font-size: 14px;
}

.mobile-menu__link:hover {
    background: #f3f4f6;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {

    .mobile-menu,
    .mobile-menu__panel {
        transition: none !important;
    }
}

/* Firefox: prevent showing alt text while image is loading */
img {
    color: transparent;

    /* Remove inline image baseline gap (main cause of top white space) */
    display: block;
}

.project-icon img,
.snap-grid img,
.app-icon img,
.app-logo img {
    color: transparent;
}