/* Otter blog — shared shell + markdown typography */
:root {
    --black: #050505;
    --black-muted: #111111;
    --white: #F4F4F5;
    --gray: #8A8A93;
    --orange: #FF4500;
    --grid-line: rgba(244, 244, 245, 0.1);
}

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

body {
    background-color: var(--black);
    color: var(--white);
    font-family: 'Space Grotesk', sans-serif;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.mono { font-family: 'Space Mono', monospace; }
a, button { cursor: pointer; }
a { text-decoration: none; color: inherit; }
.text-orange { color: var(--orange); }

.container { max-width: 800px; margin: 0 auto; padding: 0 2rem; }
.container--narrow { max-width: 720px; }
.container--post {
    max-width: 1080px;
}

/* Blog index — three-column shell (rails + main) */
.blog-layout {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

.blog-columns-main {
    min-width: 0;
}

.blog-rail {
    display: none;
    padding-top: 0.35rem;
}

.blog-rail-title {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--gray);
    margin: 0 0 1rem;
}

.blog-rail-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.blog-rail-item {
    border-bottom: 1px solid rgba(244, 244, 245, 0.06);
}

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

.blog-rail-link {
    display: block;
    padding: 0.7rem 0;
    text-decoration: none;
    color: inherit;
}

.blog-rail-link:hover .blog-rail-item-title {
    color: var(--orange);
}

.blog-rail-item-date {
    display: block;
    font-size: 0.65rem;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.3rem;
}

.blog-rail-item-title {
    display: block;
    font-size: 0.875rem;
    line-height: 1.4;
    color: var(--white);
    font-weight: 500;
    letter-spacing: -0.01em;
}

.blog-rail-link--bare .blog-rail-item-title {
    color: var(--gray);
    font-weight: 400;
}

.blog-rail-link--bare:hover .blog-rail-item-title {
    color: var(--orange);
}

@media (min-width: 1100px) {
    .blog-layout {
        grid-template-columns: minmax(0, 220px) minmax(0, 1fr) minmax(0, 220px);
        gap: 2rem 2.5rem;
        align-items: start;
    }

    .blog-rail {
        display: block;
        position: sticky;
        top: 1rem;
        align-self: start;
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 1099px) {
    .blog-rail {
        display: none !important;
    }
}

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

.grid-bg {
    position: fixed;
    inset: 0;
    background-size: 50px 50px;
    background-image:
        linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
        linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
    z-index: -1;
    mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
}

nav {
    padding: 2rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--grid-line);
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo::before {
    content: '';
    width: 16px;
    height: 16px;
    background-color: var(--orange);
    border-radius: 2px;
}

.nav-links {
    display: flex;
    gap: 2rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.nav-links a:hover { color: var(--orange); }
.nav-links a.is-active { color: var(--orange); }

.btn-primary {
    background-color: var(--orange);
    color: var(--black);
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    border: none;
    text-transform: uppercase;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 8px 8px 0 rgba(244, 244, 245, 0.08);
}

/* Blog index */
.blog-header {
    padding: 4rem 0 2rem;
    border-bottom: 1px solid var(--grid-line);
}

.blog-header-visual {
    margin: 0 0 1.75rem;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--grid-line);
    aspect-ratio: 1600 / 420;
    max-height: min(240px, 28vw);
    background: var(--black-muted);
}

.blog-header-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 40%;
    display: block;
}

.blog-header h1 {
    font-size: clamp(2.5rem, 6vw, 3.5rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    text-transform: uppercase;
}

.blog-header p {
    margin-top: 0.75rem;
    color: var(--gray);
    font-size: 1rem;
}

.blog-search-wrap {
    margin-bottom: 2rem;
}

/* Underline-style search — minimal, no card / glow */
.blog-search-field {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0 0.85rem;
    border-bottom: 1px solid var(--grid-line);
    transition: border-color 0.15s ease;
}

.blog-search-field:hover {
    border-bottom-color: rgba(244, 244, 245, 0.2);
}

.blog-search-field:focus-within {
    border-bottom-color: var(--orange);
}

.blog-search-icon {
    flex-shrink: 0;
    color: var(--gray);
    opacity: 0.65;
}

.blog-search-field:focus-within .blog-search-icon {
    opacity: 0.9;
    color: var(--gray);
}

.blog-search-input {
    flex: 1;
    min-width: 0;
    width: 100%;
    border: none;
    background: transparent;
    padding: 0;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.0625rem;
    font-weight: 400;
    letter-spacing: -0.02em;
    color: var(--white);
    outline: none;
}

.blog-search-input::placeholder {
    color: var(--gray);
    opacity: 0.75;
}

.blog-search-input::-webkit-search-decoration,
.blog-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}

.blog-index-empty {
    color: var(--gray);
    font-size: 0.9rem;
    margin: 0 0 1.5rem;
    padding: 0.5rem 0;
}

.post-list { padding: 3rem 0 6rem; }
#post-list-root { min-height: 8rem; }

.post-list article.post-card {
    border-bottom: 1px solid var(--grid-line);
    padding: 2rem 0;
    transition: background 0.2s;
}

.post-list a.post-card-link {
    display: block;
}

.post-list article.post-card:hover {
    background: rgba(17, 17, 17, 0.5);
    margin: 0 -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
}

.post-list h2 {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.post-list a:hover h2 { color: var(--orange); }

.post-meta {
    font-size: 0.8rem;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.post-excerpt {
    margin-top: 0.75rem;
    font-size: 1rem;
    color: var(--gray);
    line-height: 1.55;
}

.blog-error {
    padding: 2rem 0;
    color: var(--orange);
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
}

.post-picker { padding: 0 0 4rem; }
.post-picker-intro {
    margin-bottom: 1.5rem;
    color: var(--gray);
    font-size: 0.9rem;
    line-height: 1.5;
    max-width: 40rem;
}

/* Post page layout (article + sidebar) */
.post-page {
    display: block;
}

.post-page--split {
    display: grid;
    grid-template-columns: minmax(220px, 270px) minmax(0, 1fr);
    gap: 2rem 2.5rem;
    align-items: start;
    padding-top: 0.25rem;
}

.post-sidebar {
    position: sticky;
    top: 1rem;
    align-self: start;
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem 1rem 1rem 0;
    border-right: 1px solid var(--grid-line);
}

.post-sidebar-heading {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--gray);
    margin: 0;
}

.post-sidebar-search {
    width: 100%;
    padding: 0.5rem 0.65rem;
    font-size: 0.8rem;
    color: var(--white);
    background: var(--black-muted);
    border: 1px solid var(--grid-line);
    border-radius: 4px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.post-sidebar-search::placeholder {
    color: var(--gray);
    opacity: 0.85;
}

.post-sidebar-search:focus {
    border-color: rgba(255, 69, 0, 0.45);
    box-shadow: 0 0 0 2px rgba(255, 69, 0, 0.12);
}

.post-sidebar-empty {
    font-size: 0.75rem;
    color: var(--gray);
    margin: 0;
    padding: 0.25rem 0;
}

.post-sidebar-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.post-sidebar-list li {
    border-bottom: 1px solid rgba(244, 244, 245, 0.06);
}

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

.post-sidebar-list a {
    display: block;
    padding: 0.65rem 0.35rem 0.65rem 0;
    text-decoration: none;
    color: inherit;
    border-radius: 4px;
    margin: 0 -0.35rem;
    padding-left: 0.35rem;
    padding-right: 0.35rem;
    transition: background 0.15s;
}

.post-sidebar-list a:hover {
    background: rgba(17, 17, 17, 0.85);
}

.post-sidebar-list li.is-active a {
    background: rgba(255, 69, 0, 0.1);
    border-left: 2px solid var(--orange);
    margin-left: -2px;
    padding-left: calc(0.35rem + 2px);
}

.post-sidebar-date {
    display: block;
    font-size: 0.65rem;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.2rem;
}

.post-sidebar-title {
    display: block;
    font-size: 0.82rem;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    color: var(--white);
    line-height: 1.35;
}

.post-sidebar-list li.is-active .post-sidebar-title {
    color: var(--orange);
}

.post-main {
    min-width: 0;
}

/* Post page */
.post-shell { padding: 0 0 0 0; }

.post-back {
    margin: 2rem 0 1.5rem;
}

.post-back a {
    color: var(--orange);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-family: 'Space Mono', monospace;
}

.post-back a:hover { text-decoration: underline; }

.post-loading {
    padding: 4rem 0;
    color: var(--gray);
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
}

/* —— Rendered Markdown (beautiful) —— */
.md-content {
    padding: 0 0 5rem;
    max-width: 100%;
}

.md-content > *:first-child { margin-top: 0; }

.md-content h1 {
    font-size: clamp(1.75rem, 4vw, 2.35rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin: 0 0 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--grid-line);
}

.md-content h2 {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--white);
    margin: 2.5rem 0 1rem;
    letter-spacing: -0.02em;
}

.md-content h2::before {
    content: '';
    display: block;
    width: 2.5rem;
    height: 3px;
    background: var(--orange);
    margin-bottom: 0.65rem;
    opacity: 0.9;
}

.md-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 1.75rem 0 0.65rem;
    color: var(--white);
}

.md-content p {
    font-size: 1.0625rem;
    color: var(--gray);
    line-height: 1.75;
    margin-bottom: 1.15rem;
}

.md-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.75rem auto;
    border-radius: 8px;
    border: 1px solid var(--grid-line);
}

