/*
 * João Pereira — nsmyself.com
 *
 * Design rationale:
 * - Dark-first: engineers expect dark UIs; sets a technical, modern tone
 * - Teal accent (#00d4aa): reads "infrastructure/systems", not iOS-blue or startup-red
 * - Inter: clean, legible, contemporary — chosen over Montserrat for its neutrality at small sizes
 * - No frameworks: hand-rolled CSS Grid + Flexbox is fast and maintainable at this scale
 * - Generous whitespace and restrained decoration: lets the content breathe
 */

/* ── Reset ─────────────────────────────────────────────── */

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

/* ── Design tokens ──────────────────────────────────────── */

:root {
    /* Colour */
    --bg:          #0d1117;
    --surface:     #161b22;
    --border:      #30363d;
    --accent:      #00d4aa;
    --accent-dim:  rgba(0, 212, 170, 0.12);
    --text:        #e6edf3;
    --muted:       #7d8590;

    /* Typography */
    --font: 'Inter', system-ui, -apple-system, sans-serif;

    /* Layout */
    --max-w: 1080px;
    --section-pad: clamp(4rem, 8vw, 7rem) 1.5rem;
}

/* ── Base ───────────────────────────────────────────────── */

html {
    scroll-behavior: smooth;
    color-scheme: dark;
}

body {
    font-family: var(--font);
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.7;
    font-size: 1rem;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
}

ul {
    list-style: none;
}

/* ── Container ──────────────────────────────────────────── */

.container {
    max-width: var(--max-w);
    margin-inline: auto;
    padding-inline: 1.5rem;
}

/* ── Header / Nav ───────────────────────────────────────── */

/*
 * Sticky + glass blur: stays visible while scrolling without
 * completely blocking the content behind it.
 */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: rgba(13, 17, 23, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.nav {
    max-width: var(--max-w);
    margin-inline: auto;
    padding: 0 1.5rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.wordmark {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    white-space: nowrap;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.125rem;
}

.nav-links a {
    font-size: 0.875rem;
    color: var(--muted);
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.nav-links a:hover {
    color: var(--text);
    background-color: var(--surface);
}

.nav-cta {
    color: var(--accent) !important;
    border: 1px solid rgba(0, 212, 170, 0.5) !important;
    margin-left: 0.5rem;
}

.nav-cta:hover {
    background-color: var(--accent-dim) !important;
    border-color: var(--accent) !important;
}

/* ── Hero ───────────────────────────────────────────────── */

/*
 * Large bottom padding keeps the hero from feeling cramped on
 * tall viewports before the user scrolls.
 */
.hero {
    padding: clamp(5rem, 12vw, 9rem) 1.5rem clamp(4rem, 8vw, 7rem);
    border-bottom: 1px solid var(--border);
}

.hero-inner {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 3rem;
}

.hero-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 1.25rem;
}

.hero-name {
    font-size: clamp(2.75rem, 7vw, 5.5rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.05;
    margin-bottom: 1.5rem;
    color: var(--text);
}

.hero-bio {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    color: var(--muted);
    max-width: 52ch;
    line-height: 1.6;
    margin-bottom: 2.5rem;
}

.hero-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
}

.link-pill {
    display: inline-block;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 1.1rem;
    border-radius: 100px;
    border: 1px solid var(--border);
    color: var(--muted);
    background-color: var(--surface);
    transition: border-color 0.15s ease, color 0.15s ease;
}

.link-pill:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.link-pill--accent {
    border-color: rgba(0, 212, 170, 0.5);
    color: var(--accent);
    background-color: var(--accent-dim);
}

.link-pill--accent:hover {
    border-color: var(--accent);
    background-color: rgba(0, 212, 170, 0.2);
}

/* ── Sections ───────────────────────────────────────────── */

.section {
    padding: var(--section-pad);
    border-bottom: 1px solid var(--border);
}

.section--dark {
    background-color: var(--surface);
}

/* Small label above each section — accent-coloured, all-caps */
.section-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 1.25rem;
}

.section-intro {
    font-size: 1rem;
    color: var(--muted);
    margin-bottom: 3rem;
    margin-top: -0.5rem;
}

/* Inline text links — underlined with accent colour */
.text-link {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: rgba(0, 212, 170, 0.35);
    text-underline-offset: 3px;
    transition: text-decoration-color 0.15s ease;
}

.text-link:hover {
    text-decoration-color: var(--accent);
}

/* ── About ──────────────────────────────────────────────── */

.about-grid {
    display: block;
}

.about-text p {
    font-size: 1.05rem;
    color: var(--muted);
    margin-bottom: 1.25rem;
}

.about-text p:last-child {
    margin-bottom: 0;
}

.avatar {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    border: 2px solid var(--border);
    object-fit: cover;
}

/* ── Stack ──────────────────────────────────────────────── */

/*
 * Auto-fill grid: cards tile naturally without media query tweaking.
 * Each card uses a small sub-grid for the dot + name + description.
 */
.stack-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.stack-item {
    display: grid;
    grid-template-columns: 12px 1fr;
    grid-template-rows: auto auto;
    column-gap: 0.875rem;
    row-gap: 0.2rem;
    background-color: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    transition: border-color 0.2s ease;
}

.stack-item:hover {
    border-color: var(--accent);
}

.stack-grid--ios {
    margin-top: 4rem;
}

/* Accent dot aligned to the middle of the name + description rows */
.stack-dot {
    grid-row: 1 / 3;
    align-self: center;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--accent);
    flex-shrink: 0;
}

