/* BridgeWell — Tools Library
   Filterable directory with search, faceted multi-select chips, and an
   expandable detail drawer. Pulls tokens from site.css.
*/

/* Widen the container on this page so the filter rail + grid get more
   breathing room and the side margins feel tighter. */
.tl-hero .container,
.tl-body .container{
  max-width:1400px;
  padding-inline:48px;
}

/* ===== Hero ===== */
.tl-hero{
  background:var(--tan);
  padding:var(--hero-pad-top) 0 var(--section-pad-sm);
  position:relative;
}
.tl-hero-wrap{display:flex;flex-direction:column;gap:22px;max-width:920px;}
.tl-hero-title{
  margin:0;color:var(--forest);
  font-weight:200;
  font-size:clamp(40px,5.2vw,76px);
  line-height:1.02;letter-spacing:-.032em;
  text-wrap:balance;
}
.tl-hero-title em{font-style:normal;font-weight:300;color:var(--forest);}
.tl-hero-title em::after{
  content:"";
}
.tl-hero-lede{
  margin:0;max-width:62ch;
  font-size:clamp(17px,1.3vw,20px);line-height:1.55;
  color:var(--ink-2);font-weight:400;
}

/* Search input — pill, large */
.tl-search{
  margin-top:14px;
  position:relative;
  display:flex;align-items:center;
  background:#fff;
  border-radius:var(--radius-pill);
  box-shadow:0 1px 2px rgba(24,48,37,.05), inset 0 0 0 1.5px var(--line-soft);
  max-width:640px;
  transition:box-shadow .18s var(--ease-out);
}
.tl-search:focus-within{
  box-shadow:0 1px 2px rgba(24,48,37,.05), inset 0 0 0 1.5px var(--forest);
}
.tl-search-icon{
  display:inline-flex;align-items:center;justify-content:center;
  width:22px;height:22px;flex:0 0 auto;
  margin-left:22px;color:var(--ink-3);
}
.tl-search-input{
  flex:1;min-width:0;
  padding:18px 12px 18px 14px;
  border:0;background:transparent;outline:none;
  font:inherit;font-size:16.5px;color:var(--forest);
  font-family:'DM Sans',system-ui,sans-serif;
  /* Suppress browser-default focus indicators that ignore outline:none
     on input[type=search] (iOS Safari especially). The pill container
     handles the focus state via :focus-within. */
  -webkit-appearance:none;appearance:none;
  -webkit-tap-highlight-color:transparent;
}
.tl-search-input:focus,
.tl-search-input:focus-visible{
  outline:0 !important;border:0 !important;box-shadow:none !important;
}
/* Strip iOS's built-in clear-X — we have our own .tl-search-clear button. */
.tl-search-input::-webkit-search-decoration,
.tl-search-input::-webkit-search-cancel-button,
.tl-search-input::-webkit-search-results-button,
.tl-search-input::-webkit-search-results-decoration{-webkit-appearance:none;}
.tl-search-input::placeholder{color:var(--ink-3);}
.tl-search-clear{
  display:inline-flex;align-items:center;justify-content:center;
  width:36px;height:36px;flex:0 0 auto;
  margin-right:10px;
  background:transparent;border:0;border-radius:50%;
  color:var(--ink-3);cursor:pointer;
  transition:background .18s var(--ease-out),color .18s var(--ease-out);
}
.tl-search-clear[hidden]{display:none;}
.tl-search-clear:hover{background:var(--surface-2);color:var(--forest);}
.tl-search-clear svg{width:16px;height:16px;}

/* ===== Body (filters + grid) ===== */
.tl-body{
  background:var(--surface-2);
  padding:48px 0 var(--section-pad);
  min-height:60vh;
}
.tl-layout{
  display:grid;
  grid-template-columns:260px minmax(0,1fr);
  gap:48px;
  align-items:start;
}

