@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,400..700;1,14..32,400..700&family=Lora:wght@400;600;700&family=Fraunces:opsz,wght@9..144,400..700&family=DM+Serif+Display:wght@400&display=swap');

/* ============================================================
   Design tokens
   ============================================================ */
:root {
    --bg-color: #f7f7f5;
    --surface-color: #ffffff;
    --surface-2: #fafaf8;
    --surface-translucent: rgba(255,255,255,.92);
    --text-color: #1a1a1a;
    --secondary-color: #6b7280;
    --tertiary-color: #9ca3af;
    --accent-color: #1a1a1a;
    --link-color: #2563eb;
    --link-hover: #1d4ed8;
    --link-wash: rgba(37,99,235,.08);
    --border-color: #d4d4d4;
    --border-light: #e5e5e5;
    --border-faint: #efefeb;
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
    --heading-font: 'Lora', Georgia, serif;
    --max-width: 900px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,.08);
    --shadow-lg: 0 10px 24px rgba(0,0,0,.10);
    --radius: 8px;
    --radius-lg: 12px;
    --radius-pill: 999px;
    --dur: .2s;
    --dur-slow: .25s;
    --focus-ring: 0 0 0 3px rgba(26,26,26,.08);

    --accent-link: var(--link-color);
    --accent-link-hover: var(--link-hover);
    --accent-wash: var(--link-wash);
    --density: 0.85;

    /* Blog masonry gap; column breakpoints use ~300px min card + 1.25rem gaps (viewport media) */
    --post-col-gap: 1.25rem;
}

/* ============================================================
   Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--font-family);
    line-height: 1.65;
    color: var(--text-color);
    margin: 0;
    padding: 0;
    background: var(--bg-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

main { flex: 1; }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--heading-font);
    color: var(--text-color);
    line-height: 1.2;
    letter-spacing: -0.01em;
}

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

.flex-1 { flex: 1; }

/* ============================================================
   Site Header
   ============================================================ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--surface-translucent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-color);
    padding: calc(.7rem * var(--density)) 0;
}
.site-header__inner {
    max-width: 66rem;
    margin: 0 auto;
    padding: 0 1.05rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.site-header__brand {
    font-family: var(--heading-font);
    font-weight: 600;
    font-size: 1.02rem;
    color: var(--text-color);
    letter-spacing: -0.01em;
    white-space: nowrap;
}
.site-header__brand a { color: inherit; text-decoration: none; }
.site-header__brand a:hover { color: var(--text-color); text-decoration: none; }
.site-header__brand .dot {
    display: inline-block;
    width: 6px; height: 6px;
    background: var(--accent-link);
    border-radius: 50%;
    margin-right: .45rem;
    vertical-align: middle;
    transform: translateY(-1px);
}

.site-header__end {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.blog-sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--surface-color);
    color: var(--text-color);
    cursor: pointer;
    transition: background var(--dur), border-color var(--dur);
    flex-shrink: 0;
}
.blog-sidebar-toggle:hover {
    background: rgba(0,0,0,.04);
    border-color: var(--text-color);
}

.top-menu { display: flex; align-items: center; gap: .05rem; flex-wrap: wrap; }
.top-menu__link {
    font-family: var(--font-family);
    font-size: .76rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--secondary-color);
    padding: .4rem .6rem;
    border-radius: 4px;
    transition: color var(--dur), background var(--dur);
    text-decoration: none;
    cursor: pointer;
}
.top-menu__link:hover {
    color: var(--text-color);
    background: rgba(0,0,0,.04);
    text-decoration: none;
}
.top-menu__link[aria-current="page"] { color: var(--text-color); }
.top-menu__divider { color: var(--border-color); user-select: none; padding: 0 .1rem; }

/* ============================================================
   Page container
   ============================================================ */
.page {
    max-width: 66rem;
    margin: 0 auto;
    padding: calc(2rem * var(--density)) 1.05rem calc(3rem * var(--density));
}

/* ============================================================
   About — Hero
   ============================================================ */
.hero {
    display: grid;
    grid-template-columns: minmax(8rem, 10rem) 1fr;
    gap: 1.25rem;
    align-items: center;
    margin-bottom: calc(2rem * var(--density));
    padding-left: clamp(.35rem, 1vw, .9rem);
}
.hero__avatar {
    width: 100%;
    max-width: 10rem;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}
.hero__eyebrow {
    margin: 0;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--accent-color);
    font-size: .76rem;
    font-weight: 600;
    font-family: var(--font-family);
}
.hero__title {
    margin: .4rem 0 .5rem;
    font-size: clamp(1.75rem, 3.6vw, 3rem);
    line-height: 1.08;
    letter-spacing: -0.015em;
}
.hero__intro {
    margin: 0;
    color: var(--secondary-color);
    font-size: 1.05rem;
    max-width: 42rem;
    line-height: 1.55;
}
.hero__link {
    margin: .75rem 0 0;
    font-size: .95rem;
}
.hero__link a {
    color: var(--accent-color);
    font-weight: 500;
    text-decoration: none;
}
.hero__link a:hover {
    text-decoration: underline;
}
.hero__status {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin-top: .9rem;
    padding: .3rem .7rem .3rem .6rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    background: var(--surface-color);
    font-size: .78rem;
    color: var(--text-color);
    font-weight: 500;
    text-decoration: none;
}
.hero__status:hover { text-decoration: none; color: var(--text-color); background: var(--surface-2); }
.hero__status .pulse {
    width: 6px; height: 6px; border-radius: 50%;
    background: #15803d;
    box-shadow: 0 0 0 0 rgba(21,128,61,.5);
    animation: pulse 2.4s ease-out infinite;
    flex-shrink: 0;
}
@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(21,128,61,.4); }
    70%  { box-shadow: 0 0 0 8px rgba(21,128,61,0); }
    100% { box-shadow: 0 0 0 0 rgba(21,128,61,0); }
}

/* ============================================================
   About — Era chips
   ============================================================ */
