
/* The templates gallery. The same page doing the same job as the live one (title and search, the category pills, the
   Featured template, "All Templates", the cards three a row with a like, Load more, nothing found, the link list), with
   its UI redesigned (Lime, 19 Nov: "redo this entirely ... You made the old one pretty much with just the new
   roundnesses. Now improve it"). A template is drawn as the site's own template card, the one on the home page: the
   picture first (the server's window on its category's colour, its real logo, its channels), then the name and category,
   its line, its counts with a dot a role, and under a hairline who made it and the like. Featured is that card, big.
   Figma: section "Templates gallery, new look" 7079:1907, frame 7079:1908. Built by build_templates.py. */
.tools.tpl{padding-top:160px;align-items:center}
.tpl [hidden]{display:none!important}
.tp-wrap{width:min(1180px,calc(100vw - 48px))}
/* a category page (Figma "Category page, Gaming" 7116:1908): the template page's trail at 112, 28 over the title at 160;
   its pills are links to the other category pages, the picked one says so */
.tools.tpl[data-only]{padding-top:112px}
/* the trail (shared with a template page, whose stylesheet is built from this one) */
.tp-trail{display:flex;align-items:center;gap:8px;height:20px;margin:0;font-size:14px;line-height:20px;font-weight:500;white-space:nowrap}
.tp-trail a{color:var(--faint);text-decoration:none;border-radius:6px;transition:color .15s var(--ease)}
.tp-trail a:hover{color:#F2F2F2}
.tp-trail a:focus-visible{outline:2px solid #8B5CF6;outline-offset:3px}
.tp-trail span{color:#4D4D4D}
/* the search sits under the line on every category page, so the page does not move when a pill opens the next one
   (the longest heading, "Sports and Fitness Server Templates", is 990 wide; Figma 7117:1907) */
[data-only] .tp-top{flex-direction:column;align-items:flex-start;gap:32px}
/* a category heading is two parts ("Sports and Fitness" "Server Templates"): one line where it fits, two where it does not */
[data-only] h1 .line{display:inline-block}
[data-only] .tp-trail{margin-bottom:28px}
[data-only] .tp-trail b{font-weight:500;color:#F2F2F2}
a.tp-cat{text-decoration:none}
.tp-top{display:flex;align-items:flex-end;justify-content:space-between;gap:32px}
.tpl h1{text-align:left}
.tp-sub{margin:16px 0 0;font-size:18px;line-height:28px;font-weight:400;letter-spacing:-.01em;color:var(--soft);overflow:hidden}
.tp-sub span{display:block;will-change:transform}

/* search: 320 x 48, fully round, its foot on the line the sub line ends on */
.tp-search{position:relative;flex:none;width:320px;height:48px}
.tp-search svg{position:absolute;left:18px;top:16px;color:var(--faint);pointer-events:none}
.tp-search input{display:block;width:100%;height:48px;margin:0;border:0;border-radius:24px;background:#171717;box-shadow:inset 0 0 0 1px #262626;padding:0 20px 0 44px;font:400 14px/20px "Inter",system-ui,sans-serif;color:var(--white);outline:0;-webkit-appearance:none;appearance:none;transition:box-shadow .15s var(--ease)}
.tp-search input::placeholder{color:var(--faint);opacity:1}
.tp-search input::-webkit-search-cancel-button,.tp-search input::-webkit-search-decoration{-webkit-appearance:none}
.tp-search input:hover{box-shadow:inset 0 0 0 1px #333333}
.tp-search input:focus-visible{box-shadow:inset 0 0 0 2px #8B5CF6}

/* the category pills: 40 high, fully round, one row at full width. A picked pill is heavier, so each pill keeps the room
   its heavier words need (the hidden copy under it) and the row never shifts. */
.tp-cats{display:flex;flex-wrap:wrap;gap:8px 6px;margin:40px 0 0;padding:0;list-style:none}
.tp-cat{display:inline-flex;flex-direction:column;align-items:center;justify-content:center;height:40px;margin:0;padding:0 14px;border:0;border-radius:20px;background:#1C1C1C;color:var(--soft);font:500 13px/20px "Inter",system-ui,sans-serif;white-space:nowrap;cursor:pointer;-webkit-tap-highlight-color:transparent;transition:background-color .15s var(--ease),color .15s var(--ease),transform .12s var(--ease)}
.tp-cat::after{content:attr(data-l);height:0;overflow:hidden;visibility:hidden;font-weight:600}
.tp-cat:hover{background:#242424;color:#F2F2F2}
.tp-cat:active{transform:scale(.97)}
.tp-cat[aria-pressed="true"],.tp-cat[aria-current="page"]{background:#F5F5F5;color:#0A0A0A;font-weight:600}
.tp-cat:focus-visible{outline:2px solid #8B5CF6;outline-offset:2px}

/* a tag, 26 high and fully round: a category's tag takes that category's colour, mixed solid onto the card.
   Trending is a status, so it is an icon: a flame on amber, the tag's own height. */
.tp-tag{flex:none;height:26px;padding:0 10px;border-radius:13px;background:var(--g,#262626);color:var(--x,#F2F2F2);font-size:12px;line-height:26px;font-weight:500;white-space:nowrap}
.tp-hot{flex:none;width:26px;height:26px;border-radius:13px;background:#2B2212;color:#FBBF24;display:grid;place-items:center}

/* the server's window, as the home page's card draws it: the logo on a white tile (a letter when there is none), the
   name, a caret, a hairline, then channels on 28 rows with the one in view lit */
.tp-win{position:relative;height:200px;border-radius:12px;background:#0E0E0E;box-shadow:inset 0 0 0 1px #262626;overflow:hidden}
.tp-wh{display:flex;align-items:center;gap:10px;height:44px;padding:0 12px}
.tp-logo{flex:none;width:28px;height:28px;border-radius:8px;background:#FFFFFF;display:grid;place-items:center}
.tp-logo img{display:block;width:16px;height:16px}
.tp-logo.tp-let{background:#1F1F1F;font-size:13px;line-height:20px;font-weight:600;color:var(--white)}
.tp-wn{flex:1;min-width:0;font-size:13px;line-height:20px;font-weight:600;color:#F2F2F2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tp-wh svg{flex:none;color:var(--faint)}
.tp-ch{height:156px;margin:0 1px;padding:7px 5px 0;border-top:1px solid #1F1F1F;overflow:hidden}
.tp-chs{display:block}
.tp-c{display:flex;align-items:center;height:28px;padding-left:8px;border-radius:6px;font-size:13px;line-height:20px;color:var(--soft);white-space:nowrap;overflow:hidden}
.tp-c i{flex:none;display:flex;align-items:center;width:20px;font-style:normal;font-weight:500;color:#6B6B6B}
.tp-c img{flex:none;display:block;width:14px;height:14px;margin-right:8px}
.tp-c b{min-width:0;font-weight:400;overflow:hidden;text-overflow:ellipsis}
.tp-c.on{background:#1F1F1F;color:#F2F2F2}
.tp-c.on b{font-weight:500}

/* Featured: the card, big. Its words at the left, centred top to bottom; at the right its picture, the window with the
   channels in their groups and the roles beside them, running off the foot of the picture. */
.tp-feat{display:flex;align-items:center;gap:32px;margin-top:32px;height:416px;padding:8px 8px 8px 48px;border-radius:28px;background:#171717;box-shadow:inset 0 0 0 1px var(--o),0 8px 24px rgba(0,0,0,.4)}
.tp-ftext{flex:1 1 280px;min-width:280px}
.tp-tags{display:flex;gap:8px}
.tp-feat h2{margin:20px 0 0;font-size:40px;line-height:48px;font-weight:600;letter-spacing:-.02em;color:var(--white);overflow-wrap:anywhere}
.tp-fline{margin:12px 0 0;max-width:420px;font-size:16px;line-height:24px;color:var(--soft);text-wrap:pretty;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.tp-ffacts{margin:24px 0 0;font-size:14px;line-height:20px;color:var(--faint)}
.tp-view{margin-top:32px;display:inline-flex;align-items:center;gap:8px;height:48px;padding:0 22px 0 24px;border-radius:24px;background:#F5F5F5;color:#0A0A0A;font-size:14px;line-height:20px;font-weight:600;text-decoration:none;white-space:nowrap;-webkit-tap-highlight-color:transparent;transition:background-color .15s var(--ease),transform .12s var(--ease)}
.tp-view:hover{background:#FFFFFF}
.tp-view:active{transform:scale(.97)}
.tp-view:focus-visible{outline:2px solid #8B5CF6;outline-offset:3px}
.tp-view svg{transition:transform .15s var(--ease)}
.tp-view:hover svg{transform:translateX(2px)}
.tp-fpic{flex:0 1 640px;min-width:0;align-self:stretch;padding:32px 32px 0;border-radius:20px;background:var(--t);overflow:hidden}
.tp-win.tp-big{display:flex;flex-direction:column;height:420px}
.tp-big .tp-wh{flex:none;height:48px;padding:0 16px 0 14px;gap:12px}
.tp-big .tp-wn{font-size:14px}
.tp-cols{flex:1;min-height:0;display:flex;margin:0 1px;border-top:1px solid #1F1F1F}
.tp-col{flex:none;width:299px;padding:7px 5px 0;overflow:hidden}
.tp-col + .tp-col{flex:1;width:auto;min-width:0;padding:7px 8px 0 9px;border-left:1px solid #1F1F1F}
.tp-g{margin:4px 0 0;height:20px;padding:2px 8px 0;font-size:11px;line-height:16px;font-weight:500;color:var(--faint);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tp-g:first-child{margin-top:0}
.tp-col + .tp-col .tp-g{padding-left:6px}
.tp-r{display:flex;align-items:center;gap:8px;height:28px;padding-left:6px;font-size:13px;line-height:20px;font-weight:500;color:#E5E5E5;white-space:nowrap;overflow:hidden}
.tp-r i{flex:none;width:10px;height:10px;border-radius:50%}
.tp-r b{min-width:0;font-weight:500;overflow:hidden;text-overflow:ellipsis}

/* "All Templates" and how many */
.tp-head{display:flex;align-items:baseline;justify-content:space-between;gap:24px;margin:64px 0 24px}
.tp-head h2{margin:0;font-size:24px;line-height:32px;font-weight:600;letter-spacing:-.02em;color:var(--white)}
.tp-head span{font-size:13px;line-height:20px;color:var(--faint);white-space:nowrap}

/* the cards: three a row, 20 apart, each 376 high. The whole card is one link (the name's); the like sits over it.
   Under the pointer the card rises 4 and its outline strengthens (the home page's card), and its channel list glides
   up to show more of the server. */
.tp-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:20px;margin:0;padding:0;list-style:none}
.tp-grid.alone{margin-top:32px}
.tp-card{position:relative;min-width:0;padding:8px 8px 20px;border-radius:28px;background:#171717;box-shadow:inset 0 0 0 1px var(--o),0 8px 24px rgba(0,0,0,.4);transition:transform .2s var(--ease),box-shadow .2s var(--ease)}
.tp-tint{height:164px;padding:16px 20px 0;border-radius:20px;background:var(--t);overflow:hidden}
.tp-name{display:flex;align-items:center;gap:6px;height:28px;margin:16px 16px 0}
.tp-name h3{flex:1;min-width:0;margin:0;font-size:20px;line-height:28px;font-weight:600;letter-spacing:-.02em;color:var(--white);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tp-open{color:inherit;text-decoration:none;outline:0}
.tp-open::after{content:"";position:absolute;inset:0;border-radius:28px}
.tp-open:focus-visible::after{outline:2px solid #8B5CF6;outline-offset:3px}
.tp-line{margin:12px 16px 0;height:40px;font-size:14px;line-height:20px;color:#A3A3A3;text-wrap:pretty;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}
.tp-facts{display:flex;align-items:center;justify-content:space-between;gap:12px;height:20px;margin:12px 16px 0;font-size:13px;line-height:20px;color:var(--faint);white-space:nowrap}
.tp-facts span:first-child{min-width:0;overflow:hidden;text-overflow:ellipsis}
.tp-dots{flex:none;display:flex;gap:5px}
.tp-dots b{width:8px;height:8px;border-radius:50%}
.tp-foot{display:flex;align-items:center;justify-content:space-between;gap:12px;height:44px;margin:12px 16px 0;padding-top:11px;border-top:1px solid #262626}
.tp-by{display:flex;align-items:center;gap:8px;min-width:0;font-size:13px;line-height:20px;color:var(--faint);white-space:nowrap}
.tp-by b{min-width:0;font-weight:500;color:#F2F2F2;overflow:hidden;text-overflow:ellipsis}
.tp-av{flex:none;width:20px;height:20px;border-radius:50%;background:#000000;box-shadow:inset 0 0 0 1px #262626;display:grid;place-items:center;font-size:10px;line-height:20px;font-weight:600;color:#F2F2F2}
.tp-av img{display:block;width:12px;height:10px;object-fit:contain}
.tp-av{-webkit-user-select:none;user-select:none}   /* a picture, not words: a selection paints only the words */
.tp-like{position:relative;z-index:1;flex:none;display:flex;align-items:center;gap:6px;height:32px;margin:0;padding:0 12px 0 10px;border:0;border-radius:16px;background:#1F1F1F;color:#F2F2F2;font:500 13px/20px "Inter",system-ui,sans-serif;font-variant-numeric:tabular-nums;cursor:pointer;-webkit-tap-highlight-color:transparent;transition:background-color .15s var(--ease),transform .12s var(--ease)}
.tp-like svg{color:var(--soft);transition:color .15s var(--ease)}
.tp-like:hover{background:#2A2A2A}
.tp-like:hover svg{color:#F2F2F2}
.tp-like:active{transform:scale(.97)}
.tp-like:focus-visible{outline:2px solid #8B5CF6;outline-offset:2px}
@media (hover:hover) and (pointer:fine){
  .tp-card:hover{box-shadow:inset 0 0 0 1px var(--oh),0 8px 24px rgba(0,0,0,.4)}
}
@media (hover:hover) and (pointer:fine) and (prefers-reduced-motion:no-preference){
  .tp-card:hover{transform:translateY(-4px)}
  .tp-chs{transition:transform .45s var(--ease)}
  .tp-card:hover .tp-chs{transform:translateY(calc(var(--more,0px) * -1));transition:transform var(--glide,1.2s) cubic-bezier(.3,0,.2,1) .18s}
}

/* said to a screen reader when a search or a category changes the list; never drawn */
.tp-say{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}

/* Load more, and nothing found */
.tp-more{display:flex;justify-content:center;margin-top:48px}
.tp-btn{display:inline-flex;align-items:center;justify-content:center;height:48px;margin:0;padding:0 24px;border:0;border-radius:24px;background:#262626;color:#F2F2F2;font:500 14px/20px "Inter",system-ui,sans-serif;white-space:nowrap;cursor:pointer;-webkit-tap-highlight-color:transparent;transition:background-color .15s var(--ease),transform .12s var(--ease)}
.tp-btn:hover{background:#303030}
.tp-btn:active{transform:scale(.97)}
.tp-btn:focus-visible{outline:2px solid #8B5CF6;outline-offset:2px}
.tp-btn.tp-sm{height:40px;padding:0 18px;border-radius:20px}
.tp-none{display:flex;flex-direction:column;align-items:center;padding:64px 0 80px}
.tp-none span{width:48px;height:48px;border-radius:12px;background:#171717;box-shadow:inset 0 0 0 1px #262626;display:grid;place-items:center;color:var(--faint)}
.tp-none p{margin:16px 0 20px;font-size:20px;line-height:28px;font-weight:600;letter-spacing:-.02em;color:var(--white);text-align:center}

/* "Browse every template": the page's plain list of links. A row a category: its name, then its templates. */
.tp-dir{margin-top:120px}
.tp-dir h2{margin:0 0 32px;font-size:24px;line-height:32px;font-weight:600;letter-spacing:-.02em;color:var(--white)}
.tp-drow{display:grid;grid-template-columns:160px minmax(0,1fr);gap:0 20px;padding:14px 0;border-top:1px solid #1C1C1C}
.tp-drow h3{margin:0;font-size:13px;line-height:24px;font-weight:600;color:#F2F2F2}
.tp-drow ul{display:flex;flex-wrap:wrap;gap:0 24px;margin:0;padding:0;list-style:none}
.tp-drow a{font-size:14px;line-height:24px;color:var(--soft);text-decoration:none;border-radius:6px;transition:color .15s var(--ease)}
.tp-drow a:hover{color:#F2F2F2}
.tp-drow a:focus-visible{outline:2px solid #8B5CF6;outline-offset:2px}

/* the sign in popup: centred, over a 60% dim */
.tp-pop{margin:auto;padding:0;border:0;background:transparent;color:inherit;max-width:none;max-height:none;overflow:visible}
.tp-pop::backdrop{background:rgba(0,0,0,.6)}
.tp-popc{display:flex;flex-direction:column;align-items:center;width:min(400px,calc(100vw - 32px));padding:32px;border-radius:28px;background:#1C1C1C;box-shadow:0 24px 64px rgba(0,0,0,.5)}
.tp-popc > span{width:48px;height:48px;border-radius:12px;background:#000000;box-shadow:inset 0 0 0 1px #262626;display:grid;place-items:center}
.tp-popc > span img{display:block;width:24px;height:24px}
.tp-popc h2{margin:20px 0 24px;font-size:24px;line-height:32px;font-weight:500;letter-spacing:-.01em;color:var(--white);text-align:center}
.tp-popgo{display:grid;place-items:center;width:100%;height:48px;border-radius:24px;background:#F5F5F5;color:#0A0A0A;font-size:14px;line-height:20px;font-weight:600;text-decoration:none;-webkit-tap-highlight-color:transparent;transition:background-color .15s var(--ease),transform .12s var(--ease)}
.tp-popgo:hover{background:#FFFFFF}
.tp-popgo:active{transform:scale(.97)}
.tp-popgo:focus-visible{outline:2px solid #8B5CF6;outline-offset:3px}
.tp-popc .tp-btn{width:100%;margin-top:8px}
@media (prefers-reduced-motion: no-preference){
  .tp-pop[open] .tp-popc{animation:tpPopIn .26s var(--out)}
  .tp-pop[open]::backdrop{animation:tpDimIn .2s ease-out}
}
@keyframes tpPopIn{from{transform:scale(.96);opacity:0}}
@media (max-width:759px) and (prefers-reduced-motion:no-preference){
  .tp-pop[open] .tp-popc{animation:tpSheetIn .34s var(--out)}
}
@keyframes tpSheetIn{from{transform:translateY(calc(100% + 24px))}}
@keyframes tpDimIn{from{opacity:0}}

/* narrower windows: two cards a row, then one; Featured's picture under its words on a phone */
@media (max-width:1099px){
  .tp-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .tp-feat{padding-left:40px;gap:24px}
}
@media (max-width:759px){
  /* A phone (Figma "Templates gallery, phone" 7102:1907): the column 20 in from each side, the phone heading, the
     search types at 16 (a phone zooms in on a smaller field), the categories ONE strip that scrolls sideways inside
     itself (four rows of pills pushed the templates a screen down), fading at the end that has more. */
  .tools.tpl{padding-top:112px}
  .tools.tpl[data-only]{padding-top:96px}
  [data-only] .tp-trail{margin-bottom:20px}
  .tp-wrap{width:min(480px,calc(100vw - 40px))}
  .tpl h1{font-size:min(36px,calc((min(480px,100vw - 40px)) / 10.6));line-height:1.3333}
  .tp-sub{margin-top:12px;font-size:16px;line-height:24px;letter-spacing:0}
  .tp-top,[data-only] .tp-top{flex-direction:column;align-items:stretch;gap:24px}
  .tp-search{width:100%}
  .tp-search input{font-size:16px;line-height:24px}
  .tp-cats{flex-wrap:nowrap;gap:6px;margin:14px -20px 0;padding:2px 20px;overflow-x:auto;scroll-padding:0 20px;scrollbar-width:none;overscroll-behavior-x:contain}
  .tp-cats::-webkit-scrollbar{display:none}
  .tp-cats li{flex:none}
  .tp-cat{position:relative}
  .tp-cat::before{content:"";position:absolute;inset:-2px 0}   /* 40 drawn, 44 to the thumb */
  .tp-cats.tp-cut{-webkit-mask-image:linear-gradient(to right,#000 calc(100% - 24px),transparent);mask-image:linear-gradient(to right,#000 calc(100% - 24px),transparent)}
  .tp-cats.tp-cutl{-webkit-mask-image:linear-gradient(to right,transparent,#000 24px);mask-image:linear-gradient(to right,transparent,#000 24px)}
  .tp-cats.tp-cut.tp-cutl{-webkit-mask-image:linear-gradient(to right,transparent,#000 24px,#000 calc(100% - 24px),transparent);mask-image:linear-gradient(to right,transparent,#000 24px,#000 calc(100% - 24px),transparent)}
  .tp-cats{margin-bottom:-2px}   /* its 2 of touch room under the pills is not space */
  .tp-grid{grid-template-columns:minmax(0,1fr);gap:16px}
  /* a popup is a sheet at the foot of the screen: 12 from the sides and the foot, corners 28, 24 inside, rising up */
  .tp-pop{margin:auto 12px max(12px,env(safe-area-inset-bottom));width:calc(100vw - 24px)}
  .tp-pop .tp-popc{width:100%;max-height:calc(100dvh - 92px);padding:24px;border-radius:28px;overflow-y:auto}
  .tp-feat{flex-direction:column;align-items:stretch;height:auto;padding:8px;gap:0}
  .tp-ftext{flex:none;min-width:0;padding:24px 16px 28px;order:2}
  .tp-feat h2{font-size:32px;line-height:40px}
  .tp-fpic{flex:none;height:220px;padding:20px 20px 0}
  .tp-head{margin-top:48px}
  .tp-like::after{content:"";position:absolute;inset:-6px}   /* 32 drawn, 44 to the thumb */
  .tp-drow{grid-template-columns:minmax(0,1fr)}
  .tp-dir{margin-top:80px}
}
