/* ==========================================================================
   VRIDHIKA BLOG — Editorial System with Vridhika Slate Gray & Thinking Machines Flow
   Canvas: Crisp White / Warm Alabaster, Typography: Rich Slate & Newsreader Serif
   ========================================================================== */

:root {
  /* Vridhika Bespoke Executive Slate Palette */
  --tm-bg: #ffffff;
  --tm-bg-warm: #fbfaf8;
  --tm-text-main: #0f172a;       /* Rich Slate Black for Titles & Headings */
  --tm-text-body: #334155;       /* Premium Slate Grey for Article Body Prose */
  --tm-text-muted: #475569;      /* Muted Slate for Bylines & Subtitles */
  --tm-text-dim: #64748b;        /* Dim Slate for Dates & Captions */
  --tm-text-light: #94a3b8;      /* Light Slate */
  
  --tm-border: #e2e8f0;          /* Crisp Slate Border */
  --tm-border-light: #f1f5f9;    /* Ultra Subtle Divider */
  --tm-code-bg: #f8fafc;         /* Slate Tinted Code Canvas */
  --tm-code-border: #e2e8f0;
  
  --vridhika-slate-dark: #0f172a;
  --vridhika-slate-body: #334155;
  --vridhika-slate-muted: #475569;
  --vridhika-slate-dim: #64748b;
  --vridhika-accent: #0f172a;

  /* Typography */
  --font-serif: "Newsreader", "Source Serif Pro", "Lora", Georgia, Cambria, serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-heading: var(--font-serif);
  --font-mono: "JetBrains Mono", "SFMono-Regular", Menlo, Monaco, Consolas, monospace;

  /* Dimensions */
  --reading-width: 690px;
  --layout-max-width: 1200px;
  --header-height: 58px;
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Custom Minimalist Scrollbar */
::-webkit-scrollbar {
  width: 13px !important;
  height: 13px !important;
}

::-webkit-scrollbar-track {
  background: transparent !important;
}

::-webkit-scrollbar-thumb {
  background-color: #475569 !important;
  border-radius: 9999px !important;
  border: 4px solid transparent !important;
  background-clip: padding-box !important;
}

::-webkit-scrollbar-thumb:hover {
  background-color: #9ca3af !important;
}

* {
  scrollbar-width: thin !important;
  scrollbar-color: #475569 transparent !important;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  background-color: var(--tm-bg);
}

body {
  background-color: var(--tm-bg);
  color: var(--tm-text-body);
  font-family: var(--font-serif);
  font-size: 18.5px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: #cbd5e1;
  transition: text-decoration-color 0.15s ease, color 0.15s ease;
}

a:hover {
  text-decoration-color: var(--tm-text-main);
  color: var(--tm-text-main);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ==========================================================================
   TOP STICKY HEADER (Zero Border Line Between Header & Page)
   ========================================================================== */

.tm-header {
  width: 100%;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: none;
  border-bottom: none; /* User requirement: No line between page and upper bar */
  position: sticky;
  top: 0;
  z-index: 100;
}

.tm-header-inner {
  max-width: var(--layout-max-width);
  height: 100%;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

/* Brand horizontal logo in sticky header */
.tm-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  border-bottom: none;
}

.tm-brand img {
  height: 22px;
  width: auto;
  max-width: 170px;
  object-fit: contain;
  transition: opacity 0.15s ease;
  display: block;
}

.tm-brand img:hover {
  opacity: 0.75;
}

.tm-nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
  list-style: none;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
}

.tm-nav-links a {
  text-decoration: none;
  color: var(--tm-text-muted);
  font-weight: 500;
  transition: color 0.15s ease;
  letter-spacing: 0.01em;
}

.tm-nav-links a:hover, .tm-nav-links a.active {
  color: var(--tm-text-main);
  font-weight: 600;
}

/* ==========================================================================
   REFINED 2-LINE BAR BUTTON (Exact Thinking Machines Style)
   ========================================================================== */

.tm-mobile-menu-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  gap: 6px;
  position: relative;
  z-index: 150;
}

