:root {
    --bg-color: #000;
    --text-color: #fff;
    --border-color: #333;
    --avatar-border-color: #333;
    --theme-toggle-color: #fff;
}

/* RESET and BASE */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Space Mono', monospace;
    font-size: 1rem;
    line-height: 1.8;
    max-width: 860px;
    margin: 0 auto;
    padding: 2rem;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* NAVBAR */
nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 3rem;
}

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

nav a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    transition: color 0.3s ease;
}

nav a:hover {
    text-decoration: underline;
}

/* AVATAR */
.avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    border: 0.5px solid var(--avatar-border-color);
    transition: filter 0.3s ease, border-color 0.3s ease;
}

/* HEADINGS */
h1 {
    font-size: 3rem;
    line-height: 1.2; /* Explicit line height */
    font-weight: bold;
    letter-spacing: 0.1em;
    margin-bottom: 2rem;
    position: relative;
    display: block;
    width: fit-content; /* Helps with cursor positioning */
}

/* Typing cursor effect */
.typewriter-cursor::after {
    content: '|';
    position: absolute;
    right: -15px; /* Adjust depending on font size */
    color: var(--text-color);
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    from, to { opacity: 1; }
    50% { opacity: 0; }
}

h2 {
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 1rem;
    position: relative;
    display: block;
    width: fit-content;
    
    /* Animation settings */
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0, 1, 0, 1), opacity 0.4s ease-out;
}

h2.expanded {
    max-height: 100px; /* Arbitrary enough to hold standard H2s */
    opacity: 1;
    transition: max-height 0.4s ease-in-out, opacity 0.4s ease-in;
}

/* Simulated Selection Effects */
h2.highlighted {
    background-color: var(--selection-bg, #3399ff);
    color: var(--selection-text, #ffffff);
}

h2.underlined {
    text-decoration: underline;
    text-underline-offset: 4px;
}

/* ABOUT SECTION */
.about {
    margin-bottom: 2rem;
}

.about p {
    margin-bottom: 0.25rem;
}

/* FOOTER */
footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1.5rem;
    
    /* Animation settings */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease-in-out, border-color 0.3s ease;
}

footer.revealed {
    opacity: 1;
    pointer-events: auto;
}

footer a {
    color: var(--text-color);
    opacity: 0.75;
    transition: opacity 0.3s ease, color 0.3s ease;
}

footer a:hover {
    opacity: 1;
}

/* THEME TOGGLE */
#theme-toggle {
    background: none;
    border: none;
    color: var(--theme-toggle-color);
    font-size: 1.1rem;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.3s ease, font-size 0.3s ease;
}

/* LIGHT MODE */
body.light-mode {
    --bg-color: #ede8d5;
    --text-color: #1a1a1a;
    --border-color: #c5bfa8;
    --avatar-border-color: #aaa;
    --theme-toggle-color: #c8921a;
}

body.light-mode .avatar {
    filter: invert(1);
}

body.light-mode #theme-toggle {
    font-size: 1.6rem;
}

/* STAGGERED PRINT EFFECT */
.stagger-item {
    opacity: 0;
    /* Ensure they don't block clicks when invisible */
    pointer-events: none;
}

.stagger-item.printed {
    opacity: 1;
    pointer-events: auto;
}

/* MOBILE FIX */
@media (max-width: 600px) {
  h1 { font-size: 2rem; }
  nav { flex-direction: column; align-items: flex-start; gap: 1rem; }
}