.timeline-section {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: calc(.9rem * var(--density)) calc(1rem * var(--density));
    align-items: center;
}
.timeline-section__heading {
    position: static;
    align-self: center;
}
.timeline-section__title {
    margin: 0;
    font-size: 1.15rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--secondary-color);
    font-family: var(--font-family);
    font-weight: 700;
}
.chips {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin: 0 0 calc(1.25rem * var(--density));
    flex-wrap: wrap;
    padding: .4rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    width: fit-content;
    margin-left: 0;
    box-shadow: var(--shadow-sm);
}
.timeline-wrap {
    grid-column: 1 / -1;
}
.chip {
    font-family: var(--font-family);
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .04em;
    padding: .4rem .85rem;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--secondary-color);
    border: none;
    cursor: pointer;
    transition: color var(--dur), background var(--dur);
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}
.chip:hover { color: var(--text-color); background: rgba(0,0,0,.04); }
.chip[aria-pressed="true"] { background: var(--text-color); color: #fff; }
.chip__count { font-size: .7rem; font-weight: 500; opacity: .7; }

/* ============================================================
   About — Timeline wrap + year rail
   ============================================================ */
.timeline-wrap {
    display: grid;
    grid-template-columns: 1fr 4.5rem;
    gap: calc(1.25rem * var(--density));
    align-items: start;
}
.year-rail {
    position: sticky;
    top: calc(4rem * var(--density));
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: .15rem;
    padding-top: .5rem;
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
    scrollbar-width: none;
}
.year-rail::-webkit-scrollbar { display: none; }
.year-rail__item {
    font-family: var(--font-family);
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .06em;
    color: var(--tertiary-color);
    padding: .25rem .35rem;
    background: transparent;
    border: none;
    text-align: right;
    cursor: pointer;
    border-right: 2px solid var(--border-light);
    transition: color var(--dur), border-color var(--dur);
    font-variant-numeric: tabular-nums;
}
.year-rail__item:hover { color: var(--text-color); border-right-color: var(--text-color); }
.year-rail__item.is-active { color: var(--accent-link); border-right-color: var(--accent-link); font-weight: 700; }

/* ============================================================
   About — Timeline entries
   ============================================================ */
.timeline {
    display: grid;
    gap: calc(1rem * var(--density));
    position: relative;
}
.timeline::before {
    content: '';
    position: absolute;
    left: calc(6rem + 1px);
    top: 0; bottom: 0;
    width: 1px;
    background: var(--border-light);
    pointer-events: none;
    opacity: 0;
}
.timeline.layout-rail::before { opacity: 1; }

.entry {
    position: relative;
    display: grid;
    grid-template-columns: 6rem 1fr;
    gap: calc(1.1rem * var(--density));
    align-items: flex-start;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--surface-color);
    padding: calc(1rem * var(--density)) calc(1.15rem * var(--density));
    box-shadow: var(--shadow-sm);
    transition: transform var(--dur), box-shadow var(--dur);
    scroll-margin-top: calc(5rem * var(--density));
}
.entry:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }

.entry__media {
    width: 6rem;
    aspect-ratio: 1 / 1;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: .55rem;
    overflow: hidden;
    flex-shrink: 0;
}
.entry__media img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.entry__media--apple {
    padding: 0;
    background: #000;
}
.entry__media--apple span {
    font-size: 2.8rem;
    line-height: 1;
    font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    color: #fff;
}
.entry__media--apple span::before { content: "\F8FF"; }
.entry__media--stacked {
    padding: .25rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .15rem;
    flex-wrap: wrap;
}
.entry__media--stacked img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 1px;
    border-radius: 3px;
    background: #fff;
    border: 1px solid var(--border-light);
}

