/* What can I scan? (v0.8.1): group cards, kind tiles, rails, the kind page and the Collections shelf.
   Follows docs/design-system.md: tone tints from style.css, 22px cards with 18px inner art, capsule chips, spring
   presses. Phone: swipeable rails with scroll-snap. Computer (960px+): rails open out into grids. */

/* Art: the tone gradient with a large line icon, or the Gemini illustration when it exists (kinds.js ART_READY). */
.kart, .gart { position: relative; display: grid; place-items: center; overflow: hidden; color: var(--tone-ink); border-radius: 18px;
  background: radial-gradient(90% 90% at 18% 0%, color-mix(in srgb, var(--tone) 30%, transparent), transparent 70%),
    radial-gradient(70% 70% at 100% 100%, color-mix(in srgb, var(--tone) 18%, transparent), transparent 70%), var(--tone-soft); }
.kart { aspect-ratio: 4 / 3; }
.kart > svg { width: 38%; height: auto; max-width: 64px; stroke-width: 1.6; filter: drop-shadow(0 6px 10px color-mix(in srgb, var(--tone) 25%, transparent)); }
.kart::after, .gart::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: radial-gradient(circle, color-mix(in srgb, var(--tone) 22%, transparent) 1px, transparent 1.4px); background-size: 14px 14px;
  mask-image: linear-gradient(160deg, #000, transparent 65%); }
.kart.has-art > svg, .gart.has-art .gicons { display: none; }
.kart img, .gart img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 9%; z-index: 1;
  filter: drop-shadow(0 10px 12px color-mix(in srgb, var(--tone) 28%, rgba(0,0,0,.12))); transition: transform .45s var(--spring); }
.gart img { padding: 6% 8%; }
.kgh .gart img { padding: 6%; }
.ktile:hover .kart img, .gcard:hover .gart img { transform: translateY(-3px) scale(1.03); }
.gart { aspect-ratio: 16 / 10; }
.gicons { display: flex; align-items: center; }
.gicons > span { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 18px; background: var(--surface); color: var(--tone-ink);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--tone) 22%, transparent), inset 0 0 0 1px var(--hair); margin-left: -10px; }
.gicons > span:first-child { margin-left: 0; transform: rotate(-8deg) translateY(4px); }
.gicons > span:nth-child(2) { width: 60px; height: 60px; z-index: 1; }
.gicons > span:last-child { transform: rotate(8deg) translateY(4px); }
.gicons svg { width: 26px; height: 26px; }

/* Rails: swipe sideways on a phone, bleeding to the screen edge. */
.rail { display: grid; grid-auto-flow: column; gap: 12px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
  scroll-padding-inline: 16px; padding: 4px 16px 10px; margin: -4px -16px 0; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: start; }
.grail { grid-auto-columns: minmax(150px, 42%); }
.krail { grid-auto-columns: minmax(148px, 40%); }

.gcard, .ktile { display: grid; gap: 4px; align-content: start; padding: 8px 8px 12px; border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-1);
  color: inherit; text-decoration: none; position: relative; transition: transform .35s var(--spring-fast), box-shadow .2s; }
.gcard:active, .ktile:active { transform: scale(.96); }
.gcard .t, .ktile .t { font-weight: 760; letter-spacing: -.015em; line-height: 1.25; padding: 6px 4px 0; }
.gcard .s, .ktile .s { font-size: var(--t-sm); color: var(--muted); line-height: 1.35; padding: 0 4px; }
.ktile .mine { position: absolute; top: 14px; right: 14px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 750;
  background: var(--glass-strong); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: var(--glass-rim); }
.ktile.col .v { font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; padding: 0 4px; font-variant-numeric: tabular-nums; line-height: 1.1; }

