/* =============================================
   Glorics Article Base Styles
   Shared by all blog/article pages (EN + FR)
   Style: Industrial Monochrome / Blueprint Mode
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&display=swap');

:root {
  --dark: #141413;
  --light: #faf9f5;
  --mid-gray: #b0aea5;
  --light-gray: #e8e6dc;
  --orange: #d97757;
  --orange-dim: #c26a4d;
  --orange-bg: rgba(217,119,87,0.06);
  --orange-border: rgba(217,119,87,0.25);
  --blue: #6a9bcc;
  --green: #788c5d;
  --teal: #59b296;
  --royal-blue: #326da6;
  --peach: #f4b19a;
  --warm-gray: #b1ada5;
  --sand: #dedbd1;
  --white: #ffffff;
  --text: #3b3a37;
  --text-light: #7a7870;
  --text-faint: #9e9d95;
  --border: #e8e6dc;
  --code-bg: #191919;
  --sidebar-w: 252px;
  --toc-w: 220px;
  --serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --sans: 'DM Sans', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
}

/* ===== Base Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--sans); color: var(--text); font-size: 15px; line-height: 1.72; -webkit-font-smoothing: antialiased; }
::selection { background: rgba(217,119,87,0.15); }

/* ===== Blog Grid Layout ===== */
.blog-grid a { color: var(--orange); text-decoration: none; }
.blog-grid a:hover { color: var(--orange-dim); text-decoration: underline; }
.blog-grid { display: grid; grid-template-columns: var(--sidebar-w) 1fr var(--toc-w); max-width: 1400px; margin: 0 auto; padding: 80px 48px 0; gap: 0; }

/* ===== Left Sidebar (TOC) ===== */
.side { position: sticky; top: 150px; height: fit-content; padding: 0 20px 40px 0; overflow-y: auto; }
.side-back { display: flex; align-items: center; gap: 8px; color: var(--text-faint); font-size: 13px; font-weight: 500; margin-bottom: 32px; }
.side-back:hover { color: var(--dark); text-decoration: none; }
.side-back svg { width: 14px; height: 14px; }
.toc-title { font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-faint); margin-bottom: 16px; font-weight: 600; }
.toc-list { list-style: none; }
.toc-item { margin-bottom: 2px; }
.toc-link { display: block; padding: 6px 12px; color: var(--text-light); font-size: 13px; border-radius: 4px; border-left: 2px solid transparent; line-height: 1.4; transition: all 0.15s; }
.toc-link:hover { color: var(--dark); text-decoration: none; }
.toc-link.on { color: var(--dark); font-weight: 600; border-left-color: var(--dark); }

