/* ==========================================================================
   J. Shipps — Ghost theme version of jshipps.me
   Design tokens ported from jshipps.me
   ========================================================================== */

:root {
    --accent: #7cf03d;
    --page-bg: #07090c;
    --page-fg: #edf0f5;
    --heading: #fdfffa;
    --body-text: #aeb4c2;
    --muted: #969dab;
    --accent-text: #7cf03d;
    --accent-soft: color-mix(in srgb, var(--accent) 18%, transparent);
    --line: rgba(255, 255, 255, 0.104);
    --line-strong: rgba(255, 255, 255, 0.16);
    --chip-border: rgba(255, 255, 255, 0.124);
    --surface: rgba(255, 255, 255, 0.032);
    --surface-strong: rgba(255, 255, 255, 0.054);
    --chip-text: #d9dce4;
    --header-bg: rgba(8, 10, 13, 0.78);
    --footer-bg: rgba(4, 7, 10, 0.6);
    --card-grad: linear-gradient(155deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02));
    --card-shadow: 0 45px 90px rgba(0, 0, 0, 0.38);
    --radius-lg: 24px;
    --radius-md: 16px;
    --font-sans: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

:root[data-theme="light"] {
    --page-bg: #f2f5ec;
    --page-fg: #141a12;
    --heading: #0d130c;
    --body-text: #3c443a;
    --muted: #5d645a;
    --accent-text: #356f10;
    --accent-soft: color-mix(in srgb, var(--accent) 18%, transparent);
    --line: rgba(13, 19, 12, 0.12);
    --line-strong: rgba(13, 19, 12, 0.2);
    --chip-border: rgba(13, 19, 12, 0.16);
    --surface: rgba(13, 19, 12, 0.045);
    --surface-strong: rgba(13, 19, 12, 0.085);
    --chip-text: #3c443a;
    --header-bg: rgba(244, 247, 240, 0.82);
    --footer-bg: rgba(238, 243, 233, 0.85);
    --card-grad: linear-gradient(155deg, rgba(13, 19, 12, 0.055), rgba(13, 19, 12, 0.02));
    --card-shadow: 0 45px 90px rgba(13, 19, 12, 0.16);
}

/* ---------- Reset & base ---------- */

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    min-height: 100vh;
    background: var(--page-bg);
    color: var(--page-fg);
    font-family: var(--font-sans);
    font-size: 1.02rem;
    line-height: 1.6;
    letter-spacing: -0.015em;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { color: var(--heading); letter-spacing: -0.04em; line-height: 1.1; }
h1 { font-size: clamp(2.3rem, 4vw, 3.6rem); }
h2 { font-size: clamp(2rem, 3vw, 3.4rem); }
h3 { font-size: clamp(1.3rem, 1.6vw, 1.7rem); }

p, li, figcaption { color: var(--body-text); font-size: 1.02rem; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img { max-width: 100%; height: auto; display: block; }

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

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

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 100;
    background: var(--accent);
    color: #051003;
    font-weight: 700;
    padding: 0.7rem 1.2rem;
    border-radius: 0 0 10px 0;
}
.skip-link:focus { left: 0; top: 0; outline: none; }

/* ---------- Layout ---------- */

.container { width: 100%; max-width: 940px; margin-inline: auto; padding-inline: 32px; }

.site { display: flex; flex-direction: column; min-height: 100vh; }
.site-main { flex: 1 0 auto; }

.container-narrow { max-width: 72ch; margin-inline: auto; padding-inline: 32px; }
.container-wide { max-width: 1240px; margin-inline: auto; padding-inline: 32px; }

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: 999px;
    border: 1px solid transparent;
    padding: 0.54rem 1.1rem;
    font-weight: 700;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    line-height: 1;
    transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #051003; }
.cta-ink { color: #051003; text-shadow: 0 0 1px rgba(0, 0, 0, 0.42), 0 1px 2px rgba(0, 0, 0, 0.3), 0 0 3px rgba(0, 0, 0, 0.16); }
.btn-ghost { border-color: var(--chip-border); background: var(--surface); color: var(--page-fg); }
.btn-ghost:hover { background: var(--surface-strong); }

.cta-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1.1rem;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    font-size: 0.9rem;
    transition: background-color 0.18s ease, color 0.18s ease;
}
.cta-btn:hover { background: var(--surface-strong); color: var(--page-fg); }

