/* Moving between pages: the new page fades in under a nav bar that holds
   still (a cross-document view transition, Safari 18.2 and later). The new
   page waits until <main> is parsed (rel="expect" in the layout). Browsers
   without support, and reduced motion, just load the page. */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }
.dn-nav { view-transition-name: site-nav; }
::view-transition-group(*) { animation-duration: 0.18s; }

/* The light leak over the current nav link slides to the new page's link,
   overshoots a touch, and settles (a damped spring, about 4% past). It's a real
   element, not Deck Neon's ::before, because only elements can carry a
   view-transition-name. It mirrors `.dn-lens .dn-nav-links a[aria-current]::before`
   in deck-neon.css; keep the two in step after a sync. */
.dn-nav.dn-lens .dn-nav-links a[aria-current]::before { content: none; }
.nav-leak {
  position: absolute; left: 50%; top: -6px; width: 30px; height: 2px; translate: -50% 0; border-radius: 2px; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--lens-fringe-warm) 14%, var(--lens) 32%, var(--lens) 68%, var(--lens-fringe-cool) 86%, transparent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--lens) calc(55% * var(--dn-glow-k, 1)), transparent);
  view-transition-name: nav-leak;
}
::view-transition-group(nav-leak) {
  animation-duration: 0.5s;
  animation-timing-function: linear(0, 0.073 5%, 0.236 10%, 0.426 15%, 0.606 20%, 0.756 25%, 0.869 30%, 0.948 35%, 0.998 40%, 1.025 45%, 1.037 50%, 1.038 55%, 1.034 60%, 1.027 65%, 1.02 70%, 1.013 75%, 1.008 80%, 1.004 85%, 1.001 90%, 1);
}
/* It stretches a little while it moves, like light smearing, and keeps its glow. */
::view-transition-image-pair(nav-leak) { animation: leak-stretch 0.5s ease-in-out; }
::view-transition-old(nav-leak), ::view-transition-new(nav-leak) { animation: none; }
::view-transition-old(nav-leak) { opacity: 0; }
@keyframes leak-stretch { 35% { scale: 1.8 1; } }

/* Home Inventory's page layout on top of Deck Neon (deck-neon/*.css, copied
   from the mikahsargent/deck-neon repo by scripts/sync-deck-neon.mjs; don't
   edit those files here). */

html, body { margin: 0; min-height: 100%; }
body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 40px; } }
main.wrap { flex: 1; display: grid; gap: var(--space-5, 26px); align-content: start; padding-top: 28px; padding-bottom: 40px; }

.skip { position: absolute; left: -9999px; top: 8px; z-index: 10; padding: 8px 12px; background: var(--text); color: var(--ground); border-radius: 6px; }
.skip:focus { left: 8px; }

.dn-page-head h1 { font-size: clamp(40px, 9vw, 72px); }

/* the Lens mark, drawn in CSS colors because the CSP blocks inline styles */
.lens-mark .lm-pane { fill: var(--lens); fill-opacity: 0.08; stroke: var(--lens); stroke-opacity: 0.55; stroke-width: 1.6; }
.lens-mark .lm-leak { stroke: var(--lens); stroke-width: 2.6; stroke-linecap: round; }
.lens-mark .lm-warm { fill: var(--lens-fringe-warm); }
.lens-mark .lm-cool { fill: var(--lens-fringe-cool); }

.dn-nav { position: sticky; top: 0; z-index: 5; -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.dn-nav form { margin: 0; }
.dn-nav .dn-btn { min-height: 38px; padding: 8px 14px; font-size: 15px; }

a.dn-btn { text-decoration: none; }
.dn-btn { cursor: pointer; }
.dn-btn[disabled] { cursor: progress; opacity: 0.7; }

.stack { display: grid; gap: 14px; }
.dn-field { max-width: none; }

.notice { max-width: 640px; }

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.dn-panel-title { margin: 0; }
.dn-panel .dn-note { margin: 0; }

.plain { list-style: none; margin: 0; padding: 0; }
.key-row { grid-template-columns: 1fr auto; }
.dn-row-main { display: grid; gap: 2px; min-width: 0; }
.dn-row-end { margin: 0; }

.login { display: grid; gap: 22px; max-width: 520px; }
.login-passkey { display: grid; gap: 10px; justify-items: start; }
.login-password summary { cursor: pointer; font: 600 14px/1.2 var(--font-display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); padding: 6px 0; }
.login-password[open] summary { margin-bottom: 14px; }
.login-password .dn-note { margin: 14px 0 0; }

/* The OAuth consent page (src/pages/oauth.ts). */
.consent { max-width: 640px; }
.consent-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.consent-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 0; }


