/* SViWT Generic Themes Foundation (Neutral, Documentation, Journal)
 * Follows SCREEN_STANDARD.md: rem scale, single left vertical axis (header/main/footer),
 * sticky footer (100dvh), zero horizontal overflow at 360px / 390px / 768px / 1440px / 2560px.
 */

:root {
  --th-bg: #ffffff;
  --th-surface: #f8fafc;
  --th-ink: #0f172a;
  --th-ink-2: #334155;
  --th-muted: #64748b;
  --th-line: #e2e8f0;
  --th-line-strong: #cbd5e1;
  --th-link: var(--theme-link, #2563eb);
  --th-radius: 10px;
  --th-container: 1120px;
  --th-header-bg: rgba(255, 255, 255, 0.92);
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
@media (min-width: 1800px) { html { font-size: 16.8px; } }
@media (min-width: 2300px) { html { font-size: 17.5px; } }

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

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--th-bg);
  color: var(--th-ink);
  font-family: var(--theme-font, -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif);
  font-size: var(--theme-font-size, 1rem);
  line-height: 1.65;
  overflow-x: clip;
}

/* Container width overrides from ThemeStyles */
body[data-theme="documentation"] { --th-container: 1280px; }
body[data-theme="journal"] { --th-container: 840px; }
body[data-container="1080"] { --th-container: 1080px; }
body[data-container="1200"] { --th-container: 1200px; }
body[data-container="1440"] { --th-container: 1440px; }

.theme-container {
  width: 100%;
  max-width: var(--th-container);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

/* Preview / Auth status banners */
.theme-banner {
  background: #0f172a;
  color: #f8fafc;
  font-size: 0.875rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.theme-banner-warn {
  background: #fffbeb;
  color: #92400e;
  border-bottom-color: #fde68a;
}
.theme-banner-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.65rem;
  flex-wrap: wrap;
}
.theme-banner-link {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}

/* Sticky Header (single left axis with main & footer) */
.theme-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--th-header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--th-line);
}
.theme-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 4rem;
  padding-block: 0.75rem;
  flex-wrap: wrap;
}

.theme-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--th-ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  min-height: 44px;
}
.theme-brand:hover { color: var(--th-ink); }
.theme-brand-mark {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 7px;
  background: var(--th-ink);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex: none;
}
.theme-brand-badge {
  font-size: 0.7rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--th-link) 12%, transparent);
  color: var(--th-link);
  border: 1px solid color-mix(in srgb, var(--th-link) 28%, transparent);
}

/* Clean Top Navigation */
.theme-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}
.theme-nav a {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.75rem;
  min-height: 38px;
  border-radius: 7px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--th-ink-2);
  text-decoration: none;
  transition: background 0.14s ease, color 0.14s ease;
}
.theme-nav a:hover {
  background: var(--th-surface);
  color: var(--th-ink);
}
.theme-nav a.is-active {
  color: var(--th-link);
  background: color-mix(in srgb, var(--th-link) 10%, transparent);
  font-weight: 600;
}

/* Main Content Wrapper (pushes footer to bottom) */
.theme-body {
  flex: 1 0 auto;
  width: 100%;
}

.theme-main {
  padding-block: clamp(2rem, 4vw, 3.5rem);
  min-width: 0;
}

.theme-page-head {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--th-line);
  max-width: 72ch;
}
.theme-page-head h1 {
  margin: 0;
  font-size: clamp(1.75rem, 3.8vw, 2.5rem);
  line-height: 1.18;
  font-weight: 750;
  letter-spacing: -0.03em;
  color: var(--th-ink);
  overflow-wrap: break-word;
}
.theme-page-lead {
  margin: 0.85rem 0 0;
  font-size: 1.075rem;
  line-height: 1.6;
  color: var(--th-muted);
}

/* Generic Content Blocks */
.theme-blocks {
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
  max-width: 100%;
}
.theme-section-text,
.theme-section-text_rich,
.theme-section-quote,
.theme-section-link,
.theme-section-callout,
.theme-section-faq {
  max-width: 72ch;
}
.theme-section { min-width: 0; }
.theme-section h2, .theme-block-title {
  margin: 0 0 0.75rem;
  font-size: clamp(1.25rem, 2.4vw, 1.6rem);
  line-height: 1.28;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--th-ink);
  overflow-wrap: break-word;
}
.theme-section p {
  margin: 0 0 1rem;
  color: var(--th-ink-2);
  overflow-wrap: break-word;
}
.theme-section p:last-child { margin-bottom: 0; }
.theme-block-lead {
  font-size: 1.05rem;
  color: var(--th-muted);
  margin-bottom: 1rem;
}

