:root {
    --font-serif: 'Georgia', ui-serif, 'Times New Roman', serif;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    
    --fg: #1a1a1a;
    --fg-muted: #666;
    --fg-light: #999;
    --bg: #ffffff;
    --bg-subtle: #fafafa;
    
    --content-width: 65ch;
    --spacing-base: 1rem;
    --spacing-large: 2rem;
    --spacing-xl: 4rem;
}

[data-theme="dark"] {
    --fg: #e5e5e5;
    --fg-muted: #b0b0b0;
    --fg-light: #888;
    --bg: #0a0a0a;
    --bg-subtle: #111;
}

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

html {
    font-size: 18px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-serif);
    background: var(--bg);
    color: var(--fg);
    line-height: 1.75;
    padding: var(--spacing-large) var(--spacing-large) var(--spacing-xl) var(--spacing-large);
    max-width: 90rem;
    margin: 0 auto;
}

.page-container {
    display: flex;
    flex-direction: column;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 400;
    line-height: 1.2;
    margin-top: 2em;
    margin-bottom: 0.5em;
    color: var(--fg);
}

h1 {
    font-size: 3rem;
    font-weight: 300;
    letter-spacing: -0.02em;
    margin-top: 0;
    margin-bottom: 0.5em;
}

h2 {
    font-size: 2rem;
    font-weight: 400;
    margin-top: 2.5em;
}

h3 {
    font-size: 1.5rem;
    font-weight: 500;
}

a {
    color: var(--fg);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
    transition: opacity 0.2s;
}

a:hover {
    opacity: 0.7;
}

time {
    color: var(--fg-muted);
    font-size: 0.9rem;
    font-family: var(--font-sans);
    letter-spacing: 0.01em;
}

/* Header */
header {
    margin-bottom: var(--spacing-base);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-base);
    flex-wrap: wrap;
    gap: var(--spacing-base);
}

.site-title {
    font-size: 1.5rem;
    font-weight: 400;
    text-decoration: none;
    display: inline-block;
}

.site-title:hover {
    opacity: 0.7;
    text-decoration: none;
}

.main-nav {
    display: flex;
    gap: var(--spacing-large);
    font-family: var(--font-sans);
    font-size: 0.9rem;
}

.main-nav a {
    text-decoration: none;
    color: var(--fg);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
    transition: opacity 0.2s;
}

.main-nav a:hover {
    opacity: 0.7;
}

.header-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--spacing-large);
    flex-wrap: wrap;
}

.site-description {
    color: var(--fg-muted);
    font-size: 1rem;
    font-weight: 300;
    margin: 0;
    flex: 1;
    min-width: 200px;
}

.social-links {
    display: flex;
    gap: var(--spacing-base);
    align-items: center;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--fg-muted);
    text-decoration: none;
    transition: color 0.2s, opacity 0.2s;
}

.social-links a:hover {
    color: var(--fg);
    opacity: 1;
}

.social-links svg {
    display: block;
}

/* Main Content */
.main-content {
    max-width: var(--content-width);
    margin: 0 auto;
}

.main-content:has(.garage-page) {
    max-width: none;
}

/* Home Layout */
.home-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-xl);
}

.home-left-column {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
}

.home-header {
    margin-bottom: 0;
}

.home-header .site-title {
    font-size: 1.5rem;
    font-weight: 400;
    text-decoration: none;
    display: inline-block;
    margin-bottom: 0.25em;
}

.home-header .site-title:hover {
    opacity: 0.7;
    text-decoration: none;
}

.home-header .site-description {
    color: var(--fg-muted);
    font-size: 1rem;
    font-weight: 300;
    margin-bottom: 0;
}

.home-right-column {
    background: #0a0a0a;
    color: #e5e5e5;
    padding: var(--spacing-large);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-large);
    min-height: 100vh;
}

.home-right-column .section-title {
    color: #b0b0b0;
}

.home-right-column #random-quote .quote-text {
    color: #b0b0b0;
}

.home-right-column #random-quote .quote-author {
    color: #888;
}

.home-right-column #random-quote .quote-source-link {
    color: #888;
}

.home-right-column .image-source-link {
    color: #888;
}

/* Home Page */
.latest-posts {
    margin-bottom: 0;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 400;
    margin-bottom: 1rem;
    color: var(--fg-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.875rem;
    font-family: var(--font-sans);
}

.post-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
    grid-auto-flow: row;
    justify-items: stretch;
    width: 100%;
}

.post-card {
    display: flex;
    flex-direction: column;
    gap: 0.25em;
    padding: 0;
    margin: 0;
    width: 100%;
    max-width: none;
}

.post-card-title {
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1.3;
    margin: 0;
}

.post-card-title a {
    text-decoration: none;
    color: var(--fg);
}

.post-card-title a:hover {
    opacity: 0.7;
    text-decoration: none;
}

.post-date {
    color: var(--fg-muted);
    font-size: 0.8125rem;
    font-family: var(--font-sans);
    margin: 0;
    display: block;
}

