:root {
  color-scheme: dark;
  --bg: #0d0f14;
  --bg-2: #10131a;
  --card: #141821;
  --line: #232937;
  --text: #e9ecf3;
  --muted: #9aa3b5;
  --btn: #f3f4f8;
  --btn-text: #0d0f14;
  --chip: #1b2030;
  --lift: 0 14px 34px rgba(0, 0, 0, .35);
  --radius: 20px;
}
/* Light: the system's choice unless the visitor picked Dark, or an explicit Light pick. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
  --bg: #f6f7fa;
  --bg-2: #eef0f5;
  --card: #ffffff;
  --line: #e3e6ee;
  --text: #14161c;
  --muted: #5b6473;
  --btn: #14161c;
  --btn-text: #ffffff;
  --chip: #eef0f5;
  --lift: 0 14px 34px rgba(20, 22, 28, .10);
  color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f6f7fa;
  --bg-2: #eef0f5;
  --card: #ffffff;
  --line: #e3e6ee;
  --text: #14161c;
  --muted: #5b6473;
  --btn: #14161c;
  --btn-text: #ffffff;
  --chip: #eef0f5;
  --lift: 0 14px 34px rgba(20, 22, 28, .10);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { display: block; }

.wrap { max-width: 880px; margin: 0 auto; padding: 0 20px 64px; }

.top {
  max-width: 880px; margin: 0 auto; padding: 22px 20px 0;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 650; letter-spacing: -.01em; }
.brand__mark {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: var(--text); color: var(--bg); font-weight: 800; font-size: 17px; line-height: 1; padding-bottom: 2px;
}
.brand__mark--img { background: none; padding: 0; }
.brand__mark--img img { display: block; width: 28px; height: 28px; border-radius: 8px; }
.top__right { display: flex; align-items: center; gap: 14px; }
.top__link { color: var(--muted); text-decoration: none; font-size: 14px; }
.top__link:hover { color: var(--text); }

.hero { padding: 64px 0 36px; max-width: 640px; }
.hero h1 { font-size: clamp(32px, 6vw, 46px); line-height: 1.08; letter-spacing: -.03em; margin: 0 0 16px; font-weight: 700; }
.hero p { margin: 0; color: var(--muted); font-size: 17px; }

.toolbar { display: flex; justify-content: flex-end; margin: 0 0 12px; }
.seg { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.seg__btn {
  appearance: none; border: 0; background: transparent; color: var(--muted); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 13px; font-weight: 600;
  padding: 5px 10px; border-radius: 7px; transition: background .2s ease, color .2s ease;
}
.seg__btn:hover { color: var(--text); }
.seg__btn[aria-pressed="true"] { background: var(--chip); color: var(--text); }
.seg--icons .seg__btn { padding: 5px 7px; }

.apps { display: grid; gap: 14px; }

.app {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 72px 1fr auto; gap: 22px; align-items: center;
  padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
  transition: transform .28s cubic-bezier(.2,.7,.2,1), box-shadow .28s ease, border-color .28s ease;
}
.app:hover { transform: translateY(-3px); box-shadow: var(--lift); border-color: color-mix(in srgb, var(--accent) 38%, var(--line)); }
.app:hover .icon { transform: scale(1.06) rotate(-2deg); }
.icon { transition: transform .32s cubic-bezier(.2,.7,.2,1); }
.app { isolation: isolate; }
.app::before {
  content: ""; position: absolute; z-index: -1; inset: -40% auto auto -10%; width: 60%; height: 140%;
  background: radial-gradient(closest-side, var(--accent), transparent 70%);
  opacity: 0; transition: opacity .35s ease; pointer-events: none; filter: blur(30px);
}
.app:hover::before { opacity: .16; }
.app > * { position: relative; }

.icon { width: 72px; height: 72px; }
.icon--bleed { border-radius: 22.5%; box-shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 6px 18px rgba(0,0,0,.25); }

.app__body { min-width: 0; }
.app__body h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -.01em; font-weight: 650; }
.app__tagline { margin: 0 0 10px; color: var(--muted); font-size: 15px; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li { font-size: 12px; color: var(--muted); background: var(--chip); border-radius: 999px; padding: 3px 9px; }

.app__actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; min-width: 236px; max-width: 360px; text-align: right; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  background: var(--btn); color: var(--btn-text); text-decoration: none;
  font-weight: 650; font-size: 15px; padding: 11px 16px; border-radius: 12px;
  transition: transform .15s ease, opacity .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); opacity: .9; }
.btn__kind { font-weight: 500; opacity: .6; font-size: 13px; }

.meta { margin: 0; font-size: 13px; color: var(--muted); min-height: 1.4em; }
.meta.is-loading {
  width: 190px; height: 12px; border-radius: 6px; margin-top: 4px;
  background: linear-gradient(90deg, var(--chip) 25%, var(--line) 50%, var(--chip) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite;
}
.meta.is-error { color: #d98f5f; }
@keyframes shimmer { to { background-position: -200% 0; } }

.links { margin: 0; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; }
.links a { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--line); }
.links a:hover { color: var(--text); border-color: var(--text); }
.links .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--line); }
.hint { opacity: .8; }
.links__note { flex-basis: 100%; }
.links:not(.view-grid *) .links__note { text-align: right; }
.links--sub a:first-child { color: var(--text); font-weight: 600; }
.links--sub[hidden] { display: none; }
.links--sub { flex-direction: column; align-items: flex-end; gap: 2px; }
.updates { margin: 0; font-size: 12.5px; color: var(--muted); display: flex; align-items: flex-start; justify-content: flex-end; gap: 6px; text-align: right; line-height: 1.45; }
.updates svg { flex: none; margin-top: 3px; opacity: .8; }
.updates b { color: var(--text); font-weight: 600; }
.links--sub .dot { display: none; }

.notes { margin-top: 56px; padding: 26px 28px; border-radius: var(--radius); background: var(--bg-2); border: 1px solid var(--line); }
.notes h2 { margin: 0 0 12px; font-size: 18px; letter-spacing: -.01em; }
.notes ol { margin: 0; padding-left: 20px; color: var(--muted); font-size: 15px; }
.notes li { padding: 4px 0; }
.notes b { color: var(--text); font-weight: 600; }

.foot { max-width: 880px; margin: 0 auto; padding: 0 20px 48px; color: var(--muted); font-size: 13px; }
.foot p { margin: 4px 0; }
.foot__stamp:empty { display: none; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }


/* Cards layout */
.view-grid .apps { grid-template-columns: repeat(auto-fill, minmax(262px, 1fr)); gap: 16px; }
.view-grid .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; gap: 14px; align-items: start; padding: 22px; }
.view-grid .icon { width: 64px; height: 64px; }
.view-grid .app__body h2 { font-size: 19px; }
.view-grid .app__tagline { font-size: 14.5px; }
.view-grid .app__actions { align-items: stretch; text-align: left; min-width: 0; max-width: none; align-self: end; }
.view-grid .btn { justify-content: center; }
.view-grid .links { justify-content: flex-start; }
.view-grid .updates { justify-content: flex-start; text-align: left; }
.view-grid .links--sub { align-items: flex-start; }
.view-grid .meta.is-loading { width: 70%; }

