/* ==========================================================================
   Profile header — avatar, name, tagline, tech stack, projects button,
   social links and bio text (landing page intro panel).
   ========================================================================== */

.profile-section {
    display: flex;
    align-items: center;
    gap: 2.5rem;
    margin-bottom: var(--space-lg);
}

.profile-avatar {
    width: 140px;
    height: 140px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--accent-dim);
    box-shadow: 0 8px 32px rgba(var(--accent-rgb), 0.1);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--accent-tint-2);
    display: flex;
    align-items: center;
    justify-content: center;
}
.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    flex: 1;
    min-width: 0;
}
.profile-info h1 {
    margin-bottom: 0;
    font-size: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tagline {
    font-size: var(--font-lead);
    color: var(--text-main);
    opacity: 0.9;
}

.tech-stack {
    font-family: var(--font-mono);
    font-size: var(--font-label);
    color: var(--accent);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs) var(--space-md);
    opacity: 0.8;
}
.tech-stack span {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}
.tech-stack span:not(:last-child)::after {
    content: "//";
    color: var(--accent-dim-text);
}

/* ── Header actions: projects button + social column ── */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    flex-shrink: 0;
}

.projects-btn {
    position: relative;
    flex-shrink: 0;
    width: 110px;
    height: 110px;
    margin: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    border-radius: 50%;
    border: 3px solid var(--accent);
    background:
        radial-gradient(circle, rgba(var(--accent-rgb), 0.12), var(--accent-tint-1) 70%),
        var(--glass-bg-strong);
    color: var(--accent);
    text-shadow: 0 0 8px var(--accent-glow);
    box-shadow: 0 0 12px var(--accent-glow), inset 0 0 12px var(--accent-glow);
    transition: all 0.25s ease;
}
.projects-btn::before {
    content: "";
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 2px dashed rgba(var(--accent-rgb), 0.2);
    animation: projects-spin 14s linear infinite;
    pointer-events: none;
    transition: border-color 0.25s ease;
}
.projects-btn svg {
    width: 34px;
    height: 34px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    transition: transform var(--duration-base) ease;
}
.projects-btn span {
    font-family: var(--font-mono);
    font-size: var(--font-xsmall);
    line-height: 1;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-right: -0.15em; /* cancels trailing letter-spacing so the word is truly centered */
}
.projects-btn:hover,
.projects-btn:focus-visible {
    background: var(--accent);
    color: var(--text-on-accent);
    text-shadow: none;
    box-shadow: 0 0 28px var(--accent-glow);
    transform: scale(1.08);
}
.projects-btn:hover::before,
.projects-btn:focus-visible::before { border-color: var(--accent); }
.projects-btn:hover svg { transform: rotate(90deg); }

@keyframes projects-spin {
    to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
    .projects-btn::before { animation: none; }
}

.social-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.9rem;
    position: relative;
    flex-shrink: 0;
}
.social-links::before {
    content: "";
    position: absolute;
    top: 48px;
    bottom: 48px;
    left: 50%;
    width: 3px;
    transform: translateX(-50%);
    background: linear-gradient(to bottom, transparent, var(--accent) 20%, var(--accent) 80%, transparent);
    box-shadow: 0 0 6px var(--accent-glow);
    opacity: 0.2;
    z-index: 0;
}
.social-links a {
    position: relative;
    z-index: 1;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 3px solid var(--accent-dim);
    box-shadow: 0 0 6px var(--accent);
    background:
        radial-gradient(circle, rgba(var(--accent-rgb), 0.12), var(--accent-tint-1) 70%),
        var(--glass-bg-strong);
    color: var(--accent);
    transition: all 0.25s ease;
}
.social-links a:hover {
    background: var(--accent);
    color: var(--text-on-accent);
    box-shadow: 0 0 18px var(--accent-glow);
    text-shadow: none;
    transform: translateY(-2px) scale(1.25);
}
.social-links svg {
    width: 21px;
    height: 21px;
    fill: currentColor;
}

.bio-text {
    border-top: 1px solid var(--accent-dim-text);
    padding-top: var(--space-lg);
    margin-top: var(--space-xs);
}

/* ── ≤850px: avatar fades in behind the name + tagline ── */
@media (max-width: 850px) {
    .profile-section {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "name    actions"
            "tagline actions"
            "tech    actions";
        align-items: center;
        gap: 0.9rem var(--space-lg);
    }
    .profile-info { display: contents; }

    .profile-info h1 {
        grid-area: name;
        font-size: 2.4rem;
        padding-bottom: 0;
    }
    .tagline {
        grid-area: tagline;
        margin: 0;
    }
    .tech-stack {
        grid-area: tech;
        justify-content: flex-start;
    }
    .header-actions {
        grid-area: actions;
        justify-self: center;
    }

    .profile-info h1,
    .tagline {
        position: relative;
        z-index: 1;
        text-align: left;
        text-shadow: 0 0 12px var(--bg-dark), 0 0 4px var(--bg-dark);
    }

    /* Spans the name + tagline rows; its size follows their height */
    .profile-avatar {
        grid-area: name / name / tagline / tagline;
        z-index: 0;
        justify-self: start;
        align-self: center;
        height: 100%;
        width: auto;
        aspect-ratio: 1;
        contain: size; /* stops the image from making the rows taller */
        opacity: 0.7;
        margin: 0;
    }
}

/* ── ≤730px: stacked, avatar sits next to the actions ── */
@media (max-width: 730px) {
    .profile-section {
        grid-template-columns: 1fr auto auto 1fr;
        grid-template-areas:
            "name    name    name    name"
            "tagline tagline tagline tagline"
            "tech    tech    tech    tech"
            ".       avatar  actions .";
        column-gap: var(--space-md);
    }
    .tech-stack { justify-content: center; }

    .profile-info h1 {
        font-size: 2.2rem;
        text-align: center;
    }
    .profile-info h1,
    .tagline {
        text-shadow: none;
        text-align: center;
    }

    .profile-avatar {
        grid-area: avatar;
        width: 96px; /* a bit smaller than the 110px projects button */
        height: 96px;
        contain: none;
        opacity: 1;
        margin-right: 30px;
    }
}

/* ── ≤420px: small avatar pinned left of the name, same height ── */
@media (max-width: 420px) {
    .profile-section {
        --name-size: clamp(1.2rem, 7vw, 2rem);
        --name-lh: 1.1;
        grid-template-columns: 1fr auto auto 1fr;
        grid-template-areas:
            ".       avatar  name    ."
            "tagline tagline tagline tagline"
            "tech    tech    tech    tech"
            "actions actions actions actions";
        column-gap: 0.6rem;
    }
    .profile-info h1 {
        font-size: var(--name-size);
        line-height: var(--name-lh);
        white-space: nowrap; /* one line, so the pair can center */
    }
    .profile-avatar {
        width: calc(var(--name-size) * var(--name-lh));
        height: calc(var(--name-size) * var(--name-lh));
        align-self: center;
        border-radius: 6px;
        margin: 0;
    }
}
