/*
  Shared editorial stylesheet for SayMesh Blog (/blog, /blog/*) and Use Cases (/use-cases/*).
  Uses the exact brand fonts, color tokens, wordmark, header, buttons, and footer from
  the main SayMesh website (apps/web/src/landing.css & landing-layout.css).
*/
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/geist-variable.woff2") format("woff2");
}
/* Geist has no arrows; draw every arrow from Paper Mono so UI matches everywhere. */
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/paper-mono-variable.woff2") format("woff2");
  unicode-range: U+2190-21FF;
}
@font-face {
  font-family: "Paper Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("/fonts/paper-mono-variable.woff2") format("woff2");
}

:root {
  --sans: "Geist", system-ui, sans-serif;
  --mono: "Paper Mono", ui-monospace, monospace;
  --paper: #f4f4f1;
  --surface: #ffffff;
  --soft: #ecece7;
  --ink: #151515;
  --muted: #585853;
  --line: #a9a9a1;
  --subtle-line: #deded8;
  --lamp: #f01ef0;
  --lamp-ink: #a300a3;
  --say: #86f51f;
  --say-ink: #2f6b00;
  --file-ink: #6b5f00;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #0a0a0a;
  --surface: #121212;
  --soft: #1a1c18;
  --ink: #f2f2ee;
  --muted: #a8a8a1;
  --line: #4e4f49;
  --subtle-line: #262722;
  --lamp-ink: #ff6bff;
  --say-ink: #86f51f;
  --file-ink: #f6e600;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0a0a0a;
    --surface: #121212;
    --soft: #1a1c18;
    --ink: #f2f2ee;
    --muted: #a8a8a1;
    --line: #4e4f49;
    --subtle-line: #262722;
    --lamp-ink: #ff6bff;
    --say-ink: #86f51f;
    --file-ink: #f6e600;
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.lp {
  --gutter: clamp(20px, 4.4vw, 64px);
  --measure: 1440px;
  position: relative;
  overflow-x: clip;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.lp a:focus-visible,
.lp button:focus-visible,
.lp select:focus-visible,
.lp summary:focus-visible,
.post-diagram-scroll:focus-visible {
  outline: 2px solid var(--lamp);
  outline-offset: 3px;
}

/* Wordmark & button */
.lp-wordmark {
  display: inline-flex;
  align-items: baseline;
  color: var(--ink);
  font: 900 24px/1 var(--sans);
  letter-spacing: -0.02em;
  text-decoration: none;
}
.lp-wordmark i {
  width: 0.32em;
  height: 0.32em;
  margin-left: 0.06em;
  background: var(--lamp);
}
.lp-lamp {
  display: inline-block;
  width: 0.22em;
  height: 0.22em;
  margin-left: 0.05em;
  background: var(--lamp);
}

.lp-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font: 500 15px/1 var(--sans);
  text-decoration: none;
  white-space: nowrap;
}
:root[data-account="signed-in"] .account-signed-out,
:root:not([data-account="signed-in"]) .account-signed-in {
  display: none;
}
.lp-button:hover {
  background: transparent;
  color: var(--ink);
}
.lp-button.quiet {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.lp-button.quiet:hover {
  border-color: var(--ink);
}

.lp-docs {
  display: inline-flex;
  align-items: baseline;
  gap: 14px;
}
.lp-docs > .lp-llms {
  color: var(--muted);
  font: 11px var(--mono);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.lp-docs > .lp-llms:hover {
  color: var(--ink);
}

/* Top bar */
.fb-bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 32px;
  min-height: 76px;
  padding: 0 var(--gutter);
  border-bottom: 1px solid var(--subtle-line);
}
.fb-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-left: auto;
  font-size: 15px;
}
.fb-nav > a,
.fb-nav .lp-docs > a:not(.lp-llms) {
  color: var(--muted);
  text-decoration: none;
}
.fb-nav > a:hover,
.fb-nav > a[aria-current="page"],
.fb-nav .lp-docs > a:hover {
  color: var(--ink);
}
.fb-nav > a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: var(--lamp);
  text-decoration-thickness: 2px;
  text-underline-offset: 8px;
}
.fb-account-actions {
  display: flex;
  align-items: center;
  margin-left: auto;
  flex-shrink: 0;
  gap: 12px;
}
.fb-account {
  min-height: 36px;
  padding: 0 16px;
  font-size: 14px;
}
.fb-account-actions .theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.fb-account-actions .theme-toggle:hover {
  border-color: var(--ink);
  background: var(--surface);
}

.fb-main {
  flex: 1;
}

