/* Паспорт на сторінці — стилі до @theinua/passport/page.js (T-0319). Підключається ЯВНО
   сторінкою, де паспорт є (/ui/passport.css), як gauge.css і run-chart.css — їх він тягне сам.
   Аркуш A4 того самого паспорта — labels.css (.psp-*): там мм і чорне по білому, тут — токени.

   Розкладка від ширини самого паспорта (container), а не екрана: паспорт стоїть і на всю
   сторінку, і в колонці кабінету. Прокрутки вбік немає ніде (CLAUDE.md п.7): таблиця на
   вузькому стає стовпчиком «назва — значення». Рух один — дуга гейджа малюється на вході;
   без руху для prefers-reduced-motion і в друці. */
@import url('gauge.css');
@import url('run-chart.css');

.pp { container: pp / inline-size; display: grid; gap: 16px; min-width: 0; }

/* Шапка: номер дрібним капсом над назвою, QR праворуч — сканувати з екрана іншим телефоном. */
.pp-head { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; }
.pp-id { display: grid; gap: 4px; min-width: 0; }
.pp-no { font-size: var(--fs-caption); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--hint);
  font-variant-numeric: tabular-nums; }
.pp-title { margin: 0; font-family: var(--font-display); font-size: clamp(1.6rem, 1.1rem + 2.2cqi, 2.4rem); line-height: 1.1;
  color: var(--green); overflow-wrap: anywhere; text-wrap: balance; }
.pp-sub { margin: 0; color: var(--text); }
.pp-qr { margin: 0; display: grid; justify-items: center; gap: 4px; }
.pp-qr .lbl-qr { width: 96px; height: 96px; display: block; }
.pp-qr figcaption { font-size: var(--fs-small); color: var(--hint); }

/* Поля — плитки «назва над значенням», скільки влізе в рядок. */
.pp-fields { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.pp-fields div { background: var(--surface); border: 1px solid var(--border-gold); border-radius: var(--radius); padding: 10px 14px; min-width: 0; }
.pp-fields dt { font-size: var(--fs-small); color: var(--hint); }
.pp-fields dd { margin: 2px 0 0; font-weight: 600; color: var(--green); overflow-wrap: anywhere; }

.pp-sect { background: var(--surface); border: 1px solid var(--border-gold); border-radius: var(--radius-md);
  box-shadow: var(--shadow-card); padding: 18px 20px; min-width: 0; }
.pp-sect h2 { margin: 0 0 12px; font-size: var(--fs-caption); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--green); }
.pp-empty { margin: 0; color: var(--hint); }
.pp-lead { margin: -4px 0 10px; color: var(--hint); }
/* Згорнутий розділ (fold): заголовок — сам перемикач, стрілка після нього. */
.pp-fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.pp-fold > summary::-webkit-details-marker { display: none; }
.pp-fold > summary::after { content: ''; width: 7px; height: 7px; border: solid var(--green); border-width: 0 2px 2px 0;
  rotate: 45deg; translate: 0 -2px; transition: rotate .2s ease; }
.pp-fold[open] > summary::after { rotate: -135deg; translate: 0 2px; }
.pp-fold > summary h2 { margin: 0; }
.pp-fold[open] > summary { margin-bottom: 12px; }
.pp-fold > summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; border-radius: 4px; }

/* Таблиця: числові стовпці — праворуч і табличними цифрами. */
/* Таблиці паспорта — кеглем більшим за текст сторінки: це головні дані (власник 01.11: «таблиця дуже мала»). */
.pp-table { width: 100%; border-collapse: collapse; font-size: 1.0625rem; line-height: 1.45; }
.pp-table th { text-align: left; font-size: .85rem; font-weight: 600; color: var(--hint); padding: 0 12px 8px 0;
  border-bottom: 1px solid var(--border-gold); }