/* ----- Filter sidebar ----- */
.tl-filters{
  position:sticky;top:96px;
  display:flex;flex-direction:column;gap:24px;
  padding:24px 24px 28px;
  background:#fff;
  border-radius:var(--radius-card);
  border:1px solid var(--line-soft);
  max-height:calc(100vh - 120px);
  overflow-y:auto;
}
.tl-filters-head{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding-bottom:14px;border-bottom:1px solid var(--line-soft);
}
.tl-filters-title{
  margin:0;
  font-size:13.5px;font-weight:600;color:var(--forest);letter-spacing:-.005em;
}
.tl-filters-groups{
  display:flex;flex-direction:column;gap:22px;
}
.tl-filter-group{
  display:flex;flex-direction:column;gap:10px;
}
.tl-filter-label{
  font-family:'JetBrains Mono','SF Mono',ui-monospace,monospace;
  font-size:10.5px;letter-spacing:.16em;text-transform:uppercase;font-weight:600;
  color:var(--ink-3);
  line-height:1;
}
.tl-chips{
  display:flex;flex-wrap:wrap;gap:6px;min-width:0;
}
.tl-chip{
  display:inline-flex;align-items:center;gap:7px;
  padding:7px 12px;
  border-radius:var(--radius-pill);
  background:transparent;
  color:var(--forest);
  font-family:inherit;font-size:13px;font-weight:500;line-height:1;
  border:0;cursor:pointer;
  box-shadow:inset 0 0 0 1.5px var(--line);
  transition:background .18s var(--ease-out), box-shadow .18s var(--ease-out), color .18s var(--ease-out);
  white-space:nowrap;
}
.tl-chip:hover{box-shadow:inset 0 0 0 1.5px var(--forest);}
.tl-chip:focus-visible{outline:2px solid var(--forest);outline-offset:2px;}
.tl-chip[aria-pressed="true"]{
  background:var(--forest);color:var(--lime);
  box-shadow:inset 0 0 0 1.5px var(--forest);
}
.tl-chip[aria-pressed="true"]:hover{background:var(--forest-deep);}
.tl-chip-count{
  font-size:11px;font-weight:600;opacity:.78;
  font-variant-numeric:tabular-nums;
}
.tl-chip[aria-pressed="true"] .tl-chip-count{opacity:.9;}

/* "Clear all" lives in the filter header */
.tl-clear{
  background:transparent;border:0;cursor:pointer;
  font:inherit;font-size:12.5px;font-weight:600;
  color:var(--forest);
  display:inline-flex;align-items:center;gap:6px;
  padding:4px 10px;border-radius:var(--radius-pill);
  transition:background .18s var(--ease-out);
}
.tl-clear:hover{background:var(--surface-2);}
.tl-clear[hidden]{display:none;}
.tl-clear::before{
  content:"";display:inline-block;
  width:12px;height:12px;
  background:currentColor;flex:0 0 auto;
  mask:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 6l12 12'/><path d='M18 6L6 18'/></svg>") center/contain no-repeat;
  -webkit-mask:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 6l12 12'/><path d='M18 6L6 18'/></svg>") center/contain no-repeat;
}

/* ----- Results column ----- */
.tl-results{display:flex;flex-direction:column;gap:16px;min-width:0;}
.tl-summary{
  display:flex;align-items:center;justify-content:space-between;gap:16px;
  padding:0 4px;
}
.tl-count{
  font-size:14px;color:var(--ink-2);font-weight:500;
  font-variant-numeric:tabular-nums;
}
.tl-count strong{color:var(--forest);font-weight:600;}

/* ----- Grid ----- */
.tl-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:18px;
}
@media (min-width:1320px){.tl-grid{grid-template-columns:repeat(3,minmax(0,1fr));}}
@media (max-width:920px){.tl-grid{grid-template-columns:1fr;gap:14px;}}