/* ===== Right Sidebar (Author) ===== */
.rsb { position: sticky; top: 150px; height: fit-content; padding: 0 0 40px 24px; }
.author-block { display: flex; flex-direction: column; align-items: center; }
.author-avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; margin-bottom: 12px; border: 2px solid var(--border); }
.author-name { font-size: 13px; font-weight: 600; color: var(--dark); margin-bottom: 8px; line-height: 1.4; text-align: center; }
.author-bio { font-size: 12px; color: var(--text-faint); line-height: 1.6; margin-bottom: 16px; text-align: left; }
.author-links { display: flex; flex-direction: column; align-items: stretch; gap: 6px; width: 100%; margin-bottom: 20px; }
.author-links a { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 14px; border: 1px solid var(--border); border-radius: 4px; color: var(--text-faint); font-size: 12px; font-weight: 500; transition: all 0.15s; }
.author-links a:hover { border-color: var(--dark); color: var(--dark); text-decoration: none; }
.author-links a svg { width: 14px; height: 14px; flex-shrink: 0; }
.author-links a img { width: 14px; height: 14px; object-fit: contain; flex-shrink: 0; }
.font-controls { display: flex; justify-content: center; gap: 6px; padding-top: 16px; border-top: 1px solid var(--border); width: 100%; }
.font-controls button { width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 6px; background: var(--white); color: var(--text-faint); font-size: 14px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
.font-controls button:hover { border-color: var(--dark); color: var(--dark); }

/* ===== Main Content Area ===== */
.main { padding: 0 40px 120px; min-width: 0; }
.main-inner { max-width: 680px; margin: 0 auto; }

/* ===== Article Header ===== */
.ah { margin-bottom: 32px; }
.ah h1 { font-family: var(--sans); font-size: 42px; font-weight: 700; line-height: 1.12; color: var(--dark); letter-spacing: -0.03em; margin-bottom: 20px; }
.ah-meta { display: flex; gap: 16px; font-size: 12px; color: var(--text-faint); }
.ah-meta span { display: flex; align-items: center; gap: 4px; }
.ah-meta svg { width: 13px; height: 13px; opacity: 0.35; }
.ah-line { height: 1px; background: var(--border); margin: 28px 0; }

/* ===== Article Body (Prose) ===== */
.ab .lead { font-size: 17px; line-height: 1.7; color: var(--dark); margin-bottom: 24px; }
.ab p { font-size: var(--ab-font-size, 15px); line-height: 1.78; color: var(--text); margin-bottom: 16px; }
.ab strong { color: var(--dark); font-weight: 600; }
.ab em { font-style: italic; }
.ab h2 { font-family: var(--sans); font-size: 28px; font-weight: 700; color: var(--dark); letter-spacing: -0.02em; margin: 64px 0 20px; line-height: 1.2; scroll-margin-top: 80px; }
[id] { scroll-margin-top: 80px; }
.ab h3 { font-family: var(--sans); font-size: 20px; font-weight: 600; color: var(--dark); margin: 40px 0 12px; line-height: 1.3; }
.ab ul, .ab ol { margin: 10px 0 18px; padding-left: 0; }
.ab ul { list-style: none; }
.ab ul li { position: relative; padding-left: 16px; margin-bottom: 6px; font-size: var(--ab-font-size, 15px); line-height: 1.72; }
.ab ul li::before { content: ''; position: absolute; left: 0; top: 10px; width: 4px; height: 4px; border-radius: 50%; background: var(--orange); opacity: 0.5; }
.ab ol { list-style: decimal; padding-left: 20px; }
.ab ol li { margin-bottom: 6px; font-size: var(--ab-font-size, 15px); line-height: 1.72; }
.ab ol li::marker { color: var(--orange); font-weight: 600; }
.ab blockquote { border-left: 2px solid var(--light-gray); padding: 0 0 0 16px; margin: 16px 0; }
.ab blockquote p { color: var(--text-light); font-size: 14px; font-style: italic; margin-bottom: 4px; }
.ab blockquote strong { font-style: normal; color: var(--text); }
.ab code { font-family: var(--mono); font-size: 0.87em; background: var(--light); color: var(--orange-dim); padding: 2px 5px; border-radius: 3px; border: 1px solid var(--border); }

/* ===== Callouts ===== */
.co { display: flex; gap: 12px; align-items: flex-start; border-radius: 8px; padding: 14px 18px; margin: 20px 0; font-size: 14px; line-height: 1.6; }
.co svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.co p { font-size: 14px; margin-bottom: 6px; color: inherit; }
.co p:last-child { margin-bottom: 0; }
.co strong { font-weight: 600; }
.co.warn { background: #fef8f4; border: 1px solid rgba(217,119,87,0.3); color: #7c3a1c; }
.co.warn svg { color: var(--orange); }
.co.info { background: #f4f8fc; border: 1px solid rgba(106,155,204,0.3); color: #274060; }
.co.info svg { color: var(--blue); }
.co.ok { background: #f5f9f2; border: 1px solid rgba(120,140,93,0.3); color: #3d4a2d; }
.co.ok svg { color: var(--green); }

/* ===== Diagrams ===== */
.dia { margin: 24px 0; border-radius: 8px; overflow-x: auto; overflow-y: hidden; border: 1px solid var(--border); -webkit-overflow-scrolling: touch; }
.dia svg { display: block; height: auto; }

/* ===== Prev/Next Navigation ===== */
.fn { display: flex; justify-content: space-between; gap: 12px; margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--border); }
.fn-item { display: flex; flex-direction: column; gap: 3px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 7px; flex: 1; max-width: 48%; }
.fn-item:hover { border-color: var(--orange); background: var(--orange-bg); text-decoration: none; }
.fn-label { font-size: 10px; font-weight: 700; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.04em; }
.fn-title { font-size: 13px; font-weight: 600; color: var(--orange); }
.fn-item.next { text-align: right; margin-left: auto; }

/* ===== Post Footer ===== */
.pf { max-width: 1400px; margin: 0 auto; padding: 20px 48px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-faint); }

/* ===== Code Blocks ===== */
.cb { position: relative; margin: 20px 0; border-radius: 8px; overflow: hidden; border: 1px solid #2a2a2a; }
.cb-header { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; background: #1a1a1a; border-bottom: 1px solid #2a2a2a; }
.cb-lang { font-family: var(--mono); font-size: 11px; color: #666; text-transform: uppercase; }
.cb-copy { background: none; border: 1px solid #333; border-radius: 4px; color: #888; font-size: 11px; padding: 3px 10px; cursor: pointer; font-family: var(--mono); transition: all 0.15s; }
.cb-copy:hover { border-color: #666; color: #ccc; }
.cb pre { margin: 0; padding: 16px; background: var(--code-bg); overflow-x: auto; }
.cb code { font-family: var(--mono); font-size: 13px; line-height: 1.65; color: #d4d4d4; background: none; border: none; padding: 0; }
.cb .kw { color: #c586c0; }
.cb .str { color: #ce9178; }
.cb .cm { color: #6a9955; font-style: italic; }
.cb .fn-name { color: #dcdcaa; }
.cb .num { color: #b5cea8; }
.cb .op { color: #d4d4d4; }
.cb .type { color: #4ec9b0; }
.cb .prop { color: #9cdcfe; }
.cb .tag { color: #569cd6; }
.cb .attr { color: #92c5f7; }
.cb .val { color: #ce9178; }
.cb .punct { color: #808080; }

/* ===== Responsive ===== */
@media(max-width:1100px) {
  .blog-grid { grid-template-columns: var(--sidebar-w) 1fr; padding: 150px 32px 0; }
  .rsb { display: none; }
}

@media(max-width:768px) {
  .blog-grid { grid-template-columns: 1fr; padding: 120px 20px 0; }
  .side { display: none; }
  .main { padding: 0 0 80px; }
  .ah h1 { font-size: 26px; }
  .pf { padding: 20px 20px; }
  .dia svg { width: auto !important; min-width: 680px; }
}
