/* 
 * Joel Halen - Personal Site
 * A dark, refined aesthetic with warm accents
 */

/* ============================================
   CSS Variables & Root Setup
   ============================================ */
:root {
    /* Colors - Deep charcoal with warm amber accent */
    --bg-primary: #0d0d0d;
    --bg-secondary: #141414;
    --bg-tertiary: #1a1a1a;
    --bg-elevated: #212121;
    
    --text-primary: #f5f5f0;
    --text-secondary: #a8a8a0;
    --text-muted: #6b6b64;
    
    --accent: #e8a849;
    --accent-dim: #c48a2f;
    --accent-glow: rgba(232, 168, 73, 0.15);
    
    --border: rgba(255, 255, 255, 0.06);
    --border-strong: rgba(255, 255, 255, 0.12);
    
    /* Typography */
    --font-display: 'Instrument Serif', Georgia, serif;
    --font-body: 'DM Sans', system-ui, sans-serif;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 5rem;
    
    /* Layout */
    --container-max: 1200px;
    --container-narrow: 720px;
    
    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --transition-fast: 150ms var(--ease-out);
    --transition-normal: 300ms var(--ease-out);
    --transition-slow: 500ms var(--ease-out);
}

/* ============================================
   Reset & Base
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Film grain overlay */
.grain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 400;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 { font-size: clamp(2.5rem, 6vw, 4rem); }
h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 3vw, 1.5rem); }

p {
    color: var(--text-secondary);
    max-width: 65ch;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-fast);
}

/* ============================================
   Layout Components
   ============================================ */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.container-narrow {
    max-width: var(--container-narrow);
}

/* ============================================
   Header & Navigation
   ============================================ */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: var(--space-lg) 0;
    background: linear-gradient(to bottom, var(--bg-primary) 0%, transparent 100%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-style: italic;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.logo:hover {
    color: var(--accent);
}

.main-nav {
    display: flex;
    gap: var(--space-xl);
}

.main-nav a {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    position: relative;
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width var(--transition-normal);
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--text-primary);
}

.main-nav a:hover::after,
.main-nav a.active::after {
    width: 100%;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-sm);
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: var(--transition-fast);
}

/* Mobile Navigation */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }
    
    .main-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 100%;
        height: 100vh;
        background: var(--bg-primary);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: var(--space-xl);
        transition: right var(--transition-slow);
    }
    
    .main-nav.open {
        right: 0;
    }
    
    .main-nav a {
        font-size: 1.5rem;
    }
}

/* ============================================
   Main Content
   ============================================ */
.site-main {
    padding-top: 100px;
    min-height: calc(100vh - 200px);
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
    min-height: calc(100vh - 100px);
    display: flex;
    align-items: center;
    padding: var(--space-3xl) 0;
    position: relative;
    overflow: hidden;
}

.hero .container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3xl);
    align-items: center;
}

.hero-intro {
    display: block;
    font-size: 0.875rem;
    color: var(--accent);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: var(--space-md);
    animation: fadeSlideUp 0.8s var(--ease-out) both;
}

.hero-title {
    font-size: clamp(3rem, 8vw, 5.5rem);
    font-style: italic;
    letter-spacing: -0.03em;
    margin-bottom: var(--space-md);
    animation: fadeSlideUp 0.8s var(--ease-out) 0.1s both;
}

.hero-tagline {
    font-family: var(--font-display);
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
    animation: fadeSlideUp 0.8s var(--ease-out) 0.2s both;
}

.hero-description {
    font-size: 1.125rem;
    margin-bottom: var(--space-xl);
    animation: fadeSlideUp 0.8s var(--ease-out) 0.3s both;
}

.hero-actions {
    display: flex;
    gap: var(--space-md);
    animation: fadeSlideUp 0.8s var(--ease-out) 0.4s both;
}

.hero-visual {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 1.2s var(--ease-out) 0.5s both;
}