.stack-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    align-self: end;
}

.stack-desc {
    font-size: 0.825rem;
    color: var(--muted);
    align-self: start;
    line-height: 1.4;
}

/* ── Projects ───────────────────────────────────────────── */

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

.project-card {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.75rem;
    transition: border-color 0.2s ease;
}

.project-card:hover {
    border-color: var(--accent);
}

.project-icon {
    width: 68px;
    height: 68px;
    border-radius: 16px;
    flex-shrink: 0;
    object-fit: cover;
}

.project-info h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.project-info p {
    font-size: 0.875rem;
    color: var(--muted);
    line-height: 1.55;
    margin-bottom: 1rem;
}

/* Small bordered badge — conveys social proof without being loud */
.badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent);
    border: 1px solid rgba(0, 212, 170, 0.4);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    letter-spacing: 0.02em;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.badge:hover {
    border-color: var(--accent);
    background-color: var(--accent-dim);
}

/* ── Community ──────────────────────────────────────────── */

.community-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 3rem;
    align-items: start;
}

.community-logo img {
    width: 110px;
    height: 110px;
    border-radius: 18px;
    object-fit: contain;
    background-color: var(--bg);
    padding: 0.875rem;
    border: 1px solid var(--border);
    transition: border-color 0.2s ease;
}

.community-logo img:hover {
    border-color: var(--accent);
}

.community-text h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.community-text p {
    font-size: 1rem;
    color: var(--muted);
    margin-bottom: 1rem;
    max-width: 62ch;
}

.community-text p:last-child {
    margin-bottom: 0;
}

/* ── Footer ─────────────────────────────────────────────── */

.site-footer {
    padding: 2.5rem 1.5rem;
    background-color: var(--surface);
    border-top: 1px solid var(--border);
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.site-footer p {
    font-size: 0.8rem;
    color: var(--muted);
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    font-size: 0.8rem;
    color: var(--muted);
    transition: color 0.15s ease;
}

.footer-links a:hover {
    color: var(--text);
}

/* ── Responsive ─────────────────────────────────────────── */

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

    .hero-avatar {
        display: none;
    }

    .community-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

@media (max-width: 560px) {
    /* Hide nav links; show email inline in nav bar */
    .nav-links {
        display: none;
    }

    .nav::after {
        content: 'jpereira@nsmyself.com';
        font-size: 0.8rem;
        color: var(--accent);
        white-space: nowrap;
    }

    .hero-links {
        flex-direction: column;
        align-items: flex-start;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .project-card {
        flex-direction: column;
        gap: 1rem;
    }

    .stack-grid {
        grid-template-columns: 1fr;
    }
}