/* Main article & index containers */
.post-wrap {
  flex: 1;
  width: min(804px, calc(100% - 2 * var(--gutter)));
  margin: 0 auto;
  padding: clamp(32px, 5vw, 56px) 0 clamp(56px, 7vw, 88px);
}
.blog-wrap {
  width: min(1160px, calc(100% - 2 * var(--gutter)));
}

/* Breadcrumb & section kicker */
.post-crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  color: var(--muted);
  font: 13px/1.3 var(--mono);
}
.post-crumb a {
  text-decoration: none;
}
.post-crumb a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.fb-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  color: var(--muted);
  font: 13px var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.fb-kicker::before {
  content: "";
  width: 7px;
  height: 7px;
  background: var(--lamp);
}

/* Typography */
h1,
h2,
h3 {
  font-family: var(--sans);
  color: var(--ink);
}
h1 {
  margin: 0 0 20px;
  font-size: clamp(36px, 5vw, 54px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.06;
  text-wrap: balance;
}
h2 {
  margin: 44px 0 14px;
  padding-top: 24px;
  border-top: 1px solid var(--subtle-line);
  font-size: clamp(24px, 3vw, 30px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.18;
}
h3 {
  margin: 24px 0 8px;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}
.post-wrap p,
.post-wrap li {
  font-size: 17px;
  line-height: 1.65;
}
.post-wrap a {
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
}
.post-wrap a:hover {
  color: var(--lamp-ink);
  text-decoration-color: var(--lamp-ink);
}
.post-wrap .lp-button,
.post-wrap .blog-card h3 a {
  text-decoration: none;
}
.post-wrap .lp-button:hover {
  color: var(--ink);
}

/* Direct-answer summary box */
.post-answer {
  margin: 0 0 28px;
  padding: 18px 20px;
  border: 1px solid var(--subtle-line);
  border-left: 3px solid var(--lamp);
  background: var(--surface);
  font-size: 17px;
  line-height: 1.6;
}

/* Tables */
.post-table {
  width: 100%;
  margin: 20px 0 24px;
  border-collapse: collapse;
  border: 1px solid var(--subtle-line);
  background: var(--surface);
  font-size: 15px;
}
.post-table caption {
  padding-bottom: 8px;
  color: var(--muted);
  font: 13px/1.4 var(--mono);
  text-align: left;
}
.post-table thead th {
  background: var(--soft);
  font: 600 13px/1.35 var(--mono);
  color: var(--ink);
  text-transform: none;
}
.post-table th,
.post-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--subtle-line);
  overflow-wrap: break-word;
  text-align: left;
  vertical-align: top;
}
.post-table tbody th {
  font-weight: 600;
}

/* Phones: a wide table scrolls inside its own box instead of widening the page; long inline code wraps. */
@media (max-width: 760px) {
  .post-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .post-wrap :not(pre) > code {
    overflow-wrap: anywhere;
  }
}

.post-label {
  margin: 20px 0 8px;
  color: var(--muted);
  font: 600 13px/1.3 var(--mono);
}

pre {
  margin: 0 0 18px;
  padding: 14px 16px;
  overflow: auto;
  border: 1px solid var(--subtle-line);
  background: var(--surface);
}
code {
  font: 13.5px/1.55 var(--mono);
}
p code,
li code,
td code {
  padding: 1px 5px;
  border: 1px solid var(--subtle-line);
  background: var(--surface);
  font-size: 0.88em;
}
pre code {
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 13.5px;
}

blockquote {
  margin: 20px 0;
  padding: 4px 0 4px 18px;
  border-left: 3px solid var(--line);
  color: var(--muted);
}

.post-links {
  padding-left: 20px;
}
.post-links li + li,
main ul li + li,
main ol li + li {
  margin-top: 8px;
}
.post-note {
  color: var(--muted);
  font-size: 15px;
}

/* Diagrams & figures */
.post-figure {
  margin: 26px 0 30px;
  border: 1px solid var(--subtle-line);
  overflow: hidden;
  background: var(--surface);
}
.post-hero {
  margin-top: 22px;
}
.post-media-img,
.post-media-fallback {
  display: block;
  width: 100%;
  height: auto;
}
.post-media-img:not([src]) {
  display: none;
}
.post-diagram-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.post-diagram-scroll img {
  display: block;
  width: 100%;
  min-width: 800px;
  height: auto;
}
.post-figure-caption {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: baseline;
  justify-content: space-between;
  margin: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--subtle-line);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}
.post-diagram-caption-text {
  flex: 1 1 240px;
}
.post-diagram-link {
  color: var(--ink);
  font: 600 13px/1.3 var(--mono);
  white-space: nowrap;
  text-underline-offset: 3px;
}

