/* =====================================================================
   Mobile Apps directory (/mobile-apps) + app detail pages.
   Loaded only on those pages via $extra_head. Uses the site tokens from
   styles.css; no animation library, no web fonts beyond the site's own.
   ===================================================================== */

/* ---------- Store buttons ---------- */
.store-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.store-btn {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 7px 16px 7px 13px;
  border-radius: 10px; background: #0B0B1F; color: #fff;
  border: 1px solid #0B0B1F; line-height: 1.1;
  transition: transform .2s cubic-bezier(.2,.7,.2,1), box-shadow .2s, background .2s;
}
.store-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 22px -10px rgba(14,14,61,.55); background: #17173A; }
.store-btn:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }
.store-btn svg { flex: 0 0 auto; }
.store-btn small { display: block; font-size: 10px; letter-spacing: .04em; opacity: .78; font-weight: 500; }
.store-btn strong { display: block; font-family: var(--fd); font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.store-btn.sm { min-height: 38px; padding: 5px 12px 5px 10px; border-radius: 8px; gap: 8px; }
.store-btn.sm small { font-size: 9px; }
.store-btn.sm strong { font-size: 13px; }
.store-btn.light { background: #fff; color: var(--text); border-color: var(--line-2); }
.store-btn.light:hover { background: var(--bg-2); border-color: var(--navy); box-shadow: none; }

/* ---------- Hub hero ---------- */
.apps-hero { padding: 72px 0 0; }
.apps-hero-grid {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: 48px; align-items: end;
}
.apps-hero-copy { padding-bottom: 72px; }
.apps-hero .lead { max-width: 560px; }
.apps-hero-actions { margin-top: 28px; display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }
.apps-hero-explore { font-family: var(--fm); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--cyan-3); display: inline-flex; gap: 8px; align-items: center; }
.apps-hero-explore:hover { color: var(--navy); }

.apps-stats {
  margin-top: 36px; display: grid; grid-template-columns: repeat(4, auto);
  gap: 6px 28px; justify-content: start;
}
.apps-stats div { display: flex; flex-direction: column; }
.apps-stats b { font-family: var(--fd); font-size: 26px; font-weight: 600; letter-spacing: -.02em; color: var(--navy); line-height: 1.1; }
.apps-stats span { font-size: 12.5px; color: var(--muted); }

/* Phone showcase — real store screenshots in CSS frames */
.phone-stage { position: relative; height: 520px; display: flex; justify-content: center; align-items: flex-end; }
.phone {
  position: absolute; bottom: -40px; width: 218px; aspect-ratio: 9 / 19.2;
  border-radius: 34px; padding: 9px; background: #0B0B1F;
  box-shadow: 0 30px 60px -24px rgba(14,14,61,.45), inset 0 0 0 1.5px rgba(255,255,255,.08);
}
.phone::before { content: ''; position: absolute; top: 15px; left: 50%; width: 62px; height: 17px; margin-left: -31px; border-radius: 10px; background: #0B0B1F; z-index: 2; }
.phone picture, .phone img { width: 100%; height: 100%; border-radius: 26px; object-fit: cover; object-position: top center; background: #fff; }
.phone.p1 { transform: translateX(-150px) rotate(-7deg); z-index: 1; }
.phone.p2 { width: 238px; bottom: -20px; z-index: 3; }
.phone.p3 { transform: translateX(150px) rotate(7deg); z-index: 2; }
.phone-glow { position: absolute; inset: 10% 6% 0; background: radial-gradient(closest-side, rgba(41,197,224,.30), transparent); filter: blur(10px); z-index: 0; }

/* ---------- Directory ---------- */
.apps-dir { padding-top: 84px; }
.apps-toolbar {
  position: sticky; top: 72px; z-index: 5;
  display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center;
  padding: 14px; margin-bottom: 28px;
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: 14px;
}
.apps-search { position: relative; flex: 1 1 240px; }
.apps-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.apps-search input {
  width: 100%; height: 42px; padding: 0 12px 0 38px;
  border: 1px solid var(--line-2); border-radius: 9px; background: var(--surface);
  font: inherit; font-size: 14.5px; color: var(--text);
}
.apps-search input:focus { outline: none; border-color: var(--cyan-3); box-shadow: 0 0 0 3px rgba(41,197,224,.22); }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 9px; overflow: hidden; background: var(--surface); }
.seg button { height: 40px; padding: 0 14px; font-size: 13.5px; font-weight: 600; color: var(--text-2); border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--navy); color: #fff; }
.seg button:focus-visible, .chip:focus-visible { outline: 3px solid var(--cyan); outline-offset: -3px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.chip {
  height: 34px; padding: 0 13px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--text-2);
  display: inline-flex; align-items: center; gap: 6px;
}
.chip .n { font-family: var(--fm); font-size: 11px; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--bg-3); border-color: var(--navy); color: var(--navy); }
.apps-count { font-size: 13px; color: var(--muted); margin: -12px 0 18px; }

.apps-group + .apps-group { margin-top: 48px; }
.apps-group-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.apps-group-head h3 { font-family: var(--fd); font-size: 21px; font-weight: 600; letter-spacing: -.015em; }
.apps-group-head p { font-size: 13.5px; color: var(--muted); }

.apps-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.app-card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 20px; transition: border-color .2s, box-shadow .25s, transform .25s cubic-bezier(.2,.7,.2,1);
  scroll-margin-top: 170px;
}
.app-card:hover { border-color: var(--line-2); box-shadow: 0 18px 40px -26px rgba(14,14,61,.35); transform: translateY(-2px); }
.app-card:target { border-color: var(--cyan-3); box-shadow: 0 0 0 3px rgba(41,197,224,.25); }
.app-card[hidden] { display: none; }
.app-card-top { display: flex; gap: 14px; align-items: center; }
.app-icon { width: 60px; height: 60px; border-radius: 15px; flex: 0 0 auto; overflow: hidden; box-shadow: 0 0 0 1px var(--line); background: var(--bg-2); }
.app-icon img { width: 100%; height: 100%; }
.app-card h3, .app-card .app-name { font-family: var(--fd); font-size: 17.5px; font-weight: 600; letter-spacing: -.015em; line-height: 1.2; }
.app-meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.app-summary { margin-top: 14px; font-size: 14px; line-height: 1.55; color: var(--text-2); }
.app-feats { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; list-style: none; }
.app-feats li { font-size: 11.5px; padding: 4px 9px; border-radius: 6px; background: var(--bg-2); color: var(--text-2); }
.app-badges { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.pbadge { display: inline-flex; align-items: center; gap: 5px; font-family: var(--fm); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line); color: var(--text-2); }
.pbadge.android { color: #0B6B3A; border-color: rgba(11,107,58,.25); background: rgba(52,168,83,.07); }
.pbadge.ios { color: #1F2937; border-color: rgba(31,41,55,.2); background: rgba(31,41,55,.04); }
.pbadge.biz { color: var(--cyan-3); border-color: rgba(12,113,134,.25); background: rgba(41,197,224,.07); }
.pbadge.partner { color: #7A4E0A; border-color: rgba(194,141,42,.35); background: rgba(229,176,74,.10); }
.app-card-foot { margin-top: auto; padding-top: 18px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.app-more { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--cyan-3); display: inline-flex; align-items: center; gap: 5px; }
.app-more:hover { color: var(--navy); }
.apps-empty { padding: 48px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: 14px; }

/* ---------- Ecosystem / why ---------- */
.eco-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.eco-col { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.eco-col h3 { font-family: var(--fd); font-size: 18px; font-weight: 600; letter-spacing: -.015em; }
.eco-col p { margin-top: 8px; font-size: 14px; color: var(--text-2); line-height: 1.55; }
.eco-col ul { list-style: none; margin-top: 16px; display: grid; gap: 10px; }
.eco-col li a { display: flex; gap: 10px; align-items: center; font-size: 14px; font-weight: 600; }
.eco-col li a:hover { color: var(--cyan-3); }
.eco-col li img { width: 28px; height: 28px; border-radius: 7px; box-shadow: 0 0 0 1px var(--line); }
.eco-col li span { font-weight: 400; color: var(--muted); font-size: 12.5px; }

.why-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.why-grid > div { background: var(--surface); padding: 24px 26px; }
.why-grid h3 { font-family: var(--fd); font-size: 16.5px; font-weight: 600; letter-spacing: -.01em; }
.why-grid p { margin-top: 8px; font-size: 14px; line-height: 1.6; color: var(--text-2); }

.dev-links { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.dev-link { display: flex; gap: 16px; align-items: center; padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); transition: border-color .2s; }
.dev-link:hover { border-color: var(--navy); }
.dev-link .ico { width: 46px; height: 46px; border-radius: 12px; background: #0B0B1F; color: #fff; display: grid; place-items: center; flex: 0 0 auto; }
.dev-link b { display: block; font-family: var(--fd); font-size: 15.5px; font-weight: 600; }
.dev-link span { font-size: 13px; color: var(--muted); }

/* ---------- Detail page ---------- */
.appd-hero-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 28px; align-items: start; }
.appd-icons { display: flex; gap: 12px; }
.appd-icon { width: 104px; height: 104px; border-radius: 24px; overflow: hidden; box-shadow: 0 16px 34px -18px rgba(14,14,61,.45), 0 0 0 1px var(--line); }
.appd-icon img { width: 100%; height: 100%; }
.appd-store-row { margin-top: 26px; display: flex; flex-direction: column; gap: 14px; }
.appd-store-row .label { font-size: 13px; color: var(--muted); }
.appd-store-row .label b { color: var(--text); }

.shots { display: flex; gap: 18px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 6px 2px 18px; -webkit-overflow-scrolling: touch; }
.shots:focus-visible { outline: 3px solid var(--cyan); outline-offset: 4px; border-radius: 8px; }
.shots figure { flex: 0 0 auto; width: 228px; scroll-snap-align: start; margin: 0; }
.shots img { width: 100%; height: auto; border-radius: 18px; border: 1px solid var(--line); background: var(--bg-2); box-shadow: 0 16px 30px -22px rgba(14,14,61,.4); }
.shots figcaption { margin-top: 10px; font-size: 12.5px; color: var(--muted); line-height: 1.45; }

.appd-overview { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 48px; align-items: start; }
.appd-overview p + p { margin-top: 16px; }
.appd-overview .prose p { font-size: 16px; line-height: 1.7; color: var(--text-2); }
.appd-aud { background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.appd-aud h3 { font-family: var(--fd); font-size: 16px; font-weight: 600; }
.appd-aud ul { margin-top: 12px; list-style: none; display: grid; gap: 9px; }
.appd-aud li { font-size: 14px; color: var(--text-2); padding-left: 22px; position: relative; }
.appd-aud li::before { content: ''; position: absolute; left: 2px; top: 6px; width: 10px; height: 10px; border-radius: 3px; background: linear-gradient(135deg, var(--cyan), var(--indigo-2)); }

.feat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feat { border: 1px solid var(--line); border-radius: 16px; padding: 22px; background: var(--surface); }
.feat .app-tag { font-family: var(--fm); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--cyan-3); }
.feat h3 { font-family: var(--fd); font-size: 16.5px; font-weight: 600; letter-spacing: -.01em; margin-top: 4px; }
.feat p { margin-top: 8px; font-size: 14px; line-height: 1.6; color: var(--text-2); }

.related-card { display: flex; gap: 22px; align-items: center; padding: 26px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.related-card .product-mark, .related-card .pg-mark { flex: 0 0 auto; }
.related-card h3 { font-family: var(--fd); font-size: 19px; font-weight: 600; }
.related-card p { margin-top: 6px; color: var(--text-2); font-size: 14.5px; line-height: 1.6; }
.related-card .btn { margin-top: 14px; }

.verified-note { margin-top: 18px; font-size: 12.5px; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .apps-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .phone.p1 { transform: translateX(-120px) rotate(-7deg); }
  .phone.p3 { transform: translateX(120px) rotate(7deg); }
  .feat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .apps-hero-grid { grid-template-columns: 1fr; gap: 0; }
  .apps-hero-copy { padding-bottom: 36px; }
  .phone-stage { height: 400px; }
  .phone { width: 170px; }
  .phone.p2 { width: 186px; }
  .phone.p1 { transform: translateX(-110px) rotate(-7deg); }
  .phone.p3 { transform: translateX(110px) rotate(7deg); }
  .eco-grid { grid-template-columns: 1fr; }
  .appd-overview { grid-template-columns: 1fr; gap: 28px; }
  .apps-toolbar { position: static; }
}
@media (max-width: 640px) {
  .apps-hero { padding-top: 48px; }
  .apps-stats { grid-template-columns: repeat(2, auto); }
  .apps-grid, .why-grid, .dev-links, .feat-grid { grid-template-columns: 1fr; }
  .phone-stage { height: 330px; }
  .phone { width: 138px; border-radius: 24px; padding: 6px; }
  .phone::before { top: 10px; width: 44px; height: 12px; margin-left: -22px; }
  .phone picture, .phone img { border-radius: 19px; }
  .phone.p2 { width: 152px; }
  .phone.p1 { transform: translateX(-88px) rotate(-7deg); }
  .phone.p3 { transform: translateX(88px) rotate(7deg); }
  .appd-hero-grid { grid-template-columns: 1fr; gap: 18px; }
  .appd-icon { width: 80px; height: 80px; border-radius: 19px; }
  .shots figure { width: 64vw; max-width: 240px; }
  .related-card { flex-direction: column; align-items: flex-start; }
  .app-more { margin-left: 0; }
  .seg { width: 100%; }
  .seg button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .store-btn, .app-card, .dev-link { transition: none; }
  .store-btn:hover, .app-card:hover { transform: none; }
}

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
