/* BdotRads AI Skool. Own look (light + dark + print), per its brief.
   The masthead stays dark in both schemes because /shared/header.css
   uses light text. */
:root {
  --bg: #f6f7f9; --surface: #ffffff; --surface2: #eef1f5; --fg: #17202a; --muted: #5a6672; --line: #d6dce3;
  --brad: #1f5fbf; --brad-bg: #e3edfb; --ai: #b4530f; --ai-bg: #fbeee3;
  --good: #11795a; --bad: #b42318; --note: #6b5b00; --note-bg: #fff7d1;
  --mast: #0f141a;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141a; --surface: #171f28; --surface2: #1e2833; --fg: #e6ebf0; --muted: #96a3b0; --line: #2b3643;
    --brad: #7fb0ff; --brad-bg: #1b2c45; --ai: #f6a564; --ai-bg: #3a2717;
    --good: #45cf9c; --bad: #ff7b6e; --note: #f1d36b; --note-bg: #2e2a14;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f141a; --surface: #171f28; --surface2: #1e2833; --fg: #e6ebf0; --muted: #96a3b0; --line: #2b3643;
  --brad: #7fb0ff; --brad-bg: #1b2c45; --ai: #f6a564; --ai-bg: #3a2717;
  --good: #45cf9c; --bad: #ff7b6e; --note: #f1d36b; --note-bg: #2e2a14;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 17px; line-height: 1.55; }
.wrap { max-width: 980px; margin: 0 auto; padding-inline: 16px; }
main.wrap { padding-bottom: 48px; }
a { color: var(--brad); }
code { font-family: var(--mono); font-size: 0.9em; background: var(--surface2); padding: 1px 4px; border-radius: 4px; }
dfn { font-style: normal; font-weight: 650; border-bottom: 1px dotted var(--muted); }
.muted { color: var(--muted); }
.small-print { font-size: 0.85rem; }
@media (min-width: 520px) { .nowrap { white-space: nowrap; } }

/* masthead */
.masthead { background: var(--mast); border-bottom: 1px solid #232d38; }
.mast-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 14px; }
.masthead .site-header { margin: 0; }
.theme-btn { background: transparent; color: #c7d0dc; border: 1px solid #3a4654; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 0.85rem; cursor: pointer; }

.intro { padding-block: 28px 8px; }
h1 { font-size: clamp(1.7rem, 5vw, 2.6rem); line-height: 1.12; margin: 0 0 10px; text-wrap: balance; letter-spacing: -0.01em; }
.lede { font-size: 1.1rem; color: var(--muted); margin: 0; max-width: 46em; }
h2 { font-size: 1.5rem; margin: 6px 0 12px; }
h3 { font-size: 1.1rem; margin: 28px 0 10px; }

/* tabs */
.tabbar { position: sticky; top: 0; z-index: 5; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: thin;
  background: var(--bg); border-bottom: 1px solid var(--line); margin: 20px -16px 0; padding: 8px 16px 0; }
.tabbar button { flex: 0 0 auto; font: inherit; font-size: 0.92rem; color: var(--muted); background: none; border: 0;
  border-bottom: 3px solid transparent; padding: 8px 10px 9px; cursor: pointer; white-space: nowrap; }
.tabbar button .n { display: inline-grid; place-items: center; width: 1.4em; height: 1.4em; border-radius: 50%; background: var(--surface2);
  font-size: 0.78rem; margin-right: 6px; font-weight: 700; }
.tabbar button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--brad); font-weight: 650; }
.tabbar button[aria-selected="true"] .n { background: var(--brad); color: var(--bg); }
.tabbar button:focus-visible, .btn:focus-visible, .seg:focus-visible, .node:focus-visible { outline: 2px solid var(--brad); outline-offset: 2px; }

.panel { padding-top: 22px; outline: none; }
.takeaway { margin: 0 0 6px; font-size: 1.15rem; font-weight: 600; color: var(--brad); border-left: 4px solid var(--brad); padding: 2px 0 2px 12px; }

/* buttons */
.btn { font: inherit; font-size: 0.95rem; background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; cursor: pointer; }
.btn:hover { border-color: var(--brad); }
.btn.small { font-size: 0.85rem; padding: 5px 10px; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 36px; padding-top: 16px; border-top: 1px solid var(--line); }
.pager .btn { max-width: 48%; text-align: left; }
.pager .next { margin-left: auto; text-align: right; }