/* ---------- Header ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 30;
    border-bottom: 1px solid var(--line);
    background: var(--header-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.header-nav { display: flex; align-items: center; justify-content: space-between; gap: 2rem; height: 68px; }

.brand { display: flex; align-items: center; gap: 0.75rem; }
.footer-mark {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: var(--accent);
    color: #051003;
    font-family: var(--font-mono);
    font-weight: 800;
    flex-shrink: 0;
}
.brand-title { font-weight: 700; font-size: 1.25rem; letter-spacing: -0.02em; }

.nav-menu { display: flex; align-items: center; gap: 1.4rem; list-style: none; }
.nav-link { font-size: 0.9rem; color: var(--page-fg); transition: color 0.18s ease; }
.nav-link:hover { color: var(--muted); }
.nav-link.is-active { color: var(--page-fg); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 0.34em; text-decoration-thickness: 1px; }

.header-actions { display: flex; align-items: center; gap: 0.5rem; }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid var(--chip-border);
    background: var(--surface);
    color: var(--page-fg);
    transition: background-color 0.18s ease, border-color 0.18s ease;
}
.icon-btn:hover { background: var(--surface-strong); }

.theme-toggle .theme-icon { display: block; }
.theme-toggle .theme-icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .theme-icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .theme-icon-moon { display: none; }

.nav-toggle { display: none; }

/* ---------- Hero ---------- */

.hero { position: relative; padding-top: 96px; padding-bottom: 80px; overflow: hidden; }
.hero-inner {
    max-width: 940px;
    margin-inline: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 350px;
    gap: 64px;
    align-items: center;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    width: fit-content;
    border-radius: 999px;
    border: 1px solid var(--chip-border);
    background: var(--surface);
    color: var(--page-fg);
    padding: 0.54rem 1rem;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: var(--accent); }

.hero-copy { font-size: clamp(2.5rem, 5vw, 4rem); margin: 1.2rem 0 1.3rem; line-height: 1.05; }
.accent { color: var(--accent-text); }
.hero-text { max-width: 56ch; margin-top: 0.9rem; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.8rem; max-width: 560px; }

.hero-card {
    position: relative;
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    background: var(--card-grad);
    padding: 1.6rem;
    box-shadow: var(--card-shadow);
}
.hero-card-top { display: flex; align-items: center; gap: 0.55rem; font-family: var(--font-mono); color: var(--muted); font-size: 0.8rem; }
.dot { width: 10px; height: 10px; border-radius: 999px; display: inline-block; }
.dot.green { background: #79ff83; }
.dot.amber { background: #ffd876; }
.dot.rose { background: #ff7d90; }
.hero-code { margin: 1.2rem 0 0; font-family: var(--font-mono); font-size: 0.82rem; line-height: 1.9; white-space: pre; overflow-x: auto; color: var(--page-fg); }

.stats {
    max-width: 940px;
    margin-top: 3rem;
    margin-bottom: 0;
    padding-block: 1rem;
    border-block: 1px solid var(--line);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}
.meta { display: grid; gap: 0.3rem; }
.stat { display: block; color: var(--page-fg); font-family: var(--font-mono); font-size: 1.4rem; font-weight: 700; }
.meta-label { color: var(--muted); font-size: 1rem; }

/* ---------- Work ---------- */

.section-work { padding-block: 3rem 4rem; }
.work-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.work-head-text { max-width: 72ch; }
.work-head-text h2 { margin-bottom: 0.9rem; }
.work-head-text p { margin: 0; line-height: 1.65; }
.all-work {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--chip-border);
    background: var(--surface);
    padding: 0.54rem 1rem;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--page-fg);
    transition: transform 0.18s ease, background-color 0.18s ease;
}
.all-work:hover { transform: translateY(-1px); background: var(--surface-strong); }

.work-grid { margin-top: 2.4rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }

.work-card { overflow: hidden; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--surface); }
.work-card a { display: flex; flex-direction: column; min-height: 100%; }
.work-media { height: 260px; background: var(--media-grad); }
.work-media img { width: 100%; height: 100%; object-fit: cover; }
.work-body { padding: 1.4rem; }
.work-body p { margin: 0; line-height: 1.65; }
.work-body p.muted { color: var(--muted); }
.work-body h2 { font-size: clamp(1.3rem, 1.6vw, 1.7rem); margin-top: 0.5rem; }

/* ---------- Hubs ---------- */