.md-content a:has(> img) {
    display: block;
    margin: 1.75rem 0;
    text-decoration: none;
}

.md-content a:has(> img):hover img {
    border-color: rgba(249, 115, 22, 0.45);
}

.md-content strong {
    color: var(--white);
    font-weight: 500;
}

.md-content a {
    color: var(--orange);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.md-content a:hover {
    filter: brightness(1.1);
}

.md-content ul,
.md-content ol {
    margin: 1rem 0 1.25rem 1.25rem;
    color: var(--gray);
    line-height: 1.7;
}

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

.md-content li::marker { color: var(--orange); }

.md-content code {
    font-family: 'Space Mono', monospace;
    font-size: 0.88em;
    color: var(--orange);
    background: rgba(255, 69, 0, 0.08);
    padding: 0.12em 0.4em;
    border-radius: 4px;
    border: 1px solid rgba(255, 69, 0, 0.2);
}

.md-content pre {
    margin: 1.25rem 0 1.25rem;
    padding: 1.25rem 1.35rem;
    background: var(--black-muted);
    border: 1px solid var(--grid-line);
    border-left: 3px solid var(--orange);
    border-radius: 4px;
    overflow-x: auto;
}

.md-content pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.875rem;
    color: var(--white);
    line-height: 1.55;
}

