/* The law site's own styles (issue #62), on top of BetaNYC's Pages template (site.css).
   This file names no colors: every color is one of the template's variables, so site.css
   stays the one file that names a color. test/site-build.test.js checks that. */

/* NYSDS parts take their colors and type from the template. The seven --nys-color-theme*
   tokens are the ones NYSDS's themes set (NYSDS themes guide, 1.23.2); the others are the
   tokens the parts used here fall back on. */
:root {
  --nys-color-theme-faint: var(--bg-blue-lt);
  --nys-color-theme-weaker: var(--bg-blue);
  --nys-color-theme-weak: var(--blue-2);
  --nys-color-theme-mid: var(--blue);
  --nys-color-theme: var(--blue);
  --nys-color-theme-strong: var(--blue-dark);
  --nys-color-theme-stronger: var(--blue-dark);
  --nys-color-text: var(--ink);
  --nys-color-ink: var(--ink);
  --nys-color-text-weak: var(--ink);
  --nys-color-link: var(--blue);
  --nys-color-link-strong: var(--blue-dark);
  --nys-color-link-strongest: var(--blue-dark);
  --nys-color-focus: var(--focus);
  --nys-color-focus-reverse: var(--blue-2);
  --nys-color-surface: var(--white);
  --nys-color-surface-raised: var(--bg-blue-lt);
  --nys-color-white: var(--white);
  --nys-color-text-reverse: var(--white);
  --nys-color-ink-reverse: var(--white);
  --nys-color-neutral-400: var(--line);
  --nys-color-neutral-500: var(--line);
  --nys-color-neutral-600: var(--ink);
  --nys-font-family-ui: var(--font-body);
  --nys-font-family-body: var(--font-body);
  --nys-font-family-sans: var(--font-body);
  --nys-font-family-heading: var(--font-head);
}

/* The template's focus ring covers links, buttons and summaries; plain form fields get it too.
   NYSDS's fields draw their own ring inside their shadow root from --nys-color-focus (set above
   from the template's --focus). In forced colors that ring is 1px and looks like the field's
   border, so the field as a whole gets the template's ring there. */
input:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (forced-colors: active) {
  nys-textinput:focus-within { outline: 3px solid var(--focus); outline-offset: 4px; }
}

/* NYSDS's text field takes its border color from --nys-color-neutral-400 and both its border
   and its focus ring width from --nys-border-width-sm (NYSDS 1.23.2: --_nys-textinput-border-color,
   --_nys-textinput-border-width, --_nys-textinput-outline-width). Set here on the field only,
   so no other part changes: the border is the template's ink (9.25:1 on the blue search strip,
   10.21:1 on white; the template's --line was 2.75:1 on the strip), and border and ring are
   2px, so the focused field shows 4px of --focus. */
nys-textinput { --nys-color-neutral-400: var(--ink); --nys-border-width-sm: 2px; }
/* The hint inside the box ("Try § 259 ...") is placeholder text, which NYSDS colors from
   --nys-color-text-weaker, falling back on --nys-color-neutral-500 (set above to the template's
   --line: 3.03:1 on the white field). The template's ink, mixed 80% with white: about 5.7:1 on
   the white field (test/site measures it), and still lighter than typed text (10.21:1). */
nys-textinput { --nys-color-text-weaker: color-mix(in srgb, var(--ink) 80%, var(--white)); }

/* Long addresses wrap instead of widening the page on a phone (WCAG 1.4.10). */
.disclaimer a, .copy-box a, footer a, main p a { overflow-wrap: anywhere; }

/* Two columns at 900px and wider (law.js WIDE): the contents tree on the left, the page on the
   right. "Hide" folds the tree away (html.contents-hidden, law.js), and the page takes the
   whole width. One column below 900px, where the tree opens above the page. */
