/**
 * Engineering Blueprint Lite (v2)
 * Aesthetic: Invisible, functional, high-readability.
 * Grid Math: 24px square grid using 1px lines at 2% opacity.
 */

:root {
    /* Base */
    --bg-white: #ffffff;
    --bg-off-white: #fafafa;
    --bg-page: #f6f7f9;
    --grid-color: rgba(0, 0, 0, 0.015);
    --text-charcoal: #111111;
    --text-muted: #555555;
    --accent-link: #2563eb;

    /* Layout */
    --max-width: 740px;

    /* Type */
    --line-height: 1.75;
    --font-sans: Inter, "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

    /* Scale */
    --text-xs: 0.85rem;
    --text-sm: 0.95rem;
    --text-base: 1rem;
    --text-lg: 1.1rem;
    --text-xl: 1.5rem;
    --text-2xl: 2rem;

    /* Spacing */
    --s-1: 0.25rem;
    --s-2: 0.5rem;
    --s-3: 0.75rem;
    --s-4: 1rem;
    --s-5: 1.5rem;
    --s-6: 2rem;
    --s-7: 3rem;
    --s-8: 4rem;

    /* Surfaces */
    --surface: rgba(255, 255, 255, 0.92);
    --surface-solid: #ffffff;

    /* Borders + shadow */
    --border: rgba(0, 0, 0, 0.08);
    --border-soft: rgba(0, 0, 0, 0.06);
    --border-grid: var(--grid-color);
    --shadow-1: 0 1px 0 rgba(0, 0, 0, 0.03);

    /* Radius */
    --r-1: 6px;
    --r-2: 10px;

    /* Focus */
    --focus-ring: rgba(37, 99, 235, 0.35);
    --focus-outline: 2px solid var(--focus-ring);
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: light;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-page);
    color: var(--text-charcoal);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--line-height);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

::selection {
    background: rgba(37, 99, 235, 0.18);
}

a {
    color: var(--accent-link);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
    transition: text-decoration-thickness 0.15s ease;
}

a:hover {
    text-decoration-thickness: 2px;
}

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

:where(button, input, textarea, select, summary):focus-visible {
    outline: var(--focus-outline);
    outline-offset: 3px;
    border-radius: 6px;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--s-8) var(--s-6);
}

/* Header / Footer */

header {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    padding: var(--s-4) 0;
    border-bottom: 1px solid var(--border-soft);
    background: var(--surface);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

header .logo {
    display: block;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--s-6);
    text-decoration: none;
}

footer {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--s-4) var(--s-6);
    border-top: 1px solid var(--border-soft);
    color: var(--text-muted);
    font-size: var(--text-xs);
    background: var(--surface);
    backdrop-filter: blur(2px);
}

.logo {
    font-weight: 700;
    color: var(--text-charcoal);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.9rem;
}

header nav {
    display: flex;
    gap: var(--s-4);
    align-items: center;
    flex-wrap: wrap;
}

header nav a {
    text-decoration: none;
    color: var(--text-charcoal);
    font-size: var(--text-sm);
    padding: var(--s-2) var(--s-2);
    border-radius: 8px;
}

header nav a:hover {
    background: rgba(0, 0, 0, 0.03);
}

header nav a[aria-current="page"] {
    background: rgba(37, 99, 235, 0.08);
    color: var(--accent-link);
}

/* Typography */

h1,
h2,
h3 {
    font-weight: 800;
    margin-top: var(--s-8);
    margin-bottom: var(--s-5);
    line-height: 1.1;
    scroll-margin-top: 88px;
    letter-spacing: -0.025em;
}

h1 {
    font-size: var(--text-2xl);
    margin-top: 0;
}

h2 {
    font-size: var(--text-xl);
    border-bottom: 1px solid var(--border-grid);
    padding-bottom: var(--s-3);
}

h3 {
    font-size: var(--text-lg);
    font-weight: 700;
}

p {
    margin: 0 0 var(--s-5);
    font-size: 1.05rem;
    line-height: 1.8;
}

small {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

strong {
    font-weight: 650;
}

:where(p, li) {
    overflow-wrap: anywhere;
}

/* Lists */

ul,
ol {
    margin: 0 0 var(--s-5);
    padding-left: 1.5rem;
}

li {
    margin: 0 0 var(--s-4);
    line-height: 1.8;
}

li>ul,
li>ol {
    margin-top: var(--s-2);
    margin-bottom: 0;
}

/* Rules */

hr {
    border: 0;
    height: 1px;
    background: var(--border-grid);
    margin: var(--s-7) 0;
}

/* Inline code + blocks */

code {
    font-family: var(--font-mono);
    font-size: 0.92em;
    padding: 0.12em 0.35em;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

pre {
    margin: var(--s-6) 0;
    border-radius: var(--r-2);
    background: var(--surface-solid);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-1);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

pre code {
    padding: var(--s-4);
    border: 0;
    background: var(--bg-off-white);
    font-size: 0.9rem;
    line-height: 1.6;
    display: block;
}

/* Tables */

table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--s-6) 0;
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: var(--r-2);
    overflow: hidden;
    box-shadow: var(--shadow-1);
}