.theme-rich-text h2, .theme-rich-text h3 {
  margin: 1.6rem 0 0.65rem;
  color: var(--th-ink);
  letter-spacing: -0.015em;
}
.theme-rich-text ul, .theme-rich-text ol {
  padding-left: 1.4rem;
  margin: 0 0 1rem;
  color: var(--th-ink-2);
}
.theme-rich-text li { margin-bottom: 0.4rem; }

/* Quote Block */
.theme-section-quote figure {
  margin: 0;
  padding: 1.25rem 1.5rem;
  background: var(--th-surface);
  border: 1px solid var(--th-line);
  border-left: 3px solid var(--th-link);
  border-radius: 0 var(--th-radius) var(--th-radius) 0;
}
.theme-section-quote blockquote {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--th-ink);
}
.theme-section-quote figcaption {
  margin-top: 0.65rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--th-muted);
}

/* Image Block */
.theme-section-image figure {
  margin: 0;
  border: 1px solid var(--th-line);
  border-radius: var(--th-radius);
  overflow: hidden;
  background: var(--th-surface);
}
.theme-section-image img {
  display: block;
  width: 100%;
  height: auto;
}
.theme-section-image figcaption {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: var(--th-muted);
  border-top: 1px solid var(--th-line);
}

/* Link Block */
.theme-section-link a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 1.15rem;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--th-line-strong);
  background: var(--th-surface);
  color: var(--th-link);
  font-weight: 600;
  font-size: 0.925rem;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.theme-section-link a:hover {
  border-color: var(--th-link);
  background: color-mix(in srgb, var(--th-link) 8%, var(--th-bg));
}

/* Adapted Legacy Showcase Cards (Preview) */
.theme-adapted-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.theme-adapted-card {
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--th-line);
  border-radius: var(--th-radius);
  background: var(--th-surface);
}
.theme-adapted-card h3 {
  margin: 0 0 0.45rem;
  font-size: 1rem;
  font-weight: 650;
  color: var(--th-ink);
}
.theme-adapted-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--th-muted);
}

/* Links & Focus */
a { color: var(--th-link); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--th-link); outline-offset: 2px; }
img { max-width: 100%; height: auto; }
header, footer, main, aside, nav, a, section, figure { min-width: 0; }

/* ===== Documentation & Two-Column Layout (Stripe Docs / Mintlify style) ===== */
.document {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
}
.docs-sidebar, .theme-sidebar {
  position: sticky;
  top: 4.75rem;
  max-height: calc(100dvh - 5.5rem);
  overflow-y: auto;
  padding: 1.5rem 1.25rem 1.5rem 0;
  border-right: 1px solid var(--th-line);
}
.docs-sidebar-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--th-muted);
  margin: 0 0 0.75rem 0.65rem;
}
.docs-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.docs-nav-link {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  min-height: 38px;
  border-radius: 7px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--th-ink-2);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: background 0.12s ease, color 0.12s ease;
}
.docs-nav-link:hover {
  background: var(--th-surface);
  color: var(--th-ink);
}
.docs-nav-link.is-active {
  color: var(--th-link);
  background: color-mix(in srgb, var(--th-link) 11%, transparent);
  border-left-color: var(--th-link);
  font-weight: 600;
}
.docs-sidebar-extra {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--th-line);
  font-size: 0.875rem;
}

.docs-main {
  padding-block: clamp(1.75rem, 3.5vw, 3rem);
  min-width: 0;
  max-width: 72ch;
}
.docs-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.825rem;
  color: var(--th-muted);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.docs-breadcrumbs a {
  color: var(--th-muted);
  text-decoration: none;
}
.docs-breadcrumbs a:hover { color: var(--th-ink); text-decoration: underline; }

.docs-pager {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--th-line);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.docs-pager-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.95rem 1.15rem;
  border: 1px solid var(--th-line);
  border-radius: var(--th-radius);
  background: var(--th-bg);
  text-decoration: none;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.docs-pager-card:hover {
  border-color: var(--th-link);
  background: var(--th-surface);
}
.docs-pager-next { text-align: right; }
.docs-pager-dir { font-size: 0.78rem; color: var(--th-muted); font-weight: 500; }
.docs-pager-title { font-size: 0.95rem; font-weight: 600; color: var(--th-ink); }