/* flow strip */
.flow { list-style: none; padding: 0; margin: 18px 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; counter-reset: f; }
.flow li { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 8px; text-align: center; font-size: 0.85rem; line-height: 1.3; }
.flow li b { display: block; font-size: 0.9rem; margin-top: 2px; }
.flow li small { display: block; color: var(--muted); margin-top: 3px; }
.flow .ico { font-size: 1.4rem; }
.flow li:not(:last-child)::after { content: "→"; position: absolute; right: -9px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; z-index: 1; background: var(--bg); line-height: 1; }
@media (max-width: 760px) {
  .flow { grid-template-columns: 1fr; gap: 14px; }
  .flow li { display: grid; grid-template-columns: 2.2em 1fr; text-align: left; align-items: center; column-gap: 8px; }
  .flow .ico { grid-row: span 2; }
  .flow li b { margin: 0; }
  .flow li:not(:last-child)::after { content: "↓"; right: auto; left: 22px; top: auto; bottom: -13px; transform: none; }
}

.callout { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--ai); border-radius: 8px; padding: 12px 14px; margin: 18px 0; }
.callout.warn { border-left-color: var(--note); background: var(--note-bg); }

/* chat */
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.chat-head h3 { margin-bottom: 6px; }
.tag { display: inline-block; font-size: 0.72rem; font-weight: 600; color: var(--muted); background: var(--surface2); border-radius: 999px; padding: 2px 8px; vertical-align: middle; margin-left: 6px; }
.chat { display: flex; flex-direction: column; gap: 10px; margin: 10px 0 8px; }
.msg { display: grid; grid-template-columns: minmax(0, 1fr) 210px; column-gap: 18px; align-items: start; }
.bubble { max-width: 88%; padding: 10px 14px; border-radius: 16px; position: relative; }
.bubble .who { display: block; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 2px; }
.bubble p { margin: 0 0 8px; } .bubble p:last-child { margin: 0; }
.msg.brad .bubble { justify-self: end; background: var(--brad-bg); border-bottom-right-radius: 4px; }
.msg.brad .who { color: var(--brad); text-align: right; }
.msg.claude .bubble { justify-self: start; background: var(--ai-bg); border-bottom-left-radius: 4px; }
.msg.claude .who { color: var(--ai); }
.note { grid-column: 2; font-size: 0.8rem; line-height: 1.35; color: var(--note); background: var(--note-bg); border-radius: 8px; padding: 6px 9px; position: relative; }
.note::before { content: ""; position: absolute; left: -12px; top: 12px; width: 10px; border-top: 1px dashed var(--note); }
.msg .note { grid-row: 1; }
.note-only { grid-template-columns: minmax(0,1fr) 210px; }
@media (max-width: 700px) {
  .msg { grid-template-columns: 1fr; }
  .bubble { max-width: 92%; }
  .note { grid-column: 1; grid-row: auto !important; margin: 4px 0 0 18px; }
  .msg.brad .note { margin: 4px 18px 0 auto; max-width: 85%; }
  .note::before { left: 8px; top: -8px; width: 0; height: 7px; border-top: 0; border-left: 1px dashed var(--note); }
}