thead th {
    text-align: left;
    font-size: var(--text-xs);
    letter-spacing: 0.02em;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.02);
    border-bottom: 1px solid var(--border-soft);
    padding: var(--s-3) var(--s-4);
}

tbody td {
    padding: var(--s-3) var(--s-4);
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    vertical-align: top;
}

tbody tr:last-child td {
    border-bottom: 0;
}

tbody tr:hover td {
    background: rgba(37, 99, 235, 0.03);
}

/* Blockquotes (good for notes) */

blockquote {
    margin: var(--s-7) 0;
    padding: var(--s-5) var(--s-6);
    border-left: 4px solid rgba(37, 99, 235, 0.4);
    background: rgba(37, 99, 235, 0.03);
    border-radius: 12px;
}

blockquote p {
    margin: 0;
    color: var(--text-charcoal);
}

/* Callouts (optional classes you can apply in markdown->HTML) */

.callout {
    margin: var(--s-6) 0;
    padding: var(--s-4) var(--s-5);
    border: 1px solid var(--border-soft);
    border-left-width: 3px;
    border-radius: 12px;
    background: var(--surface);
}

.callout> :last-child {
    margin-bottom: 0;
}

.callout.note {
    border-left-color: rgba(37, 99, 235, 0.45);
    background: rgba(37, 99, 235, 0.04);
}

.callout.warn {
    border-left-color: rgba(245, 158, 11, 0.55);
    background: rgba(245, 158, 11, 0.06);
}

.callout.danger {
    border-left-color: rgba(220, 38, 38, 0.55);
    background: rgba(220, 38, 38, 0.06);
}

/* Details / Summary (great for collapsible steps) */

details {
    margin: var(--s-6) 0;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow-1);
    overflow: hidden;
}

summary {
    cursor: pointer;
    padding: var(--s-4) var(--s-5);
    font-weight: 650;
    list-style: none;
}

summary::-webkit-details-marker {
    display: none;
}

details[open] summary {
    border-bottom: 1px solid var(--border-soft);
    background: rgba(0, 0, 0, 0.02);
}

details> :not(summary) {
    padding: var(--s-4) var(--s-5);
}

details> :not(summary) :last-child {
    margin-bottom: 0;
}

/* Images / Figures */

img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: var(--s-6) 0;
    background: var(--bg-off-white);
    padding: var(--s-4);
    border: 1px solid var(--border);
    border-radius: var(--r-2);
    box-shadow: var(--shadow-1);
}

figure {
    margin: var(--s-6) 0;
}

figcaption,
.caption {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: calc(var(--s-3) * -1);
    margin-bottom: var(--s-6);
    text-align: center;
}

/* Keyboard + badges */

kbd {
    font-family: var(--font-mono);
    font-size: 0.85em;
    padding: 0.12em 0.4em;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface-solid);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
    white-space: nowrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    font-size: var(--text-xs);
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    background: rgba(0, 0, 0, 0.02);
    color: var(--text-muted);
}

/* Utilities */

.surface {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-2);
    box-shadow: var(--shadow-1);
}

.grid-off body,
body.grid-off {
    background-image: none;
}

/* Motion */

@media (prefers-reduced-motion: reduce) {
    * {
        scroll-behavior: auto;
        transition: none;
        animation: none;
    }
}

/* Responsive */

@media (max-width: 600px) {
    body {
        background-image: none;
    }

    .container {
        padding: var(--s-6) var(--s-5);
    }

    header,
    footer {
        padding: var(--s-4) var(--s-5);
    }
}

/* Print */

@media print {
    body {
        background: #ffffff;
        background-image: none;
        color: #000000;
    }

    header,
    footer {
        border: 0;
        background: transparent;
    }

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

    pre,
    table,
    img,
    blockquote,
    details {
        break-inside: avoid;
    }
}


/* Flex Elements */

.flex {
    display: flex;
    gap: 1rem;
    place-items: center;
    place-content: space-between;
}

.flex>div {
    width: 50%;
}



/* Mermaid */

.mermaid {
    min-height: 420px;
}

/* Homepage Elements */

.hero {
    margin-bottom: 2rem;
}

/* Start Here strip */

.start-here {
    margin-bottom: 2.5rem;
    padding: 1.25rem 1.5rem;
    background: rgba(37, 99, 235, 0.04);
    border: 1px solid rgba(37, 99, 235, 0.14);
    border-radius: var(--r-2);
}