.entry__era {
    position: absolute;
    top: calc(1rem * var(--density));
    right: calc(1.15rem * var(--density));
    z-index: 1;
    margin: 0;
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--tertiary-color);
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    white-space: nowrap;
}
.entry__era .era-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--tertiary-color);
    flex-shrink: 0;
}
.entry--work .era-dot     { background: #1a1a1a; }
.entry--study .era-dot    { background: var(--accent-link); }
.entry--adventure .era-dot{ background: #0f766e; }

.entry__title {
    margin: 0;
    padding-right: 5.5rem;
    font-size: 1.2rem;
    line-height: 1.25;
    font-family: var(--heading-font);
    font-weight: 600;
    letter-spacing: -0.01em;
    display: flex;
    align-items: baseline;
    gap: .5rem;
    flex-wrap: wrap;
}
.entry__title a { color: var(--text-color); }
.entry__title a:hover { color: var(--accent-link-hover); text-decoration: none; }
.entry__period {
    color: var(--accent-link);
    font-size: .82rem;
    font-family: var(--font-family);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    letter-spacing: 0;
}
.entry__role {
    color: var(--secondary-color);
    font-size: .85rem;
    font-family: var(--font-family);
    margin-top: .1rem;
}
.entry p {
    margin: .6rem 0 0;
    color: var(--text-color);
    line-height: 1.6;
    font-size: .98rem;
}
.entry p + p { margin-top: .5rem; }
.entry blockquote {
    margin: .75rem 0 0;
    padding: .6rem .85rem;
    border-left: 2px solid var(--accent-link);
    border-radius: 0 .35rem .35rem 0;
    background: var(--accent-wash);
    color: var(--text-color);
    font-style: italic;
    line-height: 1.5;
    font-size: .95rem;
}

/* Timeline rail layout */
.timeline.layout-rail .entry {
    grid-template-columns: 5rem 1fr;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: .35rem 0 1rem 0;
    border-bottom: 1px solid var(--border-faint);
}
.timeline.layout-rail .entry__era {
    top: .35rem;
    right: 0;
}
.timeline.layout-rail .entry:hover { transform: none; box-shadow: none; }
.timeline.layout-rail .entry__media {
    width: 3rem;
    height: 3rem;
    margin-left: 1rem;
    position: relative;
    z-index: 1;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}
.timeline.layout-rail::before { left: calc(1rem + 1.5rem - 0.5px); }

/* Timeline list layout */
.timeline.layout-list { gap: 0; }
.timeline.layout-list .entry {
    grid-template-columns: 1fr;
    background: transparent;
    border: none;
    box-shadow: none;
    border-bottom: 1px solid var(--border-faint);
    border-radius: 0;
    padding: calc(.85rem * var(--density)) 0;
}
.timeline.layout-list .entry__era {
    top: calc(.85rem * var(--density));
    right: 0;
}
.timeline.layout-list .entry:hover { transform: none; box-shadow: none; }
.timeline.layout-list .entry__media { display: none; }
.timeline.layout-list .entry__title { font-size: 1.05rem; }
.timeline.layout-list .entry__period { display: none; }
.timeline.layout-list .entry p:not(.entry__role) { font-size: .92rem; margin-top: .3rem; }
.timeline.layout-list .entry blockquote { display: none; }

/* Entry animation */
@keyframes entryIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.entry { animation: entryIn .35s ease both; }
.timeline > .entry:nth-child(1) { animation-delay: .02s; }
.timeline > .entry:nth-child(2) { animation-delay: .05s; }
.timeline > .entry:nth-child(3) { animation-delay: .08s; }
.timeline > .entry:nth-child(4) { animation-delay: .11s; }
.timeline > .entry:nth-child(5) { animation-delay: .14s; }
.timeline > .entry:nth-child(n+6) { animation-delay: .17s; }

/* ============================================================
   About — Contact block
   ============================================================ */
.contact {
    margin-top: calc(3rem * var(--density));
    padding: calc(2rem * var(--density));
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2rem;
    align-items: center;
}
.contact__eyebrow {
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--secondary-color);
    font-size: .76rem;
    font-weight: 600;
    margin: 0 0 .5rem;
}
.contact__title {
    font-size: clamp(1.4rem, 2.4vw, 1.9rem);
    margin: 0 0 .5rem;
    letter-spacing: -0.01em;
}
.contact__body {
    color: var(--secondary-color);
    margin: 0;
    font-size: 1rem;
    max-width: 34rem;
    line-height: 1.6;
}
.contact__body-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1rem;
}
.contact__body-row .contact__body { flex: 1 1 28rem; }
.contact__body-row .contact__link--primary {
    flex: 0 0 auto;
    margin-top: .08rem;
}
.contact__actions {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
    align-items: center;
}
.contact__links {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
}
.contact__link {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .65rem .9rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: .9rem;
    color: var(--text-color);
    background: var(--surface-2);
    transition: all var(--dur);
    text-decoration: none;
    min-height: 3.15rem;
    cursor: pointer;
    font-family: inherit;
}
.contact__link--primary {
    border-color: var(--text-color);
    background: var(--text-color);
    color: var(--surface-color);
}
.contact__link--primary svg,
.contact__link--primary .link-label { color: var(--surface-color); stroke: var(--surface-color); }
.contact__link--primary .link-label { opacity: .68; }
.contact__link:hover {
    border-color: var(--accent-link);
    color: var(--accent-link);
    text-decoration: none;
    background: var(--surface-color);
    transform: translateY(-1px);
}
.contact__link svg { flex-shrink: 0; stroke: var(--secondary-color); }
.contact__link:hover svg { stroke: var(--accent-link); }
.contact__link .link-label {
    display: block;
    font-size: .65rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--tertiary-color);
    font-weight: 600;
    line-height: 1.2;
}
.contact__link .link-value { font-family: var(--font-family); font-size: .9rem; line-height: 1.2; }

.modal-open { overflow: hidden; }
.contact-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: none;
    place-items: center;
    padding: 1rem;
}
.contact-modal.is-open { display: grid; }
.contact-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(26, 26, 26, .46);
}
.contact-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(100%, 34rem);
    max-height: calc(100vh - 2rem);
    overflow: auto;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 1.5rem;
}
.contact-modal__close {
    position: absolute;
    top: .75rem;
    right: .75rem;
    width: 2.25rem;
    height: 2.25rem;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--secondary-color);
    cursor: pointer;
}
.contact-modal__close:hover {
    color: var(--text-color);
    background: var(--surface-color);
}
.contact-modal__title {
    margin: 0 0 1rem;
    font-size: 1.45rem;
}
.contact-form {
    display: grid;
    gap: .9rem;
}
.contact-form label {
    display: grid;
    gap: .35rem;
    color: var(--text-color);
    font-weight: 600;
}
.contact-form input,
.contact-form textarea {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--text-color);
    font: inherit;
    font-weight: 400;
    padding: .75rem .85rem;
}
.contact-form textarea {
    min-height: 9rem;
    resize: vertical;
    line-height: 1.5;
}
.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--text-color);
    box-shadow: 0 0 0 3px rgba(26, 26, 26, .08);
}
.contact-form__trap {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
.contact-form__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding-top: .25rem;
}
.contact-form__status {
    min-height: 1.4rem;
    margin: 0;
    color: var(--secondary-color);
    font-size: .9rem;
}
.contact-form__submit {
    border: 1px solid var(--text-color);
    border-radius: var(--radius);
    background: var(--text-color);
    color: var(--surface-color);
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    padding: .75rem 1rem;
}
.contact-form__submit:disabled {
    cursor: wait;
    opacity: .62;
}

/* ============================================================
   Blog — Page header
   ============================================================ */
.blog-header { margin-bottom: calc(1.5rem * var(--density)); }
.blog-header__eyebrow {
    margin: 0;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--accent-color);
    font-size: .76rem;
    font-weight: 600;
    font-family: var(--font-family);
}
.blog-header h1 {
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    margin: .25rem 0;
    letter-spacing: -0.015em;
}

.blog-lead {
    margin: 0 0 calc(1rem * var(--density));
    padding-left: clamp(.35rem, 1vw, .9rem);
}
.blog-lead__brand {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 0.5rem;
    font-family: var(--heading-font);
    font-size: clamp(1.5rem, 2.8vw, 2.1rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.25;
    margin: 0;
    color: var(--text-color);
}
.blog-lead__brand .blog-lead__title {
    flex: 0 0 auto;
    font-weight: 600;
    color: var(--text-color);
}
.blog-lead__sep {
    flex: 0 0 auto;
    color: var(--tertiary-color);
    font-weight: 500;
    user-select: none;
}
.blog-lead__subtitle {
    flex: 1 1 auto;
    min-width: min(100%, 12rem);
    font-family: var(--heading-font);
    font-size: clamp(1rem, 2vw, 1.35rem);
    font-weight: 500;
    letter-spacing: -0.015em;
    color: var(--secondary-color);
}

/* ============================================================
   Blog — Layout (main + sidebar)
   ============================================================ */
.blog-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem;
    align-items: start;
    box-sizing: border-box;
    width: 90%;
    max-width: 100%;
    margin: 0 auto;
    padding: calc(2rem * var(--density)) clamp(1.25rem, 4vw, 2.25rem) calc(3rem * var(--density));
}
.blog-main {
    min-width: 0;
}