.pp-table td { padding: 12px 14px 12px 0; border-bottom: 1px solid var(--border-gold); vertical-align: top; overflow-wrap: anywhere; }
.pp-table tr:last-child td { border-bottom: 0; }
.pp-table .pp-num { text-align: right; padding-right: 0; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Число не останнім (К-сть посеред «Складу», «Каталогу») — відступ, як у решти колонок, інакше «2» злипається з «1 280 ₴». */
.pp-table .pp-num:not(:last-child) { padding-right: 14px; }
.pp-table img { height: 2em; width: auto; vertical-align: middle; margin-right: 6px; }
/* Вкладений рядок (склад збірки під позицією-збіркою, I-0317): комірка { html } з pp-in1…3 —
   відступ рівня, щоб склад читався під своєю збіркою. */
.pp-in1, .pp-in2, .pp-in3 { display: inline-block; }
.pp-in1 { padding-left: 1.25em; }
.pp-in2 { padding-left: 2.5em; }
.pp-in3 { padding-left: 3.75em; }

/* Перелік речей (items) — картка позиції на рядок (власник 01.11: «не видно світлину, структурувати
   текст»): фото ліворуч (нема — заглушка того ж розміру, колонка не стрибає), назва картки, бренд і
   модель, мітки характеристик, примітка «на що» акцентом; кількість — великим числом праворуч. */
.pp-group { margin: 18px 0 4px; font-size: var(--fs-caption); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--hint); }
.pp-group:first-of-type { margin-top: 0; }
/* Список позицій — pp-list, бо pp-items уже клас самого розділу (pp-<тип>). */
.pp-list { list-style: none; margin: 0; padding: 0; }
.pp-item { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 12px 0;
  border-bottom: 1px solid var(--border-gold); }
.pp-item:last-child { border-bottom: 0; }
.pp-item-ph { width: 76px; height: 76px; border-radius: var(--radius); border: 1px solid var(--border-gold); background: #fff;
  display: grid; place-items: center; overflow: hidden; }
.pp-item-ph img { width: 100%; height: 100%; object-fit: contain; display: block; }
.pp-item-none { background: var(--bg); }
.pp-item-none::before { content: ''; width: 40%; height: 40%; border: 2px dashed rgba(var(--green-rgb), .22); border-radius: 6px; }
.pp-item-t { display: grid; gap: 4px; min-width: 0; }
/* Назва — без підкреслення (як позиція щита з 31.10.2026); наведення чи відкрите прев'ю — легке тло. */
.pp-item-title { font-size: 1.0625rem; line-height: 1.35; font-weight: 600; color: var(--green); text-decoration: none; overflow-wrap: anywhere;
  justify-self: start; border-radius: 4px; }
a.pp-item-title:hover, a.pp-item-title[aria-expanded="true"] { background: rgba(var(--green-rgb), .07); text-decoration: none; }
.pp-item-sub { font-size: .9rem; color: var(--text); }
.pp-chips { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.pp-chip { font-size: .8rem; line-height: 1.5; padding: 1px 8px; border-radius: var(--radius-pill); background: rgba(var(--green-rgb), .06); color: var(--text); }
.pp-chip i { font-style: normal; color: var(--hint); }
.pp-item-note { font-size: .9rem; font-weight: 600; color: var(--green); border-left: 3px solid var(--gold); padding-left: 8px; }
.pp-item-qty { font-family: var(--font-display); font-size: 1.6rem; line-height: 1; color: var(--green); font-variant-numeric: tabular-nums;
  min-width: 2ch; text-align: right; padding-top: 4px; }
a.pp-item-ph:focus-visible, a.pp-item-title:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* Розмір фото — від ширини самого розділу, а не паспорта: розділ ставлять і поза .pp (сторінка щита /s/). */
.pp-sect.pp-items { container-type: inline-size; }
@container (max-width: 480px) {
  .pp-item { grid-template-columns: 60px minmax(0, 1fr) auto; gap: 12px; }
  .pp-item-ph { width: 60px; height: 60px; }
}

/* Посилання (на папері — сітка QR): назва й коротка адреса. */
.pp-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.pp-links li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid var(--border-gold); }
.pp-links li:last-child { border-bottom: 0; }
.pp-links a { font-weight: 600; color: var(--green); }
.pp-links span { font-size: var(--fs-small); color: var(--hint); }

/* Чого бракує — не помилка, а підказка: золота межа зліва, без червоного. */
.pp-gaps { border-left: 4px solid var(--gold); }
.pp-gaps-list { margin: 0; padding-left: 1.1em; display: grid; gap: 6px; }

