/* Shared stylesheet for TileRT blog posts. Tokens mirror index.html. */

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

/* ==================== Theme tokens ==================== */
:root {
  color-scheme: light;
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #f0eee8;
  --border: #e4e1d9;
  --border-strong: #cdc9bf;
  --text: #17171a;
  --text-2: #3b3a36;
  --muted: #6b6962;
  --faint: #9c998f;
  --accent: #2447d6;
  --accent-soft: rgba(36, 71, 214, 0.07);
  --accent-line: rgba(36, 71, 214, 0.35);
  --figure-filter: none;
  --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Hiragino Sans GB', 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --measure: 720px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #141312;
    --surface: #1b1a18;
    --surface-2: #211f1d;
    --border: #2c2a27;
    --border-strong: #3c3a36;
    --text: #eeece6;
    --text-2: #d1cec6;
    --muted: #9d9a92;
    --faint: #6f6c66;
    --accent: #8ba7ff;
    --accent-soft: rgba(139, 167, 255, 0.09);
    --accent-line: rgba(139, 167, 255, 0.4);
    --figure-filter: brightness(0.94);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141312;
  --surface: #1b1a18;
  --surface-2: #211f1d;
  --border: #2c2a27;
  --border-strong: #3c3a36;
  --text: #eeece6;
  --text-2: #d1cec6;
  --muted: #9d9a92;
  --faint: #6f6c66;
  --accent: #8ba7ff;
  --accent-soft: rgba(139, 167, 255, 0.09);
  --accent-line: rgba(139, 167, 255, 0.4);
  --figure-filter: brightness(0.94);
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-2);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

/* ==================== Brand marks ==================== */
.brand-lockup {
  display: block;
  background-color: currentColor;
  -webkit-mask: url('../images/brand/tilert-lockup.png') center / contain no-repeat;
  mask: url('../images/brand/tilert-lockup.png') center / contain no-repeat;
  aspect-ratio: 495 / 160;
}

/* ==================== Navbar (mirrors index.html) ==================== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--border);
}

.navbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-brand {
  display: flex;
  align-items: center;
  color: var(--text);
}

.navbar-brand .brand-lockup {
  height: 24px;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.navbar-back {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 500;
}

.navbar-back:hover {
  color: var(--text);
}

.navbar-lang,
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.navbar-lang {
  padding: 0 0.65rem;
}

.theme-toggle {
  width: 32px;
}

.navbar-lang:hover,
.theme-toggle:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
}

.theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: block;
  }

  :root:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: none;
  }
}

/* Figures that ship a separate light / dark rendering */
.theme-dark-only {
  display: none !important;
}

:root[data-theme="dark"] .theme-dark-only {
  display: block !important;
}

:root[data-theme="dark"] .theme-light-only {
  display: none !important;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-dark-only {
    display: block !important;
  }

  :root:not([data-theme="light"]) .theme-light-only {
    display: none !important;
  }
}

/* ==================== Article ==================== */
.article-wrap {
  max-width: calc(var(--measure) + 3rem);
  margin: 0 auto;
  padding: 8.5rem 1.5rem 4rem;
}

.article-header {
  margin-bottom: 3rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}

.article-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--faint);
  margin-bottom: 1.5rem;
}

.article-tag {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.article-title {
  font-size: clamp(1.9rem, 4.4vw, 2.75rem);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.035em;
  color: var(--text);
  margin-bottom: 1rem;
}

.article-subtitle {
  font-size: 1.2rem;
  color: var(--muted);
  line-height: 1.5;
  letter-spacing: -0.01em;
}

/* Article body */
.article-body h2 {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.025em;
  margin: 3rem 0 1.25rem;
  line-height: 1.25;
}

.article-body h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.015em;
  margin: 2.5rem 0 0.85rem;
  line-height: 1.35;
}

.article-body p {
  font-size: 1.0625rem;
  margin-bottom: 1.2rem;
}

.article-body ul,
.article-body ol {
  margin: 0 0 1.4rem;
  padding: 0;
}

.article-body li {
  font-size: 1.0625rem;
  margin-bottom: 0.5rem;
  list-style: none;
  position: relative;
  padding-left: 1.25rem;
}

.article-body li::before {
  content: '';
  position: absolute;
  left: 0.15rem;
  top: 0.78em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--faint);
}

.article-body pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.95rem 1.15rem;
  margin: 1rem 0 1.6rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.6;
}

.article-body code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.35em;
  color: var(--text);
  white-space: nowrap;
}

.article-body pre code {
  background: none;
  border: none;
  padding: 0;
  white-space: pre;
}

.article-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

.article-body strong {
  color: var(--text);
  font-weight: 600;
}

.article-body a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Section separators between major numbered sections */
.article-body h2.section-major {
  margin-top: 4rem;
  padding-top: 3rem;
  border-top: 1px solid var(--border);
}

.article-body h2.section-major:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 3rem;
}

/* Section subtitle (dash line under a major heading) */
.article-body .section-subtitle {
  margin: -0.6rem 0 1.5rem;
  font-size: 1.05rem;
  color: var(--muted);
}

