/* tina4press default theme. Light + dark via :root[data-theme]. Brand: tina4 green. */
:root {
  --tp-bg: #ffffff; --tp-bg-soft: #f6f7f9; --tp-bg-mute: #eceef1;
  --tp-border: #e2e5ea; --tp-border-2: #d2d7de;
  --tp-fg: #1c2430; --tp-fg-2: #4a5464; --tp-fg-3: #7a8494;
  --tp-brand: #2f5fe0; --tp-brand-2: #4888ff;  /* tina4 logo blue */
  --tp-code-bg: #f4f5f7; --tp-sel: #dbe6ff;
  --tk-comment:#8a919e; --tk-string:#2f7d32; --tk-keyword:#2b5fd9;
  --tk-number:#b45a00; --tk-fn:#0b7285; --tk-key:#7b3fe4; --tk-tag:#c0392b; --tk-var:#7b3fe4;
  --tp-mono: "SF Mono","JetBrains Mono","Fira Code",ui-monospace,Menlo,Consolas,monospace;
  --tp-font: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Ubuntu,sans-serif;
  --tp-sidebar-w: 264px; --tp-toc-w: 220px; --tp-max: 1440px; --tp-content: 720px;
}
:root[data-theme="dark"] {
  /* warm, browny dark */
  --tp-bg: #17130f; --tp-bg-soft: #201a15; --tp-bg-mute: #2a221b;
  --tp-border: #352b22; --tp-border-2: #45392e;
  --tp-fg: #ece4da; --tp-fg-2: #b4a99a; --tp-fg-3: #8a7d6d;
  --tp-brand: #8db4ff; --tp-brand-2: #6b9bff;  /* logo blue, lifted for warm bg */
  --tp-code-bg: #140f0b; --tp-sel: #3a2f22;
  --tk-comment:#6a7280; --tk-string:#9ece6a; --tk-keyword:#7aa2f7;
  --tk-number:#e0a25f; --tk-fn:#7dcfff; --tk-key:#bb9af7; --tk-tag:#f7768e; --tk-var:#bb9af7;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body { margin: 0; background: var(--tp-bg); color: var(--tp-fg); font-family: var(--tp-font);
  font-size: 15px; line-height: 1.7; -webkit-font-smoothing: antialiased; }
a { color: var(--tp-brand); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--tp-sel); }

/* header */
.tp-header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--tp-bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--tp-border); }
.tp-header-in { max-width: var(--tp-max); margin: 0 auto; height: 56px; display: flex; align-items: center;
  gap: 20px; padding: 0 22px; }
.tp-brand { display: flex; align-items: center; gap: 9px; font-weight: 700; color: var(--tp-fg); }
.tp-brand:hover { text-decoration: none; }
.tp-brand-mark { color: var(--tp-brand); font-size: 18px; }
.tp-logo { height: 24px; }
.tp-nav { display: flex; gap: 18px; margin-left: 8px; }
.tp-nav-link { color: var(--tp-fg-2); font-size: 14px; font-weight: 500; }
.tp-nav-link:hover { color: var(--tp-brand); text-decoration: none; }
.tp-header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.tp-search-btn { display: flex; align-items: center; gap: 7px; background: var(--tp-bg-soft);
  border: 1px solid var(--tp-border-2); border-radius: 8px; padding: 6px 10px; color: var(--tp-fg-3);
  cursor: pointer; font-size: 13px; }
.tp-search-btn:hover { border-color: var(--tp-brand); }
.tp-search-btn kbd { background: var(--tp-bg-mute); border-radius: 4px; padding: 0 5px; font-size: 11px;
  border: 1px solid var(--tp-border); }
.tp-theme-toggle, .tp-menu-toggle { background: none; border: 1px solid var(--tp-border-2);
  border-radius: 8px; width: 34px; height: 32px; cursor: pointer; color: var(--tp-fg-2); font-size: 15px; }
.tp-theme-toggle:hover { border-color: var(--tp-brand); }
.tp-menu-toggle { display: none; }
.tp-theme-toggle::before { content: "🌙"; }
:root[data-theme="dark"] .tp-theme-toggle::before { content: "☀"; }

/* layout */
.tp-body { max-width: var(--tp-max); margin: 0 auto; display: grid;
  grid-template-columns: var(--tp-sidebar-w) minmax(0,1fr) var(--tp-toc-w); gap: 0; }
.tp-body.tp-home { display: block; }
.tp-sidebar { border-right: 1px solid var(--tp-border); height: calc(100vh - 56px); position: sticky;
  top: 56px; overflow-y: auto; }