/* ~300px min card + sidebar: 3×300 + 2 gaps + main/sidebar gap + sidebar ≈ 1440px viewport @ 90% width */
@media (min-width: 1440px) {
    .blog-page .blog-layout {
        grid-template-columns: 1fr minmax(280px, 300px);
        gap: 3rem;
    }
}

/* ============================================================
   Blog — Toolbar (search + count)
   ============================================================ */
.blog-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
}
.blog-toolbar__count { color: var(--secondary-color); font-size: .85rem; }
.blog-toolbar--meta {
    justify-content: flex-end;
    min-height: 1.5rem;
}
.blog-toolbar__search {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem .65rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    transition: border-color var(--dur), box-shadow var(--dur);
}
.blog-toolbar__search:focus-within {
    border-color: var(--text-color);
    box-shadow: var(--focus-ring);
}
.blog-toolbar__search input {
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font-family);
    font-size: .88rem;
    color: var(--text-color);
    width: 180px;
}
.blog-toolbar__search input::placeholder { color: var(--tertiary-color); }
.blog-toolbar__search button {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    color: var(--tertiary-color);
}

/* ============================================================
   Blog — Masonry card grid (~300px min card: n×300 + (n−1)×gap → viewport breakpoints)
   ============================================================ */
.post-grid {
    column-count: 1;
    column-gap: var(--post-col-gap);
}
@media (min-width: 640px) {
    .post-grid { column-count: 2; }
}
@media (min-width: 960px) {
    .post-grid { column-count: 3; }
}
@media (min-width: 1280px) {
    .post-grid { column-count: 4; }
}
@media (min-width: 1600px) {
    .post-grid { column-count: 5; }
}
.post-card {
    break-inside: avoid;
    margin-bottom: 1.25rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform var(--dur), box-shadow var(--dur);
    display: block;
    text-decoration: none;
    color: inherit;
}
.post-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    text-decoration: none;
}
.post-card__image {
    width: 100%;
    aspect-ratio: 16 / 10;
    display: block;
    background-color: var(--surface-2);
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    border-bottom: 1px solid var(--border-light);
}
.post-card__image--contain {
    background-size: contain;
    background-origin: content-box;
    padding: 1rem;
    box-sizing: border-box;
}
.post-card__body { padding: 1rem 1.1rem 1.15rem; }
.post-card__meta {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-family: var(--font-family);
    font-size: .73rem;
    color: var(--tertiary-color);
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 600;
    margin-bottom: .4rem;
}
.post-card__meta .meta-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--tertiary-color); }
.post-card__title {
    font-family: var(--heading-font);
    font-weight: 600;
    font-size: 1.18rem;
    line-height: 1.25;
    letter-spacing: -0.01em;
    margin: 0 0 .45rem;
    color: var(--text-color);
}
.post-card__excerpt {
    margin: 0;
    font-size: .92rem;
    color: var(--secondary-color);
    line-height: 1.55;
}
.blog-empty {
    color: var(--secondary-color);
    font-size: .95rem;
    padding: 2rem 0;
}

/* ============================================================
   Blog — Sidebar widgets
   ============================================================ */
.blog-sidebar-backdrop {
    display: none;
}
.blog-sidebar-backdrop.is-open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 150;
    background: rgba(0,0,0,.38);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.blog-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-self: start;
}

.blog-sidebar__close {
    display: none;
}

@media (max-width: 1439px) {
    .blog-page .blog-sidebar-toggle { display: flex; }
    .blog-page .blog-sidebar {
        position: fixed;
        top: 0;
        right: 0;
        width: min(22rem, calc(100vw - 1.25rem));
        max-height: 100vh;
        overflow-y: auto;
        z-index: 160;
        margin: 0;
        padding: 3.25rem 1.5rem 1.5rem 1.35rem;
        background: var(--surface-color);
        border: none;
        border-left: 1px solid var(--border-color);
        border-radius: 0;
        box-shadow: var(--shadow-lg);
        transform: translateX(100%);
        transition: transform var(--dur-slow) ease;
        -webkit-overflow-scrolling: touch;
    }
    .blog-page .blog-sidebar.is-open {
        transform: translateX(0);
    }
    .blog-page .blog-sidebar__close {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: .85rem;
        right: .85rem;
        width: 2.25rem;
        height: 2.25rem;
        padding: 0;
        border: none;
        border-radius: var(--radius);
        background: transparent;
        color: var(--secondary-color);
        font-size: 1.5rem;
        line-height: 1;
        cursor: pointer;
        transition: color var(--dur), background var(--dur);
    }
    .blog-page .blog-sidebar__close:hover {
        color: var(--text-color);
        background: rgba(0,0,0,.05);
    }
}

@media (min-width: 1440px) {
    .blog-page .blog-sidebar__close {
        display: none;
    }
    .blog-page .blog-sidebar {
        position: sticky;
        top: 5rem;
        padding-right: 1.5rem;
        transform: none;
        width: auto;
        max-height: calc(100vh - 6rem);
        overflow-y: hidden;
        overflow-x: hidden;
        box-shadow: none;
        background: transparent;
        border: none;
        scrollbar-gutter: stable;
    }
    .blog-page .blog-sidebar:hover,
    .blog-page .blog-sidebar:focus-within {
        overflow-y: auto;
    }
    .blog-page .blog-sidebar-backdrop {
        display: none !important;
    }
}

