/* Platinum City Apps — site styles
   Hand-rolled; replaces Bootstrap 4 + jQuery (saves ~330KB of blocking assets). */

/* ---------------------------------------------------------------- tokens */
:root {
  color-scheme: light dark;

  --bg:        #ffffff;
  --bg-soft:   #f4f7fb;
  --surface:   #ffffff;
  --surface-2: #f8fafc;

  --text:      #0d1520;
  --text-soft: #55637a;
  --line:      #e3e8f0;

  --brand:     #1d6fab;   /* AA on white — links, buttons */
  --brand-lit: #2b86c9;   /* large text / decoration only */
  --brand-bg:  #eaf3fb;
  --star:      #f0a11e;

  --shadow-sm: 0 1px 2px rgb(13 21 32 / .06), 0 2px 8px rgb(13 21 32 / .04);
  --shadow-md: 0 2px 6px rgb(13 21 32 / .07), 0 12px 32px rgb(13 21 32 / .07);
  --shadow-lg: 0 8px 24px rgb(13 21 32 / .10), 0 32px 64px rgb(13 21 32 / .10);

  --radius:    18px;
  --radius-sm: 11px;
  --shot-radius: 20px;

  --pad: clamp(1.25rem, 4vw, 2.5rem);
  --gap: clamp(1.5rem, 4vw, 3rem);
  --section-y: clamp(3.5rem, 9vw, 7rem);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto,
          Helvetica, Arial, "Helvetica Neue", sans-serif;

  /* icon masks (inline SVG — no icon font, no extra request) */
  --star-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z'/%3E%3C/svg%3E") repeat-x left center / .98em 1em;
  --check-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0b1017;
    --bg-soft:   #0f1621;
    --surface:   #141c28;
    --surface-2: #182231;

    --text:      #eaf0f8;
    --text-soft: #9aabc2;
    --line:      #253247;

    --brand:     #4fa8e8;
    --brand-lit: #6cbaf0;
    --brand-bg:  #14283b;

    --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
    --shadow-md: 0 2px 6px rgb(0 0 0 / .4), 0 12px 32px rgb(0 0 0 / .35);
    --shadow-lg: 0 8px 24px rgb(0 0 0 / .45), 0 32px 64px rgb(0 0 0 / .4);
  }
}

/* ----------------------------------------------------------------- reset */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -.022em; margin: 0; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
ul { margin: 0; padding: 0; list-style: none; }

:focus-visible {
  outline: 2.5px solid var(--brand);
  outline-offset: 3px;
  border-radius: 6px;
}

.wrap { width: min(1180px, 100% - 2 * var(--pad)); margin-inline: auto; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--surface); color: var(--text);
  padding: .75rem 1.25rem; border-radius: 0 0 var(--radius-sm) 0;
  box-shadow: var(--shadow-md);
}
.skip-link:focus { left: 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---------------------------------------------------------------- header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s ease, background .25s ease;
}
.site-header[data-stuck="true"] { border-bottom-color: var(--line); }

.site-header > .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: 60px;
}

.wordmark {
  display: inline-flex; align-items: baseline; gap: .34em;
  font-size: 1.06rem; font-weight: 800; letter-spacing: .085em;
  text-transform: uppercase; color: var(--brand-lit);
  text-decoration: none; white-space: nowrap;
}
.wordmark:hover { text-decoration: none; }
.wordmark b { font-weight: 800; }
.wordmark span { font-weight: 800; letter-spacing: .085em; }

.nav { display: flex; align-items: center; gap: clamp(.5rem, 2vw, 1.5rem); }
.nav a {
  color: var(--text-soft); font-size: .92rem; font-weight: 500;
  padding: .5rem .25rem; white-space: nowrap;
}
.nav a:hover { color: var(--text); text-decoration: none; }