.tp-sidebar-in { padding: 24px 16px 60px; }
.tp-side-block { margin-bottom: 18px; }
.tp-side-group, .tp-side-group-link { display: block; font-size: 12px; font-weight: 700; color: var(--tp-fg);
  margin: 0 0 6px; padding: 4px 10px; text-transform: uppercase; letter-spacing: .04em; }
.tp-side-block ul { list-style: none; margin: 0; padding: 0; }
.tp-side-link { display: block; padding: 5px 10px; border-radius: 7px; color: var(--tp-fg-2); font-size: 14px;
  border-left: 2px solid transparent; }
.tp-side-link:hover { color: var(--tp-brand); text-decoration: none; background: var(--tp-bg-soft); }
.tp-side-link.tp-active { color: var(--tp-brand); font-weight: 600; background: var(--tp-bg-soft);
  border-left-color: var(--tp-brand); }
.tp-collapsible > summary { cursor: pointer; list-style: none; display: flex; align-items: center;
  border-radius: 6px; transition: color .12s; }
.tp-collapsible > summary::-webkit-details-marker { display: none; }
.tp-collapsible > summary:hover { color: var(--tp-brand); }
.tp-collapsible > summary::before { content: "›"; font-size: 15px; font-weight: 800; color: var(--tp-brand);
  margin-right: 8px; line-height: 1; transition: transform .15s; display: inline-block; }
.tp-collapsible[open] > summary::before { transform: rotate(90deg); }

.tp-main { min-width: 0; padding: 28px 40px 80px; }
.tp-content { max-width: var(--tp-content); }
.tp-toc { position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto; padding: 28px 16px;
  font-size: 13px; }
.tp-toc-title { font-weight: 700; color: var(--tp-fg); margin: 0 0 8px; }
.tp-toc ul { list-style: none; margin: 0; padding: 0; }
.tp-toc a { display: block; color: var(--tp-fg-3); padding: 3px 0; }
.tp-toc a:hover, .tp-toc a.tp-active { color: var(--tp-brand); text-decoration: none; }
.tp-toc-l3 { padding-left: 12px; }

/* content typography */
.tp-content h1 { font-size: 32px; line-height: 1.2; margin: 4px 0 18px; letter-spacing: -.4px; }
.tp-content h2 { font-size: 23px; margin: 42px 0 14px; padding-top: 14px; border-top: 1px solid var(--tp-border); }
.tp-content h3 { font-size: 18px; margin: 28px 0 10px; }
.tp-content h4 { font-size: 15px; margin: 20px 0 8px; }
.tp-content p { margin: 14px 0; }
.tp-content ul, .tp-content ol { padding-left: 24px; margin: 14px 0; }
.tp-content li { margin: 5px 0; }
.tp-content img { max-width: 100%; border-radius: 8px; }
.tp-content blockquote { margin: 16px 0; padding: 2px 16px; border-left: 3px solid var(--tp-border-2);
  color: var(--tp-fg-2); }
.tp-anchor { margin-left: 8px; color: var(--tp-fg-3); opacity: 0; text-decoration: none; font-weight: 400; }
.tp-content h1:hover .tp-anchor, .tp-content h2:hover .tp-anchor, .tp-content h3:hover .tp-anchor { opacity: 1; }
.tp-content :not(pre) > code { background: color-mix(in srgb, var(--tp-brand) 6%, var(--tp-bg-soft));
  border: 1px solid color-mix(in srgb, var(--tp-brand) 16%, var(--tp-border)); color: var(--tp-brand);
  padding: .12em .42em; border-radius: 5px; font-family: var(--tp-mono); font-size: .85em; font-weight: 500; }
.tp-content table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14px; display: block;
  overflow-x: auto; }
.tp-content th, .tp-content td { border: 1px solid var(--tp-border); padding: 8px 12px; text-align: left; }
.tp-content th { background: var(--tp-bg-soft); }
.tp-content hr { border: none; border-top: 1px solid var(--tp-border); margin: 32px 0; }

/* code blocks */
.tp-code { position: relative; margin: 18px 0; background: var(--tp-code-bg); border: 1px solid var(--tp-border);
  border-radius: 10px; overflow: hidden; }
.tp-code-title { display: flex; align-items: baseline; gap: 10px; padding: 8px 14px; font-size: 12px;
  color: var(--tp-fg-2); border-bottom: 1px solid var(--tp-border); background: var(--tp-bg-soft); }
