/* grainbygrain.xyz — tutorial page ("Grain App and Skill on Minds").
   Loads AFTER styles.css and reuses its :root tokens. Doc-style layout:
   sticky table-of-contents + content column, callouts, step cards, troubleshooting table.
   Structure mirrors the Superior.Trade Minds tutorial (8 anchors). */

/* ---------- doc layout ---------- */
.doc-hero { padding-top: 156px; padding-bottom: 52px; position: relative; background: radial-gradient(760px 360px at 14% 18%, rgba(232,137,59,0.10), transparent 62%); }
.doc-hero .kicker { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--grain); }
.doc-hero h1 { font-size: clamp(36px, 5vw, 60px); margin: 18px 0 18px; letter-spacing: -0.03em; }
.doc-hero .lead { max-width: 70ch; }
.doc-hero .doc-meta { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; }
.doc-badge { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; color: var(--text-soft); border: 1px solid var(--hairline); border-radius: 999px; padding: 5px 12px; }
.doc-badge.live { color: var(--pass); border-color: rgba(95,208,138,0.35); }
.doc-badge.test { color: var(--grain-bright); border-color: var(--grain-deep); }
.doc-badge.wip { color: #d8a23f; border-color: rgba(216,162,63,0.45); }

.doc-layout { display: grid; grid-template-columns: 240px minmax(0, 840px); gap: 72px; align-items: start; justify-content: center; }
@media (max-width: 940px) { .doc-layout { grid-template-columns: 1fr; gap: 0; } }

/* ---------- sticky table of contents ---------- */
.doc-toc { position: sticky; top: 88px; align-self: start; font-size: 13.5px; }
.doc-toc .toc-title { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 14px; }
.doc-toc ol { list-style: none; counter-reset: toc; border-left: 1px solid var(--hairline); }
.doc-toc li { counter-increment: toc; }
.doc-toc a { display: block; padding: 7px 0 7px 16px; margin-left: -1px; color: var(--text-soft); border-left: 2px solid transparent; transition: color 0.2s, border-color 0.2s; }
.doc-toc a::before { content: counter(toc, decimal-leading-zero) "  "; color: var(--text-faint); font-family: var(--font-mono); font-size: 11px; }
.doc-toc a:hover { color: var(--text); }
.doc-toc a.active { color: var(--grain-bright); border-left-color: var(--grain); }
@media (max-width: 940px) { .doc-toc { display: none; } }

/* ---------- content sections ---------- */
.doc-section { padding: 46px 0 54px; border-top: 1px solid var(--hairline-soft); scroll-margin-top: 88px; }
.doc-section:first-child { border-top: none; padding-top: 6px; }
.doc-section > .ix { font-family: var(--font-mono); font-size: 12px; color: var(--grain); letter-spacing: 0.1em; }
.doc-section h2 { font-size: clamp(24px, 2.6vw, 32px); margin: 8px 0 16px; }
.doc-section h3 { font-size: 18px; margin: 24px 0 10px; }
.doc-section p { color: var(--text-soft); max-width: 72ch; margin-bottom: 15px; font-size: 15.5px; line-height: 1.72; }
.doc-section p strong { color: var(--text); }
.doc-section ul, .doc-section ol.plain { margin: 0 0 16px 0; padding-left: 20px; color: var(--text-soft); max-width: 72ch; }
.doc-section li { margin-bottom: 7px; }
.doc-section code { font-family: var(--font-mono); font-size: 0.9em; background: rgba(255,255,255,0.04); border: 1px solid var(--hairline-soft); border-radius: 5px; padding: 1px 6px; color: var(--grain-bright); }
.doc-section pre { background: #0c0e11; border: 1px solid var(--hairline); border-radius: var(--r-md); padding: 16px 18px; overflow-x: auto; margin: 4px 0 18px; }
.doc-section pre code { background: none; border: none; padding: 0; color: var(--text-soft); font-size: 12.5px; line-height: 1.7; }

/* ---------- callouts (risk / safety / info) ---------- */
.callout { border-radius: var(--r-md); padding: 18px 20px; margin: 6px 0 20px; border: 1px solid var(--hairline); background: var(--surface); }
.callout .c-head { font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 15px; }
.callout p, .callout ul { margin-bottom: 0; color: var(--text-soft); font-size: 14px; }
.callout.danger { border-color: rgba(240,104,106,0.4); background: var(--fail-soft); }
.callout.danger .c-head { color: #ff9a9b; }
.callout.safe { border-color: rgba(95,208,138,0.35); background: var(--pass-soft); }
.callout.safe .c-head { color: var(--pass); }
.callout.info { border-color: var(--wire-soft); background: rgba(91,168,212,0.08); }
.callout.info .c-head { color: var(--wire); }
.callout .c-ico { font-size: 16px; }

/* ---------- step cards (Superior schema: user/mind/result/safety) ---------- */
.steps { counter-reset: step; display: flex; flex-direction: column; gap: 16px; margin: 8px 0 8px; }
.step-card { position: relative; counter-increment: step; background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: 22px 24px 22px 64px; }
.step-card::before { content: counter(step); position: absolute; left: 20px; top: 22px; width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(180deg, var(--grain-bright), var(--grain-deep)); color: #1a1205; font-family: var(--font-display); font-weight: 600; font-size: 15px; display: flex; align-items: center; justify-content: center; }
.step-card h3 { margin: 0 0 12px; font-size: 19px; }
.step-row { display: grid; grid-template-columns: 130px 1fr; gap: 12px; padding: 7px 0; border-top: 1px solid var(--hairline-soft); font-size: 14px; }
.step-row:first-of-type { border-top: none; }
.step-row .k { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); padding-top: 2px; }
.step-row .v { color: var(--text-soft); }
.step-row.safety .k { color: var(--grain); }
.step-row.safety .v { color: var(--text-soft); }
@media (max-width: 600px) { .step-row { grid-template-columns: 1fr; gap: 2px; } .step-card { padding-left: 24px; } .step-card::before { position: static; margin-bottom: 12px; } }

/* ---------- checklist (before you start) ---------- */
.checklist { list-style: none; padding: 0; margin: 8px 0 18px; max-width: 72ch; }
.checklist li { display: flex; align-items: flex-start; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--hairline-soft); color: var(--text-soft); font-size: 14.5px; }
.checklist li .box { flex: none; width: 18px; height: 18px; border: 1.5px solid var(--grain-deep); border-radius: 5px; margin-top: 1px; position: relative; }
.checklist li .box::after { content: "✓"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--grain-bright); font-size: 12px; }
.checklist li b { color: var(--text); font-weight: 600; }

/* ---------- troubleshooting table ---------- */
.tbl-wrap { overflow-x: auto; margin: 6px 0 18px; border: 1px solid var(--hairline); border-radius: var(--r-md); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 640px; }
table.tbl th { text-align: left; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--hairline); }
table.tbl td { padding: 13px 16px; color: var(--text-soft); border-bottom: 1px solid var(--hairline-soft); vertical-align: top; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl td:first-child { color: var(--text); font-weight: 500; }
table.tbl code { font-size: 0.86em; }

/* ---------- in-action mini terminal (reused motif) ---------- */
.action-term { background: linear-gradient(180deg,#0d0f13,#0b0c0f); border: 1px solid var(--hairline); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.7; margin: 4px 0 12px; }
.action-term .at-body { padding: 16px 18px; white-space: pre-wrap; }
.action-term .t-pass { color: var(--pass); } .action-term .t-fail { color: var(--fail); }
.action-term .t-actor { color: var(--wire); } .action-term .t-dim { color: var(--text-faint); }
.action-term .t-vp { color: var(--pass); font-weight: 700; } .action-term .t-vf { color: var(--fail); font-weight: 700; }

.doc-next { margin-top: 30px; display: flex; gap: 14px; flex-wrap: wrap; }
