:root {
    --primary-color: #1d1d1f;
    --secondary-color: #6e6e73;
    --tertiary-color: #86868b;
    --background: #f2f2f7;
    --card-background: #ffffff;
    --glass-background: rgba(255, 255, 255, 0.72);
    --border-color: rgba(0, 0, 0, 0.12);
    --link-color: #06c;
    --max-width: 720px;
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --spacing-xxl: 4.5rem;
    --border-radius: 24px;
    --border-radius-sm: 12px;
    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --primary-color: #f5f5f7;
        --secondary-color: #a1a1a6;
        --tertiary-color: #6e6e73;
        --background: #000000;
        --card-background: #1c1c1e;
        --glass-background: rgba(28, 28, 30, 0.72);
        --border-color: rgba(255, 255, 255, 0.1);
        --link-color: #4da3ff;
    }
}

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

body {
    font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, system-ui, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.47059;
    color: var(--primary-color);
    background: var(--background);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 19px;
    font-weight: var(--font-weight-regular);
    letter-spacing: -0.045em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* Header */
#header {
    padding: var(--spacing-xl) 0 var(--spacing-lg) 0;
}

.profile {
    text-align: center;
}

.profile-img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin-bottom: var(--spacing-md);
    object-fit: cover;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06),
                inset 0 0 0 0.5px rgba(255, 255, 255, 0.4);
}

h1 {
    font-size: 2.25rem;
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--spacing-sm);
    letter-spacing: -0.035em;
    line-height: 1.125;
}

.lead {
    font-size: 1.125rem;
    color: var(--secondary-color);
    margin-bottom: var(--spacing-lg);
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
    letter-spacing: -0.02em;
    font-weight: var(--font-weight-regular);
}

/* Links */
.links {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.links a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 17px;
    font-weight: var(--font-weight-semibold);
    padding: 12px 20px;
    border-radius: 980px;
    transition: all 0.3s var(--transition-smooth);
    background: var(--card-background);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    letter-spacing: -0.01em;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04),
                inset 0 0 0 0.5px rgba(255, 255, 255, 0.5);
}

.links a:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Service-specific colors */
.links a[href^="mailto"] {
    color: #007AFF; /* iOS Mail blue */
}

.links a[href*="linkedin"] {
    color: #0A66C2; /* LinkedIn blue */
}

.links a.mastodon-link {
    color: #6364FF; /* Mastodon purple */
}

@media (prefers-color-scheme: dark) {
    .links a[href^="mailto"] {
        color: #0A84FF; /* iOS Mail blue dark mode */
    }
    
    .links a[href*="linkedin"] {
        color: #70B5F9; /* LinkedIn blue dark mode */
    }
    
    .links a.mastodon-link {
        color: #858AFA; /* Mastodon purple dark mode */
    }
}

.links svg {
    width: 18px;
    height: 18px;
}

/* Projects Section */
#projects {
    flex: 1;
    padding: var(--spacing-xl) 0 var(--spacing-xl) 0;
}

#projects h2 {
    font-size: 1rem;
    margin-bottom: var(--spacing-md);
    letter-spacing: -0.01em;
    text-transform: none;
    color: var(--tertiary-color);
    font-weight: var(--font-weight-medium);
}

a.card,
.card {
    display: block;
    text-decoration: none !important;
    color: inherit;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0;
    margin-bottom: var(--spacing-lg);
    transition: all 0.3s var(--transition-smooth);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04),
                inset 0 0 0 0.5px rgba(255, 255, 255, 0.4);
    -webkit-tap-highlight-color: transparent;
}

/* Remove any link artifacts from card contents */
a.card img,
a.card picture {
    border: none;
    outline: none;
}

.card:hover {
    /* No hover effects */
}

.card-content {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
    padding: var(--spacing-lg) var(--spacing-lg) var(--spacing-sm) var(--spacing-lg);
}

picture.project-icon {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    display: block;
}

.project-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.text {
    flex: 1;
}

.title {
    font-size: 24px;
    font-weight: var(--font-weight-semibold);
    margin-bottom: 0.5rem;
    letter-spacing: -0.035em;
    line-height: 1.16667;
}