/* ===== Sticky Structural Footer ===== */
.theme-footer {
  margin-top: auto;
  border-top: 1px solid var(--th-line);
  background: var(--th-surface);
  color: var(--th-muted);
  font-size: 0.875rem;
}
.theme-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.35rem;
  flex-wrap: wrap;
}
.theme-footer-brand { font-weight: 500; color: var(--th-muted); }
.theme-footer .theme-nav a { padding: 0.3rem 0.6rem; min-height: 36px; font-size: 0.85rem; color: var(--th-muted); }
.theme-footer .theme-nav a:hover { color: var(--th-ink); background: transparent; text-decoration: underline; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .document {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
  }
  .docs-sidebar, .theme-sidebar {
    position: static;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--th-line);
    padding: 1.25rem 0;
  }
}

@media (max-width: 767px) {
  .theme-container { padding-inline: 1rem; }
  .theme-header { position: static; }
  .theme-header-inner { gap: 0.5rem 0.75rem; min-height: 3.5rem; }
  .theme-header .theme-nav { margin-left: -0.75rem; }
  .theme-nav a,
  .docs-nav-link,
  .theme-footer .theme-nav a {
    min-height: 44px;
  }
  .docs-pager { grid-template-columns: minmax(0, 1fr); }
  .docs-pager-next { text-align: left; }
}

/* Dark Mode Palette (SCREEN_STANDARD.md 2.5 — WCAG AA >= 4.5:1) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme-mode="light"]) {
    --th-bg: #0b1120;
    --th-surface: #111827;
    --th-ink: #f8fafc;
    --th-ink-2: #cbd5e1;
    --th-muted: #94a3b8;
    --th-line: #1f2937;
    --th-line-strong: #334155;
    --th-link: color-mix(in srgb, var(--theme-link, #2563eb) 45%, #ffffff);
    --th-header-bg: rgba(11, 17, 32, 0.9);
  }
  :root:not([data-theme-mode="light"]) .theme-brand-mark {
    background: #f8fafc;
    color: #0b1120;
  }
  :root:not([data-theme-mode="light"]) .theme-banner {
    background: #1e293b;
    color: #f8fafc;
  }
  :root:not([data-theme-mode="light"]) .theme-banner-warn {
    background: rgba(120, 53, 15, 0.45);
    color: #fde68a;
    border-bottom-color: rgba(251, 191, 36, 0.35);
  }
}

html[data-theme-mode="dark"],
body[data-theme-mode="dark"] {
  --th-bg: #0b1120;
  --th-surface: #111827;
  --th-ink: #f8fafc;
  --th-ink-2: #cbd5e1;
  --th-muted: #94a3b8;
  --th-line: #1f2937;
  --th-line-strong: #334155;
  --th-link: color-mix(in srgb, var(--theme-link, #2563eb) 45%, #ffffff);
  --th-header-bg: rgba(11, 17, 32, 0.9);
  color-scheme: dark;
}
html[data-theme-mode="dark"] .theme-brand-mark,
body[data-theme-mode="dark"] .theme-brand-mark {
  background: #f8fafc;
  color: #0b1120;
}
html[data-theme-mode="dark"] .theme-banner,
body[data-theme-mode="dark"] .theme-banner {
  background: #1e293b;
  color: #f8fafc;
}
html[data-theme-mode="dark"] .theme-banner-warn,
body[data-theme-mode="dark"] .theme-banner-warn {
  background: rgba(120, 53, 15, 0.45);
  color: #fde68a;
  border-bottom-color: rgba(251, 191, 36, 0.35);
}


/* ===== GenericBlocks v2: Hero, Cards, Form, FAQ, Callout, Gallery & Widgets ===== */
.th-eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: color-mix(in srgb, var(--th-link) 12%, transparent);
  color: var(--th-link);
  border: 1px solid color-mix(in srgb, var(--th-link) 25%, transparent);
  margin-bottom: 0.9rem;
}

.th-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  font-size: 0.94rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.14s ease, border-color 0.14s ease, transform 0.12s ease;
}
.th-btn-primary {
  background: var(--th-link);
  color: #ffffff;
  border-color: var(--th-link);
}
.th-btn-primary:hover {
  filter: brightness(1.06);
  color: #ffffff;
}
.th-btn-secondary {
  background: var(--th-surface);
  color: var(--th-ink);
  border-color: var(--th-line-strong);
}
.th-btn-secondary:hover {
  border-color: var(--th-link);
  color: var(--th-link);
}

