/* Duo New Tab © 2026 DevRoshdi. All rights reserved. See LICENSE.txt. */
/*
 * The App Store, after the App Store in iPadOS 27: large titles, feature cards, shelves of sites
 * that scroll sideways, ranked charts, product pages and the Get / Open capsule. The sidebar, bar,
 * colours and window come from settings.css (.sapp, .st-*) and notes.css.
 */

/* ---------- the App Store icon: a blue tile with an "A" of three frosted bars ---------- */

.tile.builtin-appstore { background: #0a7cff; }
/* The other icon styles draw the "A" alone. */
.tile.builtin-appstore::before {
  content: ""; position: absolute; inset: 0; background: #fff; display: none;
  -webkit-mask: url("icons/appstore-a.svg") center / 100% no-repeat; mask: url("icons/appstore-a.svg") center / 100% no-repeat;
}
body.icons-dark .tile.builtin-appstore::before, body.icons-clear .tile.builtin-appstore::before, body.icons-tinted .tile.builtin-appstore::before { display: block; }
body.icons-dark .tile.builtin-appstore { background: linear-gradient(180deg, #2c2c2e, #0c0c0e); }
body.icons-dark .tile.builtin-appstore::before { background: linear-gradient(180deg, #4fd2ff, #0a84ff); }
body.icons-clear .tile.builtin-appstore::before { background: rgba(255, 255, 255, 0.96); }
body.icons-tinted .tile.builtin-appstore::before { background: hsl(var(--hue), 95%, 72%); }

/* ---------- pages ---------- */

.as-page { max-width: 1040px; container-type: inline-size; }
.as-kicker { margin: 0 0 2px; font: 600 13px var(--font); letter-spacing: 0.02em; color: var(--st-sub); }
.as-h1 { margin: 0 0 18px; font: 700 34px/1.15 var(--font); letter-spacing: 0.01em; }
.as-h2 { margin: 0; font: 700 22px/1.2 var(--font); letter-spacing: 0.01em; }
.as-blurb { margin: -10px 0 0; font: 15px/1.4 var(--font); color: var(--st-sub); }
/*
 * A section below the screen is not laid out or painted until it is scrolled near (it keeps its last
 * size): drawing every shelf of every category at once held up the App Store's opening by 350 ms.
 */
.as-section { margin: 30px 0 0; content-visibility: auto; contain-intrinsic-size: auto 300px; }
.as-none { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 40px 0; color: var(--st-sub); text-align: center; }
.as-none-t { font: 600 20px/1.3 var(--font); color: var(--st-text); }
.as-none-s { font-size: 15px; }
.as-addlink { margin-top: 4px; padding: 4px 8px; border: 0; border-radius: 8px; background: none; color: var(--st-tint); font: 17px var(--font); cursor: pointer; }
.as-addlink:hover { background: var(--st-fill); }

/* Feature cards: big gradients with a headline and a few of the category's icons. */
/* Two to a row (four cards never leave one on its own), one in a narrow window. */
.as-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
@container (max-width: 560px) { .as-cards { grid-template-columns: minmax(0, 1fr); } }
.as-card {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-height: 230px; padding: 20px 22px; border: 0; border-radius: 26px;
  color: #fff; text-align: left; cursor: pointer; overflow: hidden; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14);
  transition: scale 0.35s var(--spring-pop, ease);
}
.as-card:hover { scale: 1.015; }
.as-card:active { scale: 0.98; }
.as-card-k { font: 700 13px var(--font); letter-spacing: 0.04em; opacity: 0.75; }
.as-card-t { max-width: 90%; font: 800 28px/1.12 var(--font); letter-spacing: -0.01em; }
.as-card-s { max-width: 85%; font: 500 15px/1.35 var(--font); opacity: 0.85; }
.as-card-icons { display: flex; gap: 10px; margin-top: auto; padding-top: 16px; }
.as-card-icons .as-ico { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25); }

/* Shelves: three rows of sites that scroll sideways, a page at a time. */
.as-shelf-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 0 12px; padding-top: 14px; border-top: 0.5px solid var(--st-sep); }
.as-more { border: 0; background: none; color: var(--st-tint); font: 17px var(--font); cursor: pointer; }
/* Whole columns only, so none is cut at the edge: three on a wide page, two, then one. */
.as-shelf {
  display: grid; grid-auto-flow: column; grid-template-rows: repeat(3, auto); grid-auto-columns: calc((100% - 36px) / 3);
  gap: 0 18px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin: 0 -4px; padding: 0 4px; scroll-padding: 0 4px;
}
@container (max-width: 820px) { .as-shelf { grid-auto-columns: calc((100% - 18px) / 2); } }
@container (max-width: 540px) { .as-shelf { grid-auto-columns: 100%; } }
.as-shelf::-webkit-scrollbar { display: none; }
.as-shelf .as-lockup { scroll-snap-align: start; }

/* A site: icon, name and subtitle, then the Get capsule; a hairline under each but the last of a column. */
.as-lockup {
  position: relative; display: flex; align-items: center; gap: 14px; min-width: 0; padding: 10px 0; cursor: pointer;
}
.as-lockup::after { content: ""; position: absolute; left: 76px; right: 0; bottom: 0; height: 0.5px; background: var(--st-sep); }
.as-shelf .as-lockup:nth-child(3n)::after, .as-chart .as-lockup:last-child::after { display: none; }
.as-lockup:focus-visible { outline: 2px solid var(--st-tint); outline-offset: 2px; border-radius: 14px; }
.as-rank { flex: none; width: 22px; font: 600 17px var(--font); color: var(--st-text); text-align: center; }
.as-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.as-name { font: 400 17px/1.25 var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-sub { font: 13px/1.3 var(--font); color: var(--st-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Ranked chart: two columns on a wide page, as iPad charts are. */
.as-chart { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 0 28px; }
.as-chart .as-lockup { padding: 12px 0; }
.as-chart-h { margin: 22px 0 6px; }
.as-cat-head { display: flex; align-items: center; gap: 18px; margin-bottom: 8px; }
.as-cat-head .as-h1 { margin-bottom: 14px; }
.as-cat-ico { width: 64px !important; height: 64px !important; border-radius: 16px !important; }
.as-cat-ico .st-sym { width: 38px; height: 38px; }

/* ---------- icons: letter tile, favicon on white, or App Store artwork ---------- */

.as-ico {
  position: relative; flex: none; display: grid; place-items: center; width: var(--icon); height: var(--icon);
  border-radius: 22.5%; overflow: hidden; color: #fff; box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.12);
}
@supports (corner-shape: superellipse(2)) { .as-ico { border-radius: 30%; corner-shape: superellipse(1.6); } }
.as-ico .glyph { font: 600 calc(var(--icon) * 0.42) / 1 var(--font); letter-spacing: -0.02em; }
/* Laid out but invisible until loaded: a lazy image with no box would never load. */
.as-fav { position: absolute; inset: 20%; width: 60%; height: 60%; object-fit: contain; opacity: 0; }
.as-art-img { position: absolute; display: none; }
.as-ico.as-has-fav { background: #fff !important; }
.as-ico.as-has-fav .glyph { display: none; }
.as-ico.as-has-fav .as-fav { opacity: 1; }
/* Behind the artwork, its own background colour; artwork with a drawn-in rim a little larger. */
.as-ico.as-art { background: var(--art-bg, #fff) !important; }
.as-ico.as-rim .as-art-img { transform: scale(1.08); }
.as-ico.as-art .glyph { display: none; }
.as-ico.as-art .as-fav { opacity: 0; }
.as-ico.as-art .as-art-img { display: block; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* ---------- Get / Open ---------- */

.as-get {
  flex: none; display: grid; place-items: center; min-width: 74px; height: 30px; padding: 0 16px; border: 0; border-radius: 15px;
  background: var(--st-fill); color: var(--st-tint); font: 700 15px var(--font); letter-spacing: 0.01em; cursor: pointer;
  transition: background 0.2s ease, scale 0.2s ease;
}
.as-get:hover { background: color-mix(in srgb, var(--st-tint) 16%, transparent); }
.as-get:active { scale: 0.94; }
.as-get.big { min-width: 96px; height: 34px; border-radius: 17px; background: var(--st-tint); color: #fff; font-size: 17px; }
.as-get.big.open { background: var(--st-tint); }
.as-get.busy { background: transparent; }
/* The download ring: a circle that fills, as the App Store's does. */
.as-ring {
  width: 26px; height: 26px; border-radius: 50%;
  background: conic-gradient(var(--st-tint) var(--p, 0%), color-mix(in srgb, var(--st-text) 14%, transparent) 0);
  -webkit-mask: radial-gradient(circle, transparent 9px, #000 9.5px); mask: radial-gradient(circle, transparent 9px, #000 9.5px);
  animation: as-fill 0.65s linear forwards;
}
@property --p { syntax: "<percentage>"; inherits: false; initial-value: 0%; }
@keyframes as-fill { to { --p: 100%; } }

/* ---------- a site's page ---------- */

.as-product { display: flex; align-items: center; gap: 26px; padding-bottom: 22px; border-bottom: 0.5px solid var(--st-sep); }
.as-product .as-ico { box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.12), 0 6px 18px rgba(0, 0, 0, 0.12); }
.as-product-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.as-product-t { margin: 0; font: 700 28px/1.15 var(--font); }
.as-product-s { font: 17px var(--font); color: var(--st-sub); }
.as-product-actions { margin-top: 14px; }
.as-facts { display: grid; grid-template-columns: repeat(4, 1fr); padding: 14px 0; border-bottom: 0.5px solid var(--st-sep); }
.as-fact { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 0 8px; text-align: center; min-width: 0; }
.as-fact + .as-fact { border-left: 0.5px solid var(--st-sep); }
.as-fact-l { font: 600 11px var(--font); letter-spacing: 0.04em; color: var(--st-sub); }
.as-fact-b { font: 700 22px/1.1 var(--font); color: var(--st-sub); }
.as-fact-s { max-width: 100%; font: 13px var(--font); color: var(--st-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-fact-ico { width: 26px !important; height: 26px !important; border-radius: 7px !important; }
.as-fact-ico .st-sym { width: 16px; height: 16px; }
.as-about p { margin: 0; font: 17px/1.5 var(--font); }

/* Search with nothing typed: the categories as chips. */
.as-suggest { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-top: 14px; }
.as-chip {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 0; border-radius: 16px; background: var(--st-cell); color: var(--st-text);
  font: 17px var(--font); text-align: left; cursor: pointer;
}
.as-chip:hover { background: color-mix(in srgb, var(--st-cell) 88%, var(--st-text)); }

/* The App Store's own sidebar shows the category icons, not a FoldTab card. */
.aapp .st-side-scroll .st-section:first-child { margin-top: 2px; }

/* A narrow window: the facts two by two. */
.st-narrow .as-facts { grid-template-columns: repeat(2, 1fr); row-gap: 14px; }
.st-narrow .as-fact:nth-child(3) { border-left: 0; }
.st-narrow .as-product { gap: 16px; }