/* The browser page */
.khead { display: grid; gap: 10px; padding: 6px 2px 2px; }
.khead h1 { font-size: clamp(1.9rem, 7.6vw, 2.4rem); line-height: 1.05; letter-spacing: -.04em; }
.khead h1 em, .khero h1 em { font-style: normal; background: linear-gradient(90deg, var(--accent), #c99a3e); -webkit-background-clip: text; background-clip: text; color: transparent; }
.khead .lede { color: var(--muted); }
.ksearch { display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 0 18px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-1); }
.ksearch:focus-within { box-shadow: 0 0 0 2px var(--accent), var(--shadow-1); }
.ksearch svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.ksearch input { flex: 1; border: 0; background: none; font: inherit; font-size: 1rem; color: var(--ink); outline: none; min-width: 0; }
.gchips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px 6px; position: sticky; top: calc(56px + env(safe-area-inset-top, 0px)); z-index: 5; }
.gchips::-webkit-scrollbar { display: none; }
.gchips .chip { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex: none; }
.gchips .chip svg { width: 18px; height: 18px; color: var(--tone-ink); }
.kgroup { display: grid; gap: 12px; scroll-margin-top: 120px; border-radius: var(--r-l); transition: background .6s var(--ease-fx); }
.kgroup.flash { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.kgh { display: flex; align-items: center; gap: 12px; }
.kgh .gart { width: 64px; aspect-ratio: 1; border-radius: 18px; flex: none; }
.kgh .gicons > span { width: 30px; height: 30px; border-radius: 10px; margin-left: -12px; }
.kgh .gicons > span:nth-child(2) { width: 34px; height: 34px; }
.kgh .gicons > span:first-child { margin-left: 0; }
.kgh .gicons svg { width: 16px; height: 16px; }
.kgh h2 { font-size: 1.25rem; }
.kgh .hint { margin: 2px 0 0; }
.kgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.empty.small { padding: 20px 12px; }
.empty.small .kart { width: 120px; }
.empty.small h2 { color: var(--ink); }

/* Kind page */
.khero { display: grid; gap: 16px; padding: 18px; border-radius: var(--r-l);
  background: radial-gradient(120% 100% at 15% 0%, color-mix(in srgb, var(--tone) 30%, transparent), transparent 62%), var(--tone-soft); }
.khero .kart.big { width: 100%; aspect-ratio: 16 / 9; background: color-mix(in srgb, var(--surface) 55%, transparent); box-shadow: inset 0 0 0 1px var(--hair); }
.khero .kart.big > svg { max-width: 96px; }
.khero .eyebrow { color: var(--tone-ink); text-decoration: none; }
.khero h1 { font-size: clamp(1.8rem, 7vw, 2.3rem); line-height: 1.05; letter-spacing: -.04em; }
.khero .lede { margin: 0; color: var(--ink-2, var(--ink)); }
.khow { display: grid; gap: 8px; }
.khow p { margin: 0; }
.kfacts { padding: 0; }
.kfacts .fact { background: var(--surface); box-shadow: var(--shadow-1); }

/* Scan page: the link into the browser */
a.li.browse { border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-1); }
.stack3 { display: flex; flex: none; }
.stack3 .thumb { width: 34px; height: 34px; border-radius: 11px; margin-left: -10px; box-shadow: 0 0 0 2px var(--surface); }
.stack3 .thumb:first-child { margin-left: 0; }
.stack3 .thumb svg { width: 18px; height: 18px; }

.desk-only { display: none !important; }
/* Phones have no sidebar, so the header carries a "What can I scan?" button instead. */
#kindsbtn { margin-right: 8px; }

@media (hover: hover) {
  .gcard:hover, .ktile:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); }
}
@media (min-width: 600px) {
  .grail { grid-auto-columns: minmax(190px, 30%); }
  .krail { grid-auto-columns: minmax(160px, 26%); }
  .kgrid { grid-template-columns: repeat(3, 1fr); }
}
/* Computer: rails become grids, the kind page splits into art and text. */
@media (min-width: 960px) {
  .desk-only { display: flex !important; }
  .mob-only { display: none !important; }
  .rail { grid-auto-flow: row; overflow: visible; margin: 0; padding: 0; scroll-snap-type: none; }
  .grail { grid-template-columns: repeat(4, 1fr); grid-auto-columns: auto; }
  .krail { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); grid-auto-columns: auto; }
  .kgrid { grid-template-columns: repeat(4, 1fr); }
  .ktile .kart { aspect-ratio: 16 / 10; }
  .khead { grid-template-columns: 1fr; padding-top: 12px; }
  .khead h1 { font-size: 2.9rem; }
  .khead .lede { max-width: 62ch; }
  .ksearch { max-width: 560px; }
  .gchips { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; position: static; }
  .kgroup { grid-template-columns: 240px 1fr; align-items: start; gap: 20px; padding-top: 6px; }
  .kgh { flex-direction: column; align-items: flex-start; position: sticky; top: 84px; }
  .kgh .gart { width: 100%; aspect-ratio: 16 / 10; border-radius: var(--r); }
  .kgh .gicons > span { width: 48px; height: 48px; border-radius: 16px; margin-left: -10px; }
  .kgh .gicons > span:nth-child(2) { width: 56px; height: 56px; }
  .kgh .gicons > span:first-child { margin-left: 0; }
  .kgh .gicons svg { width: 24px; height: 24px; }
  .kgh .pill { display: none; }
  .kgroup .krail { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .khero { grid-template-columns: 1fr 1.1fr; align-items: center; padding: 28px; gap: 28px; }
  .khero .kart.big { aspect-ratio: 4 / 3; }
  .khero h1 { font-size: 2.8rem; }
  .kfacts { grid-template-columns: repeat(3, 1fr); }
}