.hero-shape {
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, var(--accent-glow), transparent 70%);
    border: 1px solid var(--border);
    position: relative;
}

.hero-shape::before {
    content: '';
    position: absolute;
    inset: -20%;
    border-radius: 50%;
    border: 1px solid var(--border);
    animation: pulse 4s ease-in-out infinite;
}

.hero-shape::after {
    content: '';
    position: absolute;
    inset: 20%;
    border-radius: 50%;
    border: 1px solid var(--border-strong);
}

@media (max-width: 900px) {
    .hero .container {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .hero-actions {
        justify-content: center;
    }
    
    .hero-visual {
        display: none;
    }
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-primary {
    background: var(--accent);
    color: var(--bg-primary);
}

.btn-primary:hover {
    background: var(--accent-dim);
    transform: translateY(-2px);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
    border-color: var(--text-muted);
    transform: translateY(-2px);
}

/* ============================================
   Page Headers
   ============================================ */
.page-header {
    padding: var(--space-3xl) 0 var(--space-2xl);
    text-align: center;
}

.page-header h1 {
    font-style: italic;
    margin-bottom: var(--space-md);
    animation: fadeSlideUp 0.6s var(--ease-out) both;
}

.page-header p {
    margin: 0 auto;
    animation: fadeSlideUp 0.6s var(--ease-out) 0.1s both;
}

/* ============================================
   Recent Posts / Blog Section
   ============================================ */
.recent-posts,
.blog-listing {
    padding: var(--space-3xl) 0;
}

.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: var(--space-2xl);
}

.section-header h2 {
    font-style: italic;
}

.view-all {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.view-all:hover {
    color: var(--accent);
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-lg);
}

.post-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    transition: all var(--transition-normal);
}

.post-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-4px);
}

.post-card-content {
    padding: var(--space-xl);
}

.post-date {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: var(--space-sm);
}

.post-card h3 {
    margin-bottom: var(--space-sm);
}

.post-card h3 a:hover {
    color: var(--accent);
}

.post-card p {
    font-size: 0.9375rem;
    margin-bottom: var(--space-md);
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.tag {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: var(--space-xs) var(--space-sm);
    border-radius: 2px;
}

/* Posts List (Blog Page) */
.posts-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

.post-item {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: var(--space-lg);
    padding-bottom: var(--space-xl);
    border-bottom: 1px solid var(--border);
}

.post-item:last-child {
    border-bottom: none;
}

.post-item .post-date {
    font-size: 0.875rem;
    padding-top: 0.5rem;
}

.post-item h2 {
    font-size: 1.5rem;
    margin-bottom: var(--space-sm);
}

.post-item h2 a:hover {
    color: var(--accent);
}

@media (max-width: 600px) {
    .post-item {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xl);
    margin-top: var(--space-3xl);
    padding-top: var(--space-xl);
    border-top: 1px solid var(--border);
}

.pagination a {
    color: var(--text-muted);
}

.pagination a:hover {
    color: var(--accent);
}

.page-info {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ============================================
   Single Post
   ============================================ */
.single-post .post-header {
    padding: var(--space-3xl) 0 var(--space-2xl);
}

.back-link {
    display: inline-block;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: var(--space-xl);
}

.back-link:hover {
    color: var(--accent);
}

.single-post .post-date {
    margin-bottom: var(--space-md);
}

.single-post h1 {
    font-style: italic;
    margin-bottom: var(--space-lg);
}

.post-content {
    padding-bottom: var(--space-3xl);
}

/* ============================================
   Prose (Article Content)
   ============================================ */
.prose {
    font-size: 1.0625rem;
    line-height: 1.75;
}

.prose > * + * {
    margin-top: var(--space-lg);
}

.prose h2 {
    font-size: 1.75rem;
    margin-top: var(--space-2xl);
}

.prose h3 {
    font-size: 1.25rem;
    margin-top: var(--space-xl);
}

.prose a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.prose a:hover {
    color: var(--accent-dim);
}

.prose strong {
    color: var(--text-primary);
    font-weight: 500;
}

.prose code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.875em;
    background: var(--bg-tertiary);
    padding: 0.2em 0.4em;
    border-radius: 3px;
}

.prose pre {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: var(--space-lg);
    overflow-x: auto;
}

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

.prose blockquote {
    border-left: 3px solid var(--accent);
    padding-left: var(--space-lg);
    font-style: italic;
    color: var(--text-secondary);
}

.prose ul, .prose ol {
    padding-left: var(--space-lg);
}

.prose li {
    margin-top: var(--space-sm);
}

.prose img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.prose hr {
    border: none;
    height: 1px;
    background: var(--border);
    margin: var(--space-2xl) 0;
}

/* ============================================
   Portfolio
   ============================================ */
.portfolio-grid-section {
    padding-bottom: var(--space-3xl);
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: var(--space-lg);
}

.project-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    transition: all var(--transition-normal);
}