.wrap.layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 40px; padding-top: 20px; max-width: 1160px; }
.wrap.layout > .main-col { grid-column: 2; grid-row: 1; min-width: 0; }
.wrap.layout > .toc { grid-column: 1; grid-row: 1; }
@media (min-width: 900px) {
  html.contents-ready.contents-hidden .wrap.layout { grid-template-columns: minmax(0, 1fr); }
  html.contents-ready.contents-hidden .wrap.layout > .main-col { grid-column: 1; }
  html.contents-ready.contents-hidden .toc { display: none; }
}
@media (max-width: 899.98px) {
  .wrap.layout { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .wrap.layout > .main-col, .wrap.layout > .toc { grid-column: auto; grid-row: auto; }
  html.contents-ready:not(.contents-shown) .toc { display: none; }
}
main { min-width: 0; }

/* Search strip under the top bar. */
.find { background: var(--bg-blue); border-bottom: 1px solid var(--line-soft); }
.find .wrap { padding-top: .6rem; padding-bottom: .6rem; }
form.jump { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: flex-end; margin: 0; }
form.jump nys-textinput { flex: 1 1 18rem; max-width: 34rem; }
.nojs { margin: .4rem 0; font-size: 15px; }

/* Breadcrumbs read as a plain list until NYSDS defines the element (and with JavaScript off). */
.crumbs { display: block; margin: 16px 0 12px; font-size: 15px; }
/* NYSDS pads the trail from its own page grid (12px 20px, up to 12px 64px at 1280px wide, through
   its --_nys-breadcrumbs-padding; the one documented property, --nys-max-width--content, sets only
   the width). This site's column is already padded, so the trail lines up with the heading. */
nys-breadcrumbs.crumbs { --_nys-breadcrumbs-padding: 0; }
/* NYSDS sets each crumb nowrap; a long one (a Rules record such as "Property Owner's Certification
   and Application for Reimbursement") then pushed a phone's page sideways. Long crumbs wrap. */
nys-breadcrumbs.crumbs li { min-width: 0; }
nys-breadcrumbs.crumbs li > a, nys-breadcrumbs.crumbs li > span { white-space: normal; overflow-wrap: anywhere; }
nys-breadcrumbs:not(:defined) ol { display: flex; flex-wrap: wrap; gap: .25rem .5rem; list-style: none; margin: 0; padding: 0; }
nys-breadcrumbs:not(:defined) li + li::before { content: "›"; margin-right: .5rem; }

/* The contents tree (pages.js contentsTree, Noel 2026-11-23, after American Legal Publishing's
   code library): every chapter as an underlined link, the open chapter showing its sections, a
   disclosure triangle before each chapter (law.js), the reader's own page marked. On a wide
   screen it is a column that scrolls on its own, under a heading that stays in view. */
.toc { font: 15px/1.45 var(--font-body); }
@media (min-width: 900px) {
  /* scroll-padding-top keeps a focused link or button clear of the sticky heading row
     (WCAG 2.4.11): the row is 40px (the 28px Hide button plus 4px and 8px padding), plus 6px
     for the focus ring (3px, offset 2px), plus 6px to spare. If the row's padding or the
     button's size changes, change this too; law.js's showOpenChapter measures the row itself. */
  .toc { position: sticky; top: 12px; align-self: start; max-height: calc(100vh - 24px); overflow-y: auto; padding-right: 14px; border-right: 1px solid var(--line-soft); scroll-padding-top: 52px; }
}
.contents-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0 8px; background: var(--white); position: sticky; top: 0; z-index: 1; }
.contents-top h2 { font: 700 18px/1.2 var(--font-head); color: var(--blue); margin: 0; }
.contents-nav .book { margin: 2px 0 6px; font-weight: 700; }
.contents-nav .book a { display: inline-block; padding: 2px 0; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
/* A chapter: [triangle] [link], its sections under the link. The first column is kept with
   JavaScript off too, so the links line up whether or not the buttons are there. */
.tree > li { display: grid; grid-template-columns: 26px minmax(0, 1fr); align-items: start; }
.tree > li > a, .tree > li > ul { grid-column: 2; }
.tree > li > .tw { grid-column: 1; grid-row: 1; }
.tree > li > ul { margin: 2px 0 8px; border-left: 2px solid var(--line-soft); padding-left: 10px; }
.tree a { display: block; padding: 3px 0; color: var(--blue); text-decoration: underline; text-underline-offset: 2px; }
.tree a:hover { text-decoration-thickness: 2px; }
/* The reader's own page: bold, a bar on the left (a border, so it shows in forced colors), a
   light fill, no underline. The open chapter on a section page: bold. */
.tree a[aria-current="page"] { font-weight: 700; text-decoration: none; background: var(--bg-blue); border-left: 4px solid var(--blue); padding-left: 8px; margin-left: -12px; }
.tree > li > a[aria-current="page"] { margin-left: 0; padding-left: 6px; }
.tree a[aria-current="true"] { font-weight: 700; }
.tree .load-error { padding: 3px 0; }
/* The Administrative Code's deeper levels: title > chapter > part > sections, each
   indented under its link. The Charter's tree has no ul inside a ul, so this does not touch it. */
.tree ul ul { margin: 2px 0 6px; border-left: 2px solid var(--line-soft); padding-left: 10px; }
/* Kept in the page when empty (not display: none), so screen readers hear what is put in it. */
.tree-status { margin: 0; font-size: 14px; }
.tree-status:not(:empty) { margin: 0 0 6px; }
.tw { width: 26px; height: 28px; display: flex; align-items: center; justify-content: center; padding: 0; background: none; border: 0; color: var(--ink); cursor: pointer; }
.tw svg { width: 12px; height: 12px; transition: transform .15s; }
.tw[aria-expanded="true"] svg { transform: rotate(90deg); }
.tw[aria-busy="true"] { cursor: progress; }
@media (prefers-reduced-motion: reduce) { .tw svg { transition: none; } }

/* "Hide", "☰ Contents", and the no-JavaScript fold's summary, which looks like "☰ Contents". */
.contents-hide, .contents-summary { font: 600 15px/1 var(--font-body); color: var(--blue); background: var(--white); border: 2px solid var(--blue); border-radius: 6px; padding: 6px 12px; min-height: 32px; cursor: pointer; }
.contents-hide { font-size: 14px; padding: 5px 10px; min-height: 28px; border-width: 1px; }
.contents-hide:hover, .contents-summary:hover { background: var(--bg-blue); }
/* "☰ Contents" is a "you are here" bar, full width, with the reader's chapter, so it does not
   look like the top bar's Menu button (Noel, 2026-11-23). */
.contents-open { display: none; width: 100%; align-items: center; gap: 8px; margin: 0 0 6px; padding: 10px 12px; min-height: 44px; text-align: left; font: 400 15px/1.3 var(--font-body); color: var(--ink); background: var(--bg-blue); border: 1px solid var(--line-soft); border-left: 4px solid var(--blue); border-radius: 4px; cursor: pointer; }
.contents-open .cb-icon { width: 16px; height: 16px; flex: none; color: var(--blue); }
.contents-open .contents-word { font-weight: 700; color: var(--blue); flex: none; }
.contents-open .contents-here { min-width: 0; flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding-left: 8px; border-left: 1px solid var(--line); }
.contents-open .cb-chev { width: 14px; height: 14px; flex: none; margin-left: auto; color: var(--blue); }
.contents-open:hover .contents-word { text-decoration: underline; text-underline-offset: 2px; }
/* "☰ Contents" shows when the tree does not: after "Hide" on a wide screen; on a phone until it is opened. */
@media (min-width: 900px) { html.contents-ready.contents-hidden .contents-open { display: flex; } }
@media (max-width: 899.98px) { html.contents-ready:not(.contents-shown) .contents-open { display: flex; } }
.main-col > .contents-open + main .crumbs { margin-top: 8px; }

/* The fold (JavaScript off): its summary on a phone, closed, so the law text starts near the top.
   On a wide screen the tree shows whether the fold is open or not; a browser without
   ::details-content shows the summary, and the reader opens it. With scripts law.js opens the
   fold and the summary goes: "☰ Contents" and "Hide" do its job. */
.contents-summary { display: inline-block; list-style: none; margin: 8px 0 4px; }
.contents-summary::-webkit-details-marker { display: none; }
.contents-fold[open] > .contents-summary { margin-bottom: 8px; }
html.contents-ready .contents-summary { display: none; }
@supports selector(::details-content) {
  @media (min-width: 900px) {
    .contents-summary { display: none; }
    .contents-fold::details-content { content-visibility: visible; }
  }
}

/* A chapter page (pages.js chapterPage): the jump list of its sections, then, at 900px and
   wider, every section's full text; below 900px only the jump list, whose links go to each
   section's own page. */
.jump h2 { margin-top: 20px; }
.jump ol.contents li { margin: 0 0 .25rem; }
/* A long chapter's list in two columns on a wide screen, read down the first column, then the second. */
@media (min-width: 1100px) { .jump ol.contents { columns: 2; column-gap: 32px; } .jump ol.contents li { break-inside: avoid; } }
@media (max-width: 899.98px) { .chapter-text { display: none; } }
.chapter-section { border-top: 1px solid var(--line-soft); margin-top: 24px; padding-top: 12px; scroll-margin-top: 16px; }
.chapter-section h2 { font: 700 21px/1.3 var(--font-head); margin: 0 0 4px; }
.sec-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin: 0 0 10px; font-size: 15px; }
.sec-tools a { display: inline-block; padding: 2px 0; }
.copy-cite { font: 600 14px/1 var(--font-body); color: var(--blue); background: var(--white); border: 1px solid var(--blue); border-radius: 6px; padding: 5px 10px; min-height: 28px; cursor: pointer; }
.copy-cite:hover { background: var(--bg-blue); }
.sec-tools .copy-status { font-size: 14px; }
.sec-tools .copy-status:empty { display: none; }
/* "Back to contents" stays at the bottom of the window while the chapter's text scrolls, and
   ends up after the last section. It sits at the right edge, over the text's empty margin when
   the window is wide; scroll-padding-bottom keeps whatever takes focus above it (WCAG 2.4.11),
   and the box around it lets clicks through to anything beside it. */