@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* Deck Neon defaults --dn-state to green, which means "ready". Labels and
   neutral panel eyebrows aren't a state, so they read in text or muted. */
.dn-field > .dn-eyebrow { color: var(--text); }
.dn-panel:not([data-state]):not(.is-dim) .dn-panel-head .dn-eyebrow { color: var(--muted); }

/* ---- Screens ---- */

.dn-nav-links { gap: 18px; }
.inline { display: inline; margin: 0; }
.quiet-link { color: var(--muted); font: 600 13px/1.2 var(--font-display); letter-spacing: 0.12em; text-transform: uppercase; text-decoration: none; }
.quiet-link:hover { color: var(--text); }
.dn-muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--font-mono); font-size: 13px; }
.link { color: var(--text); text-decoration: underline; text-decoration-color: var(--lens); text-underline-offset: 3px; overflow-wrap: anywhere; }
.dn-page-head .dn-eyebrow a { color: inherit; text-decoration: none; }
.dn-page-head .dn-eyebrow a:hover { color: var(--text); }

/* A segmented control (triage's lists, the left-out lists) beside its filters. */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dn-seg { max-width: 100%; justify-self: start; }
.dn-seg button { white-space: nowrap; }

/* rows */
.dn-row-main { text-decoration: none; color: inherit; }
a.dn-row-main:hover .dn-row-title { text-decoration: underline; text-decoration-color: var(--lens); text-underline-offset: 3px; }
/* Deck Neon's row title is a one-line key label; item and spot names are
   sentences, so they wrap in body type instead of truncating in caps. */
