/* ==========================================================================
   Blog (/blog and /blog/<slug>). Builds on styles.css and site-v2.css: header,
   footer, buttons and tokens come from there; everything here is prefixed b-.
   ========================================================================== */

.page-blog { background: var(--paper); }
.b-main { padding-top: 68px; overflow-x: clip; }

.b-sec-title {
  margin: 0 0 22px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-500);
  display: flex;
  align-items: center;
  gap: 12px;
}
.b-sec-title::before { content: ""; width: 28px; height: 1.5px; background: var(--amber-500); }

/* ---------------------------------------------------------------- Index hero */

.b-hero {
  position: relative;
  padding: clamp(56px, 9vw, 110px) 0 clamp(48px, 6vw, 72px);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%);
  overflow: hidden;
}
.b-hero-grid {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(15, 76, 92, 0.07) 1px, transparent 1px) 0 0 / 120px 120px,
    linear-gradient(90deg, rgba(15, 76, 92, 0.07) 1px, transparent 1px) 0 0 / 120px 120px,
    linear-gradient(rgba(15, 76, 92, 0.035) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(15, 76, 92, 0.035) 1px, transparent 1px) 0 0 / 24px 24px;
  -webkit-mask-image: radial-gradient(ellipse 70% 90% at 30% 40%, #000 20%, transparent 80%);
          mask-image: radial-gradient(ellipse 70% 90% at 30% 40%, #000 20%, transparent 80%);
  pointer-events: none;
}
.b-hero-inner > * { max-width: 880px; }
.b-hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 22px;
  padding: 6px 14px 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--ink-500);
}
.b-hero-pill span { width: 8px; height: 8px; border-radius: 50%; background: var(--amber-500); }
.b-hero h1 {
  margin: 0;
  font-size: clamp(2.4rem, 6vw, 4.6rem);
  line-height: 1.02;
  letter-spacing: -0.045em;
  font-weight: 600;
  color: var(--ink-1000);
}
.b-hero h1 em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--teal-900);
}
.b-hero-sub { margin: 22px 0 0; max-width: 62ch; font-size: clamp(1rem, 1.4vw, 1.12rem); line-height: 1.65; color: var(--ink-500); }
.b-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 28px 0 0; padding: 0; list-style: none; }
.b-chips li {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #FFFFFF;
  font-size: 0.82rem;
  color: var(--ink-700);
}

/* ---------------------------------------------------------------- Cards */

.b-featured-sec { padding: clamp(48px, 6vw, 72px) 0 0; }
.b-list-sec { padding: clamp(48px, 6vw, 72px) 0 clamp(56px, 7vw, 88px); }

.b-featured {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #FFFFFF;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out), border-color 0.3s ease;
}
.b-featured:hover { transform: translateY(-3px); border-color: var(--teal-300); box-shadow: 0 30px 60px -36px rgba(6, 36, 48, 0.45); }
.b-featured-art { background: linear-gradient(160deg, var(--teal-900), var(--teal-1000)); display: grid; place-items: center; padding: 24px; }
.b-featured-art svg { width: 100%; height: auto; max-width: 520px; }
.b-featured-art .f-grid path { stroke: rgba(142, 205, 205, 0.12); stroke-width: 1; fill: none; }
.b-featured-art .f-ghost { stroke: var(--amber-400); stroke-width: 1.4; stroke-dasharray: 6 5; fill: none; opacity: 0.7; }
.b-featured-art .f-frame { stroke: #FFFFFF; stroke-width: 2.2; fill: none; stroke-linejoin: round; }
.b-featured-art .f-dim { stroke: var(--teal-300); stroke-width: 1; fill: none; }
.b-featured-art text { font-family: var(--font-mono); font-size: 12px; fill: var(--teal-300); }
.b-featured-art text.f-amber { fill: var(--amber-400); }
.b-featured-body { padding: clamp(24px, 4vw, 44px); display: flex; flex-direction: column; gap: 14px; justify-content: center; }
.b-featured-body h3 { margin: 0; font-size: clamp(1.5rem, 2.6vw, 2.1rem); line-height: 1.12; letter-spacing: -0.03em; font-weight: 600; color: var(--ink-1000); }
.b-featured-body p { margin: 0; color: var(--ink-500); line-height: 1.6; }

.b-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.b-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 26px 24px 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #FFFFFF;
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out), border-color 0.3s ease;
}
.b-card::after {
  /* A drawing grid that fades in from the corner on hover. */
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(15, 76, 92, 0.06) 1px, transparent 1px) 0 0 / 18px 18px,
    linear-gradient(90deg, rgba(15, 76, 92, 0.06) 1px, transparent 1px) 0 0 / 18px 18px;
  -webkit-mask-image: linear-gradient(135deg, transparent 45%, #000);
          mask-image: linear-gradient(135deg, transparent 45%, #000);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}
.b-card:hover { transform: translateY(-3px); border-color: var(--teal-300); box-shadow: 0 24px 48px -32px rgba(6, 36, 48, 0.4); }
.b-card:hover::after { opacity: 1; }
.b-card h3 { margin: 0; font-size: 1.18rem; line-height: 1.25; letter-spacing: -0.02em; font-weight: 600; color: var(--ink-1000); }
.b-card p { margin: 0; font-size: 0.94rem; line-height: 1.6; color: var(--ink-500); flex: 1; }
.b-card-tag {
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--teal-50);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--teal-900);
}
.b-card-meta { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-500); }
.b-card-meta span { display: inline-block; color: var(--amber-600); transition: transform 0.25s var(--ease-out); }
.b-card:hover .b-card-meta span, .b-featured:hover .b-card-meta span { transform: translateX(4px); }

