/* Spec sheets (ported from spec-library/): the yard's own shop drawings laid on a stone light
   table, the numbers retyped beside each one with its list prices, gallons per foot, and the full
   price list (the only thing that prints). Built on the tokens in site.css. */

/* ---------- title and search ---------- */
.spec-hero { padding-block: clamp(32px, 4.2vw, 60px) clamp(28px, 3vw, 40px); }
.spec-hero-grid {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 24px var(--gap-wide); align-items: end;
}
.spec-hero .lead { margin-top: 0; }

.find { position: relative; margin-top: 22px; }
.find input { min-height: 52px; padding-inline: 14px; border-color: var(--ink); font-size: 17px; }
.find.is-open input { border-bottom-color: var(--rule); }
/* the browser's clear button, drawn in ink like the panel close */
.spec-hero input[type="search"]::-webkit-search-cancel-button, .prices input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none; appearance: none; width: 14px; height: 14px; margin-left: 10px; cursor: pointer;
  background:
    linear-gradient(45deg, transparent calc(50% - 0.8px), var(--ink) calc(50% - 0.8px), var(--ink) calc(50% + 0.8px), transparent calc(50% + 0.8px)),
    linear-gradient(-45deg, transparent calc(50% - 0.8px), var(--ink) calc(50% - 0.8px), var(--ink) calc(50% + 0.8px), transparent calc(50% + 0.8px));
}
.find-results {
  position: absolute; z-index: 30; left: 0; right: 0; top: 100%;
  max-height: min(380px, 62vh); overflow-y: auto; overscroll-behavior: contain;
  list-style: none; background: var(--white); border: 1.5px solid var(--ink); border-top: 0;
}
.find-results li + li { border-top: 1px solid var(--rule); }
.find-results button {
  display: block; width: 100%; padding: 10px 14px; border: 0; background: none;
  text-align: left; font-weight: 600; line-height: 1.3; cursor: pointer;
}
.find-results button:hover { background: var(--stone); }
.find-results button:focus-visible { background: var(--stone); outline: 2px solid var(--ink); outline-offset: -2px; }
.find-results small { display: block; margin-top: 2px; font-weight: 400; font-size: var(--fs-fine); color: var(--grey); }
.find-results .none { padding: 12px 14px; font-size: var(--fs-small); color: var(--grey); }
.find-results .to-prices { font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- library: sheet list + viewer ---------- */
.library { padding-bottom: var(--section); }
.lib-grid { display: grid; grid-template-columns: 264px minmax(0, 1fr); gap: var(--gap); align-items: start; }

.sheet-list { list-style: none; border-top: 1px solid var(--ink); }
.sheet-list li { border-bottom: 1px solid var(--rule); }
.sheet-link { display: grid; gap: 2px; padding: 12px 12px 12px 16px; text-decoration: none; }
.sheet-link b { font-weight: 600; line-height: 1.3; }
.sheet-link small { font-size: var(--fs-fine); color: var(--grey); }
.sheet-link:hover b { text-decoration: underline; text-underline-offset: 3px; }
.sheet-link:focus-visible { outline-offset: -2px; }
.sheet-link[aria-current="true"] { background: var(--stone); box-shadow: inset 3px 0 0 var(--red); }
.materials { margin-top: 20px; padding-right: 8px; font-size: var(--fs-fine); line-height: 1.5; color: var(--grey); }

@media (min-width: 961px) and (min-height: 760px) {
  .sheets { position: sticky; top: calc(var(--head-h) + 24px); }
}

.viewer { min-width: 0; }
.sheet-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px;
  padding-bottom: 18px; border-bottom: 1px solid var(--rule);
}
.sheet-head h2 { font-size: clamp(26px, 2.5vw, 34px); line-height: 1.1; letter-spacing: -0.015em; }
.sheet-meta { margin-top: 6px; font-size: var(--fs-small); color: var(--grey); }

/* page tabs: one thumbnail per drawing; the selected one gets the red underline the nav uses.
   The strip is padded (and pulled back by the same amount) so a focused tab's ring isn't clipped. */
.page-tabs { display: flex; gap: 10px; margin: 12px -6px 0; padding: 6px 6px 8px; overflow-x: auto; scrollbar-width: thin; }
.page-tab {
  flex: none; display: grid; justify-items: center; gap: 4px; width: 60px; padding: 0 0 4px;
  border: 0; border-bottom: 3px solid transparent; background: none;
  color: var(--grey); font-size: 14px; line-height: 1.2; font-variant-numeric: tabular-nums; cursor: pointer;
}
.page-tab img {
  width: 60px; height: 76px; object-fit: cover; object-position: top left;
  border: 1px solid var(--rule); background: var(--white);
}
.page-tab:hover img { border-color: var(--rule-strong); }
.page-tab:hover .tab-n { color: var(--ink); }
.page-tab[aria-selected="true"] { border-bottom-color: var(--red); color: var(--ink); font-weight: 600; }
.page-tab[aria-selected="true"] img { border-color: var(--ink); }
.page-tab:focus-visible { outline-offset: 2px; }