.hubs { padding-block: 3rem 4rem; }
.hub-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.hub-card {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.6rem;
    transition: background-color 0.18s ease, border-color 0.18s ease;
}
.hub-card:hover { background: var(--surface-strong); border-color: var(--line-strong); }
.hub-card > span { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.hub-card strong { font-size: 1.02rem; font-weight: 700; color: var(--page-fg); }
.hub-card > span:last-of-type { font-size: 0.88rem; color: var(--muted); }

/* ---------- Footer ---------- */

.site-footer { border-top: 1px solid var(--line); background: var(--footer-bg); margin-top: 4rem; }

.footer-inner { max-width: 940px; margin-inline: auto; padding-block: 2rem; padding-inline: 32px; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.footer-brand { max-width: 340px; }
.footer-text { margin: 0; color: var(--muted); font-size: 0.82rem; max-width: 360px; line-height: 1.5; }
.footer-social { display: flex; gap: 0.5rem; margin-top: 1rem; }
.footer-social a { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 999px; color: var(--muted); transition: color 0.18s ease, background-color 0.18s ease; }
.footer-social a:hover { color: var(--page-fg); background: var(--surface-strong); }

.footer-nav { display: flex; align-items: center; gap: 1rem; font-size: 0.82rem; color: var(--muted); }
.footer-nav a:hover { color: var(--page-fg); }

.footer-bottom { max-width: 940px; margin-inline: auto; padding: 1.5rem 32px 2rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.footer-legal { margin: 0; color: var(--muted); font-size: 0.72rem; }

#footer-year { font-weight: 700; color: var(--page-fg); }

/* ---------- Content (posts / pages) ---------- */

.gh-content { max-width: 70ch; margin-inline: auto; margin-top: 3rem; font-size: 1.06rem; line-height: 1.78; }
.gh-content > * + * { margin-top: 1.5em; }
.gh-content h2 { font-size: 1.75rem; margin-top: 2em; }
.gh-content h3 { font-size: 1.35rem; margin-top: 1.8em; }
.gh-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.gh-content a:hover { text-decoration-color: var(--accent); }
.gh-content blockquote { padding-left: 22px; border-left: 3px solid var(--accent); font-family: var(--font-sans); font-size: 1.25rem; line-height: 1.5; color: var(--body-text); }
.gh-content hr { border: 0; height: 1px; margin-block: 2.5em; background: linear-gradient(90deg, transparent, var(--line-strong), transparent); }
.gh-content img { border-radius: 10px; }
.gh-content :not(pre) > code { font-family: var(--font-mono); font-size: 0.85em; background: var(--surface-strong); border: 1px solid var(--line); border-radius: 6px; padding: 0.2em 0.42em; }
.gh-content pre { position: relative; padding: 20px 22px; background: #101218; color: #e6e6eb; border-radius: var(--radius-md); overflow-x: auto; font-family: var(--font-mono); font-size: 0.88rem; line-height: 1.6; }
.gh-content pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
.gh-content pre:hover .code-copy { opacity: 1; }
.code-copy {
    position: absolute; top: 10px; right: 10px;
    padding: 0.5rem 0.8rem; font-size: 0.75rem; font-weight: 600;
    color: #cfd0d8; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px; opacity: 0; transition: opacity 0.15s ease;
}
.gh-content pre:hover .code-copy { opacity: 1; }

/* ---------- Post / page headers ---------- */

.post-header, .page-header { padding-top: 64px; text-align: center; }
.post-tag { display: inline-block; margin-bottom: 18px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.post-title { font-size: clamp(2rem, 4.5vw, 3.2rem); }
.post-excerpt { margin-top: 16px; font-size: 1.2rem; color: var(--body-text); }
.post-meta { margin-top: 26px; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; font-size: 0.9rem; color: var(--muted); }
.post-authors { display: inline-flex; gap: 14px; }
.post-author { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; color: var(--body-text); }
.post-author:hover { color: var(--accent); }
.post-author-avatar { width: 28px; height: 28px; border-radius: 999px; object-fit: cover; }
.sep { color: var(--muted); }

.post-feature-image { margin-top: 44px; }
.post-feature-image img { width: 100%; border-radius: var(--radius-md); box-shadow: var(--card-shadow); }
.post-feature-image figcaption { margin-top: 12px; text-align: center; font-size: 0.85rem; color: var(--muted); }

/* ---------- Archives ---------- */

.archive-header { padding-top: 64px; text-align: center; max-width: 720px; margin-inline: auto; }
.archive-label { display: block; margin-bottom: 12px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.archive-title { font-size: clamp(2rem, 4.5vw, 3rem); }
.archive-desc { margin-top: 14px; color: var(--body-text); }
.archive-count { display: inline-block; margin-top: 14px; font-size: 0.85rem; color: var(--muted); }
.archive-avatar { width: 88px; height: 88px; margin: 0 auto 18px; border-radius: 999px; object-fit: cover; }
.archive-meta { margin-top: 14px; display: flex; justify-content: center; flex-wrap: wrap; gap: 16px; font-size: 0.88rem; color: var(--muted); }

.feed { margin-top: 56px; }
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.25rem; }

.post-card { overflow: hidden; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--surface); }
.post-card a { display: flex; flex-direction: column; min-height: 100%; }
.post-card-image { aspect-ratio: 16 / 9; background: var(--surface-strong); overflow: hidden; }
.post-card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.35s ease; }
.post-card:hover .post-card-image img { transform: scale(1.04); }
.post-card-body { display: flex; flex-direction: column; gap: 10px; padding: 22px; flex: 1; }
.post-card-tag { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.post-card-title { font-size: 1.3rem; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; }
.post-card-excerpt { font-size: 0.95rem; color: var(--body-text); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-card-meta { margin-top: auto; padding-top: 6px; font-size: 0.85rem; color: var(--muted); display: flex; gap: 8px; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 20px; margin-top: 44px; }
.page-number { font-size: 0.9rem; color: var(--muted); }

/* ---------- Error ---------- */

.error-wrap { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 24px; }
.error-code { font-size: clamp(5rem, 18vw, 9rem); font-weight: 700; line-height: 1; color: var(--accent); }
.error-message { margin: 16px 0 32px; font-size: 1.1rem; color: var(--body-text); }
.error-wrap .btn { margin-inline: auto; }

/* ---------- Ghost editor cards (Koenig) ---------- */

.kg-width-wide {
    position: relative;
    width: 100vw;
    max-width: 1080px;
    margin-left: 50%;
    transform: translateX(-50%);
}

.kg-width-full {
    position: relative;
    width: 100vw;
    max-width: 100vw;
    margin-left: 50%;
    transform: translateX(-50%);
}

.kg-gallery-container { width: 100%; }
.kg-gallery-row { display: flex; gap: 10px; margin-bottom: 10px; }
.kg-gallery-row:last-child { margin-bottom: 0; }
.kg-gallery-image { flex: 1 1 0; }

.kg-bookmark-card { display: block; text-decoration: none; }
.kg-bookmark-container { display: flex; border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; background: var(--surface); }
.kg-bookmark-content { flex: 1; padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.kg-bookmark-title { font-weight: 700; font-size: 0.98rem; line-height: 1.4; color: var(--heading); }
.kg-bookmark-description { font-size: 0.85rem; color: var(--body-text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kg-bookmark-metadata { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--muted); }
.kg-bookmark-icon { width: 16px; height: 16px; }
.kg-bookmark-author { color: var(--muted); }
.kg-bookmark-publisher { color: var(--muted); }
.kg-bookmark-thumbnail { width: 180px; min-height: 100%; }
.kg-bookmark-thumbnail img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
    .hero-inner { grid-template-columns: minmax(0, 1fr); gap: 40px; }
    .hero { padding-top: 64px; }
    .stats { grid-template-columns: 1fr; gap: 20px; }
    .nav-toggle { display: inline-flex; }
    .header-nav { flex-wrap: wrap; height: auto; padding-block: 10px; row-gap: 8px; }
    .nav-menu { display: none; order: 3; flex-basis: 100%; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 12px; }
    .nav-menu.is-open { display: flex; }
    .nav-link { display: block; padding: 12px 14px; border-radius: var(--radius-md); }
    .header-actions { margin-left: auto; }
    .post-layout, .post-layout.has-sidebar { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
    .container { padding-inline: 20px; }
    .container-narrow { padding-inline: 20px; }
    .container-wide { padding-inline: 20px; }
    .hero-ctas .btn { width: 100%; }
    .work-grid { grid-template-columns: 1fr; }
    .hub-grid { grid-template-columns: 1fr; }
}

/* ---------- Motion preferences ---------- */

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