:root {
    --black: #262220;
    --red: #af5f5f;
    --green: #87875f;
    --yellow: #bcbc6c;
    --blue: #666c7f;
    --magenta: #cd7998;
    --cyan: #6d978a;
    --white: #bbbbbb;
    --max-width: 1200px;
    --padding: 1rem;
    --header-size: clamp(24px, 5vw, 36px);
    --text-size: clamp(14px, 3vw, 16px);
    --button-width: clamp(120px, 30vw, 200px);
    --button-height: clamp(40px, 10vw, 80px);
    --button-font: clamp(16px, 4vw, 30px);
}

* {
    color: var(--white);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
}

body {
    background-color: var(--black);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--padding);
}

/* Add this to allow text-align override */
main > * {
    text-align: inherit;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

h1 {
    font-size: var(--header-size);
    margin: 0.5rem 0; /* Reduced margin */
}

.projects {
    list-style: none;
    padding: 0;
}

.projects a {
    display: inline-block;
    font-size: var(--text-size);
    text-decoration: none;
    transition: color 0.2s ease;
}

.projects a:hover {
    color: var(--yellow);
}

.project-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 1rem 0;
    border-bottom: 1px solid var(--blue);
}

.description {
    color: var(--white);
    text-align: right;
    margin-left: auto;
    padding-left: 20px;
    flex-shrink: 0;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Add responsive design */
@media (max-width: 768px) {
    :root {
        --padding: 0.5rem;
    }
    
    textarea {
        width: 90%;
        font-size: 16px; /* Prevent zoom on mobile */
    }

    .button-group {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }

    .meta {
        flex-direction: column;
        gap: 0.5rem;
    }

    .word-count {
        font-size: clamp(12px, 2.5vw, 14px);
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
    }
}

body.is-offline .offline {
    display: block;
}

/* Add tablet-specific adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    textarea {
        width: 85vw;
    }
}

/* Add orientation-specific styles */
@media (orientation: landscape) and (max-height: 600px) {
    textarea {
        min-height: 30vh; /* Reduced from 40vh */
    }
    
    .button-group {
        margin-top: 1rem;
    }
}

/* Handle ultra-wide screens */
@media (min-width: 1920px) {
    :root {
        --max-width: 1600px;
    }
}

/* High-DPI screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    * {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Foldable devices */
@media (spanning: single-fold-vertical) {
    main {
        padding: var(--padding);
        max-width: 100%;
    }
}