.tp-code-file { font-family: var(--tp-mono); color: var(--tp-fg); }
.tp-code-desc { color: var(--tp-fg-3); font-size: 11.5px; }
.tp-code pre { margin: 0; padding: 14px 16px; overflow-x: auto; }
.tp-code code { font-family: var(--tp-mono); font-size: 13px; line-height: 1.5; display: block; }
.tp-line { display: block; padding: 0 2px; }
.tp-line.tp-hl { background: color-mix(in srgb, var(--tp-brand) 14%, transparent);
  box-shadow: inset 3px 0 0 var(--tp-brand); margin: 0 -16px; padding: 0 16px; }
.tp-lang { position: absolute; bottom: 6px; right: 12px; font-size: 10px; text-transform: uppercase;
  color: var(--tp-fg-3); letter-spacing: .06em; pointer-events: none; opacity: .7; }
.tp-code-title ~ .tp-lang { display: none; } /* filename bar already names it */
.tp-copy { position: absolute; top: 8px; right: 8px; display: grid; place-items: center;
  width: 28px; height: 28px; background: var(--tp-bg-mute); border: 1px solid var(--tp-border-2);
  color: var(--tp-fg-2); border-radius: 6px; cursor: pointer; opacity: .55; transition: opacity .12s, color .12s; z-index: 2; }
.tp-code:hover .tp-copy, .tp-copy:focus { opacity: 1; }
.tp-copy:hover { color: var(--tp-fg); border-color: var(--tp-brand); }
.tp-copy.tp-copied { color: var(--tp-brand); border-color: var(--tp-brand); opacity: 1; }
.tp-code-title ~ .tp-copy { top: 8px; }
.tk-comment{color:var(--tk-comment);font-style:italic} .tk-string{color:var(--tk-string)}
.tk-keyword{color:var(--tk-keyword)} .tk-number{color:var(--tk-number)} .tk-fn{color:var(--tk-fn)}
.tk-key{color:var(--tk-key)} .tk-tag{color:var(--tk-tag);font-weight:600} .tk-var{color:var(--tk-var)}

/* callouts */
.tp-callout { margin: 18px 0; padding: 12px 16px; border-radius: 10px; border: 1px solid var(--tp-border);
  border-left-width: 3px; background: var(--tp-bg-soft); }
.tp-callout-title { font-weight: 700; margin: 0 0 4px; font-size: 13px; }
.tp-callout p:last-child { margin-bottom: 0; }
.tp-tip { border-left-color: var(--tp-brand); } .tp-tip .tp-callout-title { color: var(--tp-brand); }
.tp-info, .tp-note { border-left-color: var(--tp-brand-2); } .tp-info .tp-callout-title,.tp-note .tp-callout-title{ color: var(--tp-brand-2); }
.tp-warning { border-left-color: #e0a844; } .tp-warning .tp-callout-title { color: #e0a844; }
.tp-danger { border-left-color: #e5484d; } .tp-danger .tp-callout-title { color: #e5484d; }
.tp-details { margin: 18px 0; border: 1px solid var(--tp-border); border-radius: 10px; padding: 10px 16px; }
.tp-details summary { cursor: pointer; font-weight: 600; }

.tp-page-foot { max-width: var(--tp-content); margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--tp-border);
  display: flex; justify-content: space-between; color: var(--tp-fg-3); font-size: 13px; }

/* home hero + features */
.tp-home .tp-main { padding: 0; max-width: 1152px; margin: 0 auto; width: 100%; }
.tp-content-home { max-width: none; padding: 20px 24px 40px; }
.tp-hero { display: flex; align-items: center; gap: 40px; padding: 64px 24px 40px; max-width: 1152px;
  margin: 0 auto; flex-wrap: wrap; }
.tp-hero-text { flex: 1 1 340px; }
.tp-hero-name { font-size: 56px; line-height: 1.1; margin: 0; letter-spacing: -1px;
  background: linear-gradient(120deg, var(--tp-brand), var(--tp-brand-2)); -webkit-background-clip: text;
  background-clip: text; color: transparent; }
.tp-hero-tag { font-size: 40px; font-weight: 700; line-height: 1.15; margin: 6px 0 0; color: var(--tp-fg); }
.tp-hero-line { font-size: 18px; color: var(--tp-fg-2); margin: 18px 0 24px; max-width: 520px; }
.tp-hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.tp-hero-btn { padding: 10px 22px; border-radius: 22px; font-weight: 600; font-size: 14px; border: 1px solid transparent; }
.tp-hero-btn:hover { text-decoration: none; }
.tp-hero-brand { background: var(--tp-brand); color: #fff; }
.tp-hero-brand:hover { filter: brightness(1.06); }
.tp-hero-alt { background: var(--tp-bg-soft); color: var(--tp-fg); border-color: var(--tp-border-2); }
.tp-hero-alt:hover { border-color: var(--tp-brand); }
.tp-hero-img { flex: 0 1 360px; text-align: center; }
.tp-hero-img img { max-width: 100%; max-height: 320px; }
.tp-hero-img object { width: 100%; max-width: 360px; height: 320px; pointer-events: none; }
.tp-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px;
  max-width: 1152px; margin: 20px auto 0; padding: 0 24px; }
.tp-feature { padding: 20px; border: 1px solid var(--tp-border); border-radius: 12px; background: var(--tp-bg-soft); }
.tp-feature-ic { font-size: 22px; margin-bottom: 8px; }
.tp-feature h3 { margin: 0 0 6px; font-size: 16px; }
.tp-feature p { margin: 0; color: var(--tp-fg-2); font-size: 14px; }
@media (max-width: 640px) { .tp-hero-name { font-size: 40px; } .tp-hero-tag { font-size: 28px; } }

/* code-group tabs */
.tp-code-group .tp-cg-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--tp-border); margin-bottom: 0; }
.tp-code-group .tp-cg-tab { background: none; border: none; color: var(--tp-fg-3); padding: 8px 14px;
  cursor: pointer; font-size: 13px; font-family: var(--tp-mono); border-bottom: 2px solid transparent; }