.md-content blockquote {
    margin: 1.25rem 0;
    padding: 1rem 1.25rem;
    border-left: 3px solid var(--orange);
    background: rgba(255, 69, 0, 0.04);
    color: var(--gray);
    font-style: italic;
}

.md-content hr {
    border: none;
    height: 1px;
    background: var(--grid-line);
    margin: 2.5rem 0;
}

/* GFM tables — bordered grid + orange rail (matches code blocks) */
.md-table-wrap {
    margin: 2.25rem 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-color: rgba(255, 69, 0, 0.35) transparent;
    border: 1px solid var(--grid-line);
    border-left: 3px solid var(--orange);
    border-radius: 6px;
    background: rgba(17, 17, 17, 0.55);
}

.md-content .md-table-wrap table {
    width: 100%;
    min-width: 36rem;
    border-collapse: collapse;
    border-spacing: 0;
    font-size: 0.9375rem;
    text-align: left;
    line-height: 1.55;
}

.md-content .md-table-wrap thead th {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    color: var(--white);
    padding: 0.85rem 1rem;
    vertical-align: bottom;
    letter-spacing: -0.02em;
    background: rgba(244, 244, 245, 0.04);
    border-bottom: 1px solid rgba(244, 244, 245, 0.14);
    border-right: 1px solid rgba(244, 244, 245, 0.08);
}

.md-content .md-table-wrap thead th:last-child {
    border-right: none;
}

.md-content .md-table-wrap tbody td {
    padding: 0.85rem 1rem;
    vertical-align: top;
    color: var(--gray);
    border-bottom: 1px solid rgba(244, 244, 245, 0.08);
    border-right: 1px solid rgba(244, 244, 245, 0.08);
}

.md-content .md-table-wrap tbody td:last-child {
    border-right: none;
}

.md-content .md-table-wrap tbody tr:last-child td {
    border-bottom: none;
}

.md-content .md-table-wrap tbody td strong {
    color: var(--white);
    font-weight: 600;
}

/* Give the “description” column room (Variant | Params | Role layouts) */
.md-content .md-table-wrap th:last-child,
.md-content .md-table-wrap td:last-child {
    min-width: 12rem;
}

@media (min-width: 720px) {
    .md-content .md-table-wrap table {
        min-width: 100%;
    }

    .md-content .md-table-wrap th:last-child,
    .md-content .md-table-wrap td:last-child {
        width: 50%;
    }

    .md-content .md-table-wrap th:first-child,
    .md-content .md-table-wrap td:first-child {
        width: 1%;
        white-space: nowrap;
        padding-right: 1.5rem;
    }
}

.md-content .md-table-wrap tbody td code {
    font-size: 0.86em;
}

footer.blog-footer {
    padding: 3rem 0;
    text-align: center;
    border-top: 1px solid var(--grid-line);
    color: var(--gray);
    font-size: 0.875rem;
}

footer.blog-footer a { color: var(--orange); }

@media (max-width: 900px) {
    .nav-links { display: none; }

    .post-page--split {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .post-sidebar {
        position: relative;
        top: auto;
        max-height: none;
        padding: 0 0 1rem;
        border-right: none;
        border-bottom: 1px solid var(--grid-line);
    }

    .post-sidebar-list {
        max-height: 42vh;
    }
}
