:root {
    /* Colors */
    --header-color: black;
    --secondary-text-color: #37474F;
    --link-blue: #3F9EF5;
    --link-orange: #F5924B;
    --link-green: #19B40C;

    /* Fluid Typography (scales with viewport) */
    --font-size-h1: clamp(24px, 5vw, 32px);
    --font-size-link: clamp(18px, 4vw, 20px);
    --font-size-subtitle: clamp(16px, 3.5vw, 18px);

    /* Fluid Spacing */
    --spacing-sm: clamp(12px, 3vw, 16px);
    --spacing-md: clamp(16px, 4vw, 24px);
    --spacing-lg: clamp(24px, 5vw, 32px);
    --spacing-xl: clamp(32px, 6vw, 48px);
    --spacing-2xl: clamp(48px, 8vw, 70px);

    /* Touch Targets */
    --touch-target-min: 44px;
}

/* Theme toggle button */
#theme-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid #9E9E9E;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1000;

    &:hover {
        transform: scale(1.1);
        background: rgba(128, 128, 128, 0.1);
    }

    &:active {
        transform: scale(0.95);
    }

    .theme-icon {
        width: 24px;
        height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    svg {
        width: 100%;
        height: 100%;
    }
}

/* Dark mode theme overrides */
:root[data-theme="dark"] {
    --header-color: white;
    --secondary-text-color: #B0BEC5;
}

:root[data-theme="dark"] body {
    background: #121212;
}

:root[data-theme="dark"] #theme-toggle {
    border-color: white;
}

/* Mobile Base Styles (0-870px) */
body {
    margin: 0;
    padding: 0;
    color: var(--secondary-text-color);
    font-family: 'Alata', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1 {
    color: var(--header-color);
    font-weight: normal;
    margin: 0;
}

a {
    color: var(--header-color);
    text-decoration: none;
}

.page-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-lg) var(--spacing-md) 0;
    min-height: 100vh;
}

.sidebar {
    width: 100%;
    max-width: 500px;
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.title {
    font-size: var(--font-size-h1);
    margin: 0 0 var(--spacing-sm) 0;
}

.subtitle {
    font-size: var(--font-size-subtitle);
    display: block;
    line-height: 1.5;
    margin-bottom: var(--spacing-sm);
}

.link-container {
    margin-top: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.topic-link {
    font-size: var(--font-size-link);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: underline;
    text-underline-offset: 8px;
    min-height: var(--touch-target-min);

    &:first-child {
        text-decoration-color: var(--link-blue);
    }

    &:nth-child(2) {
        text-decoration-color: var(--link-orange);
    }

    &:nth-child(3) {
        text-decoration-color: var(--link-green);
    }
}

.welcome-image {
    width: 100%;
    max-width: 400px;
    height: auto;
    display: block;
    border-radius: 8px;

    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}

/* Custom Tablet-y Breakpoint (870px+) */
@media (min-width: 870px) {
    .page-container {
        flex-direction: row;
        justify-content: center;
        align-items: flex-start;
        padding: var(--spacing-2xl) var(--spacing-lg) 0;
        gap: var(--spacing-xl);
    }

    .sidebar {
        width: auto;
        min-width: 200px;
        max-width: 300px;
        text-align: right;
        margin-bottom: 0;
    }

    .link-container {
        align-items: flex-end;
        margin-top: 0;
    }

    .topic-link {
        justify-content: flex-end;
    }

    .welcome-image {
        max-width: 500px;
        margin: 0 0 0 var(--spacing-lg);
    }
}

/* Desktop Breakpoint (1024px+) */
@media (min-width: 1024px) {
    .page-container {
        margin-top: 64px;
        padding: 0 var(--spacing-lg) 0;
    }

    .sidebar {
        max-width: 18rem;
    }

    .link-container {
        margin-right: 16px;
        margin-top: var(--spacing-lg);
    }

    .topic-link {
        text-underline-offset: 12px;
        padding-bottom: 16px;
        min-height: auto;
    }

    .welcome-image {
        width: 35rem;
        max-width: 35rem;
        margin: 0 1rem 0 2rem;
    }

    .subtitle {
        margin-bottom: var(--spacing-sm);
    }
}

/* Content Pages (Projects, Writing, etc.) */
.content-page {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--spacing-2xl) var(--spacing-md);
    min-height: 100vh;
}

.content-header {
    position: relative;
    text-align: center;
    margin-bottom: var(--spacing-md);
}

.back-button {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--header-color);
    transition: transform 0.2s ease;
    min-width: 44px;
    min-height: 44px;
}

.back-button:hover {
    transform: translateY(-50%) translateX(-4px);
}

.back-button svg {
    width: 24px;
    height: 24px;
}

.page-title {
    font-size: var(--font-size-h1);
    display: inline-block;
    margin-bottom: var(--spacing-md);
    position: relative;
    padding-bottom: 8px;
}

.page-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 6px;
}

.page-title.blue::after {
    background-color: var(--link-blue);
}

.page-title.orange::after {
    background-color: var(--link-orange);
}

.page-title.green::after {
    background-color: var(--link-green);
}

.content-main {
    line-height: 1.8;
}

.content-main p {
    margin-bottom: var(--spacing-md);
}

.project-entry {
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-lg);
    padding-left: var(--spacing-lg);
    border-bottom: 1px solid #e0e0e0;
    position: relative;
}

.project-entry::before {
    content: '✷';
    position: absolute;
    left: 0;
    top: 0;
    font-size: clamp(20px, 4vw, 24px);
    color: var(--link-orange);
    line-height: 1;
}

.project-entry:last-child {
    border-bottom: none;
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.project-title {
    font-size: clamp(20px, 4vw, 24px);
    font-weight: normal;
    margin: 0;
    line-height: 1.2;
}

.project-title a {
    color: var(--header-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.project-title a:hover {
    color: var(--link-orange);
}

.project-date {
    font-size: clamp(14px, 3vw, 16px);
    color: var(--secondary-text-color);
    white-space: nowrap;
    flex-shrink: 0;
}

.project-description {
    color: var(--secondary-text-color);
    line-height: 1.6;
}

/* Content pages responsive adjustments */
@media (min-width: 1024px) {
    .content-page {
        padding: var(--spacing-2xl) var(--spacing-lg);
        margin-top: 32px;
    }

    .page-title {
        font-size: clamp(32px, 5vw, 40px);
        padding-bottom: 12px;
    }
}
