/* Cura Core · policy-nav.css
   The policy reader's contents and search (views/policy-nav.js), and the staff reader's reading time,
   reading progress and Easy read (views/staff.js).

   Wide screens (1180px and up): a rail beside the paper that stays in view inside its own column, a white plate
   with "Search this policy" at the top and the numbered sections under it. The agency's page adds the "About this
   policy" column on the right from 1400px; between 1180 and 1399 that column sits under the paper.
   Narrower: the rail is a bottom sheet, opened by a small "Contents and search" button at the bottom right (the
   bottom left is kept for the Ask me anything button). While a search is on, the button becomes a "3 of 12" pill.

   Colour: ink for where you are, the find-hit yellow for match counts (the same yellow as the highlights in the
   text), blue for reading progress (the charts' "still reading" blue). No gold: nothing here is a Premium upsell. */

/* ---------------- layout ---------------- */

.pnav-layout { --pnav-top: calc(var(--top-h) + 34px); display: grid; grid-template-columns: minmax(0, 1fr); gap: 26px; align-items: start; }
.solo .pnav-layout { --pnav-top: 92px; }
.solo:has(.read-prog) .pnav-layout { --pnav-top: 118px; }
.pnav-main { min-width: 0; }
.pnav-main > .paper:first-child { margin-top: 0; }
.pnav-layout .pol-sec { scroll-margin-top: var(--pnav-top); }
/* under the paper, the aside's cards flow in two columns (one on a phone) without gaps under short cards */
.pnav-layout > .aside { min-width: 0; columns: 2 280px; column-gap: 22px; }
.pnav-layout > .aside > .card { break-inside: avoid; margin: 0 0 22px; }
.pnav-layout > .aside > .card + .card { margin-top: 0; }

/* the policy page's own fade-in would otherwise make the view a frame for fixed things (the sheet and its button) */
#view.content:has(.pnav-layout) { animation-fill-mode: backwards; }

/* ---------------- the rail: a bottom sheet first (phones) ---------------- */

.pnav {
  position: fixed; z-index: 90; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; max-height: min(80vh, 680px);
  padding: 4px 14px calc(14px + env(safe-area-inset-bottom));
  background: #fff; border-radius: 24px 24px 0 0;
  box-shadow: 0 0 0 1px rgba(22, 34, 44, .06), 0 -24px 60px -20px rgba(22, 34, 44, .45);
  font-family: var(--font-sans); color: var(--ink);
  transform: translateY(104%); visibility: hidden;
  transition: transform .28s var(--ease-plate), visibility 0s linear .28s;
}
.pnav.open { transform: none; visibility: visible; transition: transform .28s var(--ease-plate), visibility 0s; }
.pnav:focus { outline: none; }
.pnav:focus-visible { outline: 2px solid var(--focus); outline-offset: -4px; }
@media (min-width: 640px) { .pnav { left: 50%; right: auto; width: 560px; margin-left: -280px; } }

.pnav-scrim { position: fixed; inset: 0; z-index: 89; background: var(--scrim); animation: scrim-in var(--dur-2) var(--ease); }
body.pnav-lock { overflow: hidden; }

.pnav-head { position: relative; display: flex; align-items: center; gap: 8px; padding: 14px 0 10px; }
.pnav-grip { position: absolute; top: 6px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 999px; background: var(--line-2); }
.pnav-head h2 { flex: 1; font-family: var(--font-serif); font-weight: 500; font-size: 21px; line-height: 1.2; }
.pnav-head .icon-btn { width: 44px; height: 44px; margin-right: -6px; }