.post-item {
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-self: start;
}

.post-entry {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    min-width: 0;
    max-width: none;
    margin: 0;
}

.post-title-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.post-title {
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1.3;
    margin: 0;
}

.post-title a {
    text-decoration: none;
    color: var(--fg);
}

.post-title a:hover {
    opacity: 0.7;
    text-decoration: none;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8125rem;
    font-family: var(--font-sans);
    color: var(--fg-muted);
}

.post-lang {
    display: inline-block;
    padding: 0.125em 0.5em;
    background: var(--bg-subtle);
    color: var(--fg-muted);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 3px;
    vertical-align: baseline;
    flex-shrink: 0;
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
}

.post-description {
    color: var(--fg-muted);
    font-size: 0.9375rem;
    line-height: 1.5;
    margin: 0;
}

.random-content {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Ideas Section */
.ideas {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.ideas-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: calc(var(--spacing-large) * 2);
    margin-top: var(--spacing-large);
}

.ideas-columns h3 {
    font-size: 1.25rem;
    font-weight: 400;
    margin-top: 0;
    margin-bottom: var(--spacing-base);
    color: var(--fg-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.875rem;
    font-family: var(--font-sans);
}

.ideas-column {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-base);
}

.ideas-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-base);
}

.ideas-card {
    border: 1px solid var(--fg-light);
    border-radius: 4px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
}

.ideas-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ideas-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.ideas-card-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--bg-subtle);
}

.ideas-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ideas-card-content {
    padding: calc(var(--spacing-base) * 0.75);
}

.ideas-card-title {
    font-size: 1rem;
    font-weight: 400;
    margin: 0 0 0.25em 0;
    color: var(--fg);
    line-height: 1.3;
    word-wrap: break-word;
}

.ideas-card-summary {
    color: var(--fg-muted);
    font-size: 0.8125rem;
    line-height: 1.4;
    margin-bottom: calc(var(--spacing-base) * 0.5);
    word-wrap: break-word;
}

.ideas-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375em;
    margin-top: calc(var(--spacing-base) * 0.5);
}

.ideas-card-tags .tag {
    display: inline-block;
    padding: 0.2em 0.6em;
    background: var(--bg-subtle);
    color: var(--fg-muted);
    font-size: 0.6875rem;
    font-family: var(--font-sans);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 3px;
}

/* Post Page */
article {
    max-width: var(--content-width);
    margin: 0 auto;
}

article h1 {
    font-size: 3.5rem;
    line-height: 1.1;
    margin-bottom: 0.5em;
}

article time {
    display: block;
    margin-bottom: var(--spacing-xl);
}

.content {
    font-size: 1.25rem;
    line-height: 1.8;
}

.content p {
    margin-bottom: 1.5em;
}

.content h2 {
    font-size: 2rem;
    margin-top: 2em;
    margin-bottom: 0.75em;
}

.content h3 {
    font-size: 1.5rem;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

.content img {
    max-width: 100%;
    height: auto;
    margin: var(--spacing-large) 0;
}

.content blockquote {
    border-left: 2px solid var(--fg-light);
    padding-left: var(--spacing-large);
    margin: var(--spacing-large) 0;
    color: var(--fg-muted);
    font-style: italic;
}

.content code {
    font-family: 'Menlo', 'Monaco', monospace;
    font-size: 0.9em;
    background: var(--bg-subtle);
    padding: 0.2em 0.4em;
    border-radius: 3px;
}

.content pre {
    background: var(--bg-subtle);
    padding: var(--spacing-base);
    border-radius: 4px;
    overflow-x: auto;
    margin: var(--spacing-large) 0;
}

.content pre code {
    background: none;
    padding: 0;
}

/* Widgets */
#random-image {
    aspect-ratio: 16 / 9;
    width: 100%;
    overflow: hidden;
    margin: var(--spacing-large) 0;
}

#random-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

#random-quote {
    margin: var(--spacing-large) 0;
}

#random-quote .quote-text {
    font-size: 1.25rem;
    line-height: 1.6;
    color: var(--fg-muted);
    font-style: italic;
    margin-bottom: 0.5em;
}

#random-quote .quote-author {
    color: var(--fg-light);
    font-size: 0.9rem;
}

#random-quote .quote-source {
    margin-top: 0.5em;
}

#random-quote .quote-source-link {
    color: var(--fg-light);
    font-size: 0.75rem;
    text-decoration: none;
    opacity: 0.6;
    transition: opacity 0.2s;
}

#random-quote .quote-source-link:hover {
    opacity: 1;
}

#random-image {
    position: relative;
}

#random-image .image-source {
    position: absolute;
    bottom: 0.5em;
}

#random-image .image-source-link {
    color: var(--fg-light);
    font-size: 0.75rem;
    text-decoration: none;
    opacity: 0.6;
    transition: opacity 0.2s;
}

