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

html, body {
    height: 100%;
}

body {
    /* Cross-platform monospace stack: Windows, macOS, Linux fallbacks */
    font-family: Consolas, 'SF Mono', Menlo, Monaco, 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', monospace;
    font-size: 1.2rem; /* increased base font size */
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1 0 auto;
    margin-top: 80px; /* keep aligned with header; adjust if header height changes */
    padding: 2rem;
}

footer.footer {
    margin-top: auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 3rem 0;
}

header {
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    padding: 0 2rem;
}

.header-container {
    /*max-width: 1200px;*/
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem 0;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #333;
    font-weight: 600;
    font-size: 1.5rem;
}

.logo img {
    width: 54px;
    height: 54px;
    margin-right: 0.5rem;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

nav a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

nav a:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 0.5rem;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: #333;
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 2px;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

/* Mobile Styles */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }
    
    nav {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    nav.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    
    nav ul {
        flex-direction: column;
        padding: 2rem 0;
        gap: 0;
    }
    
    nav li {
        width: 100%;
        text-align: center;
        border-bottom: 1px solid #eee;
    }
    
    nav a {
        display: block;
        padding: 1rem 2rem;
        border-radius: 0;
    }
    
    header {
        padding: 0 1rem;
    }
}

.container {
    /* Keep a bit of breathing room on small screens */
    padding-left: clamp(1rem, 4vw, 2rem);
    padding-right: clamp(1rem, 4vw, 2rem);

    /* Center content and limit line length on wide screens */
    max-width: min(80ch, 1100px);
    margin-left: auto;
    margin-right: auto;
}

/* Profile layout: detail and image side-by-side inside a row; intro is outside the grid but inside #profile */
#profile-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 2rem;
    min-height: 300px;
    /* allow row to grow naturally to fit content in Safari */
}
#profile-row #profile-detail {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-block: 1rem;
    min-width: 0; /* prevent overflow in Safari due to min-content sizing */
}
#profile-row #profile-image {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-block: 1rem;
    min-width: 0; /* prevent overflow in Safari due to min-content sizing */
}
#profile-row #profile-image img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    max-height: 300px;
    object-fit: cover;
    -webkit-transform: translateZ(0); /* hint for Safari rendering */
}
/* Intro sits below the row with spacing */
#profile > #intro {
    margin-top: 1rem;
}

/* Slightly larger headings that scale with viewport, readable on both mobile and desktop */
#profile-detail h1 {
    font-size: clamp(1.6rem, 2.5vw + 1rem, 2.5rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.15; /* tighten heading to reduce block height */
}

/* Subtitle */
#profile-detail h4 {
    font-size: clamp(1rem, 1.2vw + 0.6rem, 1.25rem);
    color: #444;
    font-weight: 600;
    margin-top: 0.25rem;
    line-height: 1.25; /* slightly tighter subtitle */
}

/* Improve paragraph readability across widths */
.container p, .container address {
    font-size: 1em; /* inherit the base body size for body text */
}

/* Increase vertical gap between consecutive paragraphs without adding extra space after the last one */
#intro p + p {
    margin-top: 0.75em; /* space only between paragraphs inside intro */
}
/* Generic spacing for paragraphs in containers; keep it modest, and avoid trailing extra space */
.container p {
    margin-block: 0 0.75em;
}
.container p:last-child {
    margin-bottom: 0;
}

/* Responsive stacking for small screens */
@media (max-width: 768px) {
    /* Set a smaller base font size for small screens */
    body {
        font-size: 1rem;
    }

    #profile-row {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1.25rem;
        min-height: 200px;
    }
    #profile-row #profile-image img {
        max-height: 240px; /* doubled from 120px to match increased row height */
    }
}

/* Contact section tweaks */
#contact address {
    font-style: normal; /* address is italic by default; normalize */
}
#contact a {
    all: unset; /* remove any anchor default styling */
    cursor: pointer;
    color: inherit; /* keep text color consistent */
}
#contact a:hover {
    text-decoration: underline; /* show affordance on hover */
}
#contact a svg {
    display: inline-block;
    height: 1em; /* scale with text */
    width: auto;
    vertical-align: -0.125em; /* align with text baseline */
}
#contact a + a { /* space between the text link and the icon link */
    margin-left: 0.25em;
}