.start-here-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: var(--accent-link);
    margin: 0 0 0.875rem;
}

.start-here-steps {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.start-step {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-white);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-1);
    text-decoration: none;
    color: var(--text-charcoal);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.start-step:hover {
    border-color: rgba(37, 99, 235, 0.35);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.07);
}

.start-step-num {
    width: 1.75rem;
    height: 1.75rem;
    background: rgba(37, 99, 235, 0.1);
    color: #1d4ed8;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.72rem;
    font-weight: 800;
    flex-shrink: 0;
}

.start-step-body {
    flex: 1;
}

.start-step-body strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
}

.start-step-body span {
    display: block;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}

.start-step-arrow {
    color: var(--text-muted);
    font-size: 1rem;
    flex-shrink: 0;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
    font-size: 0.85rem;
}

.filter-bar a,
.load-more-btn {
    width: fit-content;
    display: inline-block;
    color: var(--text-muted);
    padding: 0.25rem 0.75rem;
    border: 1px solid transparent;
    border-radius: 999px;
    text-decoration: none;
    background: rgba(0, 0, 0, 0.03);
}

.filter-bar a.active {
    color: var(--accent-link);
    border-color: rgba(37, 99, 235, 0.4);
    background: rgba(37, 99, 235, 0.07);
    font-weight: 700;
}

.load-more-btn {
    background: none;
    border: 1px solid var(--border);
    cursor: pointer;
    font-family: inherit;
}

.load-more-btn:hover {
    border-color: var(--text-charcoal);
    color: var(--text-charcoal);
}

.post-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .post-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
        row-gap: 2rem;
    }
}

.post-card {
    padding: var(--s-5);
    border: 1px solid var(--border-soft);
    display: flex;
    flex-direction: column;
    position: relative;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    background: var(--bg-white);
    border-radius: var(--r-2);
}

.post-card:hover {
    transform: translateY(-2px);
    border-color: var(--border);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06), 0 4px 8px rgba(0, 0, 0, 0.04);
}

.post-card-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: var(--s-2);
}

.post-categories {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.cat-badge {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(37, 99, 235, 0.09);
    color: #1d4ed8;
    padding: 0.15rem 0.5rem;
    font-weight: 700;
    border-radius: 3px;
}

.post-link {
    text-decoration: none;
    color: inherit;
    flex-grow: 1;
}

.post-link p {
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--text-muted);
    margin-bottom: 0;
}

.post-card:hover {
    background: var(--bg-off-white);
}

.post-card:last-child {
    /* border-bottom: none; */
}

.post-card h2 {
    margin-top: 0.35rem;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
    font-weight: 700;
    border-bottom: none;
    padding-bottom: 0;
    line-height: 1.3;
}

.eyebrow {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.post-card .eyebrow {
    color: var(--accent-link);
    opacity: 0.75;
}

.post-card-footer {
    margin-top: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
}

.post-tags-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag-link {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-muted);
    text-decoration: none;
    background: rgba(0, 0, 0, 0.03);
    padding: 0.1rem 0.3rem;
    border-radius: 2px;
}

.tag-link:hover {
    color: var(--text-charcoal);
    background: rgba(0, 0, 0, 0.08);
}

.tag-link.active {
    color: var(--accent-link);
    background: rgba(37, 99, 235, 0.1);
    font-weight: 700;
}

.post-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* SOP Cards */
.sop-top-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--s-4);
    margin: var(--s-6) 0;
}

.sop-card {
    border: 1px solid var(--border-soft);
    border-radius: var(--r-2);
    padding: var(--s-6);
    background: var(--surface-solid);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    font-size: 0.95em;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sop-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.07);
}

.sop-card h3 {
    margin-top: 0;
    font-size: 1.1rem;
    border-bottom: 1px solid var(--border-soft);
    padding-bottom: var(--s-2);
    margin-bottom: var(--s-3);
}

.sop-card-content> :last-child {
    margin-bottom: 0;
}

.sop-card.tldr {
    margin-top: var(--s-8);
    background: rgba(37, 99, 235, 0.02);
    border-left: 4px solid var(--accent-link);
}

@media (max-width: 768px) {
    .sop-top-cards {
        grid-template-columns: 1fr;
    }
}

/* Single post content hierarchy */

.content h3 {
    padding-left: 0.75rem;
    border-left: 3px solid rgba(37, 99, 235, 0.28);
    margin-top: 2.25rem;
}

.content ol {
    padding-left: 0;
    list-style: none;
    counter-reset: step-counter;
}

.content ol > li {
    counter-increment: step-counter;
    padding-left: 2.75rem;
    position: relative;
    margin-bottom: 1rem;
}

.content ol > li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0.15rem;
    width: 1.6rem;
    height: 1.6rem;
    background: rgba(37, 99, 235, 0.1);
    color: #1d4ed8;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
}