.back-wrap { position: sticky; bottom: 0; display: flex; justify-content: flex-end; padding: 12px 0 16px; pointer-events: none; }
.back-to-contents { pointer-events: auto; display: inline-block; font-weight: 600; text-decoration: none; color: var(--blue); background: var(--white); border: 2px solid var(--blue); border-radius: 6px; padding: 8px 14px; }
.back-to-contents:hover { background: var(--bg-blue); }
@media (min-width: 900px) { html:has(.chapter-text) { scroll-padding-bottom: 80px; } }

/* The law text. */
/* Room under the breadcrumbs and between the citation and the title (Noel, 2026-11-23, on a
   phone: the title sat right under the citation line). */
h1 .cite { display: block; font-size: .55em; font-weight: 600; color: var(--ink); letter-spacing: .02em; line-height: 1.3; margin-bottom: 10px; }
h1 { font-size: clamp(26px, 4vmin, 36px); margin-top: 20px; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 20px; }
/* Copy link, Copy citation, Print: small chips (Noel, 2026-11-23), quieter than the outlined
   buttons they replaced, so the title leads and they do not look like Menu or Contents. NYSDS's
   ghost button, recolored through its public --nys-button-* properties; the height, padding and
   radius use its private --_nys-button-* ones, which hold for the pinned NYSDS version. */
