/* Documents & Resources page. One small inline script runs the search; without it the page is the plain register.
   Motion is CSS-only: a gentle hero drift and groups rising in (scroll-driven, off for reduced motion, static where
   scroll timelines are not supported), and a short fade when a row comes back into a search result. */

#library,#help,.dl-group{scroll-margin-top:96px}
.dl-hero,.dl-lib{--lift:clamp(34px,4vw,52px)}

/* Hero: the live abstract graphic under a light veil, as the UKAS and policy pages */
.dl-hero::after{background:linear-gradient(90deg,rgba(0,23,63,.78),rgba(0,23,63,.36) 55%,rgba(0,23,63,.08))}
.dl-hero>img{object-position:50% 50%}
.dl-hero .wrap{padding-bottom:calc(clamp(44px,6vw,92px) + var(--lift))}
.dl-hero .crumbs{margin-bottom:clamp(28px,5vw,64px)}
.dl-hero .crumbs a[aria-current]{text-decoration:none;color:#fff}
.dl-hero .label{color:#fff}
.dl-hero .lead{max-width:36em}

/* The search panel sits over the foot of the hero and, on larger screens, stays under the header while you scroll */
.dl-lib{position:relative;z-index:3;padding-bottom:var(--band)}
.dl-tools{position:relative;z-index:5;margin-top:calc(-1 * var(--lift))}
.dl-tools[hidden]{display:none}
.dl-tools-in{padding:clamp(14px,1.6vw,20px);background:#fff;border:1px solid var(--line);border-radius:6px;box-shadow:0 26px 50px -30px rgba(0,23,63,.6),0 2px 6px rgba(0,23,63,.06);transition:border-radius .2s,box-shadow .2s}
.dl-search{position:relative;display:flex;align-items:center}
.dl-search input{width:100%;height:58px;padding:0 64px 0 54px;border:1.5px solid #cfd6e2;border-radius:4px;background:#fff;color:var(--navy);font-size:18px;font-weight:500;-webkit-appearance:none;appearance:none;outline:none;transition:border-color .2s,box-shadow .2s}
.dl-search input::placeholder{color:#767e91;font-weight:400;opacity:1}
.dl-search input:hover{border-color:#9aa6bb}
.dl-search input:focus{border-color:var(--navy);box-shadow:0 0 0 4px rgba(255,77,1,.22)}
.dl-search input::-webkit-search-cancel-button,.dl-search input::-webkit-search-decoration{-webkit-appearance:none;appearance:none;display:none}
.dl-ico-s{position:absolute;left:18px;width:22px;height:22px;color:var(--navy);pointer-events:none}
.dl-kbd{position:absolute;right:16px;display:none;place-items:center;min-width:28px;height:28px;border:1px solid #cfd6e2;border-bottom-width:2px;border-radius:4px;color:var(--muted);font:600 14px/1 var(--font);pointer-events:none;transition:opacity .15s}
.dl-search input:focus~.dl-kbd,.dl-search input:not(:placeholder-shown)~.dl-kbd{opacity:0}
.dl-clear{position:absolute;right:10px;display:grid;place-items:center;width:40px;height:40px;padding:0;border:0;border-radius:50%;background:var(--ground);color:var(--navy);cursor:pointer;transition:background .18s,color .18s}
.dl-clear:hover{background:var(--navy);color:#fff}
.dl-clear svg{width:14px;height:14px}
.dl-search input:placeholder-shown~.dl-clear{display:none}
@media (hover:hover) and (pointer:fine) and (min-width:1024px){.dl-kbd{display:grid}}

.dl-bar{display:flex;align-items:center;justify-content:space-between;gap:12px 20px;margin-top:14px}
.dl-chips{display:flex;flex-wrap:wrap;gap:8px}
.dl-chips button{display:inline-flex;align-items:center;gap:8px;min-height:40px;padding:0 7px 0 15px;border:1px solid #cfd6e2;border-radius:999px;background:#fff;color:var(--navy);font-size:14.5px;font-weight:600;white-space:nowrap;cursor:pointer;transition:background .18s,border-color .18s,color .18s,opacity .18s}
.dl-chips button:hover{border-color:var(--navy)}
.dl-chips button[aria-pressed=true]{background:var(--navy);border-color:var(--navy);color:#fff}
.dl-chips button.is-zero{opacity:.5}
.dl-n{display:grid;place-items:center;min-width:26px;height:26px;padding:0 7px;border-radius:999px;background:var(--ground);color:var(--navy);font-size:12.5px;font-variant-numeric:tabular-nums;transition:background .18s,color .18s}
.dl-chips [aria-pressed=true] .dl-n{background:var(--orange);color:#fff}
.dl-count{flex:none;color:var(--muted);font-size:14.5px;font-weight:500;font-variant-numeric:tabular-nums}

/* Preview only: facts still to confirm (same look as the UKAS and cutting pages) */
.pv-todo strong{display:block;margin-bottom:6px;color:#7d5200;font-size:14px}
.pv-todo ul{display:flex;flex-wrap:wrap;gap:6px}
.pv-todo li{padding:4px 10px;border:1px dashed #c9a24a;border-radius:3px;background:#fff8e8;color:#7d5200;font-size:13.5px}
.dl-todo{margin-top:clamp(36px,4vw,56px)}

/* No results: the search term, the help line from the page, call / email / clear */
.dl-results{display:flex;flex-direction:column;gap:clamp(40px,4.6vw,64px);padding-top:clamp(32px,4vw,56px)}
.dl-empty{display:grid;gap:8px;padding:clamp(20px,2.4vw,30px);border:1px dashed #b4c0d3;border-radius:6px;background:var(--ground)}
.dl-empty[hidden]{display:none}
.dl-empty-h{color:var(--navy);font-size:clamp(19px,.5vw + 17px,23px);font-weight:600;line-height:1.3;overflow-wrap:anywhere}
.dl-empty>p:not(.dl-empty-h){color:var(--muted)}
.dl-empty .dl-loose,.dl-empty.is-loose .dl-none{display:none}
.dl-empty.is-loose .dl-loose{display:inline}
.dl-empty .btns{margin-top:10px;align-items:center}
.dl-reset{min-height:50px;padding:0 10px;border:0;background:none;color:var(--navy);font-weight:600;text-decoration:underline;text-underline-offset:3px;cursor:pointer}
.dl-reset:hover{color:var(--orange)}

/* Groups */
.dl-group[hidden]{display:none}
.dl-ghead{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 14px;margin-bottom:16px}
.dl-num{color:var(--orange);font-size:15px;font-weight:600;font-variant-numeric:tabular-nums}
.dl-gtitle{font-size:clamp(22px,.8vw + 18px,30px)}
.dl-gcount{margin-left:auto;color:var(--muted);font-size:14.5px;font-variant-numeric:tabular-nums;white-space:nowrap}
.dl-glead{margin:-6px 0 16px;color:var(--muted)}

/* The register: a column strip, then one row per document; the whole row opens the PDF */
.is-headed{--cols:30px minmax(0,1fr) 116px 80px 118px}
.is-details{--cols:30px minmax(0,1fr) 142px 64px 270px 118px}
.dl-list{background:#fff;border:1px solid var(--line);border-radius:4px}
.dl-cols{display:grid;grid-template-columns:var(--cols);column-gap:24px;padding:11px 24px;background:var(--ground);border-bottom:1px solid var(--line);border-radius:4px 4px 0 0;color:var(--muted);font-size:12px;font-weight:600;letter-spacing:.06em;text-transform:uppercase}
.dl-cols .c0{grid-column:1/3}
.is-headed .dl-cols .c1{grid-column:3}
.is-headed .dl-cols .c2{grid-column:4}
.is-details .dl-cols .c1{grid-column:3/6}
.dl-row+.dl-row{border-top:1px solid var(--line)}
.dl-row[hidden]{display:none}
.dl-link{position:relative;display:grid;grid-template-columns:var(--cols);column-gap:24px;align-items:center;padding:18px 24px;color:inherit;text-decoration:none;transition:background .2s}
.dl-link::before{content:"";position:absolute;left:-1px;top:0;bottom:0;width:3px;background:var(--orange);transform:scaleY(0);transition:transform .25s var(--ease)}
.dl-link:hover{background:#f7f9fc}
.dl-link:hover::before,.dl-link:focus-visible::before{transform:none}
.dl-link:focus-visible{outline-offset:-3px}
.dl-row:last-child .dl-link{border-radius:0 0 4px 4px}
.dl-file{grid-column:1;grid-row:1;width:30px;height:38px;color:var(--navy)}
.dl-file .band{fill:var(--navy);transition:fill .2s}
.dl-file text{fill:#fff;font:700 8.5px var(--font);letter-spacing:.02em}
.dl-link:hover .dl-file .band,.dl-link:focus-visible .dl-file .band{fill:var(--orange)}
.dl-main{grid-column:2;grid-row:1;min-width:0}
.dl-title{font-size:17.5px;font-weight:600;line-height:1.3;letter-spacing:-.01em}
.dl-desc{margin-top:3px;color:var(--muted);font-size:15px;line-height:1.45}
.dl-facts{display:contents}
.dl-fact{grid-row:1;display:flex;flex-direction:column;gap:2px;min-width:0}
.dl-fact.s1{grid-column:3}.dl-fact.s2{grid-column:4}.dl-fact.s3{grid-column:5}
.dl-k{color:var(--muted);font-size:11.5px;font-weight:600;letter-spacing:.05em;line-height:1.3;text-transform:uppercase}
.dl-v{color:var(--navy);font-size:15px;font-weight:500;line-height:1.35;font-variant-numeric:tabular-nums}
.dl-go{grid-column:-2;grid-row:1;justify-self:end;display:inline-flex;align-items:center;gap:8px;min-height:38px;padding:0 13px;border:1px solid var(--navy);border-radius:3px;background:#fff;color:var(--navy);font-size:14.5px;font-weight:600;white-space:nowrap;transition:background .2s,color .2s}
.dl-go .arrow{width:14px;height:14px;transition:translate .22s var(--ease)}
.dl-link:hover .dl-go,.dl-link:focus-visible .dl-go{background:var(--navy);color:#fff}
.dl-link:hover .dl-go .arrow{translate:2px -2px}
mark{padding:0 1px;border-radius:2px;background:#ffdcc9;color:inherit;box-shadow:0 0 0 1px #ffdcc9}
@media (min-width:768px){
  /* Forms and Policies carry the labels in the column strip, so each row's own labels are for screen readers */
  .dl-k.is-headed{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
}

/* Help band */
.dl-help{display:grid;grid-template-columns:minmax(0,7fr) minmax(0,4fr);gap:clamp(28px,6vw,96px);align-items:center}
.dl-help .lead a{color:var(--navy);font-weight:600;text-underline-offset:3px}
.dl-help .lead a:hover{color:var(--orange)}
.dl-help-card{display:grid;gap:12px;padding:clamp(20px,2.4vw,30px);background:#fff;border:1px solid var(--line);border-radius:4px}
.dl-help-card .btn{width:100%;overflow-wrap:anywhere}

/* Larger screens: the panel stays under the header (68 px, 58 px below 1181) while the list scrolls */
@media (min-width:768px) and (min-height:700px){
  .dl-tools{position:sticky;top:58px}
  .dl-row{scroll-margin-top:230px}
}
@media (min-width:1181px) and (min-height:700px){.dl-tools{top:68px}}
@supports (container-type:scroll-state){
  .dl-tools{container-type:scroll-state}
  @container scroll-state(stuck:top){.dl-tools-in{border-top-left-radius:0;border-top-right-radius:0;box-shadow:0 18px 36px -24px rgba(0,23,63,.55)}}
}

/* Accreditation rows have three details of different lengths: below 1281 px they sit under the title */
@media (max-width:1280px){
  .is-details{--cols:30px minmax(0,1fr) 118px}
  .is-details .dl-cols .c1{display:none}
  .is-details .dl-facts{grid-column:2;grid-row:2;display:flex;flex-wrap:wrap;gap:6px 22px;margin-top:10px}
  .is-details .dl-fact{flex-direction:row;align-items:baseline;gap:7px}
  .is-details .dl-file{grid-row:1/3;align-self:start}
  .is-details .dl-go{grid-column:3;grid-row:1/3}
}
@media (max-width:900px){
  .dl-help{grid-template-columns:1fr}
}
/* Phones: one column; details under the title with their labels; only the arrow shows (the words stay for screen readers) */
@media (max-width:767px){
  .dl-cols{display:none}
  .is-headed,.is-details{--cols:24px minmax(0,1fr) 18px}
  .dl-link{column-gap:14px;align-items:start;padding:16px}
  .dl-facts,.is-details .dl-facts{grid-column:2;grid-row:2;display:flex;flex-wrap:wrap;gap:6px 18px;margin-top:9px}
  .dl-facts:empty{display:none}
  .dl-fact,.is-details .dl-fact{flex-direction:row;align-items:baseline;gap:6px}
  .dl-file,.is-details .dl-file{grid-row:1/3;width:24px;height:30px;margin-top:2px}
  .dl-title{font-size:16.5px}
  .dl-desc{font-size:14.5px}
  .dl-v{font-size:14.5px}
  .dl-go,.is-details .dl-go{grid-column:3;grid-row:1;align-self:start;min-height:0;margin-top:3px;padding:0;border:0;background:none}
  .dl-go-t{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
  .dl-link:hover .dl-go,.dl-link:focus-visible .dl-go{background:none;color:var(--orange)}
  .dl-go .arrow{width:16px;height:16px}
}
@media (max-width:640px){
  .dl-tools-in{padding:12px}
  .dl-search input{height:54px;padding-left:48px}
  .dl-ico-s{left:15px}
  .dl-bar{flex-direction:column;align-items:stretch;gap:10px;margin-top:12px}
  /* Chips in one swipe row, faded at the right edge */
  .dl-chips{flex-wrap:nowrap;overflow-x:auto;margin:0 -12px;padding:0 12px;scrollbar-width:none;-webkit-mask-image:linear-gradient(90deg,#000 calc(100% - 28px),transparent);mask-image:linear-gradient(90deg,#000 calc(100% - 28px),transparent)}
  .dl-chips::-webkit-scrollbar{display:none}
  .dl-chips button{flex:none;min-height:38px;font-size:14px}
  .dl-count{font-size:14px}
  .dl-empty .btns .btn{flex:1 1 100%}
}

@supports (animation-timeline:view()){
  @media (prefers-reduced-motion:no-preference){
    .dl-hero>img{animation:dl-drift linear both;animation-timeline:scroll(root);animation-range:0 80vh}
    .dl-group,.dl-help-card{animation:rise linear both;animation-timeline:view();animation-range:entry 0% entry 35%}
  }
}
/* A row that comes back into the results fades in (only once a search has started, so nothing moves on load) */
@media (prefers-reduced-motion:no-preference){
  .dl-lib.is-live .dl-row:not([hidden]){animation:dl-in .28s var(--ease) both}
}
@keyframes dl-drift{from{transform:scale(1.16)}to{transform:translateY(6%) scale(1.16)}}
@keyframes dl-in{from{opacity:0;translate:0 6px}to{opacity:1;translate:none}}

@media print{
  .dl-tools,.dl-empty,.dl-help-card{display:none}
  .dl-row[hidden],.dl-group[hidden]{display:block}
}
