/**
 * Alex Strait — Core Layout
 * Following DESIGN.md: warm editorial, Instrument Serif + Inter
 */

/* === Reset === */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* === Base === */

html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

body {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-primary);
    background: var(--surface);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === Typography === */

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 400;
    color: var(--text-primary);
}

h1 {
    font-size: clamp(2.25rem, 4vw, 3.5rem);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

h2 {
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    line-height: 1.15;
    letter-spacing: -0.01em;
}

h3 {
    font-size: clamp(1.25rem, 2vw, 1.75rem);
    line-height: 1.25;
}

h4 {
    font-size: 1.125rem;
    line-height: 1.3;
}

p {
    max-width: 65ch;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-hover);
}

a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

strong {
    font-weight: 600;
}

small {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--surface-alt);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

pre {
    background: #1C1917;
    color: #E7E5E4;
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.6;
}

pre code {
    background: none;
    padding: 0;
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* === Header === */

header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(250, 249, 246, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: var(--space-md) var(--page-padding);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
}

@media (prefers-color-scheme: dark) {
    header {
        background: rgba(12, 10, 9, 0.9);
    }
}

#logo img {
    height: 36px;
    width: auto;
}

#site-name {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 400;
    letter-spacing: -0.01em;
}

#site-name a {
    color: var(--text-primary);
    text-decoration: none;
}

/* === Navigation === */

nav {
    padding: 0 var(--page-padding);
    background: transparent;
}

nav ul {
    list-style: none;
    display: flex;
    gap: var(--space-lg);
    padding: 0;
    margin: 0;
    justify-content: flex-end;
}

nav li {
    list-style: none;
}

nav a {
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    padding: var(--space-sm) 0;
    position: relative;
    transition: color var(--transition-fast);
}

nav a:hover,
nav .current-menu-item a,
nav .current_page_item a {
    color: var(--text-primary);
}

nav .current-menu-item a::after,
nav .current_page_item a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
    border-radius: 1px;
}

/* Combine header + nav into one bar */
header {
    display: flex;
    align-items: center;
    gap: var(--space-xl);
}

nav {
    margin-left: auto;
    padding: 0;
}

/* Mobile nav */
@media (max-width: 768px) {
    nav ul {
        gap: var(--space-md);
    }

    nav a {
        font-size: 0.85rem;
    }
}

/* === Main Content === */

main {
    min-height: calc(100vh - 200px);
}

.content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--space-2xl) var(--page-padding);
}

/* Narrow content for long-form reading */
.content-narrow {
    max-width: var(--narrow-width);
    margin: 0 auto;
}

/* === Footer === */

footer {
    background: var(--surface-alt);
    border-top: 1px solid var(--border);
    padding: var(--space-3xl) var(--page-padding) var(--space-2xl);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-md);
}

.footer-right {
    display: flex;
    gap: var(--space-lg);
}

footer p {
    margin: 0;
}

footer a {
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

footer a:hover {
    color: var(--text-primary);
}

/* === Buttons === */

.btn,
.wp-block-button__link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    border: none;
    transition: all var(--transition-default);
    text-decoration: none;
}

.btn-primary,
.wp-block-button:not(.is-style-outline) .wp-block-button__link {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover,
.wp-block-button:not(.is-style-outline) .wp-block-button__link:hover {
    background: var(--accent-hover);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1.5px solid var(--border-strong);
}

.btn-secondary:hover {
    background: var(--surface-alt);
    border-color: var(--text-tertiary);
}

.wp-block-button.is-style-outline .wp-block-button__link {
    background: transparent;
    color: var(--text-primary);
    border: 1.5px solid var(--border-strong);
}

.wp-block-button.is-style-outline .wp-block-button__link:hover {
    background: var(--surface-alt);
    border-color: var(--text-tertiary);
    color: var(--text-primary);
}

/* === Cards === */

.card {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    transition: all var(--transition-default);
}

.card:hover {
    border-color: var(--border-strong);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card-featured {
    border-left: 3px solid var(--accent);
}

/* === Tags / Badges === */

.tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    background: rgba(71, 85, 105, 0.1);
    color: var(--secondary);
}

.tag-accent {
    background: rgba(74, 124, 89, 0.1);
    color: var(--accent);
}

/* === Bento Grid (Homepage) === */

.bento-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
    margin: var(--space-2xl) 0;
}

.bento-grid .card.span-2 {
    grid-column: span 2;
}

.bento-grid .card.span-full {
    grid-column: 1 / -1;
}

.bento-grid .card.tall {
    grid-row: span 2;
}

@media (max-width: 1024px) {
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .bento-grid .card.span-2 {
        grid-column: span 2;
    }
}

@media (max-width: 640px) {
    .bento-grid {
        grid-template-columns: 1fr;
    }
    .bento-grid .card.span-2,
    .bento-grid .card.span-full {
        grid-column: 1;
    }
    .bento-grid .card.tall {
        grid-row: span 1;
    }
}

/* === Hero Section === */

.hero {
    padding: var(--space-4xl) 0 var(--space-3xl);
    max-width: var(--narrow-width);
}

.hero h1 {
    font-size: clamp(3rem, 6vw, 5rem);
    line-height: 1.05;
    letter-spacing: -0.02em;
    margin-bottom: var(--space-lg);
}

.hero .subtitle {
    font-size: 1.125rem;
    line-height: 1.7;
    color: var(--text-secondary);
    max-width: 50ch;
}

/* === Section Spacing === */

.section {
    padding: var(--space-3xl) 0;
}

.section + .section {
    border-top: 1px solid var(--border);
}

.section-label {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: var(--space-lg);
}

.section h2 {
    margin-bottom: var(--space-xl);
}

/* === WordPress Block Overrides === */

.wp-block-cover {
    border-radius: var(--radius-lg);
    overflow: hidden;
    min-height: 40vh !important;
}

.wp-block-cover__inner-container {
    max-width: var(--max-width);
    padding: var(--space-2xl) var(--page-padding);
}

.wp-block-group {
    padding-left: 0;
    padding-right: 0;
}

/* Cards rendered via wp-block-group need inner padding */
.card.wp-block-group {
    padding: var(--space-xl) !important;
}

.card-featured.wp-block-group {
    padding-left: calc(var(--space-xl) - 3px) !important;
}

.wp-block-columns {
    gap: var(--space-lg) !important;
}

.wp-block-heading {
    font-family: var(--font-display);
    font-weight: 400;
}

.wp-block-separator {
    border-color: var(--border);
    opacity: 1;
}

.wp-block-image img {
    border-radius: var(--radius-md);
}

/* Gutenberg block spacing */
.content > .wp-block-group,
.content > .wp-block-cover,
.content > .wp-block-columns,
.content > .wp-block-heading,
.content > p,
.content > ul,
.content > ol {
    margin-bottom: var(--space-xl);
}

/* Lists inside content */
.content ul,
.content ol {
    padding-left: calc(var(--page-padding) + 1.5em);
    list-style-position: outside;
}

.content li {
    margin-bottom: var(--space-sm);
}

/* === Scroll Animations === */

.reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .reveal {
        opacity: 1;
        transform: none;
    }
}

/* === Utility === */

.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