#random-image .image-source-link:hover {
    opacity: 1;
}

.skeleton {
    animation: pulse 1.5s ease-in-out infinite alternate;
}

@keyframes pulse {
    from { opacity: 0.5; }
    to { opacity: 0.8; }
}

.sidebar-section {
    margin-bottom: var(--spacing-large);
}

.sidebar-title {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-family: var(--font-sans);
    color: var(--fg-muted);
    margin-bottom: var(--spacing-base);
}

.sidebar-content {
    color: var(--fg-muted);
    line-height: 1.6;
}

/* Garage Page */
.garage-page {
    max-width: 1800px;
    margin: 0 auto;
}

.garage-header {
    margin-bottom: var(--spacing-xl);
}

.garage-header h1 {
    font-size: 3rem;
    font-weight: 300;
    margin-bottom: 0.25em;
}

.garage-layout {
    display: flex;
    flex-direction: column;
    gap: calc(var(--spacing-xl) * 2);
}

@media (min-width: 900px) {
    .garage-layout {
        display: grid;
        grid-template-columns: repeat(3, minmax(300px, 1fr));
        gap: calc(var(--spacing-xl) * 1.5);
        align-items: start;
    }
    
    .garage-column {
        min-width: 0;
        width: 100%;
    }
    
    .garage-grid {
        grid-template-columns: 1fr !important;
        gap: var(--spacing-base);
    }
}

.garage-column {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-base);
    min-width: 0; /* Prevents grid column from being too narrow */
}

.section-description {
    color: var(--fg-light);
    font-size: 0.8125rem;
    margin-bottom: var(--spacing-base);
}

.garage-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-base);
}

.garage-card {
    border: 1px solid var(--fg-light);
    border-radius: 4px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
    min-width: 0;
}

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

.garage-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.garage-card-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--bg-subtle);
}

.garage-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.garage-card-content {
    padding: var(--spacing-base);
}

.garage-card-title {
    font-size: 1.125rem;
    font-weight: 400;
    margin: 0 0 0.375em 0;
    color: var(--fg);
    line-height: 1.3;
    word-wrap: break-word;
}

.garage-card-summary {
    color: var(--fg-muted);
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: var(--spacing-base);
    word-wrap: break-word;
}

.garage-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    margin-top: var(--spacing-base);
}

.tag {
    display: inline-block;
    padding: 0.25em 0.75em;
    background: var(--bg-subtle);
    color: var(--fg-muted);
    font-size: 0.75rem;
    font-family: var(--font-sans);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 3px;
}

/* Responsive */
@media (min-width: 600px) {
    .post-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.25rem;
        align-items: start;
    }

    .garage-page .garage-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 900px) {
    .post-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1.5rem;
        align-items: start;
    }

    .garage-page .garage-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 1200px) {
    body:has(.home-layout) {
        padding: 0;
        max-width: none;
    }

    body:has(.home-layout) .page-container {
        display: grid;
        grid-template-columns: auto 400px;
        grid-template-rows: auto 1fr;
        min-height: 100vh;
    }

    body:has(.home-layout) header {
        grid-column: 1;
        grid-row: 1;
        padding: var(--spacing-large) var(--spacing-large);
    }

    body:has(.home-layout) .main-content {
        grid-column: 1;
        grid-row: 2;
        padding: 0 var(--spacing-large) var(--spacing-xl) var(--spacing-large);
        max-width: 1400px;
        margin: 0;
    }

    body:has(.home-layout) .home-right-column {
        grid-column: 2;
        grid-row: 1 / -1;
        position: sticky;
        top: 0;
        height: 100vh;
        overflow-y: auto;
    }

    .home-layout {
        grid-template-columns: 1fr;
        gap: var(--spacing-xl);
        align-items: start;
    }
}

@media (max-width: 1199px) {
    .page-container {
        display: flex;
        flex-direction: column;
    }

    .home-layout {
        display: flex;
        flex-direction: column;
    }

    .home-right-column {
        order: 2;
        min-height: auto;
    }

    .home-left-column {
        order: 1;
    }
}

@media (max-width: 768px) {
    html {
        font-size: 16px;
    }

    body {
        padding: var(--spacing-large) var(--spacing-base);
    }

    h1 {
        font-size: 2.5rem;
    }

    article h1 {
        font-size: 2.5rem;
    }

    .ideas-columns {
        grid-template-columns: 1fr;
        gap: var(--spacing-large);
    }

    .ideas-grid {
        grid-template-columns: 1fr;
    }

    .post-list {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .post-card-title {
        font-size: 1.125rem;
    }

    .content {
        font-size: 1.125rem;
    }

    .header-top {
        flex-direction: column;
        align-items: flex-start;
    }

    .main-nav {
        gap: var(--spacing-base);
        font-size: 0.85rem;
    }

    .header-bottom {
        flex-direction: column;
        align-items: flex-start;
    }

    .social-links {
        align-self: flex-start;
    }
}