.stage {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 356px);
  gap: 28px clamp(28px, 3vw, 44px); margin-top: 10px; align-items: start;
}
.drawing { min-width: 0; }

/* the light table */
.frame {
  position: relative; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center;
  height: clamp(420px, calc(100vh - 240px), 820px); padding: clamp(14px, 2vw, 26px);
  background: var(--stone); overflow: hidden;
}
.frame img {
  width: auto; height: auto; max-width: 100%; max-height: 100%;
  background: var(--white); box-shadow: 0 0 0 1px var(--rule);
  cursor: zoom-in; user-select: none; -webkit-user-drag: none;
  transition: opacity 0.18s ease;
}
.frame.is-loading img { opacity: 0.15; }
.frame.is-zoomed { display: block; overflow: auto; overscroll-behavior: contain; cursor: grab; }
.frame.is-zoomed img { max-width: none; max-height: none; cursor: inherit; }
.frame.is-zoomed.is-dragging { cursor: grabbing; }
.frame:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.drawing figcaption {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 20px;
  margin-top: 10px; font-size: var(--fs-small); color: var(--grey); font-variant-numeric: tabular-nums;
}
.drawing-tools { display: inline-flex; flex-wrap: wrap; gap: 4px 20px; }
.tool {
  padding: 0; border: 0; background: none; color: var(--ink);
  font-weight: 600; font-size: var(--fs-small); text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.tool:hover { text-decoration-thickness: 2px; }

/* ---------- facts beside the drawing ---------- */
.facts { min-width: 0; }
.facts h3 { font-size: var(--h3); line-height: 1.25; }
.fact-block { margin-top: 24px; }
.fact-block h4 { margin-bottom: 8px; font-size: var(--fs-small); font-weight: 600; }
.facts .data-table { font-size: 15px; }
.facts .data-table caption { padding-bottom: 8px; font-weight: 600; color: var(--ink); }
.facts .data-table th, .facts .data-table td { padding: 9px 0; }
.facts .data-table th + th, .facts .data-table th + td, .facts .data-table td + td { padding-left: 14px; }
.facts .data-table thead th { padding-top: 0; font-size: 13.5px; }
.facts .data-table tbody th { white-space: nowrap; }
.facts .data-table.is-wide { font-size: 14px; }
.facts .data-table.is-wide th + th, .facts .data-table.is-wide th + td, .facts .data-table.is-wide td + td { padding-left: 10px; }
.facts .fine { margin-top: 8px; }
.facts .fine .tool { font-size: inherit; }
.note-list { list-style: none; border-top: 1px solid var(--ink); }
.note-list li { padding: 9px 0; border-bottom: 1px solid var(--rule); font-size: 15px; line-height: 1.4; }
.facts .more { margin-top: 20px; font-size: var(--fs-small); color: var(--grey); }
.facts .more + .more { margin-top: 6px; }
.facts .more a { color: var(--ink); }

/* price lines with an Add button (facts and the price list) */
.lines { list-style: none; border-top: 1px solid var(--ink); }
.line {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 2px 14px;
  padding: 7px 0; border-bottom: 1px solid var(--rule); font-size: 15px; line-height: 1.35;
}
.line-name small { display: block; margin-top: 1px; font-size: 13.5px; color: var(--grey); }
.line-name .on-list { color: var(--ink); font-weight: 600; }
.line .price, .line .call-price { text-align: right; }
.line .call-price { font-size: 14px; }
.line-add { min-height: 34px; padding: 0 11px; font-size: 14px; }

/* ---------- gallons per foot ---------- */
.gpf-grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: var(--gap) var(--gap-wide); align-items: end; }
.gpf { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0 clamp(10px, 2vw, 28px); margin: 0; }
.gpf > div { display: flex; flex-direction: column; justify-content: flex-end; }
.gpf svg { width: 100%; height: auto; margin-bottom: 14px; overflow: visible; }
.gpf circle { fill: var(--white); stroke: var(--ink); stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.gpf circle + circle { fill: var(--stone); stroke-width: 1; }
.gpf dt { font-size: var(--fs-small); font-weight: 600; }
.gpf dd {
  margin: 2px 0 0; font-family: var(--display); font-size: clamp(30px, 3vw, 44px); font-weight: 500;
  line-height: 1.05; letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
}
.gpf dd small { display: block; margin-top: 4px; font-family: var(--sans); font-size: var(--fs-fine); letter-spacing: 0; color: var(--grey); }

/* ---------- price list ---------- */
.prices-head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px var(--gap); align-items: end;
  margin-bottom: clamp(28px, 3.5vw, 44px);
}
.prices-head .section-head { margin-bottom: 0; }
.prices-tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.pl-filter { width: 270px; }
.price-cols { columns: 3 300px; column-gap: clamp(28px, 3.4vw, 52px); }
.price-cat { break-inside: avoid; margin-bottom: 36px; }
.price-cat h3 {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding-bottom: 8px; border-bottom: 1.5px solid var(--ink); font-size: 17px; line-height: 1.3;
}
.price-cat h3 a { font-size: var(--fs-fine); font-weight: 500; white-space: nowrap; }
.price-cat .lines { border-top: 0; }
.price-cat .line { padding: 5px 0; }
.price-cat .line-add { min-height: 32px; border-color: transparent; padding-inline: 8px; }
.price-cat .line-add:hover { border-color: var(--ink); text-decoration: none; }
.cat-note { padding-top: 6px; font-size: var(--fs-fine); color: var(--grey); }
.cat-note.is-new { color: var(--red-ink); font-weight: 600; }
.price-empty { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; padding: 18px 0 30px; border-top: 1px solid var(--rule); }
.price-empty p { font-weight: 600; }
/* the columns end flush (column breaks drop the last category's margin), so the terms keep their own gap */
.terms { list-style: none; display: grid; gap: 4px; margin-top: 20px; }
.print-only { display: none; }