body.blog-sidebar-open {
    overflow: hidden;
}
.widget {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.1rem 1.2rem;
    box-shadow: var(--shadow-sm);
}
.widget__title {
    margin: 0 0 .75rem;
    font-family: var(--font-family);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--text-color);
}
.tags-cloud { display: flex; flex-wrap: wrap; gap: .35rem; }
.tag-pill {
    font-family: var(--font-family);
    font-size: .72rem;
    padding: .2rem .6rem;
    border-radius: var(--radius-pill);
    background: var(--accent-wash);
    color: var(--accent-link);
    font-weight: 500;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all var(--dur);
    display: inline-block;
}
.tag-pill:hover {
    border-color: var(--accent-link);
    text-decoration: none;
    color: var(--accent-link);
}
.tag-pill.is-active {
    background: var(--text-color);
    color: #fff;
    border-color: var(--text-color);
}

.archive-year { border-bottom: 1px solid var(--border-faint); }
.archive-year:last-child { border-bottom: none; }
.archive-year__toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .1rem;
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: var(--font-family);
    font-size: .88rem;
    font-weight: 600;
    color: var(--text-color);
    font-variant-numeric: tabular-nums;
}
.archive-year__toggle:hover { color: var(--accent-link); }
.archive-year__count { color: var(--tertiary-color); font-weight: 500; font-size: .8rem; margin-left: auto; margin-right: .5rem; }
.archive-year__chev { transition: transform var(--dur-slow) ease; color: var(--tertiary-color); font-size: .7rem; }
.archive-year.is-open .archive-year__chev { transform: rotate(180deg); }
.archive-year__months { display: flex; flex-direction: column; gap: .1rem; padding: 0 0 .5rem 0; }
.archive-year__months a.is-active {
    font-weight: 600;
    color: var(--accent-link);
}
.archive-year__months a {
    font-size: .85rem;
    color: var(--secondary-color);
    padding: .25rem .35rem;
    display: flex;
    justify-content: space-between;
    border-radius: 4px;
    font-variant-numeric: tabular-nums;
    text-decoration: none;
}
.archive-year__months a:hover { background: var(--accent-wash); color: var(--accent-link); text-decoration: none; }

.subscribe-body {
    margin: 0 0 .65rem;
    font-size: .88rem;
    color: var(--secondary-color);
    line-height: 1.55;
}
.rss-link {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .45rem .75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: .85rem;
    color: var(--text-color);
    background: var(--surface-2);
    text-decoration: none;
    transition: all var(--dur);
}
.rss-link:hover { border-color: var(--accent-link); color: var(--accent-link); text-decoration: none; }

/* ============================================================
   Blog — Pagination
   ============================================================ */
.pagination {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
    gap: 1rem;
}

/* ============================================================
   Blog — Single post
   ============================================================ */
.post-full {
    max-width: none;
    width: 100%;
    margin: 0;
}
.post-full__back {
    font-size: .8rem;
    color: var(--secondary-color);
    letter-spacing: .08em;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    text-decoration: none;
}
.post-full__back:hover { color: var(--accent-link); text-decoration: none; }
.post-full__title {
    font-size: clamp(1.6rem, 3.2vw, 2.4rem);
    line-height: 1.15;
    margin: 0 0 .6rem;
    letter-spacing: -0.015em;
}
.post-full__meta {
    font-size: .85rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
    display: flex;
    gap: .6rem;
    align-items: center;
    flex-wrap: wrap;
}
.post-full__meta .meta-dot { width: 3px; height: 3px; background: var(--tertiary-color); border-radius: 50%; }
.post-full__meta a { color: var(--secondary-color); }
.post-full__meta a:hover { color: var(--accent-link); }
.post-full__edit-link {
    display: inline-block;
    margin-left: .5rem;
    font-size: .8rem;
    color: var(--link-color);
    padding: .2rem .5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-decoration: none;
    transition: all var(--dur);
}
.post-full__edit-link:hover { background: var(--link-color); color: #fff; border-color: var(--link-color); text-decoration: none; }
.post-full__hero {
    width: 100%;
    max-width: min(100%, calc(100vw - 2rem));
    max-height: min(70vh, 520px);
    object-fit: cover;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    margin: 1.25rem 0 2rem;
    background: var(--surface-2);
    display: block;
}
.post-full__hero--contain { object-fit: contain; padding: 2rem; }
.post-full__body {
    font-family: var(--heading-font);
    font-size: clamp(1rem, 0.35vw + 0.94rem, 1.125rem);
    line-height: 1.72;
    color: var(--text-color);
}
.post-full__body p { margin: 0 0 1rem; }
.post-full__body blockquote {
    margin: 1.25rem 0;
    padding: .2rem 0 .2rem 1.1rem;
    border-left: 2px solid var(--accent-link);
    font-style: italic;
    color: var(--text-color);
    opacity: .85;
    background: transparent;
}
.post-full__body img {
    display: block;
    width: auto;
    max-width: min(100%, calc(100vw - 2rem));
    max-height: 75vh;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    margin: 1rem auto;
}
.post-full__body iframe {
    display: block;
    width: min(100%, calc(100vw - 2rem));
    max-width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    border: 0;
    margin: 1rem auto;
}
.post-full__body video {
    display: block;
    width: min(100%, calc(100vw - 2rem));
    max-width: 100%;
    height: auto;
    border: 0;
    margin: 1rem auto;
}

.post-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-light);
}
.post-nav__item {
    display: flex;
    gap: .85rem;
    padding: .9rem 1rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: all var(--dur);
    color: var(--text-color);
    text-decoration: none;
    align-items: center;
}
.post-nav__item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-link);
    text-decoration: none;
    color: var(--text-color);
}
.post-nav__label {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--secondary-color);
    font-weight: 600;
}
.post-nav__title {
    font-family: var(--heading-font);
    font-size: .95rem;
    font-weight: 600;
    line-height: 1.3;
    margin-top: .15rem;
}
.post-nav__next { text-align: right; flex-direction: row-reverse; }

/* ============================================================
   Chat card (inline, about + blog)
   ============================================================ */