/* diagrams */
.diagram-scroll { overflow-x: auto; margin: 14px 0 4px; }
.diagram { display: block; width: 100%; min-width: 580px; height: auto; }
.diagram .box { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.diagram .accent-box { stroke: var(--brad); fill: var(--brad-bg); stroke-width: 2; }
.diagram .question { stroke: var(--brad); stroke-width: 2; }
.diagram .dashed { stroke-dasharray: 6 5; fill: none; stroke: var(--muted); }
.diagram .lbl { fill: var(--fg); font-family: var(--font); font-size: 14px; }
.diagram .lbl.fl { font-size: 13px; }
.diagram .lbl.b { font-weight: 700; }
.diagram .lbl.small { font-size: 12px; fill: var(--muted); }
.diagram .lbl.em { fill: var(--brad); font-weight: 700; font-size: 13px; }
.diagram .lines line { stroke: var(--brad); stroke-width: 3; stroke-linecap: round; opacity: .45; }
.diagram .flowline { stroke: var(--muted); stroke-width: 2; fill: none; stroke-dasharray: 6 5; }
.diagram .arrowhead { fill: var(--muted); }
.diagram .edge { stroke: var(--muted); stroke-width: 0.7; opacity: .35; }
.diagram .neuron { fill: var(--ai); }
.diagram .cloud { fill: var(--surface2); stroke: var(--muted); stroke-width: 1.5; transition: opacity .4s; }
.diagram .doc { fill: var(--surface); stroke: var(--muted); stroke-width: 1.2; }
.diagram .doc.pdf { stroke: var(--bad); }
.diagram .doc.md { stroke: var(--good); }
.diagram .task { fill: var(--brad-bg); stroke: var(--brad); stroke-width: 1.5; }
.diagram .ln { stroke: var(--bad); stroke-width: 0.6; opacity: .28; }
.diagram .ln.good { stroke: var(--good); opacity: .5; stroke-width: 0.9; }
.diagram .back { stroke: var(--muted); stroke-dasharray: 3 4; fill: none; stroke-width: 1.4; }
.diagram .hit { cursor: pointer; }
.diagram .hit:hover .box, .diagram .hit.sel .box { stroke: var(--ai); stroke-width: 2.5; }
.diagram.anim .flowline { animation: dash 1.2s linear infinite; }
.diagram.anim .neuron { animation: pulse 2.4s ease-in-out infinite; }
.diagram.anim .file-g { animation: slidein .6s ease-out both; }
@keyframes dash { to { stroke-dashoffset: -22; } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes slidein { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .diagram.anim * { animation: none !important; } }

.swipe-hint { display: none; font-size: 0.8rem; color: var(--muted); margin: 0; }
@media (max-width: 620px) { .swipe-hint { display: block; } }
@media print { .swipe-hint { display: none !important; } }
.info { font-size: 0.95rem; color: var(--muted); min-height: 1.5em; margin: 6px 0 14px; }
.info.on { color: var(--fg); }

.toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--surface); margin: 6px 0; }
.seg { font: inherit; font-size: 0.9rem; border: 0; background: none; color: var(--muted); padding: 6px 14px; border-radius: 999px; cursor: pointer; }
.seg.on { background: var(--brad); color: var(--bg); font-weight: 600; }
.procon { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0 8px; font-size: 0.95rem; }
.procon div { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.procon .pro b { color: var(--good); } .procon .con b { color: var(--bad); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin: 14px 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 0.95rem; }
.card > b:first-child { display: block; margin-bottom: 2px; }
.bad-card { border-top: 3px solid var(--bad); } .good-card { border-top: 3px solid var(--good); }
@media (max-width: 640px) { .two, .procon { grid-template-columns: 1fr; } }

pre.code { font-family: var(--mono); font-size: 0.82rem; line-height: 1.5; background: var(--surface2); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; overflow-x: auto; white-space: pre; margin: 10px 0; }
pre.code:empty { display: none; }

/* org chart */
.org { display: flex; flex-direction: column; align-items: center; margin: 18px 0 6px; }
.org-row { display: flex; justify-content: center; gap: 10px; width: 100%; }
.org-row.three .node { flex: 1 1 0; max-width: 220px; }
.org-down { width: 2px; height: 22px; background: var(--line); }
.node { font: inherit; font-size: 0.98rem; font-weight: 650; color: var(--fg); background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 14px; min-width: 180px; text-align: center; cursor: pointer; }
.node small { display: block; font-size: 0.78rem; color: var(--muted); font-weight: 400; }
.node.human { border-color: var(--brad); background: var(--brad-bg); }
.node.pm { border-color: var(--ai); }
.node.folder { cursor: default; border-style: dashed; }
.node.sel { border-color: var(--ai); box-shadow: 0 0 0 2px var(--ai-bg); }
@media (max-width: 560px) { .org-row.three { flex-direction: column; align-items: center; } .org-row.three .node { max-width: none; width: 100%; } .node { min-width: 0; width: 100%; } }

/* calculator */
.calc { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 4px 16px 12px; margin: 18px 0; }
.calc label { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; font-size: 0.95rem; margin: 10px 0; }
.calc label output { font-weight: 700; font-variant-numeric: tabular-nums; }
.calc input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: var(--brad); }
.bars { margin: 12px 0 4px; display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 4.5em 1fr 9.5em; align-items: center; gap: 10px; font-size: 0.92rem; }
.bar-row output { font-variant-numeric: tabular-nums; text-align: right; }
.bar { height: 18px; background: var(--surface2); border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--bad); transition: width .3s; }
.bar i.good { background: var(--good); }
@media (max-width: 480px) { .bar-row { grid-template-columns: 4em 1fr; } .bar-row output { grid-column: 2; text-align: left; } }

