/* TonyTechLab post styles. Markup comes from render_post.py: .tt-post.tt-s-<style> > nav.tt-toc + .tt-body.
   Everything is scoped under .tt-post so the theme and older posts are untouched. */

/* ---------- Base (style "default" and shared parts) ---------- */
.tt-post {
  --tt-ink: #1e293b; --tt-muted: #475569; --tt-navy: #1a365d; --tt-blue: #2b6cb0; --tt-orange: #ed8936;
  --tt-line: #e2e8f0; --tt-soft: #f8fafc; --tt-code-bg: #0f172a; --tt-code-ink: #e2e8f0;
  --tt-font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --tt-head: 'Merriweather', Georgia, serif; --tt-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  font-family: var(--tt-font); color: var(--tt-ink); font-size: 1.05rem; line-height: 1.8;
  max-width: 820px; margin: 0 auto 2.5em; overflow-wrap: break-word;
}
.tt-post *, .tt-post *::before, .tt-post *::after { box-sizing: border-box; }
.tt-post .tt-body > *:first-child { margin-top: 0; }
.tt-post p { margin: 0 0 1.2em; }
.tt-post h2 { font-family: var(--tt-head); font-size: 1.65rem; line-height: 1.35; color: var(--tt-navy);
  margin: 2.2em 0 .8em; padding-bottom: .35em; border-bottom: 3px solid var(--tt-orange); scroll-margin-top: 90px; }
.tt-post h3 { font-family: var(--tt-head); font-size: 1.25rem; line-height: 1.4; color: var(--tt-blue); margin: 1.8em 0 .6em; }
.tt-post a { color: var(--tt-blue); text-decoration: underline; text-underline-offset: 3px; }
.tt-post ul, .tt-post ol { margin: 0 0 1.3em; padding-left: 1.5em; }
.tt-post li { margin: .4em 0; }
.tt-post li::marker { color: var(--tt-orange); font-weight: 700; }
.tt-post strong { color: var(--tt-navy); }
.tt-post code { font-family: var(--tt-mono); font-size: .88em; background: #edf2f7; color: #1a202c;
  padding: .15em .45em; border-radius: 6px; }