/* the search box */
.pnav-search { padding-bottom: 10px; }
.pnav-field { position: relative; display: block; }
.pnav-field > .i { position: absolute; left: 13px; top: 50%; width: 17px; height: 17px; margin-top: -8.5px; color: var(--ink-3); pointer-events: none; }
.pnav-q {
  width: 100%; min-height: 46px; padding: 8px 14px 8px 38px; border: 0; border-radius: 999px; background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line-2); font: 500 16px/1.3 var(--font-sans); color: var(--ink);
  -webkit-appearance: none; appearance: none; transition: box-shadow var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
}
.pnav-q::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.pnav-q:hover { box-shadow: inset 0 0 0 1px var(--field); }
.pnav-q:focus { outline: none; background: #fff; box-shadow: inset 0 0 0 1.5px var(--blue-bright), var(--focus-ring); }
.pnav-q::placeholder { color: var(--ink-3); font-weight: 400; }
.pnav-found { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; padding-left: 4px; }
.pnav-count { font-size: 13px; font-weight: 600; line-height: 1.3; color: var(--ink-2); font-variant-numeric: tabular-nums lining-nums; }
.pnav-steps { display: inline-flex; gap: 2px; }
.pnav-steps .icon-btn { width: 40px; height: 40px; color: var(--ink-2); }
.pnav-steps .icon-btn:disabled { opacity: .35; }

/* the contents */
.pnav-label {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 10px 6px 6px; border-top: 1px solid var(--line);
  font-size: 11px; font-weight: 600; line-height: 1.2; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3);
}
.pnav-sub { letter-spacing: .02em; text-transform: none; font-weight: 500; font-size: 12px; font-variant-numeric: tabular-nums; }
.pnav.searching .pnav-sub { display: none; }
.pnav-list { list-style: none; margin: 0; padding: 2px 2px 4px 0; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.pnav-item {
  position: relative; display: flex; align-items: flex-start; gap: 8px; width: 100%; min-height: 44px; padding: 11px 10px; margin: 1px 0;
  border: 0; border-radius: 12px; background: none; cursor: pointer; text-align: left;
  font-family: var(--font-sans); font-weight: 500; font-size: 15px; line-height: 1.35; color: var(--ink-2);
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease), opacity var(--dur-2) var(--ease);
}
.pnav-item:hover { background: var(--surface-2); color: var(--ink); }
.pnav-item:focus-visible { outline-offset: -2px; }
.pnav-n { flex: none; min-width: 24px; padding-top: 1px; font-family: var(--font-mono); font-weight: 500; font-size: 12px; line-height: 1.6; letter-spacing: .02em; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.pnav-t { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pnav-item.lvl-2, .pnav-item.lvl-3 { padding-left: 26px; font-size: 14px; }
.pnav-item.lvl-2 .pnav-n, .pnav-item.lvl-3 .pnav-n { min-width: 30px; }
/* where you are: ink on the tab-rail stone, with a short navy bar */
.pnav-item.on { background: var(--surface-3); color: var(--ink); font-weight: 600; }
.pnav-item.on .pnav-n { color: var(--ink-2); }
.pnav-item.on::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--navy); }
/* while searching: how many matches each section has, in the highlight yellow; sections without one step back */
.pnav-hits {
  flex: none; align-self: center; min-width: 24px; height: 22px; padding: 0 7px; border-radius: 999px;
  background: var(--hit); box-shadow: inset 0 0 0 1px var(--hit-line);
  font-size: 12px; font-weight: 600; line-height: 22px; text-align: center; color: var(--ink); font-variant-numeric: tabular-nums lining-nums;
}
.pnav-hits:empty { display: none; }
.pnav-item.dim { opacity: .5; }
.pnav-item.dim:hover, .pnav-item.dim:focus-visible { opacity: .85; }
.pnav-item.has-hits { color: var(--ink); }

/* ---------------- the phone button and the search pill ---------------- */

.pnav-float { position: fixed; z-index: 45; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); display: flex; justify-content: flex-end; pointer-events: none; }
.pnav-float > * { pointer-events: auto; }
.pnav-fab {
  display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 18px 0 14px; border: 0; border-radius: 999px; cursor: pointer;
  background: linear-gradient(180deg, #fff, #FBFAF7); color: var(--ink);
  font-family: var(--font-sans); font-weight: 600; font-size: 14px; line-height: 1.2; white-space: nowrap;
  box-shadow: 0 0 0 1px rgba(22, 34, 44, .1), 0 14px 30px -12px rgba(22, 34, 44, .45), 0 2px 0 var(--line);
  transition: transform .18s ease, box-shadow .18s ease;
}
.pnav-fab .i { width: 19px; height: 19px; color: var(--ink-2); }
@media (hover: hover) { .pnav-fab:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px rgba(22, 34, 44, .14), 0 20px 36px -14px rgba(22, 34, 44, .5), 0 3px 0 var(--line); } }
.pnav-fab:active { transform: translateY(1px); }
.pnav-pill {
  display: inline-flex; align-items: center; gap: 2px; min-height: 50px; padding: 3px 4px 3px 6px; border-radius: 999px;
  background: #fff; box-shadow: 0 0 0 1px rgba(22, 34, 44, .1), 0 14px 30px -12px rgba(22, 34, 44, .45), 0 2px 0 var(--line);
  font-family: var(--font-sans);
}
.pnav-pill[hidden] { display: none; }
.pnav-pill-open {
  display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 0 10px 0 10px; border: 0; border-radius: 999px; background: var(--hit);
  box-shadow: inset 0 0 0 1px var(--hit-line); cursor: pointer;
  font-weight: 600; font-size: 14px; line-height: 1; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums lining-nums;
}
.pnav-pill-open .i { width: 16px; height: 16px; }
.pnav-pill .icon-btn { width: 44px; height: 44px; color: var(--ink-2); }
.pnav-pill .icon-btn:disabled { opacity: .35; }

