/* Sidetrade Engineering Blog — shared layout + components. Requires tokens.css */

@font-face { font-family: Roboto; font-weight: 400; src: url("../fonts/Roboto-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: Roboto; font-weight: 500; src: url("../fonts/Roboto-Medium.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: Roboto; font-weight: 700; src: url("../fonts/Roboto-Bold.ttf") format("truetype"); font-display: swap; }

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--st-white); font-family: var(--st-font); color: var(--st-text); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--st-blue-dark); }
p { margin: 0; }
img { display: block; }

.container { max-width: var(--st-page); margin: 0 auto; padding-left: var(--st-gutter); padding-right: var(--st-gutter); }
.measure { max-width: var(--st-measure); margin: 0 auto; }

/* Mono label (eyebrows, meta, captions) */
.mono { font-family: var(--st-mono); font-size: 12px; font-weight: 500; letter-spacing: .02em; color: var(--st-text-2); text-transform: uppercase; }
.mono--muted { color: var(--st-text-3); font-weight: 400; text-transform: none; }

/* ---------- Nav ---------- */
.nav { border-bottom: 1px solid var(--st-border); }
.nav__inner { height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.nav__brand { display: flex; align-items: center; gap: 14px; }
.nav__logo { height: 22px; width: auto; }
.nav__divider { width: 1px; height: 18px; background: var(--st-border); }
.nav__section { font-size: 14px; font-weight: 500; }
.nav__links { display: flex; align-items: center; gap: 28px; font-size: 14px; }
.nav__links a { color: var(--st-text-2); }
.nav__links a.is-primary { color: var(--st-text); font-weight: 500; }

/* ---------- Article header ---------- */
.post-header { padding-top: 72px; }
.post-header__grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 32px 64px; align-items: end; }
.post-header__title-wrap { min-width: 0; max-width: 760px; }
.post-title { margin: 16px 0 0; font-size: clamp(34px, 4.4vw, 52px); line-height: 1.1; font-weight: 700; letter-spacing: -.03em; text-wrap: pretty; }
.spec { display: flex; flex-direction: column; border-bottom: 1px solid var(--st-border); }
.spec__row { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 16px; padding: 10px 0; border-top: 1px solid var(--st-border); font-family: var(--st-mono); font-size: 12px; letter-spacing: .02em; }
.spec__key { color: var(--st-text-3); }
.spec__val { color: var(--st-text); }
@media (max-width: 720px) { .post-header__grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Schematic (cover) ---------- */
.grid-bg { background-color: var(--st-white); background-image: linear-gradient(var(--st-grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--st-grid-line) 1px, transparent 1px); background-position: -0.5px -0.5px; }
.cover { margin-top: 48px; position: relative; aspect-ratio: 21 / 9; border-radius: var(--st-r-sm); overflow: hidden; container-type: inline-size; border: 1px solid var(--st-border); background-size: 5cqw 5cqw; }
.cover__corner { position: absolute; top: 1.4cqw; font-family: var(--st-mono); font-size: 1.05cqw; letter-spacing: .04em; color: var(--st-text-3); text-transform: uppercase; }
.cover__corner--l { left: 1.6cqw; } .cover__corner--r { right: 1.6cqw; }
.node { position: absolute; background: var(--st-white); border: 1px solid var(--st-navy); padding: 1.4cqw 1.6cqw; display: flex; flex-direction: column; gap: .8cqw; }
.node__lab { font-family: var(--st-mono); font-size: 1.15cqw; letter-spacing: .02em; text-transform: uppercase; color: var(--st-text-2); }
.node__ttl { font-size: 1.9cqw; font-weight: 500; letter-spacing: -.01em; line-height: 1.1; }
.node__sub { margin-top: auto; font-size: 1.15cqw; color: var(--st-text-2); }
.node__edge { position: absolute; top: 0; width: .5cqw; height: 100%; }
.node__edge--l { left: 0; background: var(--st-blue); } .node__edge--r { right: 0; background: var(--st-orange); }
.node--aimie { left: 5cqw; top: 7.5cqw; width: 25cqw; height: 12.5cqw; }
.node--o2c { left: 37.5cqw; top: 7.5cqw; width: 25cqw; height: 12.5cqw; }
.node--stiq { left: 70cqw; top: 7.5cqw; width: 25cqw; height: 12.5cqw; }
.node--safe { left: 5cqw; top: 25cqw; width: 90cqw; height: 12.5cqw; padding: 1.2cqw 1.6cqw; display: grid; grid-template-columns: 18cqw repeat(3, minmax(0, 1fr)); gap: 1cqw; }
.node__cells { margin-top: auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: .5cqw; font-family: var(--st-mono); font-size: 1cqw; text-transform: uppercase; letter-spacing: .02em; }
.node__cells span { border: 1px solid var(--st-border-strong); background: var(--st-blue-tint); padding: .4cqw .5cqw; text-align: center; }
.cell { border: 1px solid var(--st-border-strong); background: var(--st-blue-tint); padding: .8cqw 1cqw; display: flex; flex-direction: column; gap: .3cqw; min-width: 0; }
.cell--accent { border-color: var(--st-orange); background: var(--st-orange-tint); }
.cell__k { font-family: var(--st-mono); font-size: 1.15cqw; text-transform: uppercase; letter-spacing: .02em; }
.cell__v { font-size: 1.1cqw; color: var(--st-text-2); line-height: 1.3; }
.wire { position: absolute; background: var(--st-navy); }
.wire--h { height: 1px; } .wire--v { width: 1px; }
.port { position: absolute; width: 1cqw; height: 1cqw; margin: -.5cqw 0 0 -.5cqw; border-radius: 50%; background: var(--st-blue); border: 1px solid var(--st-white); }
.port--orange { background: var(--st-orange); } .port--navy { background: var(--st-navy); }
.wire-label { position: absolute; font-family: var(--st-mono); font-size: .95cqw; color: var(--st-text-3); text-transform: uppercase; }

/* ---------- Article body ---------- */
.article { padding-top: 64px; }
.toc { padding: 20px 24px; border: 1px solid var(--st-border); border-radius: var(--st-r-sm); background: var(--st-gray-1); }
.toc ol { margin: 12px 0 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 24px; font-size: 14px; line-height: 1.5; }
.toc a { display: flex; gap: 10px; }
.toc__num { font-family: var(--st-mono); font-size: 12px; color: var(--st-text-3); }

.prose { padding-top: 48px; font-size: 18px; line-height: 1.7; color: var(--st-text-body); display: flex; flex-direction: column; gap: 24px; }
.prose--lead p:first-child { font-size: 21px; line-height: 1.6; color: var(--st-text); }
.prose strong { font-weight: 500; color: var(--st-text); }

.section { padding-top: 72px; }
.section .mono + h2 { margin-top: 12px; }
.section h2 { margin: 0; font-size: clamp(28px, 3.4vw, 36px); line-height: 1.15; font-weight: 700; letter-spacing: -.025em; text-wrap: pretty; }
.section .prose { padding-top: 20px; gap: 20px; }

figure { margin: 36px auto 0; }
figcaption { margin-top: 12px; font-family: var(--st-mono); font-size: 12px; line-height: 1.5; color: var(--st-text-3); }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.card { border: 1px solid var(--st-border); border-radius: var(--st-r-sm); overflow: hidden; display: flex; flex-direction: column; background: var(--st-white); }
.card__head { padding: 14px 20px; border-bottom: 1px solid var(--st-border); font-size: 16px; font-weight: 500; line-height: 1.3; }
.card__body { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 10px; font-size: 15px; line-height: 1.5; color: var(--st-text-2); flex: 1; }
.card__body strong { font-weight: 500; color: var(--st-text); }
.bullet { display: flex; gap: 12px; }
.bullet::before { content: ""; flex: none; width: 6px; height: 6px; margin-top: 8px; border-radius: 999px; background: var(--st-blue); }
.bullet--orange::before { background: var(--st-orange); }
.strip { margin-top: 16px; padding: 14px 20px; border-radius: var(--st-r-sm); background: var(--st-gray-1); display: flex; flex-wrap: wrap; gap: 8px 28px; font-size: 14px; color: var(--st-text-2); }
.strip--dark { background: var(--st-navy); color: #fff; align-items: center; gap: 12px 20px; font-size: 15px; line-height: 1.5; }
.strip--dark .muted { color: var(--st-blue-light); }
.badge { flex: none; padding: 5px 10px; border-radius: var(--st-r-xs); background: var(--st-blue); color: #fff; font-family: var(--st-mono); font-size: 12px; letter-spacing: .06em; }

.pullquote { margin: 40px auto 0; padding-left: 28px; border-left: 2px solid var(--st-blue); font-size: 24px; line-height: 1.4; letter-spacing: -.01em; color: var(--st-text); text-wrap: pretty; }

.feature-list { margin-top: 32px; }
.feature { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 16px; padding: 20px 0; border-top: 1px solid var(--st-border); }
.feature:last-child { border-bottom: 1px solid var(--st-border); }
.feature__num { font-family: var(--st-mono); font-size: 12px; color: var(--st-text-3); padding-top: 4px; }
.feature__title { font-size: 17px; font-weight: 500; }
.feature__text { margin-top: 4px; font-size: 15px; line-height: 1.55; color: var(--st-text-2); }

.facts { margin: 24px auto 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.fact { padding: 20px; border-top: 2px solid var(--st-navy); }
.fact__title { font-size: 16px; font-weight: 500; }
.fact__text { margin-top: 8px; font-size: 15px; line-height: 1.55; color: var(--st-text-2); }

.tags { padding-top: 48px; display: flex; flex-wrap: wrap; gap: 8px; }
.tag { padding: 6px 12px; border-radius: var(--st-r-xs); border: 1px solid var(--st-border); font-family: var(--st-mono); font-size: 12px; color: var(--st-text-2); }
.author-card { margin-top: 40px; padding: 24px; border: 1px solid var(--st-border); border-radius: var(--st-r-sm); display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 20px; align-items: start; }
.avatar { width: 56px; height: 56px; border-radius: 9999px; background: var(--st-blue-tint); color: var(--st-blue-dark); font-size: 16px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.author-card__name { margin-top: 4px; font-size: 17px; font-weight: 500; }
.author-card__bio { margin-top: 6px; font-size: 15px; line-height: 1.55; color: var(--st-text-2); }

/* ---------- Post cards (related / latest) ---------- */
.related { margin-top: 96px; border-top: 1px solid var(--st-border); background: var(--st-gray-1); }
.related__inner { padding-top: 64px; padding-bottom: 80px; }
.related__head { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; }
.related__head h3 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.related__head a { font-size: 14px; font-weight: 500; color: var(--st-blue-dark); }
.post-grid { margin-top: 28px; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.post-card { display: flex; flex-direction: column; background: var(--st-white); border: 1px solid var(--st-border); border-radius: var(--st-r-sm); overflow: hidden; color: var(--st-text); transition: border-color 150ms ease; }
.post-card:hover { border-color: var(--st-blue); color: var(--st-text); }
.post-card__media { aspect-ratio: 16 / 9; position: relative; overflow: hidden; container-type: inline-size; border-bottom: 1px solid var(--st-border); background-size: 10cqw 10cqw; }
.post-card__body { padding: 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.post-card__title { font-size: 17px; font-weight: 500; line-height: 1.35; text-wrap: pretty; }
.post-card__meta { margin-top: auto; padding-top: 6px; font-family: var(--st-mono); font-size: 12px; color: var(--st-text-3); }
/* mini schematic primitives (thumbnails) */
.m-box { position: absolute; background: var(--st-white); border: 1px solid var(--st-navy); }
.m-box--tint { background: var(--st-blue-tint); border-color: var(--st-border-strong); }
.m-box--blue { background: var(--st-blue); border-color: var(--st-blue); }
.m-box--orange { background: var(--st-orange); border-color: var(--st-orange); }
.m-box--orange-tint { background: var(--st-orange-tint); border-color: var(--st-orange); }
.m-wire { position: absolute; background: var(--st-navy); }
.m-port { position: absolute; width: 1.8cqw; height: 1.8cqw; margin: -.9cqw 0 0 -.9cqw; border-radius: 50%; border: 1px solid #fff; background: var(--st-blue); }
.m-port--orange { background: var(--st-orange); }

/* ---------- Footer ---------- */
.footer { background: var(--st-navy); color: #fff; }
.footer__grid { padding-top: 64px; padding-bottom: 48px; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 40px; }
.footer__brand { display: flex; flex-direction: column; gap: 16px; }
.footer__brand img { height: 22px; width: auto; align-self: flex-start; }
.footer__brand p { max-width: 280px; font-size: 14px; line-height: 1.55; color: var(--st-blue-light); }
.footer__col { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.footer__col h4 { margin: 0 0 4px; font-size: 14px; font-weight: 500; }
.footer__col a { color: var(--st-blue-light); }
.footer__col a:hover { color: #fff; }
.footer__legal { border-top: 1px solid rgba(255,255,255,.12); }
.footer__legal-inner { padding-top: 20px; padding-bottom: 20px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; font-family: var(--st-mono); font-size: 12px; color: var(--st-blue-light); }