.tp-code-group .tp-cg-tab.tp-on { color: var(--tp-brand); border-bottom-color: var(--tp-brand); }
.tp-code-group .tp-code { display: none; margin-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; }
.tp-code-group .tp-code.tp-on { display: block; }
.tp-group { margin: 18px 0; }

/* built-in content tabs */
.tp-tabs { margin: 18px 0; border: 1px solid var(--tp-border); border-radius: 10px; overflow: hidden; }
.tp-tabs-nav { display: flex; gap: 2px; background: var(--tp-bg-soft); border-bottom: 1px solid var(--tp-border);
  padding: 0 4px; overflow-x: auto; }
.tp-tab { background: none; border: none; color: var(--tp-fg-2); padding: 9px 14px; cursor: pointer;
  font-size: 13px; font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; }
.tp-tab.tp-on { color: var(--tp-brand); border-bottom-color: var(--tp-brand); }
.tp-tab-pane { display: none; padding: 4px 16px; }
.tp-tab-pane.tp-on { display: block; }
.tp-tab-pane > .tp-code:first-child { margin-top: 14px; }

/* built-in card grid */
.tp-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 18px 0; }
.tp-card { padding: 18px; border: 1px solid var(--tp-border); border-radius: 12px; background: var(--tp-bg-soft);
  transition: border-color .15s, transform .1s; }
.tp-card:hover { border-color: var(--tp-brand); transform: translateY(-1px); }
.tp-card-ic { font-size: 22px; margin-bottom: 8px; }
.tp-card h3 { margin: 0 0 6px; font-size: 16px; border: none; padding: 0; }
.tp-card-body { color: var(--tp-fg-2); font-size: 14px; }
.tp-card-body :last-child { margin-bottom: 0; }

/* built-in numbered steps */
.tp-steps { counter-reset: tp-step; padding-left: 8px; border-left: 2px solid var(--tp-border); margin: 18px 0; }
.tp-steps > h3 { counter-increment: tp-step; position: relative; padding-left: 34px; border: none; margin: 20px 0 8px; }
.tp-steps > h3::before { counter-increment: none; content: counter(tp-step); position: absolute; left: -1px; top: -2px;
  transform: translateX(-50%); width: 26px; height: 26px; border-radius: 50%; background: var(--tp-brand); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 700; }

/* search modal */
.tp-search-modal[hidden] { display: none; }
.tp-search-modal { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.4);
  display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.tp-search-box { width: min(640px, 92vw); background: var(--tp-bg); border: 1px solid var(--tp-border-2);
  border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.4); overflow: hidden; }
#tp-search-input { width: 100%; border: none; border-bottom: 1px solid var(--tp-border); background: none;
  color: var(--tp-fg); font-size: 17px; padding: 16px 18px; outline: none; font-family: var(--tp-font); }