.project-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-4px);
}

.project-card.featured {
    grid-column: span 2;
}

@media (max-width: 800px) {
    .project-card.featured {
        grid-column: span 1;
    }
}

.project-image {
    aspect-ratio: 16/9;
    background: var(--bg-tertiary);
    overflow: hidden;
}

.project-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    color: var(--text-muted);
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-elevated));
}

.project-content {
    padding: var(--space-xl);
}

.project-category {
    font-size: 0.75rem;
    color: var(--accent);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: var(--space-sm);
    display: block;
}

.project-content h3 {
    margin-bottom: var(--space-sm);
}

.project-content p {
    font-size: 0.9375rem;
    margin-bottom: var(--space-md);
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
}

.project-tech span {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: var(--space-xs) var(--space-sm);
    border-radius: 2px;
}

.project-links a {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.project-links a:hover {
    color: var(--accent);
}

/* ============================================
   Contact
   ============================================ */
.contact-section {
    padding-bottom: var(--space-3xl);
}

.contact-methods {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-md);
}

.contact-card {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    padding: var(--space-xl);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    transition: all var(--transition-normal);
}

.contact-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.contact-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-glow);
    border-radius: 50%;
    flex-shrink: 0;
}

.contact-icon svg {
    width: 24px;
    height: 24px;
    color: var(--accent);
}

.contact-info {
    display: flex;
    flex-direction: column;
}

.contact-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.contact-value {
    font-size: 1rem;
    color: var(--text-primary);
}

/* ============================================
   Error Page
   ============================================ */
.error-page {
    min-height: calc(100vh - 300px);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.error-code {
    font-family: var(--font-display);
    font-size: clamp(6rem, 20vw, 12rem);
    font-style: italic;
    color: var(--bg-tertiary);
    line-height: 1;
    margin-bottom: var(--space-lg);
    display: block;
}

.error-content h1 {
    margin-bottom: var(--space-md);
}

.error-content p {
    margin: 0 auto var(--space-xl);
}

/* ============================================
   Footer
   ============================================ */
.site-footer {
    padding: var(--space-2xl) 0;
    border-top: 1px solid var(--border);
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.footer-content p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.social-links {
    display: flex;
    gap: var(--space-md);
}

.social-links a {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.social-links a:hover {
    color: var(--accent);
    border-color: var(--accent);
}

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

@media (max-width: 600px) {
    .footer-content {
        flex-direction: column;
        gap: var(--space-lg);
        text-align: center;
    }
}

/* ============================================
   Empty States
   ============================================ */
.empty-state {
    text-align: center;
    padding: var(--space-3xl) 0;
    color: var(--text-muted);
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.5;
        transform: scale(1);
    }
    50% {
        opacity: 0.2;
        transform: scale(1.05);
    }
}

/* ============================================
   Utility Classes
   ============================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