.tools nys-button {
  --nys-button-color: var(--blue); --nys-button-color--hover: var(--blue); --nys-button-color--active: var(--blue);
  --nys-button-background-color: var(--bg-blue); --nys-button-background-color--hover: var(--white); --nys-button-background-color--active: var(--white);
  --nys-button-border-color: var(--line-soft); --nys-button-border-color--hover: var(--blue); --nys-button-border-color--active: var(--blue);
  --_nys-button-height: 32px; --_nys-button-padding--y: 4px; --_nys-button-padding--x: 12px; --_nys-button-border-width: 1px; --_nys-button-border-radius: 999px; --_nys-button-font-size: 15px;
}
.copy-status { margin: 0; font-size: 14px; }
/* The law text is in the template's body font, like the rest of the page (Noel, 2026-11-23:
   a second family clashed). 18px with a 1.7 line height and lines of at most 70 characters
   keeps long legal text readable. */
.law { font: 18px/1.7 var(--font-body); max-width: 70ch; }
/* A run with no space in it, such as a form's fill-in blank ("________" for 60 characters, 21 Rules
   sections in July 2026) or a long address, breaks at the edge instead of pushing the page
   sideways on a phone. `anywhere` breaks only a run that would overflow, so ordinary words and
   lines are as before; it also lets the column shrink to fit (test/site/overflow.test.mjs). */