.tp-search-results { max-height: 56vh; overflow-y: auto; }
.tp-sr { display: block; padding: 11px 18px; border-bottom: 1px solid var(--tp-border); }
.tp-sr:hover, .tp-sr.tp-sel { background: var(--tp-bg-soft); text-decoration: none; }
.tp-sr-title { font-weight: 600; color: var(--tp-fg); font-size: 14px; }
.tp-sr-crumb { color: var(--tp-fg-3); font-size: 12px; }
.tp-sr-ctx { color: var(--tp-fg-2); font-size: 13px; margin-top: 2px; }
.tp-sr-ctx mark { background: var(--tp-sel); color: inherit; border-radius: 3px; padding: 0 2px; }
.tp-search-foot { padding: 8px 16px; font-size: 12px; color: var(--tp-fg-3); display: flex; gap: 12px; }
.tp-search-foot kbd { background: var(--tp-bg-mute); border: 1px solid var(--tp-border); border-radius: 4px; padding: 0 5px; }
.tp-search-empty { padding: 24px 18px; color: var(--tp-fg-3); text-align: center; }

/* built-in RAG chat */
.tp-chat { position: fixed; bottom: 20px; right: 20px; z-index: 45; }
.tp-chat-btn { padding: 11px 18px; background: var(--tp-brand); color: #fff; border: none; border-radius: 999px;
  font-weight: 600; font-size: 14px; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.tp-chat-btn:hover { filter: brightness(1.06); }
.tp-chat-panel[hidden] { display: none; }
.tp-chat-panel { position: absolute; bottom: 58px; right: 0; width: 380px; max-width: 88vw; max-height: 520px;
  display: flex; flex-direction: column; background: var(--tp-bg); color: var(--tp-fg);
  border: 1px solid var(--tp-border-2); border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.35); overflow: hidden; }
.tp-chat-head { padding: 12px 14px; border-bottom: 1px solid var(--tp-border); display: flex; align-items: center; gap: 8px; }
.tp-chat-model { margin-left: auto; font-size: 11px; color: var(--tp-fg-3); }
.tp-chat-log { padding: 12px; overflow-y: auto; flex: 1; min-height: 120px; display: flex; flex-direction: column; gap: 10px; }
.tp-chat-msg { font-size: 13.5px; line-height: 1.55; max-width: 90%; }
.tp-chat-you { align-self: flex-end; background: var(--tp-brand); color: #fff; padding: 7px 11px; border-radius: 12px 12px 3px 12px; }
.tp-chat-bot { align-self: flex-start; background: var(--tp-bg-soft); border: 1px solid var(--tp-border); padding: 8px 11px;
  border-radius: 12px 12px 12px 3px; }
.tp-chat-bot pre { background: var(--tp-code-bg); border: 1px solid var(--tp-border); border-radius: 6px; padding: 8px 10px;
  overflow-x: auto; font-size: 12px; margin: 6px 0; }
.tp-chat-bot code { font-family: var(--tp-mono); font-size: 12px; }
.tp-chat-form { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--tp-border); }
.tp-chat-input { flex: 1; padding: 8px 12px; background: var(--tp-bg-soft); border: 1px solid var(--tp-border-2);
  border-radius: 8px; color: var(--tp-fg); outline: none; font-size: 13px; }
.tp-chat-form button { padding: 8px 14px; background: var(--tp-brand); color: #fff; border: none; border-radius: 8px;
  font-weight: 600; cursor: pointer; font-size: 13px; }

/* mobile menu (hamburger target) */
.tp-mobile-menu[hidden] { display: none; }
.tp-mobile-menu { display: none; }
.tp-mobile-nav { display: flex; flex-direction: column; }
.tp-mobile-nav .tp-nav-link { padding: 12px 4px; border-bottom: 1px solid var(--tp-border); font-size: 15px; }
.tp-mobile-side { padding-top: 14px; }

/* responsive */
@media (max-width: 1080px) {
  .tp-body { grid-template-columns: var(--tp-sidebar-w) minmax(0,1fr); }
  .tp-toc { display: none; }
}
@media (max-width: 780px) {
  .tp-body { grid-template-columns: 1fr; }
  .tp-nav { display: none; }
  .tp-menu-toggle { display: block; }
  .tp-search-hint { display: none; }
  .tp-sidebar { display: none; }
  .tp-main { padding: 22px 20px 60px; }
  .tp-mobile-menu:not([hidden]) { display: block; position: fixed; top: 56px; left: 0; right: 0; bottom: 0;
    background: var(--tp-bg); z-index: 40; overflow-y: auto; padding: 16px 20px 60px;
    border-top: 1px solid var(--tp-border); }
}