/* the section a link opened: a soft highlighter wash over its first lines that fades out */
.pol-sec.pnav-flash::after {
  content: ''; position: absolute; inset: 6px -14px 0; border-radius: 14px; pointer-events: none;
  background: linear-gradient(180deg, var(--hit) 0, rgba(255, 233, 168, .6) 120px, rgba(255, 233, 168, 0) 320px);
  mix-blend-mode: multiply; animation: pnav-flash 2.6s var(--ease) forwards;
}
@keyframes pnav-flash { 0%, 40% { opacity: .9; } 100% { opacity: 0; } }

/* ---------------- wide screens: the rail beside the paper ---------------- */

@media (min-width: 1180px) {
  .pnav-layout { grid-template-columns: 224px minmax(0, 1fr); column-gap: 28px; }
  .pnav-layout > .pnav {
    grid-column: 1; grid-row: 1 / span 2; position: sticky; top: var(--pnav-top); z-index: 4;
    max-height: calc(100vh - var(--pnav-top) - 18px); margin: 0; width: auto; left: auto; right: auto; bottom: auto;
    padding: 14px 8px 8px 12px; border-radius: var(--r-plate); box-shadow: var(--plate);
    transform: none; visibility: visible; transition: none;
  }
  .pnav-layout > .pnav-main, .pnav-layout > .aside { grid-column: 2; }
  .pnav-layout .pnav-head, .pnav-layout ~ .pnav-float, .pnav-layout .pnav-float, .pnav-layout .pnav-scrim { display: none !important; }
  .pnav-search { padding: 0 4px 10px 0; }
  .pnav-q { min-height: 40px; font-size: 14px; padding-left: 36px; }
  .pnav-field > .i { left: 12px; width: 16px; height: 16px; margin-top: -8px; }
  .pnav-found { margin-top: 6px; }
  .pnav-count { font-size: 12.5px; }
  .pnav-steps .icon-btn { width: 32px; height: 32px; }
  .pnav-label { padding: 10px 6px 6px 4px; margin-right: 4px; }
  .pnav-item { min-height: 0; padding: 7px 8px; margin: 1px 0; border-radius: 10px; font-size: 13.5px; line-height: 1.35; }
  .pnav-item.lvl-2, .pnav-item.lvl-3 { padding-left: 20px; font-size: 13px; }
  .pnav-n { min-width: 22px; font-size: 11.5px; line-height: 1.6; }
  .pnav-item.lvl-2 .pnav-n, .pnav-item.lvl-3 .pnav-n { min-width: 28px; }
  .pnav-item.on::before { top: 8px; bottom: 8px; }
  .pnav-hits { height: 20px; line-height: 20px; min-width: 22px; padding: 0 6px; font-size: 11.5px; }

  /* the staff and inspector pages widen to make room for the rail; their bar follows */
  .solo .solo-body:has(> .pnav-layout) { max-width: 1140px; }
  .solo:has(.pnav-layout) .solo-top .in { max-width: 1108px; }
}
@media (min-width: 1400px) {
  .pnav-layout.has-aside { grid-template-columns: 216px minmax(0, 1fr) 268px; column-gap: 26px; }
  .pnav-layout.has-aside > .aside { grid-column: 3; grid-row: 1; columns: auto; }
  .pnav-layout.has-aside > .aside > .card { margin: 0 0 18px; }
  /* three columns leave the paper about 560px: a little less padding keeps a comfortable line */
  .pnav-layout.has-aside .paper { padding: 44px 44px 52px; }
  .pnav-layout.has-aside .pol-sec.edited { margin: 0 -20px; padding-left: 20px; padding-right: 20px; }
}
@media (pointer: coarse) and (min-width: 1180px) {
  .pnav-item { min-height: 40px; }
}

/* ---------------- staff: reading time and reading progress ---------------- */

