/* ============================================================
   SHARED — task-guide layout for /guides/<slug>
   Link this from any plain task guide:
       <link rel="stylesheet" href="{% static 'css/guides/task-guide.css' %}">

   Used by:
     guides/set-up-customer-tipping.html
     guides/brand-your-invoices.html

   Rendered as a fragment inside tools/guides.html on the v1
   base.html Bootstrap shell. That shell supplies no <h1>, no TOC
   and no section chrome (it emits only rendered_content), so the
   fragment brings its own markup and this file dresses it.

   Everything is scoped under .tg and self-sufficient — it must
   not assume any V2 token file is loaded on this route.

   Lighter than css/guides/jobs-vs-invoices.css on purpose: that
   page is a full docs layout with a sidebar and a decision
   engine, and keeps its own stylesheet. This is the plain
   several-sections-and-steps guide most topics need, so it is
   shared rather than copied per slug.

   Anything genuinely one-off for a single guide belongs in that
   guide's own sheet, not here.

   MOBILE-FIRST: base styles = phone; desktop layered on.
   ============================================================ */

.tg {
    --tg-green: #2e7d32;
    --tg-green-dark: #1b5e20;
    --tg-ink: #1a1f1b;
    --tg-muted: #5b6660;
    --tg-line: #e3e9e4;
    --tg-surface: #f6f9f6;
    --tg-amber-bg: #fff8e6;
    --tg-amber-line: #f0d492;
    --tg-radius: 10px;

    max-width: 46rem;
    margin: 0 auto;
    padding: 0 1rem 3rem;
    color: var(--tg-ink);
    line-height: 1.7;
}

/* ── Head ───────────────────────────────────────────────────── */

.tg-head {
    padding: 1.5rem 0 1rem;
}

.tg-title {
    font-size: clamp(1.7rem, 1.3rem + 2vw, 2.4rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--tg-green-dark);
    margin: 0 0 0.75rem;
}

.tg-lead {
    font-size: 1.08rem;
    color: var(--tg-muted);
    margin: 0;
}

/* ── On-this-page nav ───────────────────────────────────────── */

.tg-toc {
    margin: 1.5rem 0 2rem;
    padding: 1rem 1.15rem;
    background: var(--tg-surface);
    border: 1px solid var(--tg-line);
    border-radius: var(--tg-radius);
}

.tg-toc-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--tg-muted);
    margin-bottom: 0.5rem;
}

.tg-toc-list {
    margin: 0;
    padding-left: 1.2rem;
}

.tg-toc-list li {
    margin-bottom: 0.25rem;
}

.tg-toc-list a {
    color: var(--tg-green-dark);
    font-weight: 600;
    text-decoration: none;
}

.tg-toc-list a:hover,
.tg-toc-list a:focus-visible {
    text-decoration: underline;
}

/* ── Sections ───────────────────────────────────────────────── */

.tg-before {
    margin-bottom: 2.5rem;
    padding: 1rem 1.15rem;
    border-left: 3px solid var(--tg-green);
    background: var(--tg-surface);
    border-radius: 0 var(--tg-radius) var(--tg-radius) 0;
}

.tg-before h2 {
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--tg-green-dark);
    margin: 0 0 0.5rem;
}

.tg-before p:last-child {
    margin-bottom: 0;
}

.tg-section {
    margin-bottom: 3.5rem;
    scroll-margin-top: 5rem;   /* clear the fixed #mainNav on anchor jumps */
}

.tg-section > h2 {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: clamp(1.3rem, 1.1rem + 1vw, 1.7rem);
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--tg-green-dark);
    margin: 0 0 1rem;
    padding-bottom: 0.65rem;
    border-bottom: 2px solid var(--tg-line);
}

.tg-sec-num {
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 50%;
    background: var(--tg-green);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
}

.tg h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--tg-ink);
    margin: 2rem 0 0.5rem;
}

.tg p {
    margin: 0 0 0.9rem;
}

/* ── Steps ──────────────────────────────────────────────────── */

.tg-steps {
    counter-reset: tg-step;
    list-style: none;
    padding: 0;
    margin: 1.25rem 0;
}

.tg-steps > li {
    counter-increment: tg-step;
    position: relative;
    padding: 0 0 1.25rem 2.5rem;
}

.tg-steps > li::before {
    content: counter(tg-step);
    position: absolute;
    left: 0;
    top: 0.1rem;
    display: grid;
    place-items: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--tg-green);
    color: var(--tg-green-dark);
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1;
}

/* Connector down the left rail, stopping at the last step. */
.tg-steps > li:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 0.75rem;
    top: 1.9rem;
    bottom: 0.35rem;
    width: 2px;
    background: var(--tg-line);
}

.tg-steps > li > p:last-child {
    margin-bottom: 0;
}

.tg-sublist {
    margin: 0.65rem 0 0;
    padding-left: 1.2rem;
}

.tg-sublist li {
    margin-bottom: 0.45rem;
}

.tg-default {
    display: inline-block;
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    background: var(--tg-surface);
    border: 1px solid var(--tg-line);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--tg-muted);
    white-space: nowrap;
}

.tg-note {
    font-size: 0.93rem;
    color: var(--tg-muted);
}

/* ── Callouts ───────────────────────────────────────────────── */

.tg-callout {
    margin: 1.5rem 0;
    padding: 1rem 1.15rem;
    background: var(--tg-surface);
    border: 1px solid var(--tg-line);
    border-radius: var(--tg-radius);
}

.tg-callout--key {
    background: var(--tg-amber-bg);
    border-color: var(--tg-amber-line);
}

.tg-callout-title {
    font-weight: 700;
    color: var(--tg-ink);
    margin: 0 0 0.4rem;
}

.tg-callout p:last-child {
    margin-bottom: 0;
}

/* ── Table ──────────────────────────────────────────────────── */

.tg-table-wrap,
.tg-table {
    width: 100%;
}

.tg-table {
    display: block;
    overflow-x: auto;          /* wide content scrolls itself, never the page */
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.95rem;
}

.tg-table th,
.tg-table td {
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--tg-line);
    text-align: left;
    vertical-align: top;
}

.tg-table thead th {
    background: var(--tg-surface);
    font-weight: 700;
    color: var(--tg-green-dark);
    white-space: nowrap;
}

/* ── Foot ───────────────────────────────────────────────────── */

.tg-next {
    margin-top: 2.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--tg-line);
    font-weight: 600;
}

.tg-next a {
    color: var(--tg-green-dark);
}

/* ── Desktop ────────────────────────────────────────────────── */

@media (min-width: 768px) {
    .tg {
        padding-left: 0;
        padding-right: 0;
    }

    .tg-table {
        display: table;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tg * {
        transition: none !important;
    }
}