.law, main h1, main h2, main h3 { overflow-wrap: anywhere; }
.law p { margin: 0 0 16px; scroll-margin-top: 16px; }
.law [data-depth="2"] { margin-left: 1.6em; }
.law [data-depth="3"] { margin-left: 3.2em; }
.law [data-depth="4"] { margin-left: 4.8em; }
.law [data-depth="5"] { margin-left: 6.4em; }
.law [data-depth="6"], .law [data-depth="7"], .law [data-depth="8"] { margin-left: 8em; }
@media (max-width: 620px) {
  .law [data-depth="2"] { margin-left: .8em; }
  .law [data-depth="3"] { margin-left: 1.6em; }
  .law [data-depth="4"], .law [data-depth="5"], .law [data-depth="6"], .law [data-depth="7"], .law [data-depth="8"] { margin-left: 2.4em; }
}
.law a.num { font-weight: 700; text-decoration: none; }
.law a.num:hover { text-decoration: underline; }
.law a.xref { text-decoration-style: dotted; text-underline-offset: 2px; }
.law p:target { background: var(--bg-blue); outline: 2px solid var(--blue); outline-offset: 4px; }
/* Notes, wherever law text appears (Noel, 2026-11-23). The amendment history line, quieter and
   set off by a rule; an editor's note in a gray box, its "Editor's note:" in bold (render-html.js).
   The words are the publisher's, unchanged. */
.law .history { font: 15px/1.6 var(--font-body); border-top: 1px dashed var(--line); padding-top: 8px; margin-top: 12px; }
/* A subsection's heading line inside a section's text (issue #76): h2 on a section page, h3 in a
   chapter page's copy. One look for both, between the copy's h2 (21px) and the text (18px).
   Set off by space and a light rule so a long section doesn't read as one block (Noel,
   2026-11-24, on FC 102). */
.law .subhead { font: 700 19px/1.4 var(--font-head); margin: 44px 0 10px; padding-top: 20px; border-top: 1px solid var(--line-soft); scroll-margin-top: 16px; }
/* A paragraph the publisher set wholly in bold that reads as a heading line (render-html.js
   isBoldLine, Noel 2026-11-24 on RS 18-1): the subheading's look, kept a paragraph. Right after a
   subheading, or first in the text, no second rule. */
.law .boldline { font: 700 19px/1.4 var(--font-head); margin: 44px 0 10px; padding-top: 20px; border-top: 1px solid var(--line-soft); }
.law .subhead + .boldline, .law > .boldline:first-child { margin-top: 12px; padding-top: 0; border-top: 0; }
.law .ednote { font: 15px/1.6 var(--font-body); background: var(--light); border-left: 4px solid var(--line); padding: 8px 12px; }