/* Related links preserved from post footers */
.post-related {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--subtle-line);
  font-size: 15px;
}

/* SayMesh account & home conversion CTA */
.post-cta {
  display: grid;
  gap: 14px;
  margin-top: 40px;
  padding: clamp(24px, 3vw, 34px);
  border: 1px solid var(--subtle-line);
  background: var(--surface);
}
.post-cta .fb-kicker {
  margin-bottom: 2px;
}
.post-cta h2 {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: clamp(24px, 3vw, 32px);
  letter-spacing: -0.03em;
}
.post-cta p {
  margin: 0;
  max-width: 54ch;
  color: var(--muted);
}
.post-cta-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-top: 4px;
}
.post-cta-home {
  font-size: 15px;
  font-weight: 500;
}

/* 404 not-found actions */
.nf-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-top: 24px;
}
.nf-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid var(--line);
  color: var(--ink);
  font: 500 15px/1 var(--sans);
  text-decoration: none;
}
.nf-links a:first-child {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}
.nf-links a:first-child:hover {
  background: transparent;
  color: var(--ink);
}
.nf-links a:not(:first-child):hover {
  border-color: var(--ink);
  color: var(--ink);
}

/* Blog index layout */
.blog-hero {
  padding-bottom: 28px;
}
.blog-hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin-top: 18px;
  font: 13px/1.4 var(--mono);
  color: var(--muted);
}
.blog-section-head {
  margin-top: 8px;
  padding-top: 28px;
  border-top: 1px solid var(--subtle-line);
}
.blog-section-head h2 {
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}
.blog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.blog-grid > li {
  margin: 0;
}
.blog-card {
  position: relative;
  display: grid;
  gap: 8px;
  align-content: start;
  height: 100%;
  padding: 20px 22px;
  border: 1px solid var(--subtle-line);
  background: var(--surface);
  color: var(--ink);
  transition: border-color 140ms ease-out;
}
.blog-card:hover {
  border-color: var(--ink);
}
.blog-card time {
  color: var(--muted);
  font: 12px/1.3 var(--mono);
}
.blog-card h3 {
  margin: 0;
  font: 600 18px/1.3 var(--sans);
  letter-spacing: -0.015em;
}
.blog-card h3 a {
  color: var(--ink);
}
.blog-card h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
}
.blog-card:hover h3 a {
  color: var(--lamp-ink);
}
.blog-card-desc {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

/* Footer: identical structure & styling to landing pages */
.fb-foot {
  border-top: 1px solid var(--subtle-line);
}
.fb-foot-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 32px;
  width: min(var(--measure), 100%);
  margin: 0 auto;
  padding: 32px var(--gutter) 40px;
}
.fb-foot .lp-wordmark {
  font-size: 20px;
}
.lp-from {
  color: var(--muted);
  font: 13px var(--mono);
  text-decoration: none;
}
.lp-from:hover {
  color: var(--ink);
  text-decoration: underline;
}
.fb-foot-links {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px 24px;
  margin-left: auto;
  font-size: 15px;
}
.fb-foot-links a {
  color: var(--muted);
  text-decoration: none;
}
.fb-foot-links a:hover,
.fb-foot-links a[aria-current="page"] {
  color: var(--ink);
}
.fb-foot-links > a.fb-foot-phone {
  display: none;
}
.fb-foot-links > a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: var(--lamp);
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}
.lp .theme-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--muted);
  font: 13px var(--mono);
}
.lp .theme-control select {
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  background-color: var(--paper);
  color: var(--ink);
  font: 13px var(--mono);
}

@media (max-width: 900px) {
  .blog-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .lp .lp-docs > .lp-llms {
    display: none;
  }
  .fb-bar {
    flex-wrap: wrap;
    gap: 0 16px;
    padding-top: 14px;
  }
  .fb-account {
    margin-left: auto;
  }
  .fb-nav {
    order: 3;
    width: 100%;
    margin: 10px 0 0;
    padding: 10px 0 12px;
    gap: 22px;
    border-top: 1px solid var(--subtle-line);
    overflow-x: auto;
    font-size: 15px;
  }
  .fb-nav > a,
  .fb-nav .lp-docs > a {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    white-space: nowrap;
  }
  .fb-nav > a.fb-nav-wide {
    display: none;
  }
  .fb-account-actions {
    gap: 8px;
  }
  .fb-account-actions .theme-toggle {
    width: 32px;
    height: 32px;
  }
  .fb-foot-links {
    margin-left: 0;
    width: 100%;
  }
  .fb-foot-links > a.fb-foot-phone {
    display: inline;
  }
  .post-cta-actions .lp-button {
    flex: 1 1 auto;
  }
}