/* Гейджі: скільки влізе, кожен — зі своїм підписом під ним (число й межа — у самому гейджі текстом). */
.pp-gauges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px 12px; }
.pp-dial { margin: 0; display: grid; justify-items: center; gap: 6px; text-align: center; min-width: 0; }
.pp-dial .rbg { max-width: 170px; }
.pp-dial figcaption { display: grid; gap: 2px; }
.pp-dial figcaption b { color: var(--green); font-weight: 600; }
.pp-dial figcaption span { font-size: var(--fs-small); color: var(--hint); }
/* Дуга малюється від початку шкали до значення; гейджі — по черзі (--i). Довжина штриха 270 —
   більша за найдовшу дугу (повне коло r 42 ≈ 264), тож дуга з'являється цілою. */
.pp-dial .rbg-fill { stroke-dasharray: 270; animation: pp-draw .9s cubic-bezier(.22, .8, .3, 1) calc(var(--i, 0) * 90ms) both; }
@keyframes pp-draw { from { stroke-dashoffset: 270; } to { stroke-dashoffset: 0; } }

/* Графік: легенда з числами під курсором — run-chart.css; рядок «де курсор» над нею. */
.pp-chart .run-chart { margin-top: 0; }
.pp-chart-at { margin: 8px 0 0; font-size: var(--fs-small); color: var(--hint); font-variant-numeric: tabular-nums; }
.pp-legend b { margin-left: auto; font-weight: 600; color: var(--green); font-variant-numeric: tabular-nums; }

/* Вузький паспорт (телефон, колонка): QR менший, поля й гейджі по два. */
@container pp (max-width: 520px) {
  .pp-qr .lbl-qr { width: 72px; height: 72px; }
  .pp-sect { padding: 14px 16px; }
  .pp-fields { grid-template-columns: 1fr 1fr; }
  .pp-gauges { grid-template-columns: 1fr 1fr; }
}
/* Вузький розділ-таблиця: рядок широкої таблиці — картка: перша комірка заголовком, решта — «підпис
   стовпця — значення»; дві колонки лишаються таблицею. Мірило — сам розділ, а не .pp: зона з власною
   розкладкою (сторінка щита /s/) ставить розділи поза ним, як і позиції вище. */
/* Креслення: SVG на ширину розділу (лінії й текст — currentColor, отвори — кольором розділу).
   На вузькому підписи на кресленні дрібні — під ним список «роз'єм · клема — що підключено». */
.pp-sect.pp-figure { container-type: inline-size; }
.pp-figure { margin: 0; }
.pp-figure-img { color: var(--green); }
.pp-figure-img svg { display: block; width: 100%; height: auto; }
.pp-figure-img circle { fill: var(--surface); }
.pp-figure-list { display: none; margin: 12px 0 0; padding-left: 1.1em; gap: 6px; }
.pp-figure-list li { display: grid; gap: 1px; }
.pp-figure-list b { color: var(--green); font-weight: 600; }
.pp-figure-list span { font-size: var(--fs-small); color: var(--hint); }
@container (max-width: 560px) { .pp-figure-list { display: grid; } }
.pp-sect.pp-table { container-type: inline-size; }
@container (max-width: 480px) {
  .pp-table-wide thead { display: none; }
  .pp-table-wide, .pp-table-wide tbody, .pp-table-wide tr { display: block; }
  .pp-table-wide tr { padding: 8px 0; border-bottom: 1px solid var(--border-gold); }
  .pp-table-wide tr:last-child { border-bottom: 0; }
  .pp-table-wide td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 2px 0; border: 0; text-align: right; }
  .pp-table-wide td::before { content: attr(data-th); color: var(--hint); font-size: var(--fs-small); text-align: left; flex: none; }
  .pp-table-wide td:first-child { font-weight: 600; color: var(--green); text-align: left; }
  .pp-table-wide td:first-child::before { content: none; }
  .pp-table-wide td:empty, .pp-table-wide td:has(> span:empty) { display: none; }
}

@media (prefers-reduced-motion: reduce) { .pp-dial .rbg-fill { animation: none; } }
@media print { .pp-dial .rbg-fill { animation: none; } .pp-sect { box-shadow: none; break-inside: avoid; } }
