/*
 * James Neawedde — Editorial redesign v2
 * Broadsheet meets zine. Light, typographic, opinionated.
 * Fonts loaded via <link> in HTML — no @import.
 */

:root {
    color-scheme: light;
    --bg: #F5F0E8;
    --bg-alt: #EDE8DD;
    --bg-dark: #1A1A18;
    --text: #1A1A18;
    --text-mid: #2E2E2A;
    --text-muted: #46463F;
    --accent: #A63D2B;
    --accent-hover: #8B3222;
    --accent-light: rgba(166, 61, 43, 0.07);
    --rule: #1A1A18;
    --rule-light: #C8C3B8;
    --font-display: 'Syne', sans-serif;
    --font-body: 'Lora', Georgia, serif;
    --font-mono: 'IBM Plex Mono', 'Consolas', monospace;
    --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html {
    scroll-behavior: smooth;
    scrollbar-gutter: stable;
}

body {
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.75;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-feature-settings: "liga" 1, "calt" 1, "kern" 1;
    font-size-adjust: from-font;
    text-wrap: pretty;
    hanging-punctuation: first allow-end;
    position: relative;
}

/* Subtle paper texture via noise — use background-attachment to avoid forced compositing */
body::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.25;
    pointer-events: none;
    z-index: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

body > * { position: relative; z-index: 1; }

::selection {
    background: var(--accent);
    color: var(--bg);
}

/* ─── NAVIGATION ─── */

nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    background: rgba(245, 240, 232, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 2px solid var(--rule);
    z-index: 100;
}

.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.8rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size-adjust: none;
    transition: color 0.2s var(--ease-out);
}

.nav-logo:hover {
    color: var(--accent);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
    list-style: none;
}

.nav-links li {
    list-style: none;
    display: block;
}

.nav-links a {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.35rem 0.75rem;
    border-radius: 3px;
    transition: color 0.25s var(--ease-out), background 0.25s var(--ease-out);
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 0.75rem;
    right: 0.75rem;
    height: 1.5px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s var(--ease-out);
}

.nav-links a:hover {
    color: var(--text);
    text-decoration: none;
}

.nav-links a:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

.nav-links a.nav-active {
    color: var(--accent);
}

.nav-links a.nav-active::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* ─── LAYOUT ─── */

main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 7rem 2rem 4rem;
}

section {
    margin-bottom: 3.5rem;
}

section[id] {
    scroll-margin-top: 5rem;
}

/* ─── SCROLL REVEAL ─── */
/* JS adds .js-reveal to <html> — without JS, content stays visible */

.js-reveal .reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}

.js-reveal .reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children in project grid */
.js-reveal .project-grid .reveal:nth-child(2) { transition-delay: 0.08s; }
.js-reveal .project-grid .reveal:nth-child(3) { transition-delay: 0.16s; }
.js-reveal .project-grid .reveal:nth-child(4) { transition-delay: 0.24s; }
.js-reveal .project-grid .reveal:nth-child(5) { transition-delay: 0.3s; }
.js-reveal .project-grid .reveal:nth-child(6) { transition-delay: 0.36s; }
.js-reveal .project-grid .reveal:nth-child(7) { transition-delay: 0.42s; }

/* ─── HERO ─── */

#hero {
    padding: 4rem 0 3rem;
    margin-bottom: 3rem;
    border-bottom: 2px solid var(--rule);
    position: relative;
}

#hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 60px;
    height: 4px;
    background: var(--accent);
}

#hero h1 {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 5.5vw, 4.5rem);
    font-weight: 800;
    line-height: 0.95;
    letter-spacing: -0.03em;
    color: var(--text);
    margin-bottom: 1.25rem;
    text-transform: uppercase;
    white-space: nowrap;
}

.tagline {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--accent);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}

.intro {
    font-family: var(--font-body);
    font-size: clamp(1.15rem, 2vw + 0.5rem, 1.35rem);
    font-style: italic;
    line-height: 1.6;
    color: var(--text-mid);
    max-width: 600px;
}

/* ─── SECTION HEADERS ─── */

h2 {
    font-family: var(--font-display);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--text-muted);
    margin-bottom: 2rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--rule-light);
    position: relative;
    text-wrap: balance;
}

h2::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 30px;
    height: 1px;
    background: var(--accent);
}

h3 {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 2.5rem;
    margin-bottom: 0.75rem;
    color: var(--text);
    text-wrap: balance;
}

/* ─── ABOUT ─── */

.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 3rem;
}