.tips { padding-left: 1.3em; } .tips li { margin: 6px 0; }
.monday { background: var(--brad-bg); border-radius: 12px; padding: 4px 18px 10px; margin-top: 22px; }
.monday h3 { margin-top: 14px; }

/* videos */
.vgroup h3 { margin-top: 22px; }
.vlist { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.vlist li { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.vlist a { font-weight: 650; }
.vmeta { display: block; font-size: 0.82rem; color: var(--muted); }
.vwhy { display: block; font-size: 0.93rem; margin-top: 2px; }
.links li { margin: 6px 0; }

.foot { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 0.85rem; color: var(--muted); }
.foot-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.foot .sh-ver { color: var(--muted); margin-right: auto; }

/* print */
@media print {
  :root { --bg: #fff; --surface: #fff; --surface2: #f2f4f7; --fg: #000; --muted: #444; --line: #bbb;
    --brad: #1f5fbf; --brad-bg: #eaf1fc; --ai: #a24a0d; --ai-bg: #fbefe5; --note-bg: #fff8dc; --note: #5a4c00; color-scheme: light; }
  body { font-size: 11pt; }
  .masthead { background: #fff; border: 0; }
  .masthead .sh-name, .masthead .sh-name b, .masthead .sh-ver { color: #000; }
  .theme-btn, .tabbar, .pager, .btn, .toggle, .chat-head .btn { display: none !important; }
  .panel[hidden] { display: block !important; }
  .panel { padding-top: 0; }
  .panel ~ .panel { break-before: page; }
  body.print-one .panel:not(.current) { display: none !important; }
  .diagram { min-width: 0; }
  .diagram-scroll { overflow: visible; }
  .chat.hide-all .msg { display: grid; }
  .card, .msg, pre.code, .calc { break-inside: avoid; }
  pre.code { white-space: pre-wrap; }
  a { color: #000; }
  .vlist a::after, .links a::after { content: " (" attr(href) ")"; font-weight: 400; font-size: 0.85em; word-break: break-all; }
}

/* ---------- Tab 9: ask a question ---------- */
.ask-form { display: grid; gap: 14px; max-width: 40em; margin: 18px 0 28px; }
.ask-form label { display: grid; gap: 4px; font-weight: 600; }
.ask-form label .muted, .ask-form small { font-weight: 400; }
.ask-form textarea, .ask-form input, .adm-q textarea { font: inherit; font-size: 1rem; color: var(--fg); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; width: 100%; box-sizing: border-box; font-weight: 400; }
.ask-form textarea:focus, .ask-form input:focus, .adm-q textarea:focus { outline: 2px solid var(--brad); outline-offset: 1px; }
.ask-form .count { font-size: 0.8rem; font-weight: 400; justify-self: end; }
.ask-form p { margin: 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.btn.primary { background: var(--brad); border-color: var(--brad); color: var(--bg); font-weight: 600; }
.btn:disabled { opacity: .6; cursor: default; }
.answers { display: grid; gap: 14px; }
.qa { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.qa .q p, .qa .a p, .adm-q .q p { margin: 4px 0; }
.qa .a { border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 8px; }
.qa .a b, .qa .q b { color: var(--brad); }
.qa .a b { color: var(--ai); }
.admin { margin-top: 32px; padding-top: 12px; border-top: 2px solid var(--ai); }
.adm-q { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--ai); border-radius: 8px; padding: 10px 12px; margin: 12px 0; }
.adm-q.published { border-left-color: var(--good); }
.adm-q.hidden { opacity: .7; border-left-color: var(--muted); }
.adm-meta { font-size: 0.85rem; color: var(--muted); overflow-wrap: anywhere; }
.adm-meta b { color: var(--fg); }
.adm-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 0; }
.adm-btns .info { margin: 0; min-height: 0; }
.bad { color: var(--bad); }
@media print { #ask-form, #ask-admin, #adm-link { display: none !important; } }