/* ---------------------------------------------------------------- Lead band */

.b-magnet { padding: 0 0 clamp(64px, 8vw, 104px); }
.b-magnet-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) auto;
  gap: 28px;
  align-items: center;
  padding: clamp(28px, 4vw, 48px);
  border-radius: 26px;
  background:
    linear-gradient(rgba(142, 205, 205, 0.08) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(142, 205, 205, 0.08) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(160deg, var(--teal-900), var(--teal-1000));
  color: #C9DCDF;
}
.b-magnet-inner h2 { margin: 6px 0 12px; font-size: clamp(1.5rem, 3vw, 2.2rem); line-height: 1.1; letter-spacing: -0.03em; font-weight: 600; color: #FFFFFF; }
.b-magnet-inner p { margin: 0; max-width: 60ch; line-height: 1.6; }
.b-cta-k { margin: 0; font-family: var(--font-mono); font-size: 0.74rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--amber-500); }
.b-cta-actions { display: flex; flex-direction: column; gap: 10px; min-width: 240px; }
.b-magnet .btn-secondary { background: transparent; color: #FFFFFF; border-color: rgba(255, 255, 255, 0.3); }
.b-magnet .btn-secondary:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.5); }

/* ---------------------------------------------------------------- Article head */

.b-art-head {
  position: relative;
  padding: clamp(40px, 6vw, 72px) 0 clamp(32px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(rgba(15, 76, 92, 0.05) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(15, 76, 92, 0.05) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%);
}
.b-art-head-inner > * { max-width: 900px; }
.b-crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 0.82rem; color: var(--ink-500); }
.b-crumbs a { color: var(--ink-500); text-decoration: none; }
.b-crumbs a:hover { color: var(--teal-900); }
.b-tag { margin: 24px 0 12px; font-family: var(--font-mono); font-size: 0.78rem; font-weight: 600; color: var(--amber-700); }
.b-title { margin: 0; font-size: clamp(2rem, 4.6vw, 3.4rem); line-height: 1.06; letter-spacing: -0.04em; font-weight: 600; color: var(--ink-1000); text-wrap: balance; }
.b-dek { margin: 18px 0 0; max-width: 64ch; font-size: clamp(1.02rem, 1.5vw, 1.18rem); line-height: 1.6; color: var(--ink-500); }
.b-byline { display: flex; align-items: center; gap: 12px; margin-top: 26px; }
.b-byline img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; object-position: 30% 18%; border: 2px solid #FFFFFF; box-shadow: 0 0 0 1px var(--line); }
.b-byline div { display: grid; gap: 2px; font-size: 0.86rem; color: var(--ink-500); }
.b-byline-name { font-weight: 600; color: var(--ink-1000); text-decoration: none; }

/* ---------------------------------------------------------------- Article body */

.b-art-grid {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: clamp(32px, 5vw, 72px);
  padding-top: clamp(32px, 5vw, 56px);
  padding-bottom: clamp(48px, 6vw, 80px);
  align-items: start;
}
.b-toc { position: sticky; top: 92px; }
.b-toc-box summary {
  list-style: none;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-500);
}
.b-toc-box summary::-webkit-details-marker { display: none; }
.b-toc ol { margin: 14px 0 0; padding: 0 0 0 14px; list-style: none; border-left: 1px solid var(--line); display: grid; gap: 10px; }
.b-toc a { display: block; font-size: 0.88rem; line-height: 1.4; color: var(--ink-500); text-decoration: none; }
.b-toc a:hover { color: var(--teal-900); }