.nav .nav-cta {
  color: #fff; background: var(--brand);
  padding: .48rem 1rem; border-radius: 999px; font-weight: 600;
}
@media (prefers-color-scheme: dark) { .nav .nav-cta { color: #06101a; } }
.nav .nav-cta:hover { color: #fff; filter: brightness(1.08); text-decoration: none; }
@media (prefers-color-scheme: dark) { .nav .nav-cta:hover { color: #06101a; } }

@media (max-width: 460px) { .nav .nav-hide-xs { display: none; } }

/* ------------------------------------------------------------------ hero */
.hero {
  position: relative;
  padding: clamp(2.5rem, 7vw, 4.5rem) 0 clamp(2.25rem, 6vw, 3.75rem);
  text-align: center;
  overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; inset: -40% 50% auto; translate: 0 0;
  width: min(1000px, 130vw); aspect-ratio: 1; left: 50%; translate: -50% 0;
  background: radial-gradient(circle, color-mix(in srgb, var(--brand-lit) 17%, transparent) 0%, transparent 62%);
  pointer-events: none; z-index: -1;
}

.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 750; letter-spacing: -.028em;
  /* wide enough that the headline sits on one line wherever it fits;
     it still wraps (balanced) once the viewport genuinely runs out. */
  max-width: 44ch; margin-inline: auto;
}
.hero h1 em { font-style: normal; color: var(--brand-lit); }

.hero-sub {
  margin: .9rem auto 0; max-width: 76ch;
  font-size: clamp(.98rem, 1.7vw, 1.08rem); color: var(--text-soft);
  text-wrap: balance;   /* keeps the last line from orphaning two words */
}

.hero-stats {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: clamp(1.25rem, 5vw, 3.25rem);
  margin-top: clamp(2rem, 5vw, 3rem);
}
.hero-stats div { min-width: 5.5rem; max-width: 18ch; }
.hero-stats dt {
  font-size: clamp(1.5rem, 4vw, 2.05rem); font-weight: 750;
  letter-spacing: -.03em; line-height: 1.1;
}
.hero-stats dd {
  margin: .25rem 0 0; font-size: .78rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em; color: var(--text-soft);
  /* a long label wraps evenly instead of stretching the whole row */
  text-wrap: balance;
}

/* ------------------------------------------------------------- app cards */
.apps { padding-bottom: var(--section-y); }

.app {
  --shot-h: clamp(300px, 46vw, 440px);
  padding: clamp(2rem, 5vw, 3rem) 0;
  border-top: 1px solid var(--line);
}
.app:first-child { border-top: 0; }

@media (min-width: 900px) {
  .app {
    display: grid;
    grid-template-columns: minmax(300px, 366px) minmax(0, 1fr);
    gap: var(--gap);
    align-items: start;
  }
  .app-info { position: sticky; top: 88px; }
}

/* --- info column --- */
.app-head { display: flex; align-items: center; gap: 1rem; }

.app-icon {
  width: 74px; height: 74px; flex: none;
  border-radius: 23%;
  box-shadow: var(--shadow-sm), inset 0 0 0 1px rgb(0 0 0 / .06);
  background: var(--surface-2);
}

.app-title { font-size: clamp(1.4rem, 3.4vw, 1.72rem); font-weight: 750; }
.app-title a { color: inherit; }

.app-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .55rem;
  margin-top: .3rem; font-size: .84rem; color: var(--text-soft);
}
.app-meta .dot { opacity: .45; }

.pill {
  display: inline-block; padding: .18rem .6rem; border-radius: 999px;
  background: var(--brand-bg); color: var(--brand);
  font-size: .76rem; font-weight: 650; letter-spacing: .01em;
}
.pill-free { background: color-mix(in srgb, #17a673 15%, transparent); color: #0d8a5f; }
@media (prefers-color-scheme: dark) { .pill-free { color: #45d6a4; } }

.rating { display: inline-flex; align-items: center; gap: .35rem; }
.stars {
  --pct: 0%;
  display: inline-block; position: relative;
  width: 4.9em; height: 1em; font-size: .82rem; flex: none;
  background: currentColor; color: var(--line);
  -webkit-mask: var(--star-mask); mask: var(--star-mask);
}
.stars::before {
  content: ""; position: absolute; inset: 0; width: var(--pct);
  background: var(--star);
}

.app-tagline { margin-top: 1rem; color: var(--text-soft); font-size: 1rem; }

.app-features { margin-top: 1rem; display: grid; gap: .42rem; }
.app-features li {
  position: relative; padding-left: 1.55rem;
  font-size: .93rem; color: var(--text);
}
.app-features li::before {
  content: ""; position: absolute; left: 0; top: .44em;
  width: .95em; height: .95em;
  background: var(--brand);
  -webkit-mask: var(--check-mask) center / contain no-repeat;
  mask: var(--check-mask) center / contain no-repeat;
}

.app-cta { display: flex; flex-wrap: wrap; align-items: center; gap: .9rem; margin-top: 1.5rem; }
.badge-link { display: inline-block; transition: transform .18s ease, opacity .18s ease; }
.badge-link:hover { transform: translateY(-1px); opacity: .88; }
.badge-link img { width: 148px; height: auto; }


.app-more {
  display: inline-block; margin-top: 1.1rem;
  font-size: .92rem; font-weight: 600;
}
.app-more:hover { text-decoration: none; opacity: .8; }

/* --- screenshot gallery --- */
.gallery { position: relative; margin-top: clamp(1.5rem, 4vw, 2rem); }
@media (min-width: 900px) { .gallery { margin-top: .35rem; } }

.shots {
  display: flex; gap: clamp(.75rem, 2vw, 1.15rem);
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-left: var(--pad);
  padding: .5rem var(--pad) 1.25rem;
  margin-inline: calc(-1 * var(--pad));
  scrollbar-width: none;
}
.shots::-webkit-scrollbar { display: none; }

/* Soft trailing edge signals the strip keeps going. */
@supports (mask-image: linear-gradient(#000, #000)) {
  .gallery[data-overflow="true"] .shots {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 64px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 64px), transparent);
  }
  .gallery[data-overflow="end"] .shots {
    -webkit-mask-image: none; mask-image: none;
  }
}

@media (min-width: 900px) {
  .shots { margin-inline: 0; padding-inline: 0; scroll-padding-left: 0; }
}

.shot {
  flex: none; scroll-snap-align: start;
  border: 0; padding: 0; margin: 0; background: none;
  border-radius: var(--shot-radius);
  cursor: zoom-in;
  transition: transform .22s cubic-bezier(.22,.8,.3,1), box-shadow .22s ease;
}
.shot img {
  height: var(--shot-h); width: auto;
  aspect-ratio: 1290 / 2796;   /* modern iPhone — prevents layout shift */
  object-fit: cover;
  border-radius: var(--shot-radius);
  background: var(--surface-2);
  box-shadow: var(--shadow-md), inset 0 0 0 1px rgb(0 0 0 / .05);
}
@media (hover: hover) {
  .shot:hover { transform: translateY(-5px); }
  .shot:hover img { box-shadow: var(--shadow-lg), inset 0 0 0 1px rgb(0 0 0 / .05); }
}

/* desktop scroll arrows */
.gallery-nav {
  position: absolute; top: calc(var(--shot-h) / 2); translate: 0 -50%;
  z-index: 5; display: none;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-md); cursor: pointer;
  align-items: center; justify-content: center;
  transition: opacity .2s ease, transform .2s ease;
}
.gallery-nav svg { width: 17px; height: 17px; }
.gallery-nav[data-dir="prev"] { left: -14px; }
.gallery-nav[data-dir="next"] { right: -14px; }
.gallery-nav:hover { transform: translate(0, -50%) scale(1.07); }
.gallery-nav[hidden] { display: none !important; }
@media (hover: hover) and (min-width: 900px) { .gallery-nav { display: flex; } }

/* --------------------------------------------------- more apps (tile grid) */
.more-apps {
  margin-top: clamp(2rem, 5vw, 3rem);
  padding-top: clamp(2rem, 5vw, 3rem);
  border-top: 1px solid var(--line);
}
.more-apps h2 {
  font-size: .78rem; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-soft);
  margin-bottom: 1.25rem;
}
.more-apps ul {
  display: grid; gap: .5rem;
  grid-template-columns: repeat(auto-fill, minmax(252px, 1fr));
}
.app-tile a {
  display: flex; align-items: center; gap: .85rem;
  padding: .6rem; border-radius: var(--radius-sm);
  color: inherit; text-decoration: none;
  transition: background .18s ease;
}
.app-tile a:hover { background: var(--surface-2); text-decoration: none; }
.app-tile img {
  width: 56px; height: 56px; flex: none; border-radius: 23%;
  box-shadow: var(--shadow-sm), inset 0 0 0 1px rgb(0 0 0 / .06);
  background: var(--surface-2);
}
.app-tile-text { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.app-tile-text strong { font-size: .96rem; font-weight: 600; }
.app-tile-text small { font-size: .8rem; color: var(--text-soft); }
@media (prefers-color-scheme: dark) {
  .app-tile a:hover { background: var(--surface); }
}

/* ------------------------------------------------------------- lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  padding: clamp(1rem, 4vw, 3rem);
  background: rgb(6 10 16 / .88);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 0; max-width: 100vw; max-height: 100dvh; width: 100vw; height: 100dvh;
}
.lightbox::backdrop { background: rgb(6 10 16 / .88); }
.lightbox img {
  /* Viewport units, not %: the implicit grid row is auto-sized, so a
     percentage max-height would be cyclic and get dropped entirely. */
  max-width: min(92vw, 460px);
  max-height: calc(100dvh - 2 * clamp(1rem, 4vw, 3rem));
  width: auto; height: auto; object-fit: contain;
  border-radius: var(--shot-radius); box-shadow: var(--shadow-lg);
}
.lightbox-close {
  position: absolute; top: clamp(.75rem, 3vw, 1.5rem); right: clamp(.75rem, 3vw, 1.5rem);
  width: 42px; height: 42px; border-radius: 50%; cursor: pointer;
  border: 0; background: rgb(255 255 255 / .14); color: #fff;
  display: grid; place-items: center;
}
.lightbox-close:hover { background: rgb(255 255 255 / .26); }
.lightbox-nav {
  position: absolute; top: 50%; translate: 0 -50%;
  width: 46px; height: 46px; border-radius: 50%; cursor: pointer;
  border: 0; background: rgb(255 255 255 / .14); color: #fff;
  display: grid; place-items: center;
}
.lightbox-nav svg { width: 20px; height: 20px; }
.lightbox-nav[data-dir="prev"] { left: clamp(.5rem, 2vw, 2rem); }
.lightbox-nav[data-dir="next"] { right: clamp(.5rem, 2vw, 2rem); }
.lightbox-nav:hover { background: rgb(255 255 255 / .26); }
@media (max-width: 600px) { .lightbox-nav { display: none; } }

/* ---------------------------------------------------------------- footer */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  padding: clamp(2.5rem, 6vw, 3.5rem) 0;
}
.site-footer > .wrap {
  display: flex; flex-wrap: wrap; gap: 1rem 2rem;
  align-items: center; justify-content: space-between;
}
.footer-links { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; }
.footer-links a { color: var(--text-soft); font-size: .9rem; }
.footer-links a:hover { color: var(--text); }
.footer-copy { color: var(--text-soft); font-size: .85rem; }

/* -------------------------------------------------------- app detail page */
.detail { padding: clamp(2rem, 6vw, 3.5rem) 0 var(--section-y); }
.breadcrumb { font-size: .87rem; color: var(--text-soft); margin-bottom: 1.75rem; }
.breadcrumb a { color: var(--text-soft); }
.breadcrumb a:hover { color: var(--brand); }

.detail .app { border-top: 0; padding-top: 0; padding-bottom: 0; }

.detail-body {
  margin-top: clamp(2.5rem, 6vw, 3.5rem);
  padding-top: clamp(2rem, 5vw, 2.75rem);
  border-top: 1px solid var(--line);
  display: grid; gap: var(--gap);
}
@media (min-width: 900px) {
  .detail-body { grid-template-columns: minmax(0, 1.6fr) minmax(240px, 1fr); }
}
.detail-body h2 { font-size: 1.25rem; font-weight: 700; margin-bottom: .85rem; }
.detail-desc { color: var(--text-soft); font-size: 1rem; line-height: 1.72; }
.detail-desc > * + * { margin-top: 1rem; }
.detail-desc h3 {
  font-size: .78rem; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text);
  margin-top: 1.75rem;
}
.detail-desc ul, .detail-desc ol { padding-left: 1.3rem; }
.detail-desc ul { list-style: disc; }
.detail-desc ol { list-style: decimal; }
.detail-desc li { margin-top: .4rem; padding-left: .2rem; }
.detail-desc li::marker { color: var(--brand-lit); }
.spec-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.spec-table th, .spec-table td {
  text-align: left; padding: .6rem 0; border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.spec-table th { font-weight: 500; color: var(--text-soft); width: 45%; }
.spec-table td { font-weight: 550; }

/* --------------------------------------------------------- legal (privacy/terms) */
.legal { padding: clamp(2.5rem, 7vw, 4rem) 0 var(--section-y); }
.legal .wrap { width: min(760px, 100% - 2 * var(--pad)); }
.legal h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); font-weight: 800; }
.legal .updated {
  margin-top: .6rem; font-size: .87rem; color: var(--text-soft);
}
.legal h2 {
  font-size: 1.18rem; font-weight: 700;
  margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line);
}
.legal h3 { font-size: 1rem; font-weight: 650; margin-top: 1.5rem; }
.legal p, .legal li { color: var(--text-soft); }
.legal p { margin-top: 1rem; }
.legal ul, .legal ol { margin-top: 1rem; padding-left: 1.35rem; }
.legal ul { list-style: disc; }
.legal ol { list-style: decimal; }
.legal ol[type="a"] { list-style: lower-alpha; }
.legal ol[type="i"] { list-style: lower-roman; }
.legal li { margin-top: .5rem; padding-left: .25rem; }
.legal li::marker { color: var(--brand-lit); }

/* ------------------------------------------------------------- utilities */
/* Scroll reveal is strictly progressive enhancement:
   • no JS at all      → .js is never set, content renders normally
   • JS broken / legacy → the fallback animation un-hides it after 1.2s
   • JS working         → IntersectionObserver adds .is-in as cards scroll in */
.js .reveal {
  opacity: 0; transform: translateY(18px);
  animation: reveal-fallback 1ms linear 1.2s forwards;
}
.js .reveal.is-in {
  opacity: 1; transform: none; animation: none;
  transition: opacity .6s ease, transform .6s cubic-bezier(.22,.8,.3,1);
}
@keyframes reveal-fallback { to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .js .reveal, .js .reveal.is-in {
    opacity: 1; transform: none; transition: none; animation: none;
  }
  .shot, .badge-link, .gallery-nav { transition: none !important; }
}