/* Divider between columns */
.about-right {
    border-left: 1px solid var(--rule-light);
    padding-left: 3rem;
}

.about-content p {
    margin-bottom: 1.25rem;
    color: var(--text-mid);
}

.about-content ul {
    list-style: none;
    margin-bottom: 1.5rem;
}

.about-content li {
    padding: 0.5rem 0;
    padding-left: 1.25rem;
    position: relative;
    color: var(--text-mid);
    font-size: 0.95rem;
}

.about-content li::before {
    content: "—";
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: 600;
}

.about-content li strong {
    color: var(--text);
    font-weight: 600;
}

/* Pull quote */
.pull-quote {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text);
    padding: 1.5rem 0 1.5rem 1.5rem;
    border-left: 3px solid var(--accent);
    margin: 2rem 0;
    break-inside: avoid;
}

/* ─── PROJECTS ─── */

.project-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.project {
    padding: 2rem;
    position: relative;
    border-radius: 6px;
    border: 1px solid var(--rule-light);
    background: var(--bg);
    transition: transform 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out), border-color 0.35s var(--ease-out);
}

.project:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(26, 26, 24, 0.08), 0 2px 8px rgba(26, 26, 24, 0.04);
    border-color: var(--accent);
}

.project.featured {
    grid-column: 1 / -1;
    padding: 2.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
    background: var(--accent-light);
    border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--rule-light) 80%);
}

.project.featured:hover {
    background: rgba(166, 61, 43, 0.1);
    border-color: var(--accent);
}

.project h3 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.project.featured h3 {
    font-size: 1.6rem;
}

.project h3 a {
    color: var(--text);
    text-decoration: none;
    transition: color 0.25s var(--ease-out);
}

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

.project h3 a:hover {
    color: var(--accent);
    text-decoration: none;
}

.project-meta {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.75rem;
}

.project p:last-child {
    margin-bottom: 0;
    color: var(--text-mid);
    font-size: 0.95rem;
    line-height: 1.65;
}

.project.featured p:last-child {
    font-size: 1.05rem;
}

/* Single project in a row spans full */
.project.wide {
    grid-column: 1 / -1;
}

/* Project link — stretched link pattern for full-card clickability */
.project-link {
    cursor: pointer;
}

.project-link h3 a::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
}

.project-link::after {
    content: '→';
    position: absolute;
    top: 2rem;
    right: 2rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--rule-light);
    transition: color 0.25s var(--ease-out), transform 0.25s var(--ease-out);
    z-index: 2;
    pointer-events: none;
}

.project-link:hover::after {
    color: var(--accent);
    transform: translateX(3px);
}

.project-link:active {
    transform: translateY(0);
    box-shadow: none;
    transition-duration: 0.05s;
}

.project.featured.project-link::after {
    top: 2.5rem;
    right: 2.5rem;
}

/* ─── CONTACT ─── */

#contact {
    background: var(--bg-dark);
    color: var(--bg);
    padding: 4rem 2rem;
}

#contact .contact-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
}

#contact h2 {
    color: rgba(245, 240, 232, 0.72);
    border-bottom-color: rgba(245, 240, 232, 0.15);
    grid-column: 1 / -1;
}

#contact h2::after {
    background: var(--accent);
}

#contact p {
    color: rgba(245, 240, 232, 0.75);
    font-size: 1.1rem;
    line-height: 1.7;
}

#contact .contact-links a {
    color: #D4654F;
}

#contact .contact-links a:hover {
    color: #E8917F;
}

.contact-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.contact-links a {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: gap 0.3s var(--ease-out), color 0.25s var(--ease-out);
    position: relative;
}

.contact-links a::after {
    content: "→";
    transition: transform 0.3s var(--ease-out);
}

.contact-links a:hover {
    color: color-mix(in srgb, var(--accent) 60%, var(--bg) 40%);
    gap: 0.85rem;
    text-decoration: none;
}

/* ─── FOOTER ─── */

footer {
    background: var(--bg-dark);
    padding: 1.5rem 2rem;
    border-top: 1px solid rgba(245, 240, 232, 0.1);
}

footer p {
    max-width: 1100px;
    margin: 0 auto;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: rgba(245, 240, 232, 0.5);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ─── NOW PAGE ─── */

#now-header {
    padding-top: 2rem;
    margin-bottom: 3rem;
    border-bottom: 2px solid var(--rule);
    padding-bottom: 3rem;
    position: relative;
}

#now-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 60px;
    height: 4px;
    background: var(--accent);
}

#now-header h1 {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
    text-wrap: balance;
}

.now-updated {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 0.75rem;
}