.dn-row-title { font: 600 15.5px/1.3 var(--font-body); text-transform: none; letter-spacing: 0; white-space: normal; overflow: visible; color: var(--text); overflow-wrap: anywhere; }
.dn-row-note { font: 400 13.5px/1.35 var(--font-body); color: var(--muted); white-space: normal; overflow: visible; }
.dn-row-end { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.dn-list .dn-row { grid-template-columns: 1fr auto; }
.dn-panel { container-type: inline-size; }
.dn-panel h3.group { margin: 10px 0 0; font: 600 12px/1 var(--font-display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.dn-panel h3.group:first-of-type { margin-top: 0; }
.empty { margin: 0; }

/* Forms. Every control sits in Deck Neon's TextField wrap (.dn-input-wrap),
   which draws single-line inputs. Selects and textareas sit in the same wrap,
   drawn here to match: the same type, a chevron for a select, and room to grow
   for a textarea. */
.dn-input-wrap select, .dn-input-wrap textarea { flex: 1; min-width: 0; margin: 0; background: transparent; border: 0; outline: none; color: var(--text); font: 500 15px/1.3 var(--font-body); }
.dn-input-wrap input:disabled, .dn-input-wrap select:disabled, .dn-input-wrap textarea:disabled { color: var(--muted); }
.dn-input-wrap input.mono { font: 500 13px/1 var(--font-mono); }
.select-wrap select { appearance: none; -webkit-appearance: none; align-self: stretch; padding: 0 24px 0 0; cursor: pointer; text-overflow: ellipsis; }
.select-wrap::after { content: ""; position: absolute; right: 17px; top: 50%; width: 7px; height: 7px; margin-top: -6px; border-right: 1.6px solid var(--muted); border-bottom: 1.6px solid var(--muted); rotate: 45deg; pointer-events: none; }
.area-wrap { height: auto; align-items: stretch; padding: 11px 14px; }
.area-wrap textarea { min-height: 4.5em; padding: 0; resize: vertical; line-height: 1.5; }
.dn-input-wrap input[type="file"] { font: 400 14px/1 var(--font-body); color: var(--muted); }
.dn-input-wrap input[type="file"]::file-selector-button { margin-right: 12px; padding: 7px 12px 6px; border: 1px solid var(--lens-edge); border-radius: 6px; background: var(--lens-glass-top); color: var(--text); font: 600 13px/1 var(--font-display); letter-spacing: 0.12em; text-transform: uppercase; cursor: pointer; }
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.form-grid > .dn-field { align-content: start; min-width: 0; }
.dn-field.wide { grid-column: 1 / -1; }
.form-actions { display: flex; align-items: center; gap: 18px; margin-top: 6px; }
.record-layout { display: grid; gap: 22px; align-items: start; }
@media (min-width: 960px) { .record-layout { grid-template-columns: minmax(0, 1fr) 300px; } }
.record-form { gap: 18px; }
.record-side, .record-main { display: grid; gap: 18px; }

.dn-panel.is-careful.dn-hazard .dn-panel-head .dn-eyebrow.at-stake { color: var(--red); } /* a danger zone says what's at stake in red */
.action-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
@media (min-width: 960px) { .action-bar .push { order: 1; margin-left: auto; } }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font: 400 14px/1.4 var(--font-body); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
/* Filters share a row, two to a phone's width; a long option is cut off rather than widening the form. */
.dn-field.filter { grid-template-columns: minmax(0, 1fr); flex: 1 1 140px; min-width: 0; width: auto; }
.dn-field.filter.grow { flex: 1 1 220px; }
/* A one-line form keeps its button beside the box. */
.one-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.one-line.search { max-width: 720px; }
.report { margin: 0; padding-left: 1.2em; font: 400 14px/1.5 var(--font-body); color: var(--muted); max-height: 320px; overflow: auto; }

/* Wide tables scroll inside their panel instead of widening the page. */
main.wrap > *, .dn-panel > *, .record-layout > *, .home-grid > * { min-width: 0; }
.dn-table a { color: var(--text); text-decoration: none; font-weight: 600; }
.dn-table a:hover { text-decoration: underline; text-decoration-color: var(--lens); text-underline-offset: 3px; }
.dn-table td { vertical-align: top; }
/* The item table: names and places wrap, so the table stays as narrow as it
   can; on a phone it scrolls sideways inside its wrap (Deck Neon's DataTable). */
.item-table .item-name { white-space: normal; min-width: 15em; overflow-wrap: anywhere; }
.item-table .item-where { white-space: normal; min-width: 9em; }
.dn-panel-head { gap: 12px; flex-wrap: wrap; }


/* ---- Home Inventory ---- */

/* Home: panels in as many columns as fit. */
.home-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); align-items: start; }
.count-row .count { font: 800 22px/1 var(--font-display); font-variant-numeric: tabular-nums; color: var(--text); }
.cats .dn-row { padding-top: 8px; padding-bottom: 8px; }
.cats .count { font-size: 18px; }

/* Status words in a row under a title. */
.word-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.word-row .dn-note { margin: 0 0 0 6px; }

/* The item list's filters wrap; the search box takes the room it can. */
form.filters { padding: 16px; }
.filter-actions { display: flex; align-items: center; gap: 14px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.pager .dn-note { margin: 0; }

/* Quick answers: optional where, how many, and a note, then one button each. */
.decide { gap: 14px; }
.decide-extra { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@container (min-width: 560px) { .decide-extra { grid-template-columns: minmax(0, 2fr) minmax(90px, 0.6fr) minmax(0, 2fr); } }
.decide-extra .dn-field { margin: 0; }
.decide-extra .dn-input-wrap input { width: 100%; }
.decide-buttons { display: flex; flex-wrap: wrap; gap: 8px; }

/* Triage: one item, big, with its question. */
.triage-card { gap: 14px; }
.triage-title { font: 600 clamp(20px, 3.4vw, 28px)/1.25 var(--font-body); text-transform: none; letter-spacing: 0; overflow-wrap: anywhere; }
.triage-title a { color: var(--text); text-decoration: none; }
.triage-title a:hover { text-decoration: underline; text-decoration-color: var(--lens); text-underline-offset: 4px; }
.triage-question { margin: 4px 0 0; font: 600 17px/1.4 var(--font-body); color: var(--text); }
.triage-more { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--track); }
.toolbar .filters { padding: 0; }

/* The edit form's import details fold away. */
details.more { padding: 0; }
details.more > summary { cursor: pointer; padding: 16px 18px; font: 600 13px/1.2 var(--font-display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
details.more[open] > summary { padding-bottom: 6px; }
details.more > .form-grid { padding: 8px 18px 18px; }
.record-form > .dn-panel:not(details) { padding: 18px; }

/* History, newest first. */
.history { display: grid; gap: 10px; font: 400 14px/1.45 var(--font-body); }
.history li { display: grid; gap: 2px; overflow-wrap: anywhere; }
.history .dn-note { margin: 0; }

/* Locations nest by indenting. */
.tree .depth-1 { padding-left: 22px; }
.tree .depth-2 { padding-left: 44px; }
.tree .depth-3 { padding-left: 66px; }
.tree .depth-4, .tree .depth-5 { padding-left: 88px; }

.notes { margin-top: 12px; }
.block { display: block; }