/* ---------- closing band ---------- */
.spec-more .h2 { font-size: clamp(26px, 2.6vw, 34px); }
.spec-more .actions { margin-top: 22px; }

/* ---------- smaller screens ---------- */
@media (max-width: 1180px) {
  .stage { grid-template-columns: minmax(0, 1fr); }
  .frame { height: clamp(440px, calc(100vh - 160px), 900px); }
}
/* the title stacks over the lead and search where the Products hero does */
@media (max-width: 1080px) {
  .spec-hero-grid { grid-template-columns: minmax(0, 1fr); }
  .spec-hero-side { max-width: 40em; }
  .spec-more .split-even { row-gap: clamp(40px, 6vw, 56px); }
}
@media (max-width: 960px) {
  .lib-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .sheet-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; border: 0; }
  .sheet-list li { border: 0; }
  .sheet-link { height: 100%; align-content: start; padding: 10px 12px; border: 1.5px solid var(--rule-strong); }
  .sheet-link small { display: none; }
  .sheet-link:hover { border-color: var(--ink); }
  .sheet-link[aria-current="true"] { background: var(--white); border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }
  .materials { margin-top: 14px; }
  .gpf-grid, .prices-head { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .sheet-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sheet-link { font-size: 15px; }
  .sheet-head .btn { width: 100%; }
  /* --ratio: the drawing's own width / height, set by spec-sheets.js once it loads */
  .frame { height: auto; aspect-ratio: var(--ratio, 1080 / 1400); padding: 10px; }
  .drawing figcaption { font-size: var(--fs-fine); }
  .gpf { gap: 0 8px; }
  .gpf svg { margin-bottom: 10px; }
  .gpf dt { font-size: 13.5px; }
  .gpf dd { font-size: clamp(22px, 6vw, 30px); }
  .gpf dd small { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .gpf > div { position: relative; }
  .prices-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pl-filter { grid-column: 1 / -1; width: auto; }
  .prices-tools .btn { padding-inline: 10px; }
  .line-add { padding: 0 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .frame img { transition: none; }
}

/* ---------- print: the price list only ---------- */
@media print {
  main > :not(.prices) { display: none !important; }
  .prices { padding: 0 !important; }
  .print-only { display: block !important; }
  .print-head { margin-bottom: 12pt; font-size: 10pt; }
  .print-head p + p { margin-top: 4pt; }
  .prices-head { display: block; margin-bottom: 14pt; }
  .prices-head h2 { font-size: 20pt; }
  .prices-head .lead { color: #000; }
  .screen-only, .prices-tools, .line-add, .price-cat h3 a, .price-empty, .on-list, #price-status { display: none !important; }
  .price-cat[hidden] { display: block !important; }
  .price-cat .line[hidden] { display: grid !important; }
  .price-cols { columns: 2; column-gap: 24pt; }
  .price-cat { margin-bottom: 12pt; }
  .price-cat h3 { font-size: 11pt; padding-bottom: 3pt; }
  .line { grid-template-columns: minmax(0, 1fr) auto; gap: 0 10pt; padding: 3pt 0; font-size: 9.5pt; }
  .line-name small, .cat-note { font-size: 8.5pt; }
  .terms { margin-top: 10pt; padding: 0; background: none; font-size: 9.5pt; }
  .price-cat, .line { break-inside: avoid; }
}