.b-prose { max-width: 72ch; min-width: 0; font-size: 1.05rem; line-height: 1.75; color: var(--ink-700); }
.b-prose > * + * { margin-top: 0; }
.b-prose h2 {
  margin: 56px 0 16px;
  font-size: clamp(1.45rem, 2.4vw, 1.85rem);
  line-height: 1.2;
  letter-spacing: -0.025em;
  font-weight: 600;
  color: var(--ink-1000);
  scroll-margin-top: 92px;
}
.b-prose h3 { margin: 32px 0 10px; font-size: 1.18rem; line-height: 1.3; letter-spacing: -0.015em; font-weight: 600; color: var(--ink-900); }
.b-prose p { margin: 0 0 18px; }
.b-prose ul, .b-prose ol { margin: 0 0 20px; padding-left: 1.3em; }
.b-prose ul { list-style: disc; }
.b-prose ol { list-style: decimal; }
.b-prose .b-toc ol, .b-prose .b-chips { list-style: none; }
.b-prose li { margin: 0 0 8px; padding-left: 4px; }
.b-prose li::marker { color: var(--teal-700); }
.b-prose strong { color: var(--ink-1000); font-weight: 600; }
.b-prose a { color: var(--teal-900); text-decoration: underline; text-decoration-color: var(--amber-500); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.b-prose a:hover { color: var(--amber-700); }
.b-prose code { padding: 1px 6px; border-radius: 5px; background: var(--teal-50); color: var(--teal-900); font-size: 0.88em; }
.b-prose pre {
  margin: 0 0 22px;
  padding: 18px 20px;
  border-radius: 14px;
  background: var(--teal-1000);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.b-prose pre code { padding: 0; background: none; color: #D7E9EC; font-size: 0.86rem; line-height: 1.6; white-space: pre; }
.b-note { font-size: 0.88rem; color: var(--ink-500); font-style: italic; }

.b-table-wrap { margin: 0 0 22px; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 14px; background: #FFFFFF; }
.b-prose table { width: 100%; min-width: 520px; border-collapse: collapse; font-size: 0.92rem; line-height: 1.5; }
.b-prose th, .b-prose td { padding: 12px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.b-prose th { background: var(--paper-2); font-weight: 600; color: var(--ink-1000); }
.b-prose tr:last-child td { border-bottom: 0; }
.b-prose td:first-child { font-weight: 500; color: var(--ink-900); }

.b-summary {
  margin: 0 0 8px;
  padding: 22px 24px 8px;
  border: 1px solid var(--teal-200);
  border-left: 4px solid var(--teal-900);
  border-radius: 16px;
  background: var(--teal-50);
}
.b-summary-k { margin: 0 0 10px !important; font-family: var(--font-mono); font-size: 0.74rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--teal-900); }
.b-summary ul { padding-left: 1.2em; }
.b-summary li { font-size: 0.98rem; line-height: 1.6; }

.b-figure { margin: 8px 0 28px; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: #FFFFFF; }
.b-figure svg { display: block; width: 100%; height: auto; }
.b-figure figcaption { margin-top: 10px; font-size: 0.86rem; line-height: 1.5; color: var(--ink-500); }
.b-figure .d-grid path { stroke: rgba(15, 76, 92, 0.07); stroke-width: 1; fill: none; }
.b-figure .d-ghost { stroke: var(--amber-600); stroke-width: 1.4; stroke-dasharray: 6 5; fill: none; }
.b-figure .d-web { fill: var(--teal-100); stroke: none; }
.b-figure .d-flange { stroke: var(--teal-900); stroke-width: 3; fill: none; stroke-linecap: round; }
.b-figure .d-plate { stroke: var(--teal-700); stroke-width: 2; fill: none; }
.b-figure .d-dim { stroke: var(--ink-400); stroke-width: 1; fill: none; }
.b-figure .d-sec { fill: var(--teal-900); }
.b-figure .d-frame { stroke: var(--teal-900); stroke-width: 2.4; fill: none; stroke-linejoin: round; }
.b-figure .d-frame-in { stroke: var(--teal-500); stroke-width: 1.2; fill: none; stroke-linejoin: round; }
.b-figure .d-bar-load { fill: var(--amber-500); }
.b-figure .d-bar-str { fill: var(--teal-900); }
.b-figure .d-txt { font-family: var(--font-mono); font-size: 12px; fill: var(--ink-500); }
.b-figure .d-strong { font-weight: 600; fill: var(--ink-1000); font-size: 13px; }
.b-figure .d-inv { fill: #FFFFFF; }
.b-figure .d-amber { fill: var(--amber-700); }

/* FAQ */
.b-faq { margin-top: 56px; }
.b-faq h2 { margin-top: 0; }
.b-faq-item { border: 1px solid var(--line); border-radius: 14px; background: #FFFFFF; margin-bottom: 10px; overflow: hidden; }
.b-faq-item summary {
  position: relative;
  list-style: none;
  cursor: pointer;
  padding: 16px 48px 16px 18px;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.4;
  color: var(--ink-1000);
}
.b-faq-item summary::-webkit-details-marker { display: none; }
.b-faq-item summary::after {
  content: "+";
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 1.2rem;
  color: var(--amber-600);
}
.b-faq-item[open] summary::after { content: "\2212"; }
.b-faq-item[open] summary { border-bottom: 1px solid var(--line); }
.b-faq-item > div { padding: 14px 18px 2px; }
.b-faq-item p { font-size: 0.97rem; line-height: 1.65; }

/* CTA + author */
.b-cta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  margin: 48px 0 0;
  padding: 28px;
  border-radius: 22px;
  background:
    linear-gradient(rgba(142, 205, 205, 0.08) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(142, 205, 205, 0.08) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(160deg, var(--teal-900), var(--teal-1000));
  color: #C9DCDF;
}
.b-cta h2 { margin: 6px 0 10px; font-size: 1.45rem; line-height: 1.2; letter-spacing: -0.02em; color: #FFFFFF; scroll-margin-top: 92px; }
.b-cta p { margin: 0; font-size: 0.95rem; line-height: 1.6; }
.b-cta .b-cta-actions { min-width: 210px; }
.b-prose .b-cta a.btn { text-decoration: none; }
.b-prose .b-cta .btn-primary { color: var(--ink-1000); }
.b-cta .btn-secondary { background: transparent; color: #FFFFFF; border-color: rgba(255, 255, 255, 0.3); }
.b-cta .btn-secondary:hover { background: rgba(255, 255, 255, 0.08); color: #FFFFFF; }

.b-author { display: flex; gap: 18px; align-items: flex-start; margin-top: 28px; padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: #FFFFFF; }
.b-author img { width: 72px; height: 72px; flex: none; border-radius: 50%; object-fit: cover; object-position: 30% 18%; }
.b-author p { margin: 0; font-size: 0.92rem; line-height: 1.6; color: var(--ink-500); }
.b-author .b-author-name { margin-bottom: 4px; font-weight: 600; color: var(--ink-1000); }

.b-related { padding: clamp(48px, 6vw, 72px) 0 clamp(56px, 7vw, 88px); background: var(--paper-2); border-top: 1px solid var(--line); }

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

@media (max-width: 1000px) {
  .b-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .b-art-grid { grid-template-columns: minmax(0, 1fr); }
  .b-toc { position: static; }
  .b-toc-box { padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: #FFFFFF; }
  .b-toc-box summary::after { content: " +"; color: var(--amber-600); }
  .b-toc-box[open] summary::after { content: " \2212"; }
  .b-prose { max-width: none; }
}
@media (max-width: 760px) {
  .b-featured { grid-template-columns: minmax(0, 1fr); }
  .b-magnet-inner, .b-cta { grid-template-columns: minmax(0, 1fr); }
  .b-cta-actions { min-width: 0; }
}
@media (max-width: 600px) {
  .b-grid { grid-template-columns: minmax(0, 1fr); }
  .b-prose { font-size: 1rem; }
  .b-figure { padding: 10px; }
  .b-author { flex-direction: column; }
  .b-cta { padding: 22px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .b-card, .b-featured, .b-card::after, .b-card-meta span { transition: none; }
}

/* The free frame check link under the article CTA buttons; opens the pop-up. */
.b-cta-fc { flex-basis: 100%; font-size: 0.9rem; font-weight: 600; color: var(--teal-900); text-decoration: underline; text-decoration-color: var(--amber-500); text-underline-offset: 4px; }
.b-cta-fc:hover { color: var(--amber-700); }
