/* Template library: hub, facet pages and template detail pages (generated by tools/build-templates.mjs). */

/* ---------- hero ---------- */
.th { position: relative; overflow: hidden; background: var(--ink); color: var(--fg); padding: calc(var(--header-h) + clamp(28px, 4vw, 56px)) 0 clamp(40px, 5vw, 72px); }
.th::before { content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none; background: radial-gradient(55% 90% at 85% 0%, rgba(109,74,255,.35), transparent 70%), radial-gradient(45% 80% at 5% 100%, rgba(255,122,26,.22), transparent 70%); }
.th__inner { position: relative; z-index: 1; display: grid; gap: 20px; justify-items: start; }
.th h1 { font-size: clamp(2.2rem, 5vw, 3.9rem); max-width: 16em; color: #fff; }
.th .lede { color: #b6bed0; max-width: 42em; }
.th__note { font-family: var(--font-mono); font-size: .78rem; letter-spacing: .04em; color: #8a93a8; display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.th__note i { width: 3px; height: 3px; border-radius: 50%; background: #4b5468; display: inline-block; }
.th--list h1 { font-size: clamp(2rem, 4.4vw, 3.2rem); }
.th .pill { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.14); color: #c9d0df; }

.crumbs { font-family: var(--font-mono); font-size: .74rem; letter-spacing: .04em; color: #8a93a8; }
.crumbs ol { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.crumbs li { display: inline-flex; align-items: center; gap: 10px; }
.crumbs li + li::before { content: '/'; opacity: .5; }
.crumbs a { color: #b6bed0; text-underline-offset: 3px; }
.crumbs a:hover { color: #fff; text-decoration: underline; }
.crumbs [aria-current] { color: #e8ecf5; max-width: 40ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: bottom; }

/* ---------- search ---------- */
.tsearch { display: flex; align-items: center; gap: 10px; width: min(100%, 680px); }
.tsearch .ui-search { flex: 1; }
.tsearch .btn { height: 48px; padding: 0 22px; border-radius: var(--r-sm); }

/* ---------- browse bar ---------- */
.tbrowse { padding-block: clamp(32px, 5vw, 64px) clamp(56px, 8vw, 104px); }
.ttabs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 12px; margin-bottom: 8px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.ttab { flex: none; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--r-pill); font-weight: 600; font-size: .93rem; color: var(--fg-2); background: var(--surface); border: 1px solid var(--line); transition: background .2s, color .2s, border-color .2s; white-space: nowrap; }
.ttab small { font-family: var(--font-mono); font-size: .68rem; opacity: .7; }
.ttab:hover { border-color: var(--line-strong); color: var(--fg); }
.ttab[aria-current='page'] { background: var(--ink); color: #fff; border-color: var(--ink); }
.tfilters { display: flex; flex-wrap: wrap; gap: 14px 18px; align-items: end; margin-bottom: clamp(28px, 4vw, 44px); }
.tfilters label { display: grid; gap: 6px; font-family: var(--font-mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-3); }
.tfilters .ui-sel, .tfilters .ui-select { min-width: 180px; }
.tclear { height: 42px; padding: 0 14px; color: var(--accent-text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- shelves + grid ---------- */
.tshelf { margin-top: clamp(40px, 6vw, 72px); }
.tshelf:first-child, [data-shelves] > .tshelf:first-child { margin-top: 0; }
.tshelf__head { display: flex; align-items: end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 22px; }
.tshelf__head h2 { font-size: clamp(1.6rem, 2.8vw, 2.3rem); }
.tshelf__head p { color: var(--fg-2); margin-top: 6px; }
.tmore { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--accent-text); }
.tmore svg { width: 16px; height: 16px; transition: transform .25s var(--ease-out); }
.tmore:hover svg { transform: translateX(3px); }
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 18px; }

.tcard { position: relative; display: flex; flex-direction: column; gap: 12px; padding: 22px; min-height: 236px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--card-shadow); transition: transform .3s var(--ease-out), box-shadow .3s var(--ease-out), border-color .3s; }
.tcard:hover, .tcard:focus-within { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.tcard__top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tcard__fn { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-text); }
.tcard h3 { font-size: 1.2rem; line-height: 1.22; }
.tcard__link::after { content: ''; position: absolute; inset: 0; border-radius: inherit; }
.tcard__link:focus-visible { outline: none; }
.tcard:focus-within { outline: 2px solid var(--orange); outline-offset: 3px; }
.tcard__sum { color: var(--fg-2); font-size: .95rem; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tcard__foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.tcard__logos { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; }
.tcard__meta { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: .7rem; letter-spacing: .04em; color: var(--fg-3); white-space: nowrap; }
.tcard__meta i { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .6; }
.tlogo { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); }
.tlogo img { width: 18px; height: 18px; object-fit: contain; }
.tlogo--txt, .tlogo--more { font-family: var(--font-mono); font-size: .62rem; font-weight: 600; color: var(--fg-2); text-transform: uppercase; }

.tbadge { display: inline-block; font-family: var(--font-mono); font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; padding: 3px 8px; border-radius: var(--r-pill); font-weight: 600; background: var(--surface-2); color: var(--fg-2); border: 1px solid var(--line); }
.tbadge--new { background: rgba(25,195,166,.14); color: #0b7a68; border-color: rgba(25,195,166,.4); }
.tbadge--prem { background: rgba(109,74,255,.12); color: #4a2fd0; border-color: rgba(109,74,255,.35); }
.tbadge--plan { background: var(--orange); color: var(--ink); border-color: transparent; font-size: .72rem; padding: 5px 11px; }

/* ---------- tiles / chips ---------- */
.ttiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 12px; }
.ttile { display: grid; gap: 4px; padding: 18px 20px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); transition: border-color .25s, transform .25s var(--ease-out), box-shadow .25s; }
.ttile:hover { border-color: var(--orange); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.ttile strong { font-size: 1.02rem; letter-spacing: -0.01em; }
.ttile span { font-family: var(--font-mono); font-size: .72rem; color: var(--fg-3); }
.tchips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.tchips:first-child { margin-top: 0; }
.tchip { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 6px 14px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line); font-size: .9rem; font-weight: 500; color: var(--fg); transition: border-color .2s, background .2s; }
a.tchip:hover { border-color: var(--orange); }
.tchip img { width: 18px; height: 18px; object-fit: contain; }
.tchip small { font-family: var(--font-mono); font-size: .66rem; color: var(--fg-3); }
.tchip--static { min-height: 30px; font-size: .82rem; color: var(--fg-2); background: var(--surface-2); }
.tchips--nodes { margin-top: 12px; }

/* ---------- results (client filtering) ---------- */
.tresults { margin-bottom: clamp(28px, 4vw, 44px); }
.tresults__count { font-family: var(--font-mono); font-size: .8rem; color: var(--fg-3); margin-bottom: 18px; }
.tempty { padding: 40px 0; text-align: center; color: var(--fg-2); }
.tempty h3 { margin-bottom: 8px; color: var(--fg); }
.tempty a, .tshelf a:not([class]), .tdetail .prose a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }
[hidden] { display: none !important; }

/* ---------- pager ---------- */
.tpager { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 36px; }
.tpager__a { min-width: 42px; height: 42px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; font-size: .92rem; }
.tpager__a:hover { border-color: var(--orange); }
.tpager__a.is-current { background: var(--ink); color: #fff; border-color: var(--ink); }

.trelated { margin-top: clamp(48px, 7vw, 88px); display: grid; gap: 22px; }
.trelated h2 { font-size: clamp(1.4rem, 2.4vw, 1.9rem); }
.trelated__group h3 { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-3); font-weight: 500; }

/* ---------- detail hero ---------- */
.th__hero { display: grid; gap: 32px; width: 100%; align-items: start; }
@media (min-width: 960px) { .th__hero { grid-template-columns: minmax(0, 1fr) 300px; gap: 56px; } }
.th__copy { display: grid; gap: 20px; justify-items: start; }
.th__cta { display: flex; flex-wrap: wrap; gap: 12px; }
.th .btn--ghost { --btn-fg: #fff; --btn-bd: rgba(255,255,255,.3); }
.th .btn--ghost:hover { --btn-bg: rgba(255,255,255,.1); }
.th__plan { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; color: #b6bed0; font-size: .92rem; }
.th__facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.1); border-radius: var(--r-lg); overflow: hidden; margin: 0; }
.th__facts > div { padding: 14px 16px; background: rgba(15,20,32,.9); }
.th__facts dt { font-family: var(--font-mono); font-size: .64rem; letter-spacing: .1em; text-transform: uppercase; color: #8a93a8; }
.th__facts dd { margin: 4px 0 0; color: #fff; font-weight: 600; font-size: .95rem; }

/* ---------- detail body ---------- */
.tdetail { padding-block: clamp(32px, 5vw, 64px) clamp(56px, 8vw, 96px); }
.tprev { margin: 0 0 clamp(32px, 5vw, 56px); }
.tprev img { display: block; width: 100%; height: auto; max-height: min(88vh, 900px); object-fit: contain; border-radius: var(--r-lg); background: var(--navy); border: 1px solid var(--line); box-shadow: var(--shadow-md); }
@media (max-width: 900px) { .tprev { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--r-lg); } .tprev img { width: 900px; min-width: 900px; max-width: none; max-height: none; } }
.tprev figcaption { margin-top: 12px; font-size: .86rem; color: var(--fg-3); text-align: center; }
.tdetail__grid { display: grid; gap: 40px; align-items: start; }
@media (min-width: 960px) { .tdetail__grid { grid-template-columns: minmax(0, 1fr) 340px; gap: 56px; } .tdetail__side { position: sticky; top: calc(var(--header-h) + 20px); } }
.tdetail__main { display: grid; gap: clamp(36px, 5vw, 56px); min-width: 0; }
.tdetail h2 { font-size: clamp(1.5rem, 2.4vw, 2rem); margin-bottom: 16px; }
.prose { display: grid; gap: 14px; color: var(--fg-2); max-width: 44rem; }
.prose ul, .prose ol { padding-left: 1.2rem; display: grid; gap: 6px; list-style: disc; }
.prose ol { list-style: decimal; }
.prose strong { color: var(--fg); }
.prose h3 { color: var(--fg); margin-top: 8px; }
.prose code { font-family: var(--font-mono); font-size: .88em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
.tsteps { counter-reset: s; display: grid; gap: 14px; max-width: 44rem; }
.tsteps li { counter-increment: s; display: grid; grid-template-columns: 40px 1fr; gap: 16px; align-items: start; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.tsteps li::before { content: counter(s); display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--ink); color: #fff; font-family: var(--font-mono); font-weight: 600; }
.tsteps h3 { font-size: 1.08rem; margin-bottom: 4px; }
.tsteps p { color: var(--fg-2); font-size: .96rem; }
.tfaq { max-width: none; }
.tdetail__side { display: grid; gap: 16px; min-width: 0; }
.tpanel { padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--card-shadow); }
.tpanel h2 { font-size: 1.15rem; margin-bottom: 14px; letter-spacing: -0.015em; }
.tpanel h3 { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-3); font-weight: 500; margin-top: 18px; }
.tneeds { display: grid; gap: 12px; }
.tneeds li { display: grid; grid-template-columns: 18px 1fr; gap: 10px; align-items: start; }
.tneeds svg, .tgov svg { width: 18px; height: 18px; margin-top: 2px; color: var(--teal); }
.tneeds strong { font-size: .96rem; }
.tneeds em { font-style: normal; font-family: var(--font-mono); font-size: .64rem; text-transform: uppercase; letter-spacing: .08em; color: var(--fg-3); margin-left: 6px; }
.tneeds p { color: var(--fg-2); font-size: .88rem; margin-top: 2px; }
.tneeds a { font-size: .86rem; color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }
.tneeds--plain { margin-top: 10px; }
.tnone { color: var(--fg-2); font-size: .95rem; }
.tgov { display: grid; gap: 10px; }
.tgov li { display: grid; grid-template-columns: 18px 1fr; gap: 10px; font-size: .95rem; }
.trel { padding-block: clamp(48px, 7vw, 88px); }
.tband { padding-block: clamp(40px, 6vw, 80px); }
.tfaq-sec { padding-block: clamp(56px, 8vw, 96px); }

@media (max-width: 640px) {
    .th__note { flex-direction: column; align-items: flex-start; gap: 6px; }
    .th__note i { display: none; }
    .tsearch .btn { padding: 0 16px; }
    .tfilters label { width: 100%; }
    .tfilters label { flex: 1 1 140px; }
    .tfilters .ui-sel, .tfilters .ui-select { min-width: 0; }
    .th__cta .btn { width: 100%; }
    .tsteps li { grid-template-columns: 34px 1fr; gap: 12px; padding: 16px; }
    .tsteps li::before { width: 34px; height: 34px; }
}
@media (prefers-reduced-motion: reduce) {
    .tcard, .ttile, .tmore svg { transition: none; }
    .tcard:hover { transform: none; }
}
