/* Free tool pages (tool/<slug>/index.html) — builds on css/home.css (#hm scope, hm-* components). */

/* hero + tool window */
:is(#hm,#hm2) .tp-hero{position:relative;padding:124px 0 72px;overflow:hidden;background-image:linear-gradient(var(--hm-line-2) 1px,transparent 1px),linear-gradient(90deg,var(--hm-line-2) 1px,transparent 1px);background-size:48px 48px;background-position:center top}
:is(#hm,#hm2) .tp-hero::before{content:"";position:absolute;inset:0;background:radial-gradient(60% 50% at 50% 0,rgba(255,255,255,.2),#fff 72%);pointer-events:none}
:is(#hm,#hm2) .tp-hero::after{content:"";position:absolute;left:50%;top:58%;width:min(900px,90vw);height:380px;transform:translateX(-50%);background:radial-gradient(closest-side,rgba(74,222,128,.22),transparent);filter:blur(10px);pointer-events:none}
:is(#hm,#hm2) .tp-hero .hm-wrap{position:relative;z-index:1}
:is(#hm,#hm2) .tp-crumbs{display:flex;justify-content:center;flex-wrap:wrap;gap:8px;font:500 .74rem var(--hm-mono);color:var(--hm-faint);margin-bottom:22px}
:is(#hm,#hm2) .tp-crumbs a{color:var(--hm-muted)}
:is(#hm,#hm2) .tp-crumbs a:hover{color:var(--hm-green)}
:is(#hm,#hm2) .tp-head{max-width:760px;margin:0 auto;text-align:center}
:is(#hm,#hm2) .tp-head .hm-badge{margin:0 auto 22px}
:is(#hm,#hm2) .tp-head h1{font-size:clamp(2.4rem,5.6vw,4.2rem) !important;font-weight:600 !important;letter-spacing:-.045em;line-height:1.02;color:var(--hm-ink) !important;margin:0 0 18px}
:is(#hm,#hm2) .tp-lead{font-size:1.12rem;line-height:1.65;color:var(--hm-muted);max-width:640px;margin:0 auto}
:is(#hm,#hm2) .tp-chips{display:flex;justify-content:center;flex-wrap:wrap;gap:8px 18px;margin-top:22px}
:is(#hm,#hm2) .tp-chips span{display:inline-flex;align-items:center;gap:8px;font:500 .72rem var(--hm-mono);color:var(--hm-muted)}
:is(#hm,#hm2) .tp-chips span::before{content:"";width:6px;height:6px;border-radius:50%;background:var(--hm-green)}

:is(#hm,#hm2) .tp-app{position:relative;max-width:820px;margin:48px auto 0;background:#fff;border:1px solid var(--hm-line);border-radius:16px;box-shadow:0 1px 2px rgba(0,0,0,.04),0 40px 80px -40px rgba(15,23,42,.35)}
:is(#hm,#hm2) .tp-app-bar{display:flex;align-items:center;gap:12px;height:44px;padding:0 14px;border-bottom:1px solid var(--hm-line);background:var(--hm-bg);border-radius:16px 16px 0 0}
:is(#hm,#hm2) .tp-dots{display:flex;gap:6px}
:is(#hm,#hm2) .tp-dots i{width:10px;height:10px;border-radius:50%;background:#e4e4e7}
:is(#hm,#hm2) .tp-app-url{flex:1;min-width:0;text-align:center;font:500 .72rem var(--hm-mono);color:var(--hm-faint);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
:is(#hm,#hm2) .tp-app-live{display:inline-flex;align-items:center;gap:6px;font:500 .68rem var(--hm-mono);text-transform:uppercase;color:var(--hm-green)}
:is(#hm,#hm2) .tp-app-live i{width:6px;height:6px;border-radius:50%;background:var(--hm-green);animation:tpPulse 2s ease-in-out infinite}
@keyframes tpPulse{0%,100%{box-shadow:0 0 0 0 rgba(22,163,74,.45)}50%{box-shadow:0 0 0 5px rgba(22,163,74,0)}}
:is(#hm,#hm2) .tp-app-body{padding:8px;background:#f8fafc;border-radius:0 0 16px 16px}
:is(#hm,#hm2) .tp-app-body iframe{display:block;width:100%;min-height:520px;border:0;background:#f8fafc;border-radius:10px}

/* section heads */
:is(#hm,#hm2) .tp-sec-head{max-width:680px;margin-bottom:40px}
:is(#hm,#hm2) .tp-h2{font-size:clamp(1.8rem,3.4vw,2.6rem)}

/* how it works: numbered rules */
:is(#hm,#hm2) .tp-rules{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));border:1px solid var(--hm-line);border-radius:16px;overflow:hidden;background:#fff}
:is(#hm,#hm2) .tp-rule{position:relative;padding:26px 24px;box-shadow:0 0 0 1px var(--hm-line);min-width:0;transition:background .2s}
:is(#hm,#hm2) .tp-rule::before{content:"";position:absolute;left:0;top:0;right:0;height:2px;background:var(--hm-green);transform:scaleX(0);transform-origin:left;transition:transform .35s cubic-bezier(.2,.8,.2,1)}
:is(#hm,#hm2) .tp-rule:hover{background:#fcfdfc}
:is(#hm,#hm2) .tp-rule:hover::before{transform:scaleX(1)}
:is(#hm,#hm2) .tp-rule .hm-mono{font-size:.7rem;color:var(--hm-green)}
:is(#hm,#hm2) .tp-rule h3{font-size:1.08rem;font-weight:600;letter-spacing:-.02em;color:var(--hm-ink);margin:10px 0 8px}
:is(#hm,#hm2) .tp-rule p{font-size:.9rem;line-height:1.65;color:var(--hm-muted)}

/* worked example */
:is(#hm,#hm2) .tp-ex-sec{padding-top:0}
:is(#hm,#hm2) .tp-ex{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);border:1px solid var(--hm-line);border-radius:16px;overflow:hidden}
:is(#hm,#hm2) .tp-ex-k{display:block;font:500 .68rem var(--hm-mono);text-transform:uppercase;letter-spacing:.08em;color:var(--hm-faint);margin-bottom:14px}
:is(#hm,#hm2) .tp-ex-in{padding:26px;background:var(--hm-dark);background-image:linear-gradient(rgba(255,255,255,.04) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.04) 1px,transparent 1px);background-size:24px 24px}
:is(#hm,#hm2) .tp-ex-in .tp-ex-k{color:#86efac}
:is(#hm,#hm2) .tp-ex-in pre{margin:0;white-space:pre-wrap;word-break:break-word;font:400 .9rem/1.75 var(--hm-mono);color:#e7f5ec}
:is(#hm,#hm2) .tp-ex-out{padding:26px;background:#fff}
:is(#hm,#hm2) .tp-ex-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));border:1px solid var(--hm-line);border-radius:12px;overflow:hidden}
:is(#hm,#hm2) .tp-ex-grid div{display:flex;flex-direction:column;gap:4px;padding:14px;box-shadow:0 0 0 1px var(--hm-line)}
:is(#hm,#hm2) .tp-ex-grid b{font-size:1.5rem;font-weight:600;letter-spacing:-.03em;color:var(--hm-ink);font-variant-numeric:tabular-nums}
:is(#hm,#hm2) .tp-ex-grid span{font:500 .66rem var(--hm-mono);text-transform:uppercase;letter-spacing:.05em;color:var(--hm-faint)}
:is(#hm,#hm2) .tp-ex-out p{margin-top:16px;padding:12px 14px;border-radius:10px;background:var(--hm-green-bg);border:1px solid var(--hm-green-bd);font-size:.86rem;line-height:1.6;color:#14532d}

/* reference table */
:is(#hm,#hm2) .tp-split{display:grid;grid-template-columns:minmax(0,.8fr) minmax(0,1.2fr);gap:56px;align-items:start}
:is(#hm,#hm2) .tp-split-side{position:sticky;top:120px}
:is(#hm,#hm2) .tp-table{position:relative;background:#fff;border:1px solid var(--hm-line);border-radius:16px;overflow:visible}
:is(#hm,#hm2) .tp-table table{width:100%;border-collapse:collapse;font-size:.88rem}
:is(#hm,#hm2) .tp-table th,:is(#hm,#hm2) .tp-table td{padding:13px 18px;text-align:left;border-bottom:1px solid var(--hm-line);vertical-align:top}
:is(#hm,#hm2) .tp-table thead th{font:500 .66rem var(--hm-mono);text-transform:uppercase;letter-spacing:.06em;color:var(--hm-faint);background:var(--hm-bg)}
:is(#hm,#hm2) .tp-table thead th:first-child{border-radius:16px 0 0 0}
:is(#hm,#hm2) .tp-table thead th:last-child{border-radius:0 16px 0 0}
:is(#hm,#hm2) .tp-table tbody th{font-weight:600;color:var(--hm-ink)}
:is(#hm,#hm2) .tp-table td{color:var(--hm-muted)}
:is(#hm,#hm2) .tp-table tbody tr:hover{background:#fcfdfc}
:is(#hm,#hm2) .tp-table tbody tr:last-child :is(th,td){border-bottom:0}
:is(#hm,#hm2) .tp-table-foot{margin:0;padding:12px 18px;border-top:1px dashed var(--hm-line);font-size:.8rem;line-height:1.55;color:var(--hm-faint)}

/* editorial */
:is(#hm,#hm2) .tp-ed{display:grid;grid-template-columns:minmax(0,.8fr) minmax(0,1.2fr);gap:56px}
:is(#hm,#hm2) .tp-ed-body{display:flex;flex-direction:column;gap:18px;padding-left:28px;border-left:1px solid var(--hm-line)}
:is(#hm,#hm2) .tp-ed-body p{font-size:1.02rem;line-height:1.75;color:var(--hm-text)}

/* related */
:is(#hm,#hm2) .tp-rel-head{display:flex;align-items:flex-end;justify-content:space-between;gap:24px;margin-bottom:32px}
:is(#hm,#hm2) .tp-rel-head .hm-h2{margin-bottom:0}
:is(#hm,#hm2) .tp-rels{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));border:1px solid var(--hm-line);border-radius:16px;overflow:hidden;background:#fff}
:is(#hm,#hm2) .tp-rel{position:relative;display:flex;flex-direction:column;gap:8px;padding:24px;min-width:0;box-shadow:0 0 0 1px var(--hm-line);transition:background .2s}
:is(#hm,#hm2) .tp-rel::before{content:"";position:absolute;left:0;top:0;right:0;height:2px;background:var(--hm-green);transform:scaleX(0);transform-origin:left;transition:transform .35s cubic-bezier(.2,.8,.2,1)}
:is(#hm,#hm2) .tp-rel:hover{background:#fcfdfc}
:is(#hm,#hm2) .tp-rel:hover::before{transform:scaleX(1)}
:is(#hm,#hm2) .tp-rel .hm-mono{font-size:.64rem;text-transform:uppercase;letter-spacing:.06em;color:var(--hm-faint)}
:is(#hm,#hm2) .tp-rel h3{font-size:1.05rem;font-weight:600;letter-spacing:-.02em;color:var(--hm-ink)}
:is(#hm,#hm2) .tp-rel p{font-size:.88rem;line-height:1.55;color:var(--hm-muted)}
:is(#hm,#hm2) .tp-rel-go{margin-top:auto;padding-top:8px;display:inline-flex;align-items:center;gap:6px;font-size:.82rem;font-weight:600;color:var(--hm-green)}
:is(#hm,#hm2) .tp-rel-go svg{width:13px;height:13px;fill:none;stroke:currentColor;stroke-width:2.2;transition:transform .2s}
:is(#hm,#hm2) .tp-rel:hover .tp-rel-go svg{transform:translateX(3px)}
:is(#hm,#hm2) .tp-rel-head .hm-btn svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:2}

@media (max-width:980px){
  :is(#hm,#hm2) .tp-rules{grid-template-columns:1fr 1fr}
  :is(#hm,#hm2) .tp-split,:is(#hm,#hm2) .tp-ed{grid-template-columns:1fr;gap:28px}
  :is(#hm,#hm2) .tp-split-side{position:static}
}
@media (max-width:760px){
  :is(#hm,#hm2) .tp-ex{grid-template-columns:1fr}
  :is(#hm,#hm2) .tp-rels{grid-template-columns:1fr}
  :is(#hm,#hm2) .tp-rel-head{flex-direction:column;align-items:flex-start}
}
@media (max-width:560px){
  :is(#hm,#hm2) .tp-hero{padding:108px 0 48px}
  :is(#hm,#hm2) .tp-rules{grid-template-columns:1fr}
  :is(#hm,#hm2) .tp-ex-grid{grid-template-columns:1fr 1fr}
  :is(#hm,#hm2) .tp-app{margin-top:32px}
  :is(#hm,#hm2) .tp-app-body{padding:4px}
  :is(#hm,#hm2) .tp-dots{display:none}
  :is(#hm,#hm2) .tp-ed-body{padding-left:18px}
  :is(#hm,#hm2) .tp-table th,:is(#hm,#hm2) .tp-table td{padding:11px 12px}
}
@media (prefers-reduced-motion:reduce){:is(#hm,#hm2) .tp-app-live i{animation:none}}

/* use cases + tips */
:is(#hm,#hm2) .tp-uses{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
:is(#hm,#hm2) .tp-use{position:relative;padding:24px 22px;background:#fff;border:1px solid var(--hm-line);border-radius:14px;min-width:0;transition:border-color .2s,box-shadow .2s}
:is(#hm,#hm2) .tp-use:hover{border-color:var(--hm-green-bd);box-shadow:0 18px 36px -24px rgba(22,163,74,.45)}
:is(#hm,#hm2) .tp-use h3{display:flex;align-items:center;gap:8px;font-size:1rem;font-weight:600;letter-spacing:-.02em;color:var(--hm-ink);margin-bottom:10px}
:is(#hm,#hm2) .tp-use h3::before{content:"";width:8px;height:8px;border-radius:2px;background:var(--hm-green)}
:is(#hm,#hm2) .tp-use p{font-size:.88rem;line-height:1.65;color:var(--hm-muted)}
:is(#hm,#hm2) .tp-tips{list-style:none;margin:0;padding:0;background:#fff;border:1px solid var(--hm-line);border-radius:16px;overflow:hidden}
:is(#hm,#hm2) .tp-tips li{display:flex;gap:16px;padding:18px 22px;border-bottom:1px solid var(--hm-line)}
:is(#hm,#hm2) .tp-tips li:last-child{border-bottom:0}
:is(#hm,#hm2) .tp-tips .hm-mono{flex-shrink:0;font-size:.72rem;color:var(--hm-green);padding-top:3px}
:is(#hm,#hm2) .tp-tips p{font-size:.95rem;line-height:1.65;color:var(--hm-text)}
@media (max-width:980px){:is(#hm,#hm2) .tp-uses{grid-template-columns:1fr 1fr}}
@media (max-width:560px){:is(#hm,#hm2) .tp-uses{grid-template-columns:1fr}:is(#hm,#hm2) .tp-tips li{padding:16px}}

/* long tokens (URLs, tags, records) must wrap inside the example and headings */
:is(#hm,#hm2) .tp-ex>*{min-width:0}
:is(#hm,#hm2) .tp-ex-in pre{overflow-wrap:anywhere}
:is(#hm,#hm2) .tp-ex-grid b,:is(#hm,#hm2) .tp-ex-grid span,:is(#hm,#hm2) .tp-h2,:is(#hm,#hm2) .tp-rule p,:is(#hm,#hm2) .tp-table :is(th,td){overflow-wrap:anywhere}

/* grids adapt to item count so no empty cells */
:is(#hm,#hm2) .tp-rules--n4{grid-template-columns:repeat(2,minmax(0,1fr))}
:is(#hm,#hm2) .tp-rules--n5{grid-template-columns:repeat(6,minmax(0,1fr))}
:is(#hm,#hm2) .tp-rules--n5>*{grid-column:span 2}
:is(#hm,#hm2) .tp-rules--n5>:nth-child(n+4){grid-column:span 3}
:is(#hm,#hm2) .tp-ex-grid--n4,:is(#hm,#hm2) .tp-ex-grid--n2{grid-template-columns:repeat(2,minmax(0,1fr))}
:is(#hm,#hm2) .tp-ex-grid--n5>:last-child{grid-column:span 2}
:is(#hm,#hm2) .tp-ex-grid--text{grid-template-columns:repeat(2,minmax(0,1fr))}
:is(#hm,#hm2) .tp-ex-grid--text.tp-ex-grid--n5>:last-child{grid-column:span 1}
:is(#hm,#hm2) .tp-ex-grid--text.tp-ex-grid--n3>:last-child,:is(#hm,#hm2) .tp-ex-grid--text.tp-ex-grid--n5>:last-child{grid-column:1/-1}
:is(#hm,#hm2) .tp-ex-grid--text b{font:500 .86rem/1.5 var(--hm-mono);letter-spacing:0}
@media (max-width:980px){:is(#hm,#hm2) .tp-rules--n5{grid-template-columns:1fr 1fr}:is(#hm,#hm2) .tp-rules--n5>*{grid-column:auto}:is(#hm,#hm2) .tp-rules--n5>:last-child{grid-column:1/-1}:is(#hm,#hm2) .tp-rules--n3{grid-template-columns:1fr}}
@media (max-width:560px){:is(#hm,#hm2) .tp-rules--n4,:is(#hm,#hm2) .tp-rules--n5{grid-template-columns:1fr}:is(#hm,#hm2) .tp-rules--n5>:last-child{grid-column:auto}:is(#hm,#hm2) .tp-ex-grid--text{grid-template-columns:1fr}:is(#hm,#hm2) .tp-ex-grid--text>*{grid-column:auto !important}}

/* illustration beside "Our take" */
:is(#hm,#hm2) .tp-fig{margin:28px 0 0;position:relative}
:is(#hm,#hm2) .tp-fig img{display:block;width:100%;height:auto;border-radius:16px;border:1px solid var(--hm-line);background:#fafafa;box-shadow:0 30px 60px -40px rgba(15,23,42,.35)}
:is(#hm,#hm2) .tp-fig figcaption{margin-top:10px;font:500 .68rem var(--hm-mono);text-transform:uppercase;letter-spacing:.06em;color:var(--hm-faint)}
@media (min-width:981px){:is(#hm,#hm2) .tp-ed-side{position:sticky;top:110px;align-self:start}}
:is(#hm,#hm2) .tp-uses--n3{grid-template-columns:repeat(3,minmax(0,1fr))}
@media (max-width:980px){:is(#hm,#hm2) .tp-uses--n3{grid-template-columns:1fr}}

/* tips: full-width title, then list left + illustration right */
:is(#hm,#hm2) .tp-tips-head{max-width:900px;margin-bottom:36px}
:is(#hm,#hm2) .tp-tips-head .hm-lead{max-width:680px}
:is(#hm,#hm2) .tp-tips-row{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,.9fr);gap:48px;align-items:start}
:is(#hm,#hm2) .tp-tips-row--solo{grid-template-columns:minmax(0,1fr);max-width:820px}
:is(#hm,#hm2) .tp-fig--tips{margin:0}
@media (min-width:981px){:is(#hm,#hm2) .tp-fig--tips{position:sticky;top:110px}}
@media (max-width:980px){:is(#hm,#hm2) .tp-tips-row{grid-template-columns:1fr;gap:28px}}

/* media rows: one column is only the illustration, stretched to the copy's height */
:is(#hm,#hm2) .tp-media{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:56px;align-items:stretch}
:is(#hm,#hm2) .tp-media--solo{grid-template-columns:minmax(0,1fr);max-width:820px}
:is(#hm,#hm2) .tp-media-copy{min-width:0;align-self:center}
:is(#hm,#hm2) .tp-media-copy .hm-h2{margin-bottom:20px}
:is(#hm,#hm2) .tp-ed-text{display:flex;flex-direction:column;gap:16px}
:is(#hm,#hm2) .tp-ed-text p{font-size:1rem;line-height:1.75;color:var(--hm-text)}
:is(#hm,#hm2) .tp-media-copy .hm-lead{margin-bottom:24px}
:is(#hm,#hm2) .tp-frame{position:relative;margin:0;min-height:100%;display:flex;align-items:center;justify-content:center;padding:24px;border:1px solid var(--hm-line);border-radius:20px;overflow:hidden;background-color:#fafafa;background-image:linear-gradient(#e9ece9 1px,transparent 1px),linear-gradient(90deg,#e9ece9 1px,transparent 1px);background-size:40px 40px;box-shadow:0 30px 60px -44px rgba(15,23,42,.35)}
:is(#hm,#hm2) .tp-frame::before{content:"";position:absolute;inset:0;background:radial-gradient(70% 60% at 50% 50%,rgba(250,250,250,0) 40%,#fafafa 95%);pointer-events:none}
:is(#hm,#hm2) .tp-frame img{position:relative;display:block;width:100%;height:auto;max-height:100%;object-fit:contain}
:is(#hm,#hm2) .tp-frame figcaption{position:absolute;left:18px;bottom:14px;font:500 .66rem var(--hm-mono);text-transform:uppercase;letter-spacing:.06em;color:var(--hm-faint)}
:is(#hm,#hm2) .tp-media--rev>.tp-frame{order:2}
@media (max-width:980px){
  :is(#hm,#hm2) .tp-media{grid-template-columns:1fr;gap:28px}
  :is(#hm,#hm2) .tp-media>.tp-frame{order:2;min-height:0;padding:12px 12px 36px}
}

/* portrait illustrations: frame = image area + caption strip; image never cropped */
:is(#hm,#hm2) .tp-frame{flex-direction:column;align-items:stretch;justify-content:flex-start;padding:0;min-height:0}
:is(#hm,#hm2) .tp-frame img{flex:1;width:100%;height:100%;min-height:0;max-height:none;object-fit:contain;aspect-ratio:1000/1120}
:is(#hm,#hm2) .tp-frame figcaption{position:relative;left:auto;bottom:auto;padding:12px 18px;border-top:1px solid var(--hm-line);background:rgba(255,255,255,.7)}
@media (max-width:980px){:is(#hm,#hm2) .tp-media>.tp-frame{padding:0;max-width:560px;width:100%;justify-self:center}}
:is(#hm,#hm2) .tp-updated{margin-top:14px;font:500 .7rem var(--hm-mono);color:var(--hm-faint);text-align:center}
:is(#hm,#hm2) .tp-updated time{color:var(--hm-muted)}