/* ----- Tool card ----- */
.tl-card{
  position:relative;
  display:flex;flex-direction:column;
  background:#fff;
  border-radius:var(--radius-card);
  padding:26px 26px 22px;
  min-height:220px;
  border:1px solid var(--line-soft);
  transition:transform .25s var(--ease-out), box-shadow .25s var(--ease-out), border-color .25s var(--ease-out);
}
.tl-card:hover{
  transform:translateY(-2px);
  box-shadow:0 16px 32px rgba(24,48,37,.10),0 2px 4px rgba(24,48,37,.05);
  border-color:transparent;
}
.tl-card h3{
  margin:0 0 10px;
  font-size:19px;font-weight:600;line-height:1.25;letter-spacing:-.012em;
  color:var(--forest);text-wrap:balance;
}
.tl-card-excerpt{
  margin:0 0 18px;
  font-size:14.5px;line-height:1.55;color:var(--ink-2);
  display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;
  overflow:hidden;text-overflow:ellipsis;
}
.tl-card-tags{
  display:flex;flex-wrap:wrap;gap:6px;
  margin:auto 0 16px;
}
.tl-tag{
  display:inline-flex;align-items:center;
  padding:5px 11px;border-radius:var(--radius-pill);
  font-size:11.5px;font-weight:600;letter-spacing:.02em;line-height:1;
  white-space:nowrap;
}
.tl-tag-evidence{background:rgba(177,214,117,.22);color:var(--forest);}
.tl-tag-type{background:var(--surface-2);color:var(--ink-2);box-shadow:inset 0 0 0 1px var(--line-soft);}

.tl-card-more{
  align-self:flex-start;
  background:transparent;border:0;cursor:pointer;
  font:inherit;font-size:13.5px;font-weight:600;color:var(--forest);
  padding:8px 0;
  display:inline-flex;align-items:center;gap:8px;
  position:relative;
}
.tl-card-more::after{
  content:"";position:absolute;
  left:0;right:0;bottom:6px;height:1.5px;
  background:currentColor;
  transform:scaleX(.32);transform-origin:left;
  transition:transform .25s var(--ease-out);
}
.tl-card-more:hover::after{transform:scaleX(1);}
.tl-card-more .arr{transition:transform .22s var(--ease-out);}
.tl-card-more:hover .arr{transform:translateX(3px);}

/* ----- Custom Tool CTA card ----- */
.tl-card-custom{
  background:var(--forest);
  border-color:transparent;
  color:var(--on-dark);
  position:relative;overflow:hidden;
  isolation:isolate;
}
.tl-card-custom::before{
  content:"";position:absolute;inset:0;z-index:-1;
  background:url('../assets/texture-darkgreen.png') center/600px 600px;
  opacity:.35;
}
.tl-card-custom h3{color:var(--lime);font-weight:300;font-size:24px;letter-spacing:-.02em;line-height:1.1;}
.tl-card-custom .tl-card-excerpt{color:var(--on-dark);-webkit-line-clamp:unset;font-size:15px;}
.tl-card-custom .tl-card-more{display:none;}
.tl-card-custom .btn{margin-top:8px;align-self:flex-start;}
.tl-card-custom:hover{transform:translateY(-2px);box-shadow:0 18px 40px rgba(0,0,0,.22);}

/* Lime swoop accent on the custom card */
.tl-card-custom-swoop{
  position:absolute;
  left:-12%;bottom:-12%;
  width:116%;height:116%;
  z-index:-1;opacity:.28;pointer-events:none;
  overflow:visible;
}

/* ----- Empty state ----- */
.tl-empty{
  display:flex;flex-direction:column;align-items:center;
  text-align:center;gap:14px;
  padding:80px 24px;
  color:var(--ink-2);
}
.tl-empty[hidden]{display:none;}
.tl-empty-glyph{
  width:56px;height:56px;color:var(--ink-3);
  background:#fff;border-radius:50%;
  display:inline-flex;align-items:center;justify-content:center;
  box-shadow:inset 0 0 0 1.5px var(--line-soft);
  margin-bottom:6px;
}
.tl-empty-glyph svg{width:24px;height:24px;}
.tl-empty h2{margin:0;font-size:22px;font-weight:600;color:var(--forest);letter-spacing:-.014em;}
.tl-empty p{margin:0 0 8px;font-size:15px;color:var(--ink-2);max-width:42ch;}

