/*
  Shared component: platform download cards + the homepage hero download action. Loaded after styles.css
  and motion.css on the pages that render them (/download and the homepage; COMPONENTS in
  scripts/build.mjs), before the page's own stylesheet. Markup: scripts/pages/platforms.mjs (cards, hero
  actions) and scripts/build.mjs › home (#download section). The visitor's system comes from dist/os.js
  (<html data-os>, set before first paint) and dist/platforms.js (<html data-arch>, Chromium Macs).
  Rules: the two literal breakpoints (max-width: 960px / 640px); no state may move layout (CLS 0): every
  choice below is made before first paint or only toggles visibility.
*/

/* Platform cards: one card per available platform, the whole card is the download link. */
.platform-grid { margin: 0; padding: 0; list-style: none; }
.platform-item { display: flex; min-width: 0; }
.platform { flex: 1; display: flex; flex-direction: column; padding: var(--space-6); color: var(--ink); text-decoration: none; transition: border-color var(--dur-ui, 240ms) var(--ease-standard, ease), background-color var(--dur-ui, 240ms) var(--ease-standard, ease); }
.platform:hover { border-color: var(--line-strong); }
.platform:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.platform-top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-2); margin-bottom: 20px; }
.platform .icon-tile { color: var(--ink); }
.platform h3 { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.platform h3 .badge { font-family: var(--font); letter-spacing: 0; }
.platform-detail { display: block; margin-top: var(--space-2); margin-bottom: var(--space-5); font-size: var(--fs-ui); line-height: var(--lh-ui); color: var(--ink-2); }
/* The visible download label (a span styled as the filled button; the card itself is the link) and the
   file hint ("DMG · Apple Silicon"). */
.platform-action { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-4); margin-top: auto; }
.platform-button { gap: var(--space-3); }
.platform:hover .platform-button { background: #fff; transform: translateY(-1px); }
.platform-file { font-size: var(--fs-meta); line-height: 1.4; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* "Dein System": the badge slot is always rendered (visibility only), so marking never shifts anything.
   Both Mac cards are marked while the processor is unknown (Safari, Firefox, no JS yet). */
.platform-yours { visibility: hidden; }
:root[data-os="mac"] .platform[data-os="mac"], :root[data-os="windows"] .platform[data-os="windows"], :root[data-os="linux"] .platform[data-os="linux"] { border-color: var(--line-strong); background: linear-gradient(180deg, #ffffff0a, #ffffff03 40%), var(--surface); box-shadow: 0 26px 64px -35px #000; }
:root[data-os="mac"] .platform[data-os="mac"] .platform-yours, :root[data-os="windows"] .platform[data-os="windows"] .platform-yours, :root[data-os="linux"] .platform[data-os="linux"] .platform-yours { visibility: visible; color: var(--ink); }
:root[data-arch="arm"] .platform[data-platform="macIntel"] .platform-yours, :root[data-arch="x86"] .platform[data-platform="macArm64"] .platform-yours { visibility: hidden; }

/* Wide: titles, details and actions of neighbouring cards start on the same lines. */
@supports (grid-template-rows: subgrid) {
  @media not all and (max-width: 960px) {
    .platform-grid { row-gap: 0; }
    .platform-item { display: grid; grid-row: span 4; grid-template-rows: subgrid; }
    .platform { display: grid; grid-row: span 4; grid-template-rows: subgrid; row-gap: 0; }
    .platform-action { margin-top: 0; align-self: end; }
  }
}

/* Homepage #download: heading, the cards, one link to /download. */
.home-download-more { margin-top: var(--space-5); }
.home-download-more .text-link { color: var(--ink); }

/* Homepage hero (owner decision of 4 October 2026): exactly one filled primary button and one text link
   ("Alle Plattformen ansehen" → /download), on every width. The button is built in every variant
   (scripts/pages/platforms.mjs › heroActions); this shows the one for <html data-os> when the build has
   an installer for that system ([data-has]), otherwise the generic "Download" to #download (also without
   JS, on phones, on unknown systems and on Windows/Linux before their installers exist). Decided before
   first paint, so the row is laid out once (CLS 0). Phones: the link goes under the button. */
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; column-gap: var(--space-6); row-gap: var(--space-2); }
.hero-download { display: inline-flex; }
.hero-download > [data-hero-for] { display: none; }
.hero-download > [data-hero-for="any"],
:root[data-os="mac"] .hero-download[data-has~="mac"] > [data-hero-for="mac"],
:root[data-os="windows"] .hero-download[data-has~="windows"] > [data-hero-for="windows"],
:root[data-os="linux"] .hero-download[data-has~="linux"] > [data-hero-for="linux"] { display: inline-flex; }
:root[data-os="mac"] .hero-download[data-has~="mac"] > [data-hero-for="any"],
:root[data-os="windows"] .hero-download[data-has~="windows"] > [data-hero-for="any"],
:root[data-os="linux"] .hero-download[data-has~="linux"] > [data-hero-for="any"] { display: none; }
.hero-download .button { gap: var(--space-3); }
.hero-all { color: var(--ink); }

@media (max-width: 960px) {
  .platform { padding: var(--space-5); }
}
@media (max-width: 640px) {
  /* Platform cards become compact rows: glyph left, name and detail next to it, the download below. */
  .platform { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; column-gap: var(--space-4); align-items: start; padding: 20px; }
  .platform-top { display: contents; }
  .platform .icon-tile { grid-column: 1; grid-row: 1 / span 2; }
  .platform-yours { grid-column: 3; grid-row: 1; align-self: center; }
  .platform h3 { grid-column: 2; grid-row: 1; min-height: 29px; }
  .platform-detail { grid-column: 2 / -1; grid-row: 2; margin-top: var(--space-1); margin-bottom: 0; }
  .platform-action { grid-column: 1 / -1; grid-row: 3; margin-top: var(--space-4); }
  .platform-button { flex: 1 1 100%; }
  .hero-actions { flex-direction: column; }
}