.now-block {
    margin-bottom: 3rem;
}

.now-block p {
    margin-bottom: 1rem;
    color: var(--text-mid);
}

.now-block p:last-child {
    margin-bottom: 0;
}

/* ─── USES PAGE ─── */

#uses-header {
    padding-top: 2rem;
    margin-bottom: 3rem;
    border-bottom: 2px solid var(--rule);
    padding-bottom: 3rem;
    position: relative;
}

#uses-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 60px;
    height: 4px;
    background: var(--accent);
}

#uses-header h1 {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
    text-wrap: balance;
}

.uses-list {
    list-style: none;
}

.uses-list li {
    padding: 0.75rem 0 0.75rem 1.25rem;
    position: relative;
    color: var(--text-mid);
    font-size: 0.95rem;
    border-bottom: 1px solid var(--rule-light);
    transition: padding-left 0.25s var(--ease-out);
}

.uses-list li:last-child {
    border-bottom: none;
}

.uses-list li:hover {
    padding-left: 1.5rem;
}

.uses-list li::before {
    content: "—";
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: 600;
}

.uses-list li strong {
    color: var(--text);
    font-weight: 600;
}

/* ─── 404 PAGE ─── */

.error-page {
    text-align: center;
    padding-top: 6rem;
    border-bottom: none;
}

.error-page::before {
    display: none;
}

.error-page h1 {
    font-size: clamp(6rem, 15vw, 12rem);
    color: var(--rule-light);
    margin-bottom: 0.5rem;
}

.error-page .tagline {
    font-size: 1rem;
}

.error-page .intro {
    margin: 0 auto;
}

/* ─── LINKS ─── */

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.25s var(--ease-out);
}

a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

/* External link indicator — subtle arrow for links leaving the site */
a[rel~="external"]::after {
    content: '\2009\2197'; /* thin space + ↗ */
    font-size: 0.75em;
    vertical-align: super;
    opacity: 0.6;
    text-decoration: none;
    display: inline-block;
}

/* ─── FOCUS / ACCESSIBILITY ─── */

.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    padding: 0.75rem 1.5rem;
    background: var(--accent);
    color: var(--bg);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 0 0 4px 4px;
    z-index: 200;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 0;
    color: var(--bg);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 2px;
}

/* ─── MOBILE NAV ─── */

.nav-toggle {
    display: none;
    background: none;
    border: 2px solid var(--rule);
    cursor: pointer;
    padding: 0;
    color: var(--text);
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: background 0.2s, border-color 0.2s;
    position: relative;
}

.nav-toggle:hover {
    background: var(--bg-alt);
    border-color: var(--text-muted);
}

/* CSS hamburger icon — three lines that animate to X */
.nav-toggle .hamburger {
    width: 18px;
    height: 14px;
    position: relative;
    display: block;
}

.nav-toggle .hamburger span {
    display: block;
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--text);
    border-radius: 1px;
    transition: transform 0.3s var(--ease-out), opacity 0.2s var(--ease-out);
}

.nav-toggle .hamburger span:nth-child(1) { top: 0; }
.nav-toggle .hamburger span:nth-child(2) { top: 6px; }
.nav-toggle .hamburger span:nth-child(3) { top: 12px; }

.nav-toggle[aria-expanded="true"] .hamburger span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .hamburger span:nth-child(2) {
    opacity: 0;
}

.nav-toggle[aria-expanded="true"] .hamburger span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* ─── SCROLLBAR ─── */

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--rule-light); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── BLOG ─── */

#blog-header {
    padding: 4rem 0 2rem;
    position: relative;
}

#blog-header::before {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: var(--accent);
    margin-bottom: 2rem;
}

#blog-header h1 {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: -0.02em;
    color: var(--text);
    margin-bottom: 1rem;
}

#blog-header .intro {
    font-family: var(--font-body);
    font-size: 1.15rem;
    font-style: italic;
    color: var(--text-mid);
    max-width: 600px;
}

.tag-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 1.25rem;
    position: relative;
    z-index: 1;
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--text-muted);
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--rule-light);
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.tag-pill:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.tag-count {
    font-size: 0.58rem;
    color: var(--text-muted);
    font-weight: 500;
    opacity: 0.6;
}

.tag-pill:hover .tag-count {
    color: var(--accent);
    opacity: 1;
}

.post-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: var(--rule-light);
    border-top: 1px solid var(--rule-light);
    border-bottom: 1px solid var(--rule-light);
}

