/* APKFie layout v1.2 — hero panel + icon river, categories, updates, charts, app page additions.
   Loaded after app.css (tokens and base components live there). */

/* Hero panel */
.hero__panel {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 1.55fr) minmax(300px, .95fr);
	gap: 40px;
	padding: 44px 44px 40px;
	border-radius: 32px;
	overflow: hidden;
	isolation: isolate;
	background:
		radial-gradient(120% 140% at 100% 0%, color-mix(in oklab, var(--brand) 14%, transparent) 0, transparent 55%),
		radial-gradient(80% 120% at 0% 100%, color-mix(in oklab, #3b82f6 9%, transparent) 0, transparent 60%),
		var(--surface);
	border: 1px solid var(--line);
}
.hero__panel::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	opacity: .5;
	background-image: radial-gradient(color-mix(in srgb, var(--ink) 9%, transparent) 1px, transparent 1px);
	background-size: 22px 22px;
	-webkit-mask-image: linear-gradient(110deg, transparent 35%, #000 100%);
	mask-image: linear-gradient(110deg, transparent 35%, #000 100%);
}
.hero__panel .shuffle { box-shadow: 0 30px 60px -36px rgb(18 23 33 / .45); }

/* Icon river: real app icons drifting under the hero. Decorative; pauses on hover, stops for reduced motion. */
.river { position: relative; margin-top: 18px; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.river__track { display: flex; gap: 14px; width: max-content; padding-block: 6px; animation: river 70s linear infinite; }
.river:hover .river__track { animation-play-state: paused; }
.river a { flex: none; display: block; border-radius: 16px; transition: transform .2s; }
.river a:hover { transform: translateY(-4px) scale(1.06); }
.river img { display: block; width: 56px; height: 56px; border-radius: 16px; box-shadow: 0 0 0 1px rgb(0 0 0 / .06); }
@keyframes river { to { transform: translateX(-50%); } }

/* Section heads with a short subtitle */
.section__head > div { min-width: 0; }
.section__sub { margin-top: 2px; font-size: .9rem; color: var(--muted); }

/* Category cards: stacked real icons */
.catgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 12px; list-style: none; margin: 0; padding: 0; }
.catcard {
	position: relative;
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	grid-template-areas: "icons name" "icons meta";
	column-gap: 14px;
	align-items: center;
	padding: 14px 16px;
	border-radius: var(--r);
	background: var(--surface);
	border: 1px solid var(--line);
	overflow: hidden;
	transition: border-color .15s, transform .15s, box-shadow .15s;
}
.catcard::after { content: ""; position: absolute; inset: auto -30% -60% auto; width: 120px; height: 120px; border-radius: 50%; background: color-mix(in oklab, var(--tint) 22%, transparent); filter: blur(30px); opacity: .7; pointer-events: none; }
.catcard:hover { border-color: color-mix(in oklab, var(--tint) 45%, var(--line)); transform: translateY(-2px); box-shadow: var(--lift); }
.catcard__icons { grid-area: icons; display: flex; min-width: max-content; }
.catcard__icons img { flex: none; max-width: none; width: 40px; height: 40px; border-radius: 11px; border: 2px solid var(--surface); box-shadow: 0 2px 6px rgb(0 0 0 / .12); }
.catcard__icons img + img { margin-left: -14px; }
.catcard__name { grid-area: name; font-weight: 700; align-self: end; min-width: 0; line-height: 1.25; hyphens: auto; overflow-wrap: break-word; }
.catcard__meta { grid-area: meta; font-size: .82rem; color: var(--muted); align-self: start; }

/* Recently updated list */
.updates { list-style: none; margin: 0; padding: 4px 0; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); container-type: inline-size; }
.updates li + li { border-top: 1px solid var(--line); }
.update { display: flex; align-items: center; gap: 14px; padding: 12px 16px; transition: background-color .15s; }
.update:hover { background: color-mix(in srgb, var(--sunk) 60%, transparent); }
.update .apk-icon { width: 48px; height: 48px; }
.update__body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.update__name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.update__sub { font-size: .85rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.update__side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.update__ver { padding: 2px 8px; border-radius: 6px; background: var(--sunk); font-size: .74rem; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.update__time { font-size: .78rem; color: var(--muted); }
@container (max-width: 420px) { .update__ver { display: none; } }

/* Top charts */
.charts { padding: 18px 18px 8px; }
.tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 8px; border-radius: 999px; background: var(--sunk); }
.tabs__tab, .tabs__tab:hover, .tabs__tab:focus { flex: 1; min-height: 36px; padding: 8px 6px; border: 0; border-radius: 999px; background: none; color: var(--ink-2); font-size: .84rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.tabs__tab[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / .1); }
.chart { list-style: none; margin: 0; padding: 0; counter-reset: chart; }
.chart li { counter-increment: chart; }
.chart__item { display: flex; align-items: center; gap: 12px; padding: 8px 4px; border-radius: 12px; }
.chart__item::before { content: counter(chart); width: 18px; flex: none; text-align: center; font-weight: 700; font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.chart li:nth-child(-n+3) .chart__item::before { color: var(--brand); }
.chart__item:hover { background: var(--sunk); }
.chart__body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.chart__name { font-weight: 600; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart__sub { font-size: .78rem; color: var(--muted); }
.split .sidebar { position: sticky; top: 86px; }

/* Star rating: a gradient clipped to five star shapes, filled to the rating */
.stars {
	--star-shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5l2.9 6 6.6.8-4.9 4.5 1.3 6.5L12 17l-5.9 3.3 1.3-6.5L2.5 9.3l6.6-.8z'/%3E%3C/svg%3E");
	display: inline-block;
	width: 5.2em;
	height: 1em;
	vertical-align: -.12em;
	background: linear-gradient(90deg, var(--star) var(--fill), color-mix(in srgb, var(--muted) 35%, transparent) var(--fill));
	-webkit-mask: var(--star-shape) 0 0 / 1.04em 1em repeat-x;
	mask: var(--star-shape) 0 0 / 1.04em 1em repeat-x;
}
.spot__rating { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink); }

/* App hero additions */
.app-hero__tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 10px 0 0; padding: 0; }
.app-hero__tags li { padding: 4px 10px; border-radius: 999px; background: color-mix(in oklab, var(--tint) 10%, var(--surface)); border: 1px solid color-mix(in oklab, var(--tint) 18%, var(--line)); font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.app-hero__tags a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.app-hero__tags .is-verified { background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); }
.stats { flex-wrap: wrap; row-gap: 12px; }
.stats > div { padding: 0 24px; }
.stats dd { font-size: 1.1rem; }
.stats__rating dd { display: flex; align-items: center; gap: 8px; }
.stats__rating .stars { font-size: .95rem; }

/* Send to phone (computers): QR beside the main button. Space is held so nothing shifts when it appears. */
.sendto { display: none; }
@media (hover: hover) and (pointer: fine) and (min-width: 961px) { .sendto { display: block; min-height: 100px; } }
.sendto.is-ready { display: flex; align-items: center; gap: 12px; margin-top: 4px; padding: 10px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.sendto svg { flex: none; width: 76px; height: 76px; border-radius: 8px; }
.sendto__text { display: flex; flex-direction: column; gap: 2px; font-size: .8rem; color: var(--muted); }
.sendto__text strong { color: var(--ink); font-size: .88rem; }
.sendto__text .compat__actions { gap: 12px; margin-top: 2px; font-size: .82rem; }

/* Landscape game screenshots: shorter rows */
.gallery--wide .gallery__item img { height: 300px; }

/* FAQ accordion */
.faq__list { display: grid; gap: 8px; }
.faq__item { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.faq__item summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 12px 18px; font-weight: 600; cursor: pointer; list-style: none; }
.faq__item summary::-webkit-details-marker { display: none; }
.faq__item summary svg { width: 20px; height: 20px; flex: none; color: var(--muted); transition: transform .2s; }
.faq__item[open] summary svg { transform: rotate(180deg); }
.faq__item p { padding: 0 18px 16px; color: var(--ink-2); max-width: 70ch; }
.versions__note { margin-top: 8px; font-size: .88rem; color: var(--muted); }

/* Original writing vs. developer text */
.review__glance { padding: 14px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink-2); max-width: 72ch; }
.review__body { margin-top: 16px; }
.review__body h3 { font-size: 1rem; margin: 1.2em 0 .4em; }
.review__body ul { padding-left: 1.2em; }
.review__body li { margin-bottom: .35em; }
.source-label { margin: -8px 0 12px; font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

/* Category and archive intros */
.listing__intro { max-width: 76ch; margin-top: 14px; }
.listing__intro .prose { max-width: none; }
.listing__intro p { margin-bottom: .8em; color: var(--ink-2); }
.listing__intro .listing__glance { font-size: .92rem; color: var(--muted); }

/* Logo tile lifts on dark backgrounds so the dark monogram stays visible */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand__tile { fill: #27313F; } }
:root[data-theme="dark"] .brand__tile { fill: #27313F; }

/* ---- Design critique fixes ---- */

/* Screen-reader text is position:absolute; anchor it inside its tile so it can't escape the scrolling row and widen the page */
.app-tile { position: relative; }

/* Rows that scroll sideways fade at the edge, so it's clear there is more */
.quick-apps, .appnav__links { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); padding-right: 32px; }

/* "/" shortcut badge only where there's a keyboard */
@media (hover: none), (max-width: 700px) { .search__key { display: none; } }

/* Desktop with the QR card: the status line would repeat it, so it never takes space there */
@media (hover: hover) and (pointer: fine) and (min-width: 961px) { .compat { display: none; } .compat.is-forced { display: flex; } }

/* Home categories: first 8, the rest behind a button (only when JS can show them) */
.js .catgrid:not(.is-expanded) > .is-extra { display: none; }
.catgrid__more { display: none; margin-top: 14px; }
.js .catgrid__more { display: inline-flex; }

/* Listing: short lead above the list, full guide below */
.listing__lead { max-width: 72ch; margin-top: 12px; color: var(--ink-2); }
.listing__lead p { margin: 0; }
.listing__chips { margin-top: 18px; }
.listing__chips .chips { flex-wrap: nowrap; margin: 0; }
.listing__chips .chip { white-space: nowrap; }
.listing__about { max-width: 76ch; margin-top: 24px; border-top: 1px solid var(--line); }
.listing__about h2 { margin-bottom: 10px; }
.listing__about .prose { max-width: none; }
.listing__about .listing__glance { margin-top: 12px; font-size: .92rem; color: var(--muted); }

@media (max-width: 1200px) { .appnav__app span { display: none; } }

@media (max-width: 1100px) {
	.split .sidebar { position: static; grid-template-columns: minmax(0, 1fr); }
	.charts .chart { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: column; grid-template-rows: repeat(5, auto); column-gap: 24px; }
}
@media (max-width: 700px) {
	.charts .chart { display: block; }
	.js .catgrid > .is-extra { display: list-item; } /* swipe strip shows them all */
	.js .catgrid__more { display: none; }
	.spot__pitch { display: none; }
	.spot__shots { height: 180px; }
}
@media (max-width: 960px) {
	.hero__panel { grid-template-columns: minmax(0, 1fr); gap: 24px; padding: 28px 24px; border-radius: 26px; }
	/* Games become a swipeable row instead of a tall stack */
	.shelf--games .game-grid--bento { grid-auto-flow: column; grid-auto-columns: minmax(260px, 72%); grid-template-columns: none; }
	.shelf--games .game-grid--bento > :first-child { grid-column: auto; grid-row: auto; }
	.shelf--games .game-grid--bento > :first-child .game-card__art { aspect-ratio: 16 / 9; }
	.shelf--games .game-card { scroll-snap-align: start; }
}
@media (max-width: 700px) {
	.hero { padding-top: 12px; }
	.hero__panel { padding: 22px 18px; }
	.river img { width: 48px; height: 48px; border-radius: 14px; }
	/* Two-row swipeable strip instead of an 8-row stack */
	.catgrid { grid-template-columns: none; grid-template-rows: repeat(2, auto); grid-auto-flow: column; grid-auto-columns: 44%; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; scroll-padding-inline: 16px; }
	.catgrid::-webkit-scrollbar { display: none; }
	.catgrid > li { scroll-snap-align: start; }
	.catcard { grid-template-columns: 1fr; grid-template-areas: "icons" "name" "meta"; row-gap: 8px; padding: 12px; }
	.catcard__icons img { width: 34px; height: 34px; }
	.catcard__icons img + img { margin-left: -12px; }
	.stats > div { padding: 0 16px; }
	.stats > div:first-child { padding-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
	.river__track { animation: none; }
}