.chat-card {
    display: flex;
    flex-direction: column;
    margin: 0 0 calc(1.25rem * var(--density));
    max-width: 100%;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    font-size: 0.95rem;
    overflow: hidden;
}
.blog-main .chat-card {
    margin-bottom: calc(1.25rem * var(--density));
}
.chat-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light, #eee);
    font-weight: 600;
    flex-shrink: 0;
}
.chat-card--collapsed .chat-card__header {
    border-bottom: none;
}
.chat-card__title {
    font-size: 0.95rem;
    color: var(--text-color);
    min-width: 0;
}
.chat-card__header-actions {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    flex-shrink: 0;
}
.chat-card__icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--secondary-color);
    cursor: pointer;
    transition: background var(--dur), color var(--dur);
}
.chat-card__icon-btn:hover {
    background: var(--link-wash, rgba(37, 99, 235, 0.08));
    color: var(--text-color);
}
.chat-card__icon-btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}
.chat-card__collapse .chat-card__chev {
    display: block;
    transition: transform var(--dur-slow) ease;
    transform: rotate(180deg);
}
.chat-card--collapsed .chat-card__collapse .chat-card__chev {
    transform: rotate(0deg);
}
.chat-card__body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}
.chat-card--collapsed .chat-card__body {
    display: none;
}
.chat-card .chat-log {
    resize: vertical;
    flex: 0 1 auto;
    align-self: stretch;
    width: 100%;
    min-height: 0;
    height: auto;
    max-height: min(60vh, 32rem);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    box-sizing: border-box;
}
.chat-msg {
    padding: 0.55rem 0.75rem;
    border-radius: 0.8rem;
    max-width: 85%;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.chat-msg.user {
    background: var(--text-color);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 0.2rem;
}
.chat-msg.bot {
    background: var(--bg-color, #f5f5f5);
    color: var(--text-color);
    align-self: flex-start;
    border-bottom-left-radius: 0.2rem;
}
.chat-msg.error {
    color: #b91c1c;
    font-style: italic;
}
.chat-form {
    border-top: 1px solid var(--border-light, #eee);
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex-shrink: 0;
}
.chat-form__composer {
    display: flex;
    gap: 0.4rem;
}
.chat-form input[type="text"] {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.55rem 0.75rem;
    font-family: inherit;
    font-size: 0.95rem;
}
.chat-form input[type="text"]:focus {
    outline: none;
    border-color: var(--text-color);
}
.chat-form button {
    background: var(--text-color);
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    padding: 0 0.9rem;
    cursor: pointer;
    font-weight: 500;
}
.chat-form button:disabled {
    opacity: 0.5;
    cursor: wait;
}
.chat-provider {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    width: 100%;
    margin-top: -0.05rem;
    padding: 0;
    color: var(--secondary-color);
    font-size: 0.78rem;
}
.chat-provider__choices {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: stretch;
    gap: 0.28rem;
    width: min(100%, 15.25rem);
    padding: 0.25rem;
    border: 1px solid var(--border-light, #e5e5e5);
    border: 1px solid color-mix(in srgb, var(--border-color) 70%, transparent);
    border-radius: 0.65rem;
    background: rgba(255, 255, 255, 0.62);
    background: color-mix(in srgb, var(--surface-color) 76%, var(--surface-2));
}
.chat-provider__cell {
    display: block;
    min-width: 0;
}
.chat-provider .chat-provider__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100%;
    min-width: 0;
    height: 2.25rem;
    padding: 0;
    margin: 0;
    border: 1px solid transparent;
    border-radius: 0.48rem;
    background: transparent;
    color: var(--text-color);
    cursor: pointer;
    font-weight: inherit;
    transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}
.chat-provider .chat-provider__btn::after {
    content: "";
    position: absolute;
    left: 28%;
    right: 28%;
    bottom: 0.2rem;
    height: 2px;
    border-radius: 999px;
    background: var(--link-color);
    opacity: 0;
    transition: opacity 0.12s ease, left 0.12s ease, right 0.12s ease;
}
.chat-provider .chat-provider__btn:hover:not(.is-selected) {
    background: rgba(26, 26, 26, 0.045);
    background: color-mix(in srgb, var(--text-color) 7%, transparent);
}
.chat-provider .chat-provider__btn:focus { outline: none; }
.chat-provider .chat-provider__btn:focus-visible {
    outline: 2px solid var(--link-color);
    outline-offset: 2px;
    z-index: 1;
}
.chat-provider .chat-provider__btn.is-selected {
    background: var(--surface-color, #fff);
    color: var(--text-color);
    border-color: var(--border-color);
    border-color: color-mix(in srgb, var(--text-color) 15%, var(--border-color));
    box-shadow: 0 2px 7px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.78);
    transform: translateY(-1px);
}
.chat-provider .chat-provider__btn.is-selected::after {
    left: 20%;
    right: 20%;
    opacity: 1;
}
.chat-provider__logo {
    position: relative;
    z-index: 1;
    width: 1.28rem;
    height: 1.28rem;
    display: block;
    flex-shrink: 0;
    pointer-events: none;
    margin: 0;
}
.chat-provider__logo--grok {
    width: 1.38rem;
    height: 1.28rem;
    transform: translateY(-0.04rem);
}
.chat-hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

/* ============================================================
   Site Footer
   ============================================================ */
.site-footer {
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    background: var(--surface-color);
    padding: 1.5rem 0;
    color: var(--secondary-color);
    font-size: .82rem;
}
.site-footer__inner {
    max-width: 66rem;
    margin: 0 auto;
    padding: 0 1.05rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
}
.site-footer__inner p { margin: 0; }
.site-footer a { color: var(--secondary-color); }
.site-footer a:hover { color: var(--text-color); }

/* ============================================================
   Inline SVG icon helper
   ============================================================ */
.ic { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.5; fill: none; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.ic-lg { width: 18px; height: 18px; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 860px) {
    .timeline-section {
        grid-template-columns: 1fr;
        align-items: start;
    }
    .timeline-wrap { grid-template-columns: 1fr; }
    .year-rail { display: none; }
    .chips { margin-left: 0; }
}
@media (max-width: 720px) {
    .contact { grid-template-columns: 1fr; padding: 1.5rem; }
}
@media (max-width: 600px) {
    .hero {
        grid-template-columns: 1fr;
        gap: .85rem;
        padding-left: 0;
    }
    .hero__avatar { max-width: 7rem; }
    .entry { grid-template-columns: 1fr; }
    .entry__media { width: 5rem; }
    .post-nav { grid-template-columns: 1fr; }
    .post-nav__next { text-align: left; flex-direction: row; }
    .blog-lead { padding-left: 0; }
}

/* ============================================================
   Admin Area Styles — aligned with blog/about light editorial UI
   ============================================================ */
body.admin-dashboard main,
body.admin-editor main,
body.admin-page main {
    max-width: 1200px;
    padding: 0 1.05rem 3rem;
    margin: 0 auto;
}

body.admin-dashboard,
body.admin-editor,
body.admin-page {
    background: var(--bg-color);
    color: var(--text-color);
}

body.admin-dashboard header,
body.admin-editor header {
    background: var(--surface-translucent);
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
}

body.admin-dashboard header h1,
body.admin-editor header h1 { color: var(--text-color); }

body.admin-dashboard header a,
body.admin-editor header a { color: var(--secondary-color); transition: color .2s ease; }

body.admin-dashboard header a:hover,
body.admin-editor header a:hover { color: var(--text-color); text-decoration: none; }

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding: 1.25rem 0 .9rem;
    border-bottom: 1px solid var(--border-light);
}
.admin-header h2 {
    margin: 0;
    font-size: clamp(1.5rem, 3vw, 2.15rem);
}
.table-responsive { overflow-x: auto; border: 1px solid var(--border-light); border-radius: var(--radius-lg); background: var(--surface-color); box-shadow: var(--shadow-sm); }
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface-color);
    overflow: hidden;
}
th, td { text-align: left; padding: .9rem 1rem; border-bottom: 1px solid var(--border-light); }
th { background-color: var(--surface-2); font-weight: 700; color: var(--secondary-color); text-transform: uppercase; font-size: .74rem; letter-spacing: .09em; }
tr:hover { background-color: rgba(0,0,0,.025); }
tr:last-child td { border-bottom: none; }

.status-badge { padding: .25rem .7rem; border-radius: 50px; font-size: .78rem; font-weight: 700; letter-spacing: .02em; }
.status-published { background-color: #d1fae5; color: #116530; }
.status-draft { background-color: #fff3cd; color: #8a5d00; }

.btn { display: inline-block; padding: .56rem .95rem; border-radius: var(--radius); text-decoration: none; font-weight: 700; cursor: pointer; border: 1px solid transparent; transition: background-color .2s ease, transform .1s ease, border-color .2s ease; font-family: var(--font-family); }
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn-primary { background-color: var(--text-color); color: white; border-color: var(--text-color); }
.btn-primary:hover { background-color: #333; color: white; }
.btn-secondary { background-color: var(--surface-color); color: var(--text-color); border-color: var(--border-color); }
.btn-secondary:hover { background-color: var(--surface-2); color: var(--text-color); }
.btn-sm { padding: .32rem .58rem; font-size: .82rem; border-radius: 5px; text-decoration: none; font-weight: 700; }
.btn-edit { background-color: var(--surface-2); color: var(--text-color); border: 1px solid var(--border-color); }
.btn-edit:hover { background-color: #fff; text-decoration: none; }
.btn-delete { background-color: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.btn-delete:hover { background-color: #fecaca; }
.btn-large { padding: .75rem 2rem; font-size: 1.1rem; }

.editor-form { background: var(--surface-color); padding: clamp(1.25rem, 3vw, 2.5rem); border: 1px solid var(--border-light); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.login-container {
    width: min(92vw, 440px);
    margin: clamp(3rem, 9vw, 6rem) auto;
    padding: clamp(1.5rem, 4vw, 2.25rem);
    background: var(--surface-color);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}
.login-container h2 { margin: 0 0 .7rem; font-size: clamp(1.65rem, 3vw, 2.25rem); }
.login-copy,
.google-login__hint { color: var(--secondary-color); line-height: 1.55; }
.login-container .btn { width: 100%; text-align: center; margin-top: .25rem; }
.form-row { display: flex; gap: 1.5rem; margin-bottom: 1.5rem; }
.form-group { margin-bottom: 1.5rem; }
.form-group .flex-1, .flex-1.form-group { flex: 1; }
.flex-2 { flex: 2; }
.form-group label { display: block; margin-bottom: .5rem; font-weight: 600; color: var(--text-color); }
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="datetime-local"],
.form-group textarea,
.form-group select { width: 100%; padding: .75rem; border: 1px solid var(--border-color); border-radius: 6px; font-family: inherit; font-size: 1rem; transition: border-color .2s ease, box-shadow .2s ease; background: var(--surface-color); }
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--text-color); box-shadow: 0 0 0 3px rgba(26,26,26,.08); }
.form-group textarea { min-height: 500px; line-height: 1.6; font-family: 'Courier New', Courier, monospace; }
.checkbox-group { display: flex; align-items: center; padding-top: 2rem; }
.checkbox-group label { font-weight: normal; cursor: pointer; display: flex; align-items: center; gap: .5rem; }
.image-preview { margin-top: 1rem; padding: 1rem; background: var(--bg-color); border-radius: 6px; border: 1px dashed var(--border-color); }
.image-preview img { max-width: 200px; display: block; margin-bottom: .5rem; box-shadow: 0 2px 4px rgba(0,0,0,.1); }
.help-text { font-size: .85rem; color: var(--secondary-color); margin: 0; }
.form-actions { display: flex; gap: 1rem; align-items: center; margin-top: 2rem; padding-top: 2rem; border-top: 1px solid var(--border-color); }
.alert { padding: 1rem; margin-bottom: 1.5rem; border-radius: 4px; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.editor-container { max-width: 900px !important; margin: 0 auto; padding: 0 1.5rem; }
@media (max-width: 1200px) {
    .editor-container { padding: 0 1.25rem; }
    .editor-grid { grid-template-columns: 1fr; height: auto; overflow: visible; }
    .editor-container-fluid { padding: 0 1rem; }
    .preview-pane { margin-top: 2rem; height: 500px; }
}

/* Admin legacy header overrides */
header:not(.site-header) {
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    margin-bottom: 2rem;
}
header:not(.site-header) nav {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    font-size: .9rem;
}
header:not(.site-header) h1 {
    max-width: var(--max-width);
    margin: .5rem auto 0;
    padding: 0 1rem;
    font-size: 1.5rem;
}
header:not(.site-header) h1 a { color: var(--text-color); text-decoration: none; }

/* ============================================================
   Admin top-nav tabs (shared by /admin)
   ============================================================ */
.admin-header-bar { background: var(--surface-translucent); color: var(--text-color); border-bottom: 1px solid var(--border-color); padding: .25rem 0; margin-bottom: 1.25rem; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.admin-header-bar .site-header__inner { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; padding: .55rem 1.05rem; max-width: 1200px; margin: 0 auto; }
.admin-header-bar h1 { color: var(--text-color); font-family: var(--heading-font); font-size: 1.15rem; margin: 0; flex-shrink: 0; }
.admin-tabs { display: flex; align-items: center; gap: .35rem; flex: 1; flex-wrap: wrap; font-size: .86rem; }
.admin-tab-spacer { flex: 1; min-width: 0; }
.admin-tab { color: var(--secondary-color); padding: .38rem .65rem; border-radius: 6px; text-decoration: none; transition: background-color .15s ease, color .15s ease; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; font-size: .75rem; }
.admin-tab:hover { background: rgba(0,0,0,.04); color: var(--text-color); text-decoration: none; }
.admin-tab.is-active { background: var(--link-wash); color: var(--text-color); }
.admin-tab--util { color: var(--secondary-color); }
.admin-tab--util:hover { color: var(--text-color); }

/* ============================================================
   Admin mobile responsiveness
   ============================================================ */
@media (max-width: 720px) {
    .admin-header-bar { margin-bottom: 1rem; }
    .admin-header-bar .site-header__inner { gap: .5rem; padding: .5rem .75rem; }
    .admin-header-bar h1 { font-size: 1rem; width: 100%; }
    .admin-tabs { width: 100%; gap: .25rem; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
    .admin-tab { padding: .35rem .6rem; font-size: .85rem; white-space: nowrap; }
    .admin-tab-spacer { display: none; }
    body.admin-dashboard main,
    body.admin-editor main,
    body.admin-page main { padding: 0 1rem; }
    .admin-header { flex-direction: column; align-items: stretch; gap: .75rem; }
    .admin-header h2 { font-size: 1.15rem; }
    th, td { padding: .65rem .5rem; font-size: .9rem; }
    .actions { display: flex; gap: .35rem; flex-wrap: wrap; }
    .form-row { flex-direction: column; gap: 0; }
    .editor-form { padding: 1.25rem; }
    .login-container { margin: 2rem 1rem; padding: 1.5rem; }
}

/* ── Edit-mode overlay ──────────────────────────────────────────────────────────── */
.em-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .55rem 1rem .55rem .75rem;
  background: var(--surface-color);
  color: var(--text-color);
  border: 1.5px solid var(--border-color);
  border-radius: 99px;
  font-family: var(--body-font, inherit);
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-md, 0 2px 8px rgba(0,0,0,.15));
  transition: background .15s, border-color .15s, transform .15s;
}
.em-toggle:hover  { background: var(--surface-2, #f5f5f5); border-color: var(--text-color); }
.em-toggle--active { background: var(--text-color); color: var(--bg-color, #fff); border-color: var(--text-color); }
.em-toggle--active svg { stroke: currentColor; }

.em-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 320px;
  z-index: 910;
  background: var(--surface-color);
  border-left: 1px solid var(--border-color);
  box-shadow: -4px 0 24px rgba(0,0,0,.12);
  display: flex;
  flex-direction: column;
  font-size: .9rem;
}
.em-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.em-drawer__heading { font-weight: 600; font-size: .95rem; }
.em-drawer__close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--secondary-color);
  padding: .2rem .4rem;
  border-radius: 4px;
  line-height: 1;
}
.em-drawer__close:hover { background: var(--surface-2, #f0f0f0); }

.em-drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.em-drawer__footer {
  display: flex;
  gap: .5rem;
  padding: .75rem 1rem;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.em-field { display: flex; flex-direction: column; gap: .35rem; }
.em-label { font-size: .78rem; font-weight: 500; color: var(--secondary-color); text-transform: uppercase; letter-spacing: .04em; }

.em-input {
  width: 100%;
  padding: .55rem .7rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-family: inherit;
  font-size: .9rem;
  background: var(--surface-color);
  color: var(--text-color);
  box-sizing: border-box;
  transition: border-color .15s;
}
.em-input:focus { outline: none; border-color: var(--text-color); box-shadow: 0 0 0 2px rgba(0,0,0,.07); }

.em-image-wrap { display: flex; flex-direction: column; gap: .5rem; }
.em-image-preview { width: 100%; border-radius: 6px; object-fit: cover; max-height: 160px; border: 1px solid var(--border-color); }
.em-image-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .85rem;
  background: var(--surface-2, #f5f5f5);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  align-self: flex-start;
  transition: background .15s;
}
.em-image-btn:hover { background: var(--border-light, #e8e8e8); }
.em-image-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.em-image-status { font-size: .78rem; color: var(--secondary-color); min-height: 1em; }

.em-content-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .82rem;
  color: var(--secondary-color);
  padding: .45rem .85rem;
  border: 1px dashed var(--border-color);
  border-radius: 6px;
  text-decoration: none;
  transition: color .15s, border-color .15s;
}
.em-content-link:hover { color: var(--text-color); border-color: var(--text-color); }

.em-btn {
  flex: 1;
  padding: .6rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  font-family: inherit;
  font-size: .88rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.em-btn--ghost { background: none; color: var(--secondary-color); }
.em-btn--ghost:hover { background: var(--surface-2, #f0f0f0); }
.em-btn--primary { background: var(--text-color); color: var(--bg-color, #fff); border-color: var(--text-color); }
.em-btn--primary:hover { opacity: .85; }
.em-btn:disabled { opacity: .5; cursor: not-allowed; }

#em-toast {
  position: fixed;
  bottom: 5rem;
  right: 1.5rem;
  z-index: 950;
  padding: .55rem 1rem;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 500;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.em-toast--ok  { background: #16a34a; color: #fff; }
.em-toast--err { background: #dc2626; color: #fff; }

@media (max-width: 480px) {
  .em-drawer { width: 100%; }
  .em-toggle { bottom: 1rem; right: 1rem; }
}