.post-list li a {
    display: block;
    padding: 1.5rem 0.5rem;
    background: var(--bg);
    text-decoration: none;
    color: var(--text);
    transition: background 0.15s ease;
}

.post-list li a:hover {
    background: var(--accent-light);
}

.post-list h2 {
    font-family: var(--font-body);
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.post-list time,
.post-list .reading-time,
.post-list .meta-sep {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

.post-list p {
    font-size: 0.9rem;
    color: var(--text-mid);
    margin-top: 0.5rem;
}

/* Blog post single */
#blog-post {
    padding: 4rem 0 3rem;
}

#blog-post header {
    margin-bottom: 3rem;
    position: relative;
}

#blog-post header::before {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: var(--accent);
    margin-bottom: 2rem;
}

#blog-post h1 {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: -0.02em;
    color: var(--text);
    margin-bottom: 0.75rem;
}

#blog-post time {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

.post-meta {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

.post-author {
    color: var(--text-mid);
}

.meta-sep {
    color: #6E6A64;
}

.reading-time {
    color: #6E6A64;
    font-size: 0.72rem;
}

.post-tags {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.post-tags .tag {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    transition: color 0.15s ease;
}

.post-tags .tag:hover {
    color: var(--accent-hover);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.post-content {
    max-width: 680px;
}

.post-content p {
    margin-bottom: 1.5rem;
}

.post-content h2 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: -0.01em;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

.post-content h3 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.post-content code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    background: var(--accent-light);
    padding: 0.15em 0.4em;
    border-radius: 3px;
}

.post-content pre {
    background: var(--bg-dark);
    color: var(--bg);
    padding: 1.25rem 1.5rem;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.6;
}

.post-content pre code {
    background: none;
    padding: 0;
    border-radius: 0;
}

.post-content blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 1.25rem;
    margin: 1.5rem 0;
    color: var(--text-mid);
    font-style: italic;
}

.post-content ul, .post-content ol {
    padding-left: 1.5rem;
    margin-bottom: 1.5rem;
}

.post-content li {
    margin-bottom: 0.5rem;
}

.post-content a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

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

.post-content img {
    max-width: 100%;
    height: auto;
    margin: 1.5rem 0;
}

.post-content hr {
    border: none;
    border-top: 1px solid var(--rule-light);
    margin: 2rem 0;
}

/* ─── RESPONSIVE ─── */

/* Large tablets and small desktops */
@media (max-width: 1024px) {
    main {
        padding: 7rem 1.5rem 3.5rem;
    }

    .about-content {
        gap: 0 2rem;
    }

    .about-right {
        padding-left: 2rem;
    }

    .project.featured {
        padding: 2rem;
    }
}

/* About section collapse */
@media (max-width: 900px) {
    .about-content {
        grid-template-columns: 1fr;
    }

    .about-right {
        border-left: none;
        padding-left: 0;
        border-top: 1px solid var(--rule-light);
        padding-top: 2rem;
        margin-top: 1rem;
    }
}

/* Tablets — hamburger nav */
@media (max-width: 768px) {
    .nav-toggle { display: flex; }

    .nav-links {
        position: absolute;
        top: 100%;
        left: 0; right: 0;
        flex-direction: column;
        background: rgba(245, 240, 232, 0.98);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-bottom: 2px solid var(--rule);
        padding: 0.5rem 1rem;
        gap: 0;
        /* Animated open/close via grid row trick */
        display: grid;
        grid-template-rows: 0fr;
        overflow: hidden;
        transition: grid-template-rows 0.35s var(--ease-out), padding 0.35s var(--ease-out), border-bottom-width 0.35s;
        padding-block: 0;
        border-bottom-width: 0;
        visibility: hidden;
    }

    .nav-links > li {
        overflow: hidden;
    }

    .nav-links.open {
        grid-template-rows: 1fr;
        padding-block: 0.5rem;
        border-bottom-width: 2px;
        visibility: visible;
    }

    .nav-links li {
        border-bottom: 1px solid var(--rule-light);
    }

    .nav-links li:last-child { border-bottom: none; }

    .nav-links a {
        padding: 0.75rem 0.5rem;
        min-height: 44px;
        display: flex;
        align-items: center;
        font-size: 0.8rem;
    }

    .nav-links a::after {
        display: none;
    }

    .project.featured {
        grid-template-columns: 1fr;
    }

    #contact .contact-inner {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .contact-links {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 1.5rem;
    }
}