/* Hero Block */
.th-hero {
  padding: clamp(1.75rem, 4vw, 3rem);
  border-radius: calc(var(--th-radius) + 4px);
  border: 1px solid var(--th-line);
  background: linear-gradient(135deg, var(--th-surface) 0%, var(--th-bg) 100%);
}
.th-hero-split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(1.5rem, 3.5vw, 2.75rem);
  align-items: center;
}
.th-hero-title {
  margin: 0 0 0.9rem;
  font-size: clamp(1.85rem, 4.2vw, 2.85rem);
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--th-ink);
  overflow-wrap: break-word;
}
.th-hero-lead {
  margin: 0 0 1.45rem;
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  line-height: 1.6;
  color: var(--th-muted);
  max-width: 58ch;
}
.th-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.th-hero-media {
  border-radius: var(--th-radius);
  overflow: hidden;
  border: 1px solid var(--th-line);
  background: var(--th-bg);
}
.th-hero-media img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* Cards Grid */
.th-cards-grid {
  display: grid;
  gap: 1.15rem;
}
.th-cards-grid.th-cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.th-cards-grid.th-cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.th-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1.35rem 1.4rem;
  border: 1px solid var(--th-line);
  border-radius: var(--th-radius);
  background: var(--th-surface);
  transition: border-color 0.14s ease, transform 0.14s ease;
}
.th-card:hover {
  border-color: var(--th-line-strong);
}
.th-card-badge {
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--th-link) 11%, transparent);
  color: var(--th-link);
}
.th-card-title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--th-ink);
}
.th-card-desc {
  margin: 0;
  font-size: 0.93rem;
  line-height: 1.58;
  color: var(--th-ink-2);
  flex: 1 0 auto;
}
.th-card-meta {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--th-muted);
}
.th-card-link {
  margin-top: 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--th-link);
}
.th-card-link:hover { text-decoration: underline; }