.tm-menu-bar {
  display: block;
  width: 22px;
  height: 1.75px;
  background-color: var(--tm-text-main);
  border-radius: 1px;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.18s ease;
  transform-origin: center;
}

/* Open State (Crisp ✕ transformation) */
.tm-mobile-menu-btn.open .tm-bar-top {
  transform: translateY(3.85px) rotate(45deg);
}

.tm-mobile-menu-btn.open .tm-bar-bottom {
  transform: translateY(-3.85px) rotate(-45deg);
}

/* ==========================================================================
   FULLSCREEN MOBILE NAVIGATION (Thinking Machines Image 1 Style)
   ========================================================================== */

.tm-mobile-nav {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: auto;
  width: 100vw;
  height: auto;
  min-height: 50vh;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 200;
  transform: translateY(-100%);
  pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  border-bottom-left-radius: 24px;
  border-bottom-right-radius: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
  overflow-y: hidden;
}

.tm-mobile-nav.open {
  transform: translateY(0);
  pointer-events: auto;
}

.tm-mobile-nav-top {
  width: 100%;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  flex-shrink: 0;
  border-bottom: none;
}

.tm-mobile-nav-logo img {
  height: 20px;
  width: auto;
  object-fit: contain;
  display: block;
}

.tm-mobile-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  color: var(--tm-text-main);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
  border-radius: 6px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.tm-mobile-close-btn:hover,
.tm-mobile-close-btn:active {
  color: var(--tm-text-main);
  background-color: #f1f5f9;
}

.tm-mobile-nav-links {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex: 1;
  gap: 1.5rem;
  padding: 1.5rem 1.5rem 4rem;
}

.tm-mobile-nav-links a {
  display: block;
  font-family: var(--font-sans);
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--tm-text-main);
  text-decoration: none;
  letter-spacing: -0.01em;
  padding: 0.35rem 1.25rem;
  text-align: center;
  transition: opacity 0.15s ease, color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.tm-mobile-nav-links a:hover,
.tm-mobile-nav-links a.active {
  color: var(--tm-text-main);
  font-weight: 600;
  opacity: 0.8;
}

/* ==========================================================================
   BLOG HERO BRAND & FLOATING ANIMATION
   ========================================================================== */

@keyframes tmLogoFloat {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-6px);
  }
  100% {
    transform: translateY(0px);
  }
}

.tm-hero-brand-section {
  max-width: 800px;
  margin: 3.5rem auto 2rem;
  padding: 0 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.tm-hero-text-logo {
  max-width: 280px;
  width: 75%;
  height: auto;
  object-fit: contain;
  animation: tmLogoFloat 4s ease-in-out infinite;
  display: block;
  margin: 0 auto 1.25rem;
}

.tm-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--tm-text-muted);
  background: var(--tm-code-bg);
  border: 1px solid var(--tm-border);
  border-radius: 9999px;
  margin-bottom: 0.75rem;
}

.tm-hero-tagline {
  font-family: var(--font-serif);
  font-size: clamp(1.2rem, 3.5vw, 1.45rem);
  font-weight: 400;
  font-style: italic;
  color: var(--tm-text-body);
  line-height: 1.45;
  max-width: 600px;
  margin: 0 auto;
}

/* ==========================================================================
   ARTICLE PAGE — MASTHEAD & CENTERED HERO
   ========================================================================== */

.article-hero-header {
  max-width: 860px;
  margin: 3.25rem auto 2.5rem;
  padding: 0 1.5rem;
  text-align: center;
}

.article-main-h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 4.5vw, 3.15rem);
  font-weight: 600;
  line-height: 1.2;
  color: var(--tm-text-main);
  margin-bottom: 1.5rem;
  letter-spacing: -0.015em;
}

.article-byline-text {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--tm-text-muted);
  margin-bottom: 0.4rem;
  font-weight: 500;
}

.article-byline-text a {
  color: var(--tm-text-main);
  text-decoration: none;
  font-weight: 600;
}

.article-byline-text a:hover {
  color: var(--tm-text-main);
  text-decoration: underline;
}