/* ----- Drawer ----- */
.tl-drawer{
  position:fixed;inset:0;z-index:200;
  display:flex;justify-content:flex-end;
}
.tl-drawer[hidden]{display:none;}
.tl-drawer-scrim{
  position:absolute;inset:0;
  background:rgba(14,31,24,.42);
  backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px);
  opacity:0;animation:tlScrim .25s var(--ease-out) forwards;
}
@keyframes tlScrim{ to{opacity:1;} }
.tl-drawer-panel{
  position:relative;
  width:min(560px,100%);height:100%;
  background:#fff;
  display:flex;flex-direction:column;
  box-shadow:-24px 0 60px rgba(14,31,24,.22);
  overflow-y:auto;
  transform:translateX(40px);opacity:0;
  animation:tlPanel .35s var(--ease-out) forwards;
  outline:none;
}
@keyframes tlPanel{ to{transform:translateX(0);opacity:1;} }
.tl-drawer-head{
  position:sticky;top:0;z-index:2;
  background:#fff;
  padding:28px 28px 16px;
  border-bottom:1px solid var(--line-soft);
  display:grid;grid-template-columns:1fr auto;align-items:start;gap:12px;
  row-gap:8px;
}
.tl-drawer-eyebrow{
  grid-column:1 / -1;
  font-family:'JetBrains Mono','SF Mono',ui-monospace,monospace;
  font-size:11px;letter-spacing:.16em;text-transform:uppercase;font-weight:600;
  color:var(--ink-3);
}
.tl-drawer-head h2{
  margin:0;
  font-size:clamp(24px,2.4vw,32px);font-weight:300;line-height:1.15;
  letter-spacing:-.018em;color:var(--forest);
  text-wrap:balance;
}
.tl-drawer-close{
  width:40px;height:40px;flex:0 0 auto;
  background:var(--surface-2);border:0;border-radius:50%;cursor:pointer;
  display:inline-flex;align-items:center;justify-content:center;
  color:var(--forest);
  transition:background .18s var(--ease-out);
}
.tl-drawer-close:hover{background:var(--lime);}
.tl-drawer-close svg{width:18px;height:18px;}

.tl-drawer-body{padding:24px 28px 40px;display:flex;flex-direction:column;gap:24px;}
.tl-drawer-body p{
  margin:0;font-size:15.5px;line-height:1.65;color:var(--ink-2);
}
.tl-drawer-meta{display:grid;grid-template-columns:1fr 1fr;gap:20px;}
.tl-drawer-meta-cell{display:flex;flex-direction:column;gap:8px;}
.tl-drawer-meta-cell h4{
  margin:0;
  font-family:'JetBrains Mono','SF Mono',ui-monospace,monospace;
  font-size:10.5px;letter-spacing:.16em;text-transform:uppercase;font-weight:600;
  color:var(--ink-3);
}
.tl-drawer-meta-chips{display:flex;flex-wrap:wrap;gap:6px;}
.tl-drawer-meta-chip{
  display:inline-flex;align-items:center;
  padding:6px 12px;border-radius:var(--radius-pill);
  background:var(--surface-2);
  font-size:12.5px;font-weight:500;color:var(--forest);
  line-height:1;
  box-shadow:inset 0 0 0 1px var(--line-soft);
}

/* ----- Responsive ----- */
@media (max-width:980px){
  .tl-layout{grid-template-columns:1fr;gap:24px;}
  .tl-filters{
    position:static;max-height:none;
    padding:18px 18px 20px;
  }
  .tl-filter-group{display:flex;flex-direction:column;gap:8px;}
}
@media (max-width:780px){
  .tl-hero{padding:var(--hero-pad-top) 0 var(--section-pad-sm);}
}
