/* GearRoom polish: loaded after style.css, before motion.css.
   Tokens only — no hard-coded colours, so light and dark both work. */

/* A. Photo-card grid (markup from gearCard in ui.js) */
.gear-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.gcard {
  position: relative; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; overflow: hidden;
}
.gcard-link, .gcard-link:hover { display: block; color: inherit; text-decoration: none; }
.gcard-photo {
  position: relative; aspect-ratio: 4 / 3; display: grid; place-items: center;
  overflow: hidden; background: linear-gradient(135deg, var(--gray-soft), var(--panel));
}
.gcard-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gcard-ph { color: var(--muted); opacity: .7; }
.gcard-badge { position: absolute; top: 10px; left: 10px; }
.gcard-body { padding: 12px 14px 4px; }
.gcard-title {
  font-size: 14.5px; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.gcard-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gcard-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: auto; padding: 8px 14px 14px; }
.gcard.is-off .gcard-photo, .gcard.is-off .gcard-body { opacity: .55; }
.gcard.is-selected { border-color: var(--accent); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.stepper button { width: 30px; height: 30px; border: 0; background: var(--panel); color: var(--ink); cursor: pointer; }
.stepper span { min-width: 28px; text-align: center; font-variant-numeric: tabular-nums; }

/* B. Chip filters */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); color: var(--ink); font: inherit; font-size: 13px; cursor: pointer;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip .count { font-size: 12px; color: var(--muted); }
.chip.on .count { color: rgba(255, 255, 255, .8); }

/* C. View switch (segmented control) */
.seg { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 9px; background: var(--gray-soft); }
.seg button {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted); font: inherit; cursor: pointer;
}
.seg button.on { background: var(--panel); box-shadow: var(--shadow); color: var(--ink); }

/* D. Big screens */
@media (min-width: 1600px) {
  :root { font-size: 15px; }
  .content { padding: 28px 36px; }
}
@media (min-width: 2200px) {
  :root { font-size: 16px; }
}

/* E. Tables */
.table thead th { position: sticky; top: 0; z-index: 1; background: var(--panel); }
.table tbody tr:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }

/* F. Cards and titles */
.card { border-radius: 14px; }
.page-head h1 { font-size: 26px; letter-spacing: -.01em; }

/* G. Photo drop zone */
.photo-drop {
  position: relative; display: grid; place-items: center; align-content: center; gap: 6px;
  aspect-ratio: 4 / 3; border: 2px dashed var(--line); border-radius: 14px;
  background: linear-gradient(135deg, var(--gray-soft), var(--panel));
  overflow: hidden; color: var(--muted); text-align: center; cursor: pointer;
}
.photo-drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-drop.has-photo { border-style: solid; border-color: transparent; }
.photo-drop-hint { font-size: 12.5px; }
.photo-drop.has-photo .photo-drop-hint {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
  padding: 5px 12px; border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  color: var(--ink); opacity: 0;
}
.photo-drop.has-photo:hover .photo-drop-hint,
.photo-drop.has-photo:focus-visible .photo-drop-hint { opacity: 1; }
.photo-drop.dragging { border-color: var(--accent); border-style: dashed; background: var(--accent-soft); }
.photo-drop.busy::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 35%, color-mix(in srgb, var(--accent) 16%, transparent) 50%, transparent 65%);
  animation: gr-shimmer 1.3s linear infinite;
}
@keyframes gr-shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

/* H. Sticky side column */
.sticky-side { position: sticky; top: 76px; align-self: start; }

/* I. Mobile cart bar */
@media (max-width: 860px) {
  .cart-bar { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 40; box-shadow: var(--shadow-lg); }
}

/* Wide screens: let content use the space, keep side panels a sensible width. */
.content { max-width: 1760px; }
.split { grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }
.item-photo-zone { max-width: 480px; margin-bottom: 4px; }
@media (min-width: 2000px) { .content { max-width: 2200px; margin-inline: auto; } }

/* N. Gear picker dialog: photo grid with category chips (pickItems in ui.js) */
.modal.wide:has(.pick-grid) { width: min(1240px, 96vw); }
.pick-top { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.pick-top input[type=search] { width: 100%; }
button.chip { font: inherit; cursor: pointer; }
/* Fixed height, so the dialog doesn't jump when a category has only a few items. */
.pick-grid { height: min(62vh, 760px); overflow-y: auto; padding: 2px; }
.pick-grid .gear-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.pick-grid .gcard { cursor: pointer; }
.pick-grid .gcard.is-off { cursor: not-allowed; }
.pick-grid .gcard:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pick-grid .gcard.is-selected { box-shadow: 0 0 0 2px var(--accent); background: var(--accent-soft); }
.pick-tick { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 600; font-size: 12.5px; }
[data-count] { margin-top: 8px; }
@media (max-width: 860px) {
  .pick-grid { height: auto; min-height: 50vh; }
  .pick-grid .gear-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pick-top .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .pick-top .chip { white-space: nowrap; flex: none; }
  .modal.wide:has(.pick-grid) { width: 100%; max-width: 100vw; min-width: 0; }
  .pick-top, .pick-top .chips { min-width: 0; max-width: 100%; }
}

/* O. Help topic page: topic list on the left, article on the right */
.help-layout { display: grid; grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); gap: 20px; align-items: start; }
.help-nav { position: sticky; top: 76px; }
.help-nav .topic-list { display: flex; flex-direction: column; gap: 2px; padding: 8px; }
.help-nav .topic-list a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: var(--ink); text-decoration: none; font-size: 14px;
}
.help-nav .topic-list a:hover { background: var(--gray-soft); }
.help-nav .topic-list a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.help-nav .topic-list svg { width: 16px; height: 16px; flex: none; }
.help-main { min-width: 0; }
.help-body { max-width: 860px; line-height: 1.6; }
.help-body h2:first-child { margin-top: 0; }
@media (max-width: 860px) {
  .help-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .help-nav { position: static; }
  .help-nav .topic-list { flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .help-nav .topic-list a { flex: none; white-space: nowrap; }
}

/* P. Dashboard maintenance card */
.maint-card h2 { display: flex; align-items: center; gap: 8px; }
.maint-head { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 14px 0 6px; }
.maint-card .row .thumb, .maint-card .row img { flex: none; }
.maint-card ul.stack { list-style: none; padding: 0; margin: 0; }
.dash-quiet { display: flex; align-items: center; gap: 8px; margin: 4px 0 0; color: var(--ink); }
.dash-quiet svg { color: var(--green, var(--accent)); flex: none; }