.article-date-subtext {
  font-family: var(--font-sans);
  font-size: 0.825rem;
  color: var(--tm-text-dim);
}

/* Masthead Hero Graphic / Cover Image */
.article-masthead-graphic {
  max-width: 900px;
  margin: 2.5rem auto 3.5rem;
  padding: 0 1.5rem;
  text-align: center;
}

.article-masthead-graphic img {
  width: 100%;
  max-height: 480px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--tm-border);
  margin: 0 auto;
}

.article-graphic-caption {
  font-family: var(--font-sans);
  font-size: 0.775rem;
  color: var(--tm-text-dim);
  margin-top: 0.75rem;
  text-align: center;
}

/* ==========================================================================
   MOBILE TABLE OF CONTENTS (Collapsible Accordion)
   ========================================================================== */

.tm-mobile-toc {
  display: none;
  margin: 1.5rem 0 2rem;
  border: 1px solid var(--tm-border);
  border-radius: 8px;
  background: var(--tm-code-bg);
  overflow: hidden;
}

.tm-mobile-toc-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1rem;
  background: transparent;
  border: none;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--tm-text-main);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.tm-mobile-toc-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tm-mobile-toc-arrow {
  font-size: 0.8rem;
  color: var(--tm-text-muted);
  transition: transform 0.2s ease;
}

.tm-mobile-toc.open .tm-mobile-toc-arrow {
  transform: rotate(180deg);
}

.tm-mobile-toc-content {
  display: none;
  padding: 0.6rem 1rem 1rem;
  border-top: 1px solid var(--tm-border);
  background: #ffffff;
}

.tm-mobile-toc.open .tm-mobile-toc-content {
  display: block;
}

.tm-mobile-toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
}

.tm-mobile-toc-list a {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--tm-text-muted);
  text-decoration: none;
  display: block;
  padding: 0.25rem 0;
  line-height: 1.45;
  transition: color 0.15s ease;
}

.tm-mobile-toc-list a:hover,
.tm-mobile-toc-list li.active a {
  color: var(--tm-text-main);
  font-weight: 600;
}

/* ==========================================================================
   ARTICLE ASYMMETRIC 3-COLUMN LAYOUT
   ========================================================================== */

.tm-article-grid {
  max-width: var(--layout-max-width);
  margin: 0 auto;
  padding: 0 2rem 6rem;
  display: grid;
  grid-template-columns: 210px minmax(0, var(--reading-width)) 220px;
  gap: 3.5rem;
  justify-content: center;
  align-items: start;
}

/* Left Column: Table of Contents */
.tm-toc-column {
  position: sticky;
  top: calc(var(--header-height) + 2rem);
  max-height: calc(100vh - var(--header-height) - 4rem);
  overflow-y: auto;
  font-family: var(--font-sans);
}

.tm-toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tm-toc-item {
  position: relative;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--tm-text-dim);
  transition: color 0.15s ease;
}

.tm-toc-item a {
  text-decoration: none;
  color: inherit;
  display: block;
}

.tm-toc-item a:hover {
  color: var(--tm-text-main);
}

.tm-toc-item.active {
  color: var(--tm-text-main);
  font-weight: 600;
}

.tm-toc-item.active::before {
  content: "•";
  position: absolute;
  left: -14px;
  top: 0;
  color: var(--tm-text-main);
  font-size: 1rem;
  line-height: 1.2;
}

.tm-toc-item.depth-3 {
  padding-left: 0.85rem;
  font-size: 0.75rem;
}

/* Center Column: Editorial Prose (Vridhika Slate Gray) */
.tm-prose-column {
  width: 100%;
  min-width: 0;
}

.tm-prose-column p {
  margin-bottom: 1.35rem;
  font-size: 1.125rem;
  line-height: 1.55;
  color: var(--tm-text-body); /* Vridhika Slate Gray #334155 */
  font-weight: 400;
}