/* Embedded Form Block */
.th-form-box {
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid var(--th-line);
  border-radius: calc(var(--th-radius) + 2px);
  background: var(--th-surface);
  max-width: 44rem;
}
.th-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.th-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.th-form-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.th-form-full {
  grid-column: 1 / -1;
}
.th-form-field label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--th-ink);
}
.th-form-field input,
.th-form-field select,
.th-form-field textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--th-line-strong);
  border-radius: 8px;
  background: var(--th-bg);
  color: var(--th-ink);
  font: inherit;
  font-size: 0.95rem;
}
.th-form-field input:focus,
.th-form-field select:focus,
.th-form-field textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--th-link) 35%, transparent);
  border-color: var(--th-link);
}
.th-form-check {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  cursor: pointer;
}
.th-form-check input { width: auto; }
.th-form-footer {
  margin-top: 1.15rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.th-form-status {
  font-size: 0.9rem;
  font-weight: 500;
}
.th-form-status.is-ok { color: #15803d; }
.th-form-status.is-err { color: #b91c1c; }
.th-form-missing {
  margin: 0;
  font-size: 0.9rem;
  color: var(--th-muted);
}

/* FAQ Accordion */
.th-faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.th-faq-item {
  border: 1px solid var(--th-line);
  border-radius: var(--th-radius);
  background: var(--th-surface);
  overflow: hidden;
}
.th-faq-item summary {
  list-style: none;
  cursor: pointer;
  padding: 1rem 1.25rem;
  font-weight: 650;
  color: var(--th-ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.th-faq-item summary::-webkit-details-marker { display: none; }
.th-faq-item summary::after {
  content: "+";
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--th-muted);
  flex: none;
}
.th-faq-item[open] summary::after { content: "−"; color: var(--th-link); }
.th-faq-answer {
  padding: 0 1.25rem 1.1rem;
  color: var(--th-ink-2);
  font-size: 0.95rem;
  line-height: 1.65;
  white-space: pre-wrap;
}

/* Callout Box */
.th-callout {
  padding: 1.1rem 1.3rem;
  border-radius: var(--th-radius);
  border: 1px solid var(--th-line);
  border-left-width: 4px;
  background: var(--th-surface);
}
.th-callout-info { border-left-color: #2563eb; background: color-mix(in srgb, #2563eb 6%, var(--th-surface)); }
.th-callout-tip { border-left-color: #16a34a; background: color-mix(in srgb, #16a34a 6%, var(--th-surface)); }
.th-callout-warning { border-left-color: #d97706; background: color-mix(in srgb, #d97706 8%, var(--th-surface)); }
.th-callout-neutral { border-left-color: var(--th-line-strong); }
.th-callout-title {
  font-weight: 700;
  font-size: 0.96rem;
  color: var(--th-ink);
  margin-bottom: 0.35rem;
}
.th-callout-body {
  color: var(--th-ink-2);
  font-size: 0.93rem;
  line-height: 1.62;
  white-space: pre-wrap;
  overflow-x: auto;
}

/* Gallery Grid + Lightbox */
.th-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: 1rem;
}
.th-gallery-item {
  margin: 0;
  border: 1px solid var(--th-line);
  border-radius: var(--th-radius);
  overflow: hidden;
  background: var(--th-surface);
}
.th-gallery-trigger {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}
.th-gallery-trigger img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}
.th-gallery-item figcaption {
  padding: 0.65rem 0.85rem;
  font-size: 0.85rem;
  color: var(--th-muted);
  border-top: 1px solid var(--th-line);
}
.th-lightbox {
  max-width: min(94vw, 1080px);
  max-height: 92dvh;
  padding: 0;
  border: 1px solid var(--th-line-strong);
  border-radius: var(--th-radius);
  background: var(--th-bg);
  color: var(--th-ink);
}
.th-lightbox::backdrop { background: rgba(15, 23, 42, 0.78); }
.th-lightbox-inner {
  position: relative;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}
.th-lightbox-close {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--th-line-strong);
  background: var(--th-surface);
  color: var(--th-ink);
  font-size: 1.25rem;
  cursor: pointer;
}
.th-lightbox-inner img {
  max-height: 76dvh;
  width: auto;
  border-radius: 6px;
}
.th-lightbox-caption {
  margin: 0;
  font-size: 0.9rem;
  color: var(--th-muted);
}

/* Widgets & Template Positions */
.theme-widget-slot {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.theme-widget-slot-header_right,
.theme-widget-slot-footer {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
}
.theme-widget-slot-content_top { margin-bottom: 1.5rem; }
.theme-widget-slot-content_bottom { margin-top: 2rem; }
.th-widget-heading {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--th-muted);
  margin-bottom: 0.5rem;
}
.theme-nav-vertical {
  flex-direction: column;
  align-items: stretch;
}
.th-widget-contacts {
  padding: 1rem 1.15rem;
  border: 1px solid var(--th-line);
  border-radius: var(--th-radius);
  background: var(--th-surface);
  font-size: 0.9rem;
}
.th-contacts-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.th-contacts-list li {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.th-contact-label {
  color: var(--th-muted);
  font-weight: 600;
  min-width: 4.5rem;
}
.th-cta-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
  padding: 1.35rem 1.6rem;
  border: 1px solid var(--th-line-strong);
  border-radius: calc(var(--th-radius) + 2px);
  background: var(--th-surface);
}
.th-cta-title {
  margin: 0 0 0.35rem;
  font-size: 1.2rem;
  font-weight: 750;
  color: var(--th-ink);
}
.th-cta-body {
  margin: 0;
  font-size: 0.95rem;
  color: var(--th-muted);
}

@media (max-width: 900px) {
  .th-hero-split { grid-template-columns: minmax(0, 1fr); }
  .th-cards-grid.th-cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .th-cards-grid.th-cols-2,
  .th-cards-grid.th-cols-3,
  .th-form-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme-mode="light"]) .th-btn-primary {
    background: var(--th-link);
    color: #0b1120;
    border-color: var(--th-link);
  }
  :root:not([data-theme-mode="light"]) .th-form-status.is-ok { color: #4ade80; }
  :root:not([data-theme-mode="light"]) .th-form-status.is-err { color: #f87171; }
}
html[data-theme-mode="dark"] .th-btn-primary,
body[data-theme-mode="dark"] .th-btn-primary {
  background: var(--th-link);
  color: #0b1120;
  border-color: var(--th-link);
}
html[data-theme-mode="dark"] .th-form-status.is-ok,
body[data-theme-mode="dark"] .th-form-status.is-ok { color: #4ade80; }
html[data-theme-mode="dark"] .th-form-status.is-err,
body[data-theme-mode="dark"] .th-form-status.is-err { color: #f87171; }