.tt-post blockquote { margin: 1.6em 0; padding: 1em 1.3em; border-left: 4px solid var(--tt-blue);
  background: #ebf8ff; border-radius: 0 10px 10px 0; color: #2a4365; }
.tt-post blockquote p:last-child { margin-bottom: 0; }
.tt-post img { max-width: 100%; height: auto; border-radius: 10px; }
.tt-post table { width: 100%; border-collapse: collapse; margin: 1.5em 0; font-size: .95rem; }
.tt-post table th, .tt-post table td { border: 0; border-bottom: 1px solid var(--tt-line); vertical-align: top; }
.tt-post table th { background: var(--tt-navy); color: #fff; text-align: left; padding: .7em .9em; font-weight: 600; border-bottom: 0; }
.tt-post table td { padding: .65em .9em; }
.tt-post tr:nth-child(even) td { background: var(--tt-soft); }

.tt-post .tt-lead > p:first-child { font-size: 1.15rem; color: var(--tt-muted); }

.tt-post .tt-code { margin: 1.5em 0; border-radius: 12px; overflow: hidden; background: var(--tt-code-bg);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .18); }
.tt-post .tt-code-head { font-family: var(--tt-mono); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase;
  color: #94a3b8; padding: .55em 1.1em; background: #1e293b; border-bottom: 1px solid #334155; }
.tt-post .tt-code-head::before { content: "● ● ●"; color: #475569; letter-spacing: .2em; margin-right: 1em; }
.tt-post .tt-code pre { margin: 0; padding: 1.1em 1.3em; overflow-x: auto; background: transparent; border: 0; }
.tt-post .tt-code code { background: none; color: var(--tt-code-ink); padding: 0; font-size: .9rem; line-height: 1.55; white-space: pre; display: block; }

.tt-post .tt-callout { margin: 1.6em 0; padding: 1.1em 1.3em 1.1em 3.2em; border-radius: 12px; position: relative;
  border: 1px solid; }
.tt-post .tt-callout::before { position: absolute; left: 1.05em; top: 1.05em; font-size: 1.25em; line-height: 1; }
.tt-post .tt-callout-title { font-weight: 700; margin-bottom: .35em; }
.tt-post .tt-callout > :last-child { margin-bottom: 0; }
.tt-post .tt-tip { background: #ebf8ff; border-color: #bee3f8; color: #2a4365; }
.tt-post .tt-tip::before { content: "💡"; }
.tt-post .tt-warning { background: #fffbeb; border-color: #fde68a; color: #78350f; }
.tt-post .tt-warning::before { content: "⚠️"; }
.tt-post .tt-success { background: #f0fff4; border-color: #c6f6d5; color: #22543d; }
.tt-post .tt-success::before { content: "✅"; }
.tt-post .tt-callout strong, .tt-post .tt-callout .tt-callout-title { color: inherit; }

.tt-post .tt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1em; margin: 1.5em 0; }
.tt-post .tt-grid-item { background: #fff; border: 1px solid var(--tt-line); border-top: 4px solid var(--tt-blue);
  border-radius: 12px; padding: 1em 1.1em; }
.tt-post .tt-grid-item p { margin: 0 0 .5em; font-size: .97rem; }
.tt-post .tt-grid-item p:last-child { margin-bottom: 0; }
.tt-post .tt-grid-title { font-weight: 700; color: var(--tt-navy); font-size: 1.02rem !important; }

/* Table of contents (styles brutal, darkdocs, pixar, sketch) */
.tt-post .tt-toc { margin: 0 0 2em; padding: 1.1em 1.3em; border-radius: 12px; background: var(--tt-soft);
  border: 1px solid var(--tt-line); }
.tt-post .tt-toc-title { font-weight: 800; text-transform: uppercase; letter-spacing: .08em; font-size: .8rem;
  margin: 0 0 .6em; color: var(--tt-muted); }
.tt-post .tt-toc ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5em; }
.tt-post .tt-toc li { margin: 0; }
.tt-post .tt-toc a { display: block; text-decoration: none; font-size: .92rem; font-weight: 600; padding: .35em .85em;
  border-radius: 999px; background: #fff; border: 1px solid var(--tt-line); color: var(--tt-navy); }
.tt-post .tt-toc a:hover { border-color: var(--tt-blue); color: var(--tt-blue); }

/* ---------- brutal: neo-brutalism, kept from the best CLM template ---------- */
.tt-s-brutal { --tt-head: 'Space Grotesk', var(--tt-font); --tt-dark: #0f172a; --tt-yellow: #fde047; --tt-green: #86efac;
  --tt-pink: #f9a8d4; --tt-sky: #93c5fd; background: #fdfaf6; border: 3px solid var(--tt-dark);
  box-shadow: 10px 10px 0 var(--tt-dark); }
.tt-s-brutal .tt-toc { margin: 0; border: 0; border-bottom: 3px solid var(--tt-dark); border-radius: 0;
  background: var(--tt-yellow); padding: 1.2em 1.5em; }
.tt-s-brutal .tt-toc-title { display: inline-block; color: var(--tt-dark); background: #fff; border: 2px solid var(--tt-dark);
  box-shadow: 3px 3px 0 var(--tt-dark); padding: .2em .6em; }
.tt-s-brutal .tt-toc a { border: 2px solid var(--tt-dark); border-radius: 0; box-shadow: 4px 4px 0 var(--tt-dark);
  color: var(--tt-dark); font-weight: 700; transition: transform .1s, box-shadow .1s; }
.tt-s-brutal .tt-toc a:hover { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--tt-dark); background: var(--tt-pink); color: var(--tt-dark); }
.tt-s-brutal .tt-body { padding: 2em 2.2em; }
.tt-s-brutal h2 { font-weight: 800; color: var(--tt-dark); border-bottom: 4px solid var(--tt-dark); }
.tt-s-brutal h3 { display: inline-block; color: var(--tt-dark); background: var(--tt-sky); border: 2px solid var(--tt-dark);
  padding: .1em .5em; font-family: var(--tt-head); }
.tt-s-brutal .tt-callout { border: 3px solid var(--tt-dark); border-radius: 0; box-shadow: 6px 6px 0 var(--tt-dark); color: var(--tt-dark); }
.tt-s-brutal .tt-tip { background: var(--tt-sky); }
.tt-s-brutal .tt-warning { background: var(--tt-yellow); }
.tt-s-brutal .tt-success { background: var(--tt-green); }
.tt-s-brutal .tt-code { border: 3px solid var(--tt-dark); border-radius: 0; box-shadow: 6px 6px 0 var(--tt-dark); }
.tt-s-brutal .tt-grid-item { border: 3px solid var(--tt-dark); border-radius: 0; box-shadow: 5px 5px 0 var(--tt-dark); }
.tt-s-brutal blockquote { border: 3px solid var(--tt-dark); border-radius: 0; background: #fff; color: var(--tt-dark); }
.tt-s-brutal table th { background: var(--tt-dark); }
.tt-s-brutal table td { border-bottom: 2px solid var(--tt-dark); }

/* ---------- darkdocs: dark technical docs, now readable ---------- */
.tt-s-darkdocs { --tt-ink: #cbd5e1; --tt-muted: #94a3b8; --tt-navy: #f1f5f9; --tt-blue: #38bdf8; --tt-orange: #38bdf8;
  --tt-line: rgba(148, 163, 184, .22); --tt-soft: rgba(255, 255, 255, .04); --tt-head: 'Be Vietnam Pro', system-ui, sans-serif;
  background: #0f172a; background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
  linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px); background-size: 28px 28px;
  border-radius: 16px; overflow: hidden; box-shadow: 0 20px 40px rgba(2, 6, 23, .35); }
.tt-s-darkdocs .tt-toc { margin: 0; border: 0; border-bottom: 1px solid var(--tt-line); border-radius: 0;
  background: rgba(15, 23, 42, .9); padding: 1.1em 1.5em; }
.tt-s-darkdocs .tt-toc-title { color: var(--tt-blue); }
.tt-s-darkdocs .tt-toc a { background: rgba(255,255,255,.04); border-color: var(--tt-line); color: #cbd5e1; }
.tt-s-darkdocs .tt-toc a:hover { border-color: var(--tt-blue); color: var(--tt-blue); }
.tt-s-darkdocs .tt-body { padding: 2em 2.2em; }
.tt-s-darkdocs h2 { font-weight: 700; border-bottom: 1px solid var(--tt-line); }
.tt-s-darkdocs h2::before { content: "#"; color: var(--tt-blue); margin-right: .4em; font-family: var(--tt-mono); }
.tt-s-darkdocs h3 { color: #7dd3fc; font-family: var(--tt-head); }
.tt-s-darkdocs strong { color: #f8fafc; }
.tt-s-darkdocs code { background: rgba(56, 189, 248, .12); color: #7dd3fc; }
.tt-s-darkdocs .tt-lead > p:first-child { color: #e2e8f0; }
.tt-s-darkdocs .tt-code { background: #020617; border: 1px solid var(--tt-line); }
.tt-s-darkdocs .tt-code-head { background: #0b1222; }
.tt-s-darkdocs blockquote { background: rgba(56, 189, 248, .08); color: #e0f2fe; border-left-color: var(--tt-blue); }
.tt-s-darkdocs .tt-callout { background: rgba(255,255,255,.04); }
.tt-s-darkdocs .tt-tip { border-color: rgba(56,189,248,.45); color: #e0f2fe; }
.tt-s-darkdocs .tt-warning { border-color: rgba(251,191,36,.5); color: #fef3c7; }
.tt-s-darkdocs .tt-success { border-color: rgba(52,211,153,.5); color: #d1fae5; }
.tt-s-darkdocs .tt-grid-item { background: rgba(255,255,255,.04); border-color: var(--tt-line); border-top-color: var(--tt-blue); }
.tt-s-darkdocs .tt-grid-title { color: #f1f5f9; }
.tt-s-darkdocs table th { background: #1e293b; color: #f1f5f9; }
.tt-s-darkdocs tr:nth-child(even) td { background: rgba(255,255,255,.03); }
.tt-s-darkdocs a { color: var(--tt-blue); }

/* ---------- pixar: playful and soft, readable body text ---------- */
.tt-s-pixar { --tt-font: 'Nunito', system-ui, sans-serif; --tt-head: 'Nunito', system-ui, sans-serif; --tt-ink: #334155;
  --tt-navy: #0369a1; --tt-blue: #0284c7; --tt-orange: #fb923c; --tt-line: #e0f2fe;
  background: linear-gradient(180deg, #f0f9ff 0%, #ffffff 320px); border-radius: 28px; padding: 0 0 .5em;
  box-shadow: 0 20px 40px rgba(14, 165, 233, .12); font-weight: 500; }
.tt-s-pixar .tt-toc { margin: 0; background: transparent; border: 0; border-bottom: 2px dashed #bae6fd; border-radius: 0; padding: 1.3em 1.6em; }
.tt-s-pixar .tt-toc-title { display: inline-block; color: #fff; background: linear-gradient(180deg, #38bdf8, #0284c7);
  padding: .3em .9em; border-radius: 999px; box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); }
.tt-s-pixar .tt-toc a { background: #fff; border: 0; color: #0369a1; font-weight: 800;
  box-shadow: 0 3px 0 #bae6fd, 0 6px 12px rgba(14,165,233,.12); }
.tt-s-pixar .tt-toc a:hover { transform: translateY(-2px); color: #0284c7; }
.tt-s-pixar .tt-body { padding: 1.8em 2em; }
.tt-s-pixar h2 { font-weight: 900; border-bottom: 0; padding-bottom: 0; display: flex; gap: .5em; align-items: center; }
.tt-s-pixar h2::before { content: ""; flex: 0 0 .7em; height: .7em; border-radius: 50%;
  background: linear-gradient(135deg, #fda4af, #f43f5e); box-shadow: 0 3px 6px rgba(244,63,94,.35); }
.tt-s-pixar h3 { font-weight: 800; color: #334155; background: linear-gradient(90deg, #fef9c3, transparent);
  border-left: 5px solid #facc15; padding: .3em .7em; border-radius: 10px; }
.tt-s-pixar .tt-callout, .tt-s-pixar .tt-grid-item, .tt-s-pixar blockquote { border-radius: 20px; }
.tt-s-pixar .tt-grid-item { border: 0; border-top: 0; background: #fff; box-shadow: 0 4px 0 #e0f2fe, 0 10px 20px rgba(14,165,233,.1); }
.tt-s-pixar .tt-code { border-radius: 20px; }
.tt-s-pixar table th { background: #0284c7; }

/* ---------- sketch: notebook paper, handwritten headings with Vietnamese glyphs ---------- */
.tt-s-sketch { --tt-head: 'Patrick Hand', 'Comic Sans MS', cursive; --tt-navy: #1e293b; --tt-blue: #0369a1; --tt-orange: #be123c;
  background-color: #fdfbf7; background-image: linear-gradient(90deg, transparent 54px, #fca5a5 54px, #fca5a5 56px, transparent 56px),
  linear-gradient(#e0f2fe 1px, transparent 1px); background-size: 100% 100%, 100% 2em;
  box-shadow: 0 12px 30px rgba(0,0,0,.08); border-radius: 4px; }
.tt-s-sketch .tt-toc { margin: 0; background: transparent; border: 0; border-bottom: 2px solid #1e293b; border-radius: 0;
  padding: 1.2em 1.4em 1em 76px; }
.tt-s-sketch .tt-toc-title { font-family: var(--tt-head); font-size: 1.3rem; text-transform: none; letter-spacing: 0;
  color: #be123c; transform: rotate(-2deg); display: inline-block; }
.tt-s-sketch .tt-toc a { background: transparent; border: 0; padding: .1em .4em; color: #0369a1; font-family: var(--tt-head);
  font-size: 1.15rem; font-weight: 400; }
.tt-s-sketch .tt-toc a:hover { text-decoration: underline wavy #be123c; }
.tt-s-sketch .tt-body { padding: 1.6em 1.8em 1.8em 76px; }
.tt-s-sketch h2 { font-size: 2rem; font-weight: 400; border-bottom: 2px dashed #1e293b; display: inline-block; }
.tt-s-sketch h3 { font-size: 1.5rem; font-weight: 400; color: #1e293b; display: inline-block; padding: 0 .3em;
  background: linear-gradient(transparent 55%, #fde68a 55%); }
.tt-s-sketch .tt-callout { background: #fff; border: 2px solid #1e293b; border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  color: #1e293b; box-shadow: 3px 4px 0 rgba(30, 41, 59, .15); }
.tt-s-sketch .tt-callout-title { font-family: var(--tt-head); font-size: 1.25rem; font-weight: 400; }
.tt-s-sketch .tt-grid-item { border: 2px solid #1e293b; border-top: 2px solid #1e293b; background: #fffdf5;
  border-radius: 225px 15px 255px 15px / 15px 255px 15px 225px; transform: rotate(-.4deg); }
.tt-s-sketch .tt-grid-item:nth-child(even) { transform: rotate(.5deg); }
.tt-s-sketch .tt-grid-title { font-family: var(--tt-head); font-size: 1.2rem !important; font-weight: 400; }
.tt-s-sketch blockquote { background: #fef9c3; border-left: 0; transform: rotate(-.5deg); box-shadow: 2px 3px 0 rgba(0,0,0,.08); color: #1e293b; }
.tt-s-sketch table th { background: #1e293b; }

/* ---------- cards: lead hero + one card per section, brand colours ---------- */
.tt-s-cards { background: #f1f5f9; border-radius: 22px; padding: 1.2em; }
.tt-s-cards .tt-lead { background: linear-gradient(135deg, #1a365d 0%, #2b6cb0 100%); color: #e2e8f0; border-radius: 18px;
  padding: 1.8em 2em; margin-bottom: 1.2em; box-shadow: 0 14px 30px rgba(26, 54, 93, .25); }
.tt-s-cards .tt-lead > p:first-child { color: #fff; font-size: 1.2rem; font-weight: 500; }
.tt-s-cards .tt-lead strong { color: #fbd38d; }
.tt-s-cards .tt-lead code { background: rgba(255,255,255,.15); color: #fff; }
.tt-s-cards .tt-lead .tt-callout { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.25); color: #fff; }
.tt-s-cards .tt-card { background: #fff; border-radius: 18px; padding: 1.6em 1.9em; margin: 0 0 1.2em;
  box-shadow: 0 1px 2px rgba(15,23,42,.06), 0 8px 24px rgba(15,23,42,.06); }
.tt-s-cards .tt-card > :last-child { margin-bottom: 0; }
.tt-s-cards .tt-card h2 { margin-top: 0; border-bottom: 0; padding-bottom: 0; display: flex; gap: .55em; align-items: center;
  font-family: var(--tt-font); font-weight: 800; }
.tt-s-cards .tt-card h2::before { content: ""; flex: 0 0 .5em; height: .5em; border-radius: 50%; background: var(--tt-orange);
  box-shadow: 0 0 0 5px #feebc8; }

/* ---------- chat: dialogue bubbles (Tony x AI) ---------- */
.tt-s-chat h2 { font-family: var(--tt-font); font-weight: 800; }
.tt-post .tt-chat { display: flex; flex-direction: column; gap: 1em; margin: 1.5em 0; }
.tt-post .tt-msg { display: flex; gap: .75em; align-items: flex-end; max-width: 88%; }
.tt-post .tt-msg.tt-me { align-self: flex-end; flex-direction: row-reverse; }
.tt-post .tt-avatar { flex: 0 0 2.4em; height: 2.4em; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #fff; background: #64748b; font-size: .95rem; }
.tt-post .tt-me .tt-avatar { background: linear-gradient(135deg, #2b6cb0, #1a365d); }
.tt-post .tt-them .tt-avatar { background: linear-gradient(135deg, #ed8936, #c05621); }
.tt-post .tt-bubble { padding: .8em 1.1em; border-radius: 18px; background: #fff; border: 1px solid var(--tt-line);
  box-shadow: 0 4px 14px rgba(15,23,42,.06); }
.tt-post .tt-me .tt-bubble { background: #ebf8ff; border-color: #bee3f8; border-bottom-right-radius: 4px; }
.tt-post .tt-them .tt-bubble { border-bottom-left-radius: 4px; }
.tt-post .tt-bubble > :last-child { margin-bottom: 0; }
.tt-post .tt-bubble p { margin-bottom: .6em; }
.tt-post .tt-who { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; margin: 0 0 .25em !important; color: var(--tt-muted); }
.tt-post .tt-chat-note { align-self: center; font-size: .9rem; color: var(--tt-muted); }

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  .tt-post { font-size: 1rem; }
  .tt-post table { display: block; overflow-x: auto; }
  .tt-post h2 { font-size: 1.4rem; }
  .tt-s-brutal, .tt-s-darkdocs, .tt-s-pixar, .tt-s-sketch { box-shadow: none; border-radius: 0; }
  .tt-s-brutal { border-width: 2px; }
  .tt-s-brutal .tt-body, .tt-s-darkdocs .tt-body, .tt-s-pixar .tt-body { padding: 1.3em 1em; }
  .tt-s-brutal .tt-toc, .tt-s-darkdocs .tt-toc, .tt-s-pixar .tt-toc { padding: 1em; }
  .tt-s-sketch { background-image: linear-gradient(90deg, transparent 22px, #fca5a5 22px, #fca5a5 23px, transparent 23px),
    linear-gradient(#e0f2fe 1px, transparent 1px); }
  .tt-s-sketch .tt-toc, .tt-s-sketch .tt-body { padding-left: 36px; padding-right: 1em; }
  .tt-s-cards { padding: .6em; border-radius: 14px; }
  .tt-s-cards .tt-lead, .tt-s-cards .tt-card { padding: 1.2em 1.1em; }
  .tt-post .tt-msg { max-width: 100%; }
  .tt-post .tt-callout { padding-left: 2.8em; }
}