.tm-prose-column h2 {
  font-family: var(--font-serif);
  font-size: 1.7rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--tm-text-main); /* Rich Slate #0f172a */
  margin-top: 3.5rem;
  margin-bottom: 1.25rem;
  letter-spacing: -0.015em;
  scroll-margin-top: calc(var(--header-height) + 20px);
}

.tm-prose-column h3 {
  font-family: var(--font-serif);
  font-size: 1.38rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--tm-text-main); /* Rich Slate #0f172a */
  margin-top: 2.75rem;
  margin-bottom: 0.9rem;
  letter-spacing: -0.01em;
  scroll-margin-top: calc(var(--header-height) + 20px);
}

.tm-prose-column h4 {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--tm-text-main);
  margin-top: 2rem;
  margin-bottom: 0.65rem;
}

.tm-prose-column ol {
  margin-bottom: 1.85rem;
  padding-left: 1.5rem;
}

.tm-prose-column ul {
  margin-bottom: 1.85rem;
  padding-left: 1.35rem; /* Safe padding from edge */
  list-style: none;
}

.tm-prose-column li {
  margin-bottom: 0.5rem;
  font-size: 1.125rem;
  line-height: 1.55;
  color: var(--tm-text-body);
}

.tm-prose-column ul > li {
  position: relative;
}

.tm-prose-column ul > li::before {
  content: "";
  position: absolute;
  left: -0.95rem; /* Brings bullet closer to text */
  top: 0.65rem;
  width: 5px;
  height: 5px;
  background-color: #475569;
  border-radius: 50%;
}

.tm-prose-column blockquote {
  margin: 2.25rem 0;
  padding: 1rem 1.35rem;
  border-left: 3px solid #cbd5e1;
  background: var(--tm-code-bg);
  border-radius: 0 6px 6px 0;
  font-style: italic;
  color: var(--tm-text-muted);
}

/* Callouts (Exact Thinking Machines Style - Image 2) */
.tm-callout {
  margin: 2.25rem 0;
  padding: 1.25rem 1.5rem;
  background: var(--tm-code-bg);
  border-radius: 8px;
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--tm-text-body);
}

.tm-callout-title {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.45rem;
  color: var(--tm-text-main);
}

/* ==========================================================================
   CODE BLOCKS & SYNTAX HIGHLIGHTING (Exact Thinking Machines Style - Image 2)
   ========================================================================== */

.tm-code-card {
  position: relative;
  margin: 2.25rem 0;
  background: #f1f5f9; /* Vridhika light gray */
  border-radius: 8px;
  overflow: hidden;
  font-family: var(--font-mono);
}

.tm-code-lang {
  position: absolute;
  top: 1rem;
  left: 1.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #8c959f;
  font-family: var(--font-mono);
  text-transform: lowercase;
  z-index: 10;
}

.tm-code-copy-btn {
  position: absolute;
  top: 0.85rem;
  right: 1.25rem;
  font-size: 0;
  color: #8c959f;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease, color 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tm-code-card:hover .tm-code-copy-btn,
.tm-code-card:active .tm-code-copy-btn,
.tm-code-card:focus-within .tm-code-copy-btn {
  opacity: 1;
  visibility: visible;
}

.tm-code-copy-btn:hover {
  color: #0f172a;
}

.tm-code-card pre {
  margin: 0;
  padding: 3rem 1.25rem 1.15rem 1.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  font-size: 13.5px;
  line-height: 1.65;
  color: #24292f;
}

/* Custom Scrollbar for Code Blocks */
.tm-code-card pre::-webkit-scrollbar {
  height: 6px !important;
}

.tm-code-card pre::-webkit-scrollbar-track {
  background: transparent !important;
}

/* Hidden by default on desktop */
.tm-code-card pre::-webkit-scrollbar-thumb {
  background: transparent !important;
  border-radius: 9999px !important;
}

/* Show scrollbar when hovering over the code block */
.tm-code-card:hover pre::-webkit-scrollbar-thumb {
  background: #cbd5e1 !important;
}

/* Highlight scrollbar thumb when directly hovered */
.tm-code-card pre::-webkit-scrollbar-thumb:hover {
  background: #94a3b8 !important;
}

/* Keep visible on touch devices */
@media (hover: none) {
  .tm-code-card pre::-webkit-scrollbar-thumb {
    background: #cbd5e1 !important;
  }
}

/* Syntax Highlighting */
.tm-code-card .k-kw {
  color: #0550ae; /* Teal/Blue for keywords */
  font-weight: 400;
}

.tm-code-card .k-str {
  color: #16a34a; /* Green for strings */
}

.tm-code-card .k-num {
  color: #b91c1c; /* Red/Brown for numbers */
}

.tm-code-card .k-com {
  color: #8c959f; /* Gray for comments */
  font-style: italic;
}

.tm-prose-column code:not(pre code) {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: #f1f5f9;
  padding: 0.15em 0.35em;
  border-radius: 4px;
  color: var(--tm-text-main);
  border: 1px solid #e2e8f0;
}

/* ==========================================================================
   TABLES & HORIZONTAL OVERFLOW WRAPPERS
   ========================================================================== */

.tm-table-wrapper {
  width: 100%;
  margin: 2.25rem 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--tm-border);
  border-radius: 8px;
}

