/* ── Template gallery (/templates, /templates/{slug}) ─────────────────────────
   Marketing-side styling on the tokens.css palette, so the gallery reads as part
   of the same site as the homepage and the library. */

.tg-wrap { max-width: 1080px; margin: 0 auto; padding: 52px 24px 100px; }
.tg-eyebrow {
    font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.14em;
    text-transform: uppercase; color: var(--text-muted); margin-bottom: 12px;
}
.tg-head { margin-bottom: 48px; max-width: 760px; }
.tg-head h1 {
    font-family: var(--font-display); font-weight: 400; font-size: 50px; line-height: 1.03;
    letter-spacing: -0.028em; margin: 0 0 16px;
}
.tg-head h1 em { font-style: italic; color: var(--accent-ink); }
.tg-lead { font-size: 18.5px; color: var(--text-2); line-height: 1.55; margin: 0; max-width: 66ch; }

.tg-crumbs {
    display: flex; align-items: center; gap: 9px; margin-bottom: 26px;
    font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.05em; color: var(--text-faint);
}
.tg-crumbs a { color: var(--text-muted); }
.tg-crumbs a:hover { color: var(--accent-deep); }

/* ── Group nav ────────────────────────────────────────────────────────────── */
.tg-groupnav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
.tg-groupchip {
    display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px;
    border: 1px solid var(--border); background: var(--card);
    font-size: 13.5px; font-weight: 600; color: var(--text-2);
    transition: border-color 140ms, color 140ms;
}
.tg-groupchip:hover { border-color: var(--accent-deep); color: var(--accent-deep); }
.tg-groupchip i { font-style: normal; font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.tg-group { margin-bottom: 56px; scroll-margin-top: 100px; }
.tg-group h2 {
    font-family: var(--font-display); font-weight: 400; font-size: 29px;
    letter-spacing: -0.018em; margin: 0 0 20px;
}
.tg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.tg-card {
    display: flex; flex-direction: column; gap: 10px; padding: 22px 22px 20px;
    border: 1px solid var(--border); border-radius: 16px; background: var(--card);
    transition: border-color 160ms, transform 160ms, box-shadow 160ms;
}
.tg-card:hover { border-color: var(--accent-deep); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.tg-card h3 {
    font-family: var(--font-display); font-weight: 400; font-size: 20px; line-height: 1.22;
    letter-spacing: -0.012em; margin: 0;
}
.tg-card p { font-size: 14px; color: var(--text-2); line-height: 1.55; margin: 0; flex: 1; }

.tg-ico {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 11px; font-size: 18px; flex: none;
}
.tg-ico.lg { width: 54px; height: 54px; border-radius: 15px; font-size: 26px; margin-bottom: 16px; }

.tg-tables { display: flex; flex-wrap: wrap; gap: 5px; }
.tg-chip {
    font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.03em;
    padding: 3px 8px; border-radius: 999px; background: var(--paper-2);
    border: 1px solid var(--border-soft); color: var(--text-muted);
}
.tg-chip.more { color: var(--text-faint); }

/* ── Detail page ──────────────────────────────────────────────────────────── */
.td-head { margin-bottom: 44px; }
.td-head-main { max-width: 760px; }
.td-head h1 {
    font-family: var(--font-display); font-weight: 400; font-size: 44px; line-height: 1.06;
    letter-spacing: -0.026em; margin: 0 0 16px;
}
.td-actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 26px; }
.td-free { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-faint); }

.td-body { display: grid; grid-template-columns: 1fr 300px; gap: 52px; align-items: start; }
.td-main { min-width: 0; max-width: 68ch; }
.td-section { margin-bottom: 40px; }
.td-section h2 {
    font-family: var(--font-display); font-weight: 400; font-size: 26px;
    letter-spacing: -0.018em; margin: 0 0 12px;
}
.td-section p { font-size: 16.5px; color: var(--text-2); line-height: 1.65; margin: 0; }
.td-section a { color: var(--accent-deep); font-weight: 550; text-decoration: underline; text-underline-offset: 2.5px; }
.td-sub { margin-bottom: 16px !important; }

.td-highlights { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.td-highlights li {
    position: relative; padding-left: 26px; font-size: 16.5px; color: var(--text-2); line-height: 1.6;
}
.td-highlights li::before {
    content: ""; position: absolute; left: 0; top: 9px;
    width: 8px; height: 8px; border-radius: 50%; background: var(--accent-deep);
}

.td-tables { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.td-table {
    display: flex; align-items: center; gap: 10px; padding: 12px 14px;
    border: 1px solid var(--border); border-radius: 11px; background: var(--card);
    font-size: 14.5px; font-weight: 550; color: var(--text);
}
.td-table-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }

.td-side { position: sticky; top: 100px; }
.td-card {
    padding: 24px; border: 1px solid var(--border); border-radius: 18px; background: var(--paper-2);
}
.td-card-label {
    font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em;
    text-transform: uppercase; color: var(--text-faint); margin-bottom: 12px;
}
.td-card p { font-size: 14.5px; color: var(--text-2); line-height: 1.6; margin: 0 0 18px; }
.td-card-foot { margin-top: 14px; font-size: 12px; color: var(--text-faint); line-height: 1.5; text-align: center; }

.td-related { margin-top: 72px; padding-top: 34px; border-top: 1px solid var(--border-soft); }
.td-related-label {
    font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.14em;
    text-transform: uppercase; color: var(--text-faint); margin-bottom: 18px;
}

/* ── Bottom CTA ───────────────────────────────────────────────────────────── */
.tg-cta {
    margin-top: 40px; padding: 38px 36px; border-radius: 20px;
    border: 1px solid var(--border); background: var(--paper-2);
}
.tg-cta h2 {
    font-family: var(--font-display); font-weight: 400; font-size: 30px;
    letter-spacing: -0.018em; margin: 0 0 10px;
}
.tg-cta p { font-size: 16px; color: var(--text-2); line-height: 1.6; margin: 0 0 22px; max-width: 62ch; }
.tg-cta-actions { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.tg-cta-alt { font-size: 14.5px; font-weight: 600; color: var(--accent-deep); }

/* ── Icon backgrounds (mirrors the app's accent palette) ──────────────────── */
.bg-ink { background: var(--ink-900); color: var(--paper); }
.bg-violet { background: var(--violet-soft); color: #4F35BF; }
.bg-coral { background: var(--coral-soft); color: #b4342f; }
.bg-mint { background: var(--mint-soft); color: #0c7a4e; }
.bg-amber { background: var(--amber-soft); color: #9a6a12; }
.bg-rose { background: var(--rose-soft, var(--coral-soft)); color: #b02f60; }
.bg-sky { background: var(--sky-soft, var(--violet-soft)); color: #1f6f9e; }
.bg-chartreuse { background: var(--accent-tint); color: #5a7a0c; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 1000px) {
    .tg-grid { grid-template-columns: repeat(2, 1fr); }
    .td-body { grid-template-columns: 1fr; gap: 34px; }
    .td-side { position: static; }
    .td-card { max-width: 420px; }
}
@media (max-width: 720px) {
    .tg-head h1 { font-size: 36px; }
    .td-head h1 { font-size: 32px; }
    .tg-grid { grid-template-columns: 1fr; }
    .td-tables { grid-template-columns: 1fr; }
    .tg-cta { padding: 28px 24px; }
    .tg-cta h2 { font-size: 25px; }
}