/* Where subgrid exists, every card in a row shares the same eight row tracks
   (icon, name, tagline, chips, button, version, updates, Mac line, links), so buttons
   and text sit at the same height across the row. Spacing moves from gaps to
   margins so an absent row costs nothing. */
@supports (grid-template-rows: subgrid) {
  .view-grid .apps { row-gap: 0; }
  .view-grid .app {
    grid-template-rows: subgrid; grid-row: span 9; row-gap: 0; align-items: start;
    margin-bottom: 16px;
  }
  /* The last row's margin is taken back here, whatever the column count. */
  .view-grid .apps { margin-bottom: -16px; }
  .view-grid .app__body, .view-grid .app__actions { display: contents; }
  .view-grid .icon { grid-row: 1; margin-bottom: 14px; }
  .view-grid .app__body h2 { grid-row: 2; margin: 0 0 4px; }
  .view-grid .app__tagline { grid-row: 3; margin: 0 0 10px; }
  .view-grid .chips { grid-row: 4; margin-bottom: 16px; align-self: start; }
  .view-grid .btn { grid-row: 5; margin-bottom: 8px; }
  .view-grid .meta { grid-row: 6; margin-bottom: 8px; }
  .view-grid .updates { grid-row: 7; margin-bottom: 8px; }
  .view-grid .links--sub { grid-row: 8; margin-bottom: 8px; }
  .view-grid .links:not(.links--sub) { grid-row: 9; align-self: start; }
}

@media (prefers-reduced-motion: reduce) {
  .app, .icon, .seg__btn { transition: none; }
  .app:hover { transform: none; }
  .app:hover .icon { transform: none; }
  .meta.is-loading { animation: none; }
}

@media (max-width: 720px) {
  .hero { padding: 44px 0 28px; }
  .app { grid-template-columns: 56px 1fr; gap: 16px; padding: 20px; }
  .icon { width: 56px; height: 56px; }
  .app__actions { grid-column: 1 / -1; align-items: stretch; text-align: left; min-width: 0; max-width: none; }
  .btn { justify-content: center; }
  .links { justify-content: flex-start; }
  .updates { justify-content: flex-start; text-align: left; }
  .meta.is-loading { width: 60%; }
  .notes { padding: 22px 20px; }
}