.tm-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  line-height: 1.55;
  text-align: left;
}

.tm-table th {
  background: #f8fafc;
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--tm-text-main);
  border-bottom: 1px solid var(--tm-border);
  white-space: nowrap;
}

.tm-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--tm-border-light);
  color: var(--tm-text-body);
}

.tm-table tr:last-child td {
  border-bottom: none;
}

/* Math Blocks */
.tm-math-block {
  margin: 2rem 0;
  padding: 1rem;
  background: var(--tm-code-bg);
  border: 1px solid var(--tm-border);
  border-radius: 8px;
  text-align: center;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--tm-text-main);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Right Column: Marginalia / Sidenotes (Desktop) */
.tm-sidenote-column {
  position: relative;
  font-family: var(--font-sans);
  font-size: 0.825rem;
  line-height: 1.55;
  color: var(--tm-text-muted);
  display: flex;
  flex-direction: column;
}

.tm-sidenote-card {
  position: absolute;
  width: 100%;
  left: 0;
  padding: 0.35rem 0.5rem 0.35rem 0.85rem;
  border-left: 2px solid var(--tm-border);
  color: var(--tm-text-muted);
  font-size: 0.825rem;
  line-height: 1.55;
  cursor: pointer;
  border-radius: 0 4px 4px 0;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease, top 0.3s ease;
}

.tm-sidenote-card.highlighted {
  border-left-color: var(--tm-text-main);
  color: var(--tm-text-main);
  background-color: #f8fafc;
}

.tm-sidenote-card sup {
  font-weight: 700;
  font-size: 0.85em;
  margin-right: 4px;
  color: var(--tm-text-muted);
}

/* Sidenote Superscript Reference in Main Prose */
.tm-sidenote-ref {
  cursor: pointer;
  color: var(--tm-text-muted);
  font-family: var(--font-sans);
  font-size: 0.6em;
  font-weight: 600;
  line-height: 1;
  padding: 1px 3px;
  margin-left: 1px;
  border-radius: 3px;
  transition: all 0.15s ease;
  user-select: none;
  display: inline-block;
  vertical-align: super;
}

.tm-sidenote-ref:hover, .tm-sidenote-ref.highlighted {
  color: var(--tm-text-main);
  background: #e2e8f0;
}

.tm-mobile-sidenote {
  display: none;
}

/* ==========================================================================
   HOMEPAGE FEED (Thinking Machines Stream Aesthetic)
   ========================================================================== */