.subtitle {
    color: var(--secondary-color);
    font-size: 17px;
    line-height: 1.47059;
    letter-spacing: -0.022em;
    font-weight: var(--font-weight-regular);
}

.project-preview-grid {
    display: flex;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-md) var(--spacing-sm) var(--spacing-md);
    justify-content: center;
    align-items: flex-start;
}

.project-preview {
    flex: 0 1 auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.project-preview img {
    width: auto;
    height: 420px;
    max-width: 100%;
    object-fit: contain;
    display: block;
}

.app-store-cta {
    display: flex;
    justify-content: center;
    padding: var(--spacing-sm) 0 var(--spacing-md) 0;
}

.app-store-cta a {
    display: inline-block;
    line-height: 0;
}

.app-store-badge {
    height: 40px;
    width: auto;
    display: block;
}

/* Project link styles removed - no longer needed */

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal[aria-modal="true"] {
    pointer-events: auto;
    opacity: 1;
}

.modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
}

.modal-wrapper {
    background: var(--glass-background);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.modal-controls {
    display: flex;
    gap: var(--spacing-sm);
}

.mode-toggle,
.close-button {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    color: var(--primary-color);
    transition: background 0.2s ease;
}

.mode-toggle:hover,
.close-button:hover {
    background: var(--card-background);
}

.mode-toggle {
    position: relative;
    width: 36px;
    height: 36px;
}

.mode-toggle svg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: opacity 0.2s ease;
}

.mode-toggle .moon {
    opacity: 0;
}

.mode-toggle.active .sun {
    opacity: 0;
}

.mode-toggle.active .moon {
    opacity: 1;
}

.modal-content {
    overflow: auto;
    padding: var(--spacing-md);
}

.modal-content.hidden {
    display: none;
}

.modal-content img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

.hidden {
    display: none;
}

/* Footer */
#footer {
    padding: var(--spacing-lg) 0;
    margin-top: auto;
}

.copyright {
    display: block;
    text-align: center;
    color: var(--tertiary-color);
    font-size: 17px;
    letter-spacing: -0.01em;
}

.footer-link {
    color: var(--tertiary-color);
    text-decoration: none;
}

.footer-link:hover {
    text-decoration: underline;
}

/* Imprint Page */
.back-link {
    margin-top: var(--spacing-md);
}

.back-link a {
    color: var(--link-color);
    text-decoration: none;
    font-size: 0.95rem;
    transition: opacity 0.2s ease;
}

.back-link a:hover {
    opacity: 0.7;
}

#imprint-content {
    padding: var(--spacing-xl) 0;
}

.imprint-section {
    margin-bottom: var(--spacing-xl);
}

.imprint-section h2 {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-sm);
    color: var(--primary-color);
}

.imprint-section h3 {
    font-size: 1.1rem;
    margin-top: var(--spacing-md);
    margin-bottom: var(--spacing-xs);
    color: var(--primary-color);
}

.imprint-section p {
    color: var(--secondary-color);
    line-height: 1.6;
    margin-bottom: var(--spacing-sm);
}

/* Responsive */
@media (max-width: 640px) {
    .links {
        gap: var(--spacing-sm);
    }
    
    /* Reorder card content on mobile - icon floats right */
    .card-content {
        display: block;
        padding: var(--spacing-md);
    }
    
    .card-content .project-icon {
        width: 40px;
        height: 40px;
        float: right;
        margin-left: var(--spacing-sm);
        margin-bottom: var(--spacing-xs);
    }
    
    .card-content .text {
        display: block;
        /* Don't clear the float so text can wrap */
    }
    
    .text .title {
        font-size: 1.15rem;
    }
    
    .text .subtitle {
        font-size: 0.95rem;
        line-height: 1.4;
    }

    .project-preview-grid {
        gap: var(--spacing-xs);
        padding: var(--spacing-sm) var(--spacing-xs) var(--spacing-xs) var(--spacing-xs);
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .project-preview img {
        height: 300px;
    }

    .app-store-cta {
        padding: var(--spacing-sm) 0 var(--spacing-sm) 0;
    }
}