.pager { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--line-soft); margin-top: 28px; padding-top: 16px; max-width: 72ch; }
.pager a { text-decoration: none; display: block; padding: .4rem 0; max-width: 32ch; }
.pager small { display: block; color: var(--ink); font-size: 13px; }
.pager .next { text-align: right; margin-left: auto; }

ol.contents, ul.contents { padding-left: 1.4em; }
ol.contents li, ul.contents li { margin: 0 0 .4rem; }
.count { font-size: 14px; }
.hero-law { padding: 24px 0 8px; }
.hero-law .buttons { display: flex; flex-wrap: wrap; gap: 10px; }

/* Text for screen readers only ("Title " before a title card's number). */
.vh { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

/* The Administrative Code's front page (pages-admin.js adminContentsPage; Noel, 2026-11-23): one
   card per title, each one link. One column on a phone; on a wider screen as many 300px columns
   as fit. The focus ring is the template's (a:focus-visible), kept clear of the next card by the gap. */
.title-cards { list-style: none; margin: 16px 0 32px; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.title-cards a { display: block; height: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--line-soft); border-left: 4px solid var(--blue); border-radius: 4px; background: var(--bg-blue); text-decoration: none; color: var(--ink); }
.title-cards a:hover, .title-cards a:focus-visible { background: var(--white); border-color: var(--blue); }
.title-cards a:hover .tc-name { text-decoration: underline; }
.tc-top { display: flex; align-items: baseline; gap: 8px; }
.tc-num { flex: 0 0 2.6em; font-size: 14px; font-weight: 700; color: var(--ink); }
.tc-name { flex: 1; font-weight: 700; color: var(--blue); font-size: 17px; line-height: 1.25; }
.tc-count { font-size: 14px; color: var(--ink); white-space: nowrap; margin-left: auto; }

/* What BetaNYC's copy leaves out of a section (pictures, unread subsections), with a link out. */
.left-out { border-left: 4px solid var(--warn); background: var(--light); padding: 8px 12px; margin: 0 0 16px; }

/* The one box at the bottom of every page. */
.copy-box { margin-top: 40px; }
.copy-box p { margin: 0 0 10px; }
.copy-box p:last-child { margin: 0; }
.copy-box .lead { font-size: 16px; }

/* Search results. */
.results-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; margin-top: 12px; }
.results-layout:has(.filters[hidden]) { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 760px) { .results-layout { grid-template-columns: 1fr; } }
.filters-h { font-size: 17px; margin: 0 0 8px; }
.filters nys-checkboxgroup { display: block; margin-bottom: 16px; }
.summary { font-weight: 600; min-height: 1.6em; }
ol.hits { list-style: none; padding: 0; margin: 0; }
.hit { border-bottom: 1px solid var(--line-soft); padding: 14px 0; }
.hit h2 { font-size: 19px; margin: 2px 0 6px; }
.hit .where { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
.badge { font-weight: 700; color: var(--blue); }
.hit .snip { margin: 0 0 6px; }
.hit mark { background: var(--blue-2); color: var(--ink); }
.subs { margin: 4px 0 0; padding-left: 1.2em; font-size: 15px; }
#pick { margin: 12px 0 20px; }

@media print {
  .site-bar, .menu-btn, .find, .toc, .contents-open, .tools, .sec-tools, .back-wrap, .pager, .crumbs, footer, nys-backtotop, .skip { display: none !important; }
  .wrap.layout { display: block; }
  /* A printed chapter page has every section's text, whatever the paper's width. */
  .chapter-text { display: block !important; }
  .law { max-width: none; font-size: 12pt; }
  .law a { color: inherit; text-decoration: none; }
  .copy-box { break-inside: avoid; }
  /* On paper, the official text still needs its address. */
  .copy-box a[href^="http"]::after { content: " (" attr(href) ")"; overflow-wrap: anywhere; word-break: break-all; }
}