.tm-filter-bar {
  max-width: 760px;
  margin: 3.5rem auto 0;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.tm-filter-tags {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
}

.tm-filter-btn {
  background: none;
  border: none;
  color: var(--tm-text-dim);
  font-weight: 500;
  cursor: pointer;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.tm-filter-btn:hover, .tm-filter-btn.active {
  color: var(--tm-text-main);
  border-bottom-color: var(--tm-text-main);
}

.tm-search-box {
  position: relative;
  font-family: var(--font-sans);
}

.tm-search-input {
  border: 1px solid var(--tm-border);
  border-radius: 6px;
  padding: 0.45rem 0.85rem;
  font-size: 0.8125rem;
  outline: none;
  width: 220px;
  color: var(--tm-text-main);
  background: #ffffff;
  transition: border-color 0.15s ease;
}

.tm-search-input:focus {
  border-color: var(--tm-text-main);
}

.tm-articles-stream {
  max-width: 760px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 6rem;
  display: flex;
  flex-direction: column;
}

.tm-article-stream-item {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--tm-border-light);
  transition: opacity 0.15s ease;
}

.tm-article-stream-item:last-child {
  border-bottom: none;
}

.tm-stream-title {
  font-family: var(--font-serif);
  font-size: 1.38rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
}

.tm-stream-title a {
  text-decoration: none;
  color: var(--tm-text-main);
}

.tm-stream-title a:hover {
  color: var(--tm-text-main);
  text-decoration: underline;
  text-decoration-color: var(--tm-text-main);
}

.tm-stream-byline {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--tm-text-muted);
  line-height: 1.4;
}

.tm-stream-date {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--tm-text-dim);
}

/* ==========================================================================
   FOOTER (Minimalist)
   ========================================================================== */

.tm-footer {
  width: 100%;
  padding: 0 2rem 4rem;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--tm-text-dim);
}