/* the progress line under the agency bar: how far through the policy, and the minutes left */
.solo-top .in:has(.read-prog) { flex-wrap: wrap; row-gap: 2px; padding-bottom: 8px; }
.read-prog { flex: 1 0 100%; display: flex; align-items: center; gap: 10px; padding: 0 4px 0 2px; }
.read-prog .track { position: relative; flex: 1; height: 5px; border-radius: 999px; background: var(--surface-3); box-shadow: inset 0 1px 1px rgba(22, 34, 44, .08); overflow: hidden; }
.read-prog .fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: linear-gradient(90deg, #3A8AC4, var(--blue-bright)); transition: width .2s linear; }
.read-prog .left { flex: none; min-width: 9.5em; text-align: right; font-size: 12.5px; font-weight: 600; line-height: 1.2; color: var(--ink-2); font-variant-numeric: tabular-nums lining-nums; }

.reader-meta .read-time { display: inline-flex; align-items: center; gap: 5px; }
.reader-meta .read-time .i { width: 15px; height: 15px; color: var(--ink-3); }

/* the reading list: minutes beside each card's line, and the total in the greeting */
.read-card .small.rc-line { display: flex; flex-wrap: wrap; align-items: center; column-gap: 12px; row-gap: 2px; }
.rc-time { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; color: var(--ink-3); }
.rc-time .i { width: 13px; height: 13px; }
.staff-hero .hero-time { display: inline-flex; align-items: center; gap: 7px; margin-top: 8px; font-size: 14px; font-weight: 600; line-height: 1.4; color: var(--cover-cream); }
.staff-hero .hero-time .i { width: 16px; height: 16px; color: var(--mint); }

/* ---------------- staff: Easy read ---------------- */

.easy-bar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 14px;
  margin: 0 0 18px; padding: 10px 12px 10px 16px; border-radius: var(--r-plate-md); background: #fff; box-shadow: var(--plate-flat);
}
.easy-bar .switch { min-height: 44px; }
.easy-bar .switch-label { font-size: 15.5px; }
.easy-bar .easy-hint { flex: 1 1 160px; font-size: 13.5px; line-height: 1.4; color: var(--ink-3); }
.easy-size { display: inline-flex; align-items: center; gap: 4px; }
.easy-size .lbl { margin-right: 4px; font-size: 13px; font-weight: 500; color: var(--ink-3); }
.easy-size button {
  min-width: 48px; min-height: 44px; padding: 0 10px; border: 0; border-radius: 999px; cursor: pointer;
  background: linear-gradient(180deg, #fff, #FBFAF7); color: var(--ink);
  box-shadow: 0 0 0 1px var(--line-2) inset, 0 2px 0 var(--line);
  font-family: var(--font-sans); font-weight: 600; line-height: 1;
}
.easy-size button[data-size="-1"] { font-size: 14px; }
.easy-size button[data-size="1"] { font-size: 19px; }
.easy-size button:hover:not(:disabled) { box-shadow: 0 0 0 1px var(--field) inset, 0 2px 0 var(--line); }
.easy-size button:disabled { opacity: .4; cursor: default; }

.easy { --easy-size: 19px; }
.easy-h {
  margin: 0 0 12px; font-family: var(--font-sans); font-weight: 600; font-size: 12.5px; line-height: 1.2; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3);
}
.easy-points { margin: 0 0 26px; }
.easy-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.easy-card {
  display: flex; align-items: flex-start; gap: 16px; padding: 18px 20px; border-radius: var(--r-plate-md); background: #fff; box-shadow: var(--plate);
  font-family: var(--font-sans); font-weight: 500; font-size: calc(var(--easy-size) + 1px); line-height: 1.5; color: var(--ink);
}
.easy-card p { margin: 0; max-width: 36em; }
.easy-card .ico-chip { width: 44px; height: 44px; flex: none; display: grid; place-items: center; margin-top: 1px; }
.easy-card .ico-chip .i { width: 22px; height: 22px; }
/* the full text: the sans, bigger, with more air between lines and paragraphs */
.paper.easy-text { font-family: var(--font-sans); font-weight: 400; font-size: var(--easy-size); line-height: 1.8; }
.paper.easy-text p, .paper.easy-text li { max-width: 36em; }
.paper.easy-text .pol-sec p { margin-bottom: 1em; }
.paper.easy-text .pol-sec li { margin: 10px 0; }
.paper.easy-text .sec-head h3 { font-family: var(--font-sans); font-weight: 600; font-size: calc(var(--easy-size) * 1.15); line-height: 1.3; }
.paper.easy-text .pol-sec table { font-size: calc(var(--easy-size) * .82); line-height: 1.55; }
.paper.easy-text .pol-sec .note { font-family: var(--font-sans); font-style: normal; font-size: calc(var(--easy-size) * .92); }
.paper.easy-text .paper-agency .n { font-family: var(--font-sans); }

@media (max-width: 640px) {
  .easy-bar { padding: 8px 10px 8px 14px; }
  .easy-card { gap: 14px; padding: 16px; }
  .easy-card .ico-chip { width: 40px; height: 40px; }
  .read-prog .left { min-width: 8.5em; font-size: 12px; }
}

/* ---------------- print: the paper only ---------------- */

@media print {
  .pnav, .pnav-scrim, .pnav-float, .read-prog, .easy-bar { display: none !important; }
  .pnav-layout { display: block; }
  .easy-card { box-shadow: none; border: 1px solid #000; }
  .pol-sec.pnav-flash::after { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .pol-sec.pnav-flash::after { animation: none !important; opacity: .55; }
  .pnav, .pnav.open { transition: none !important; }
}