/* Inline figure block */
.article-figure {
  margin: 2.75rem 0 3rem;
}

.article-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  filter: var(--figure-filter);
}

.article-figure-caption {
  margin: 0.9rem auto 0;
  max-width: var(--measure);
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.55;
}

@media (min-width: 1000px) {
  .article-figure {
    margin-left: -80px;
    margin-right: -80px;
  }
}

/* Headline stat callout */
.stat-callout {
  margin: 1.75rem 0 2rem;
  padding: 1.5rem 1.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.stat-callout-value {
  font-size: clamp(2.5rem, 6vw, 3.25rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.05;
  color: var(--text);
}

.stat-callout-unit {
  font-family: var(--font-mono);
  font-size: 0.4em;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--muted);
  margin-left: 0.4rem;
}

.stat-callout-label {
  margin-top: 0.4rem;
  font-size: 0.95rem;
  color: var(--muted);
}

/* Test-configuration note */
.article-body .article-note,
.article-body .benchmark-note {
  font-size: 0.92rem;
  color: var(--muted);
  padding: 1rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  margin: 1.5rem 0 2rem;
}

/* Closing punch line */
.article-body .punch-line {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.025em;
  margin: 2.5rem 0 1.25rem;
}

/* ==================== Vision infographic (mirrors index.html) ==================== */
.vision-infographic {
  padding: 1.5rem 1.25rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.viz-svg {
  width: 100%;
  height: auto;
  display: block;
}

.viz-svg text {
  font-family: var(--font-sans);
}

.viz-svg text[font-family] {
  font-family: var(--font-mono);
}

.viz-era-bg,
.viz-divider,
.viz-era-header,
.viz-gap,
.viz-anchor,
.viz-callout,
.viz-label,
.viz-curve-cost {
  opacity: 0;
}

.viz-curve-value {
  stroke-dasharray: 1500;
  stroke-dashoffset: 1500;
}

.viz-animate .viz-era-bg,
.viz-animate .viz-divider,
.viz-animate .viz-era-header,
.viz-animate .viz-gap,
.viz-animate .viz-anchor,
.viz-animate .viz-callout,
.viz-animate .viz-label,
.viz-animate .viz-curve-cost {
  animation: viz-fade 0.65s ease-out forwards;
  animation-delay: var(--delay, 0s);
}

.viz-animate .viz-curve-value {
  animation: viz-draw 2.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  animation-delay: var(--delay, 0s);
}

@keyframes viz-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes viz-draw {
  to { stroke-dashoffset: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .viz-era-bg,
  .viz-divider,
  .viz-era-header,
  .viz-gap,
  .viz-anchor,
  .viz-callout,
  .viz-label,
  .viz-curve-cost {
    opacity: 1;
  }

  .viz-curve-value {
    stroke-dashoffset: 0;
  }

  .viz-animate .viz-era-bg,
  .viz-animate .viz-divider,
  .viz-animate .viz-era-header,
  .viz-animate .viz-gap,
  .viz-animate .viz-anchor,
  .viz-animate .viz-callout,
  .viz-animate .viz-label,
  .viz-animate .viz-curve-cost,
  .viz-animate .viz-curve-value {
    animation: none;
  }
}

.vision-mobile-fallback {
  display: none;
}

.mobile-era {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.mobile-era-future {
  border-color: var(--accent-line);
}

.mobile-era-meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.mobile-era-meta strong {
  color: var(--text);
  font-weight: 600;
}

.article-body .mobile-era-anchor {
  font-size: 0.95rem;
  color: var(--text-2);
  font-weight: 500;
  margin: 0;
}

.mobile-era-stat {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted);
}

.mobile-era-future .mobile-era-stat,
.mobile-era-future .mobile-era-stat strong {
  color: var(--accent);
}

@media (max-width: 768px) {
  .vision-infographic {
    display: none;
  }

  .vision-mobile-fallback {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }
}

/* ==================== Footer ==================== */
.article-footer {
  margin-top: 4.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--faint);
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

.article-footer-links {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.article-footer-links a {
  color: var(--muted);
}

.article-footer-links a:hover {
  color: var(--text);
}

@media (max-width: 640px) {
  .navbar-inner {
    padding: 0 1.25rem;
  }

  .navbar-back {
    display: none;
  }

  .article-wrap {
    padding: 6.5rem 1.25rem 3rem;
  }

  .article-subtitle {
    font-size: 1.05rem;
  }

  .article-body h2 {
    font-size: 1.35rem;
  }

  .article-body p,
  .article-body li {
    font-size: 1rem;
  }
}

/* WeChat QR at the end of Chinese posts */
.wechat-qr {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  margin: 0.25rem 0 1.5rem;
  padding: 0.75rem 1.25rem 0.75rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.wechat-qr img {
  display: block;
  width: 120px;
  height: 120px;
  border-radius: 6px;
}

.wechat-qr figcaption {
  font-size: 0.92rem;
  color: var(--muted);
}