.tm-footer-inner {
  max-width: var(--layout-max-width);
  margin: 0 auto;
  border-top: 1px solid var(--tm-border);
  padding-top: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.tm-footer-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.tm-footer-links a {
  color: var(--tm-text-muted);
  text-decoration: none;
}

.tm-footer-links a:hover {
  color: var(--tm-text-main);
  text-decoration: underline;
}

/* ==========================================================================
   RESPONSIVE — TABLET & LAPTOP (≤1080px)
   ========================================================================== */

@media (max-width: 1080px) {
  .tm-article-grid {
    grid-template-columns: minmax(0, 1fr);
    max-width: 720px;
    gap: 0;
  }

  .tm-toc-column {
    display: none !important;
  }

  .tm-sidenote-column {
    display: none !important;
  }

  .tm-sidenote-card {
    display: none !important;
  }

  .tm-mobile-toc {
    display: block;
  }

  .tm-mobile-sidenote {
    display: block;
    font-family: var(--font-sans);
    font-size: 0.825rem;
    color: var(--tm-text-muted);
    background: #f8fafc;
    border-left: 2.5px solid #475569;
    padding: 0.65rem 0.95rem;
    margin: 0.75rem 0 1.35rem;
    border-radius: 0 6px 6px 0;
  }
}

/* ==========================================================================
   RESPONSIVE — MOBILE PHONE MODE (≤834px)
   ========================================================================== */

@media (max-width: 834px) {

  /* --- Header: Clean, No Border --- */
  .tm-header {
    height: 52px;
    border: none;
    border-bottom: none;
  }

  .tm-header-inner {
    padding: 0 1.25rem;
  }

  .tm-brand img {
    height: 19px;
  }

  .tm-nav-links {
    display: none;
  }

  .tm-mobile-menu-btn {
    display: flex;
  }

  /* --- Hero Brand Section: Clean & Minimal on Phone --- */
  .tm-hero-brand-section {
    margin: 1.25rem auto 0.5rem;
    padding: 0 1.25rem;
  }

  .tm-hero-badge {
    display: none !important;
  }

  .tm-hero-tagline {
    display: none !important;
  }

  .tm-hero-text-logo {
    max-width: 180px;
    width: 52%;
    margin-bottom: 0;
  }

  /* --- Filter Bar --- */
  .tm-filter-bar {
    padding: 0 1.25rem;
    margin: 1rem auto;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .tm-filter-tags {
    gap: 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.25rem;
  }

  .tm-filter-tags::-webkit-scrollbar {
    display: none;
  }

  .tm-filter-btn {
    font-size: 0.825rem;
    white-space: nowrap;
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
    border-bottom: none;
    background: #f1f5f9;
    color: var(--tm-text-muted);
  }

  .tm-filter-btn:hover,
  .tm-filter-btn.active {
    background: var(--tm-text-main);
    color: #ffffff;
  }

  .tm-search-box {
    width: 100%;
  }

  .tm-search-input {
    width: 100%;
    padding: 0.5rem 0.85rem;
    font-size: 0.875rem;
  }

  /* --- Article Stream --- */
  .tm-articles-stream {
    padding: 0.5rem 1.25rem 4rem;
  }

  .tm-article-stream-item {
    padding: 1.35rem 0;
    gap: 0.3rem;
  }

  .tm-stream-title {
    font-size: 1.22rem;
    line-height: 1.35;
  }

  .tm-stream-byline {
    font-size: 0.85rem;
  }

  .tm-stream-date {
    font-size: 0.775rem;
  }

  /* --- Article Page — Masthead --- */
  .article-hero-header {
    margin: 1.75rem auto 1.25rem;
    padding: 0 1.25rem;
  }

  .article-main-h1 {
    font-size: clamp(1.65rem, 6.5vw, 2.25rem);
    margin-bottom: 1rem;
    color: var(--tm-text-main);
  }

  .article-byline-text {
    font-size: 0.875rem;
  }

  .article-date-subtext {
    font-size: 0.775rem;
  }

  .article-masthead-graphic {
    margin: 1.25rem auto 1.75rem;
    padding: 0 1rem;
  }

  .article-masthead-graphic img {
    max-height: 280px;
    border-radius: 6px;
  }

  /* --- Article Grid & Prose on Smartphone --- */
  .tm-article-grid {
    grid-template-columns: 1fr;
    padding: 0 1.25rem 3.5rem;
    gap: 0;
  }

  .tm-prose-column p {
    font-size: 1.0625rem;
    line-height: 1.55;
    margin-bottom: 1.25rem;
    color: var(--tm-text-body);
  }

  .tm-prose-column h2 {
    font-size: 1.38rem;
    margin-top: 2.25rem;
    margin-bottom: 0.75rem;
    color: var(--tm-text-main);
  }

  .tm-prose-column h3 {
    font-size: 1.18rem;
    margin-top: 1.75rem;
    margin-bottom: 0.6rem;
    color: var(--tm-text-main);
  }

  .tm-prose-column li {
    font-size: 1.05rem;
    line-height: 1.55;
    color: var(--tm-text-body);
  }

  .tm-code-card {
    margin: 1.5rem 0;
    border-radius: 6px;
  }

  .tm-code-card pre {
    padding: 2.75rem 0.85rem 0.85rem 0.85rem;
    font-size: 12.5px;
    line-height: 1.6;
  }

  /* --- Mobile Footer --- */
  .tm-footer {
    padding: 0 1.25rem 3rem;
    text-align: center;
  }

  .tm-footer-inner {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding-top: 1.5rem;
    text-align: center;
  }

  .tm-footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.85rem 1.25rem;
  }
}

/* ==========================================================================
   RESPONSIVE — COMPACT SMARTPHONES (≤400px)
   ========================================================================== */

@media (max-width: 400px) {
  body {
    font-size: 16.5px;
  }

  .tm-header-inner {
    padding: 0 0.85rem;
  }

  .article-hero-header {
    padding: 0 0.85rem;
  }

  .article-main-h1 {
    font-size: 1.45rem;
  }

  .tm-article-grid {
    padding: 0 0.85rem 2.5rem;
  }

  .tm-prose-column p {
    font-size: 0.975rem;
    line-height: 1.55;
    color: var(--tm-text-body);
  }

  .tm-code-card {
    margin: 1.25rem -0.5rem;
    border-radius: 4px;
  }

  .tm-code-card pre {
    font-size: 11.5px;
    padding: 2.75rem 0.75rem 0.75rem 0.75rem;
  }

  .tm-articles-stream {
    padding: 0.5rem 0.85rem 3rem;
  }

  .tm-stream-title {
    font-size: 1.15rem;
  }
}