/* Small tablets */
@media (max-width: 640px) {
    body { font-size: 16px; hyphens: auto; }

    main { padding: 5.5rem 1.25rem 3rem; }

    #hero { padding: 2.5rem 0; }

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

    .project.featured {
        grid-template-columns: 1fr;
    }

    .project-link::after {
        top: 1.5rem;
        right: 1.5rem;
    }

    #contact {
        padding: 3rem 1.25rem;
    }
}

/* Small phones */
@media (max-width: 480px) {
    .nav-inner { padding: 0.8rem 1rem; }

    main { padding: 5.5rem 1rem 2.5rem; }

    #hero { padding: 2rem 0; }
    /* h1 size handled by clamp */

    .intro { font-size: 1.1rem; }

    .project { padding: 1.25rem; }
    .project.featured { padding: 1.5rem; }
    .project.featured h3 { font-size: 1.25rem; }

    .project-link::after {
        top: 1.25rem;
        right: 1.25rem;
    }

    #contact {
        padding: 3rem 1rem;
    }

    #now-header h1,
    #uses-header h1 {
        font-size: 2.5rem;
    }

    .contact-links {
        flex-direction: column;
    }
}

/* Very small phones */
@media (max-width: 360px) {
    main { padding: 5.5rem 0.75rem 2.5rem; }
    #contact { padding: 3rem 0.75rem; }
    .nav-inner { padding: 0.8rem 0.75rem; }
}

/* ─── ENTRANCE ANIMATIONS ─── */

@keyframes ruleGrow {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

#hero h1 {
    animation: fadeUp 0.6s var(--ease-out) both;
}

.tagline {
    animation: fadeUp 0.6s var(--ease-out) 0.15s both;
}

.intro {
    animation: fadeUp 0.6s var(--ease-out) 0.3s both;
}

#hero::before {
    animation: ruleGrow 0.4s var(--ease-out) 0.5s both;
    transform-origin: left;
}

/* Sub-page header animations */
#now-header h1,
#uses-header h1 {
    animation: fadeUp 0.6s var(--ease-out) both;
}

#now-header .intro,
#uses-header .intro {
    animation: fadeUp 0.6s var(--ease-out) 0.15s both;
}

#now-header::before,
#uses-header::before {
    animation: ruleGrow 0.4s var(--ease-out) 0.4s both;
    transform-origin: left;
}

/* ─── VIEW TRANSITIONS (progressive enhancement for same-origin navigation) ─── */

@view-transition {
    navigation: auto;
}

::view-transition-old(root) {
    animation-duration: 0.2s;
    animation-timing-function: var(--ease-out);
}

::view-transition-new(root) {
    animation-duration: 0.2s;
    animation-timing-function: var(--ease-out);
}

/* ─── PREFERS REDUCED MOTION ─── */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    html {
        scroll-behavior: auto;
    }

    .reveal,
    .js-reveal .reveal {
        opacity: 1;
        transform: none;
    }

    .project:hover {
        transform: none;
    }

    @view-transition {
        navigation: none;
    }
}

/* ─── PREFERS CONTRAST ─── */

@media (prefers-contrast: more) {
    :root {
        --rule-light: #8A8580;
        --text-muted: #3D3D38;
        --accent-light: rgba(166, 61, 43, 0.15);
    }

    nav {
        background: var(--bg);
        backdrop-filter: none;
    }

    .project {
        border-width: 2px;
    }

    h2 {
        color: var(--text-mid);
    }
}

/* ─── FORCED COLORS (Windows High Contrast) ─── */

@media (forced-colors: active) {
    nav {
        border-bottom: 2px solid CanvasText;
    }

    .project {
        border: 2px solid CanvasText;
    }

    .skip-link {
        background: Highlight;
        color: HighlightText;
    }

    .nav-toggle {
        border: 2px solid ButtonText;
    }

    .nav-toggle .hamburger span {
        background: ButtonText;
    }

    h2::after {
        background: Highlight;
    }

    #hero::before {
        background: Highlight;
    }

    ::selection {
        background: Highlight;
        color: HighlightText;
    }
}

/* ─── PRINT ─── */

@media print {
    nav, .skip-link, .nav-toggle, footer {
        display: none;
    }

    body {
        font-size: 12pt;
        color: #000;
        background: #fff;
    }

    body::before {
        display: none;
    }

    main {
        padding: 0;
        max-width: none;
    }

    a {
        color: #000;
        text-decoration: underline;
    }

    a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #555;
    }

    a[href^="mailto"]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #555;
    }

    .project {
        break-inside: avoid;
        border: 1px solid #ccc;
    }

    #contact {
        background: #fff;
        color: #000;
    }

    #contact h2,
    #contact p {
        color: #000;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }
}
