/* One stylesheet for the whole site: the project list and every project page.
 *
 * Colours come from the app icon. Everything else is a token, so a new project
 * page only writes markup. Both themes are defined here: the palette below is
 * the light one, and the two blocks after it restate only the tokens that
 * differ in the dark one. Never give a colour its only definition inside those
 * blocks. Themes are picked in assets/theme.js.
 */

:root {
  color-scheme: light;

  --accent: #512BD4;          /* links and accents on a light background */
  --accent-soft: #6B45E0;
  --button: #512BD4;          /* button fill, always carries white text */
  --button-hover: #6B45E0;
  --button-off: #bdb8cc;
  --text: #16151a;
  --text-quiet: #5c5966;
  --bg: #ffffff;
  --bg-card: #f7f5fb;
  --border: #e6e2f0;

  --width: 1080px;
  --radius: 14px;
}

/* No stored choice: follow the operating system. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --accent: #b9a5ff;
    --accent-soft: #cdbcff;
    --button: #6B45E0;
    --button-hover: #7c5ae8;
    --button-off: #3a3648;
    --text: #ece9f5;
    --text-quiet: #a5a0b8;
    --bg: #14131a;
    --bg-card: #1d1b26;
    --border: #2e2b3b;
  }
}

/* Visitor overrode the system setting: these win in both directions. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --accent: #b9a5ff;
  --accent-soft: #cdbcff;
  --button: #6B45E0;
  --button-hover: #7c5ae8;
  --button-off: #3a3648;
  --text: #ece9f5;
  --text-quiet: #a5a0b8;
  --bg: #14131a;
  --bg-card: #1d1b26;
  --border: #2e2b3b;
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 16px/1.65 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
.wrap { max-width: var(--width); margin: 0 auto; padding: 0 24px; }

/* Header */
header.top {
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg); z-index: 10;
}
header.top .wrap { display: flex; align-items: center; gap: 12px; height: 62px; }
header.top img { width: 28px; height: 28px; border-radius: 7px; }
header.top b { font-size: 17px; letter-spacing: -.01em; }
header.top nav { margin-left: auto; display: flex; align-items: center; gap: 22px; font-size: 15px; }
header.top nav a { color: var(--text-quiet); text-decoration: none; }
header.top nav a:hover { color: var(--accent); }

/* Theme toggle. Hidden in the markup and revealed by the script, so a browser
   without JavaScript never shows a button that cannot do anything. */
.theme {
  font: inherit; font-size: 14px; line-height: 1;
  color: var(--text-quiet); background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 7px 14px; min-width: 74px; cursor: pointer;
}
.theme:hover { color: var(--accent); border-color: var(--accent-soft); }

/* Hero */
.hero { padding: 64px 0 8px; text-align: center; }
.hero h1 {
  font-size: clamp(34px, 5vw, 52px); line-height: 1.12;
  letter-spacing: -.025em; margin: 0 0 18px;
}
.hero p.lead {
  font-size: clamp(17px, 2vw, 20px); color: var(--text-quiet);
  max-width: 640px; margin: 0 auto 10px;
}
.hero p.claim { font-weight: 600; color: var(--text); margin: 0 auto 34px; }
.banner { width: 100%; max-width: 860px; border-radius: 16px; display: block; margin: 40px auto 0; }
/* Hero images that are not wide artwork. Each is capped at its own natural
   width, so neither gets blown up to fill the column. */
.banner.phone { max-width: 270px; border-radius: 20px; }
.banner.panel { max-width: 500px; }

/* Downloads */
.downloads { padding: 40px 0 8px; }
.downloads h2 { text-align: center; font-size: 26px; margin: 0 0 6px; letter-spacing: -.02em; }
.release { text-align: center; color: var(--text-quiet); font-size: 15px; margin: 0 0 26px; }
.release .badge {
  display: inline-block; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 999px; padding: 2px 12px; font-weight: 600; color: var(--accent);
}
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 16px; }
.tile {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
  background: var(--bg-card); display: flex; flex-direction: column; gap: 6px;
}
/* A project shipping a single file should not have that one tile stretched
   across the whole page. */
.tiles .tile:only-child { max-width: 420px; margin: 0 auto; }
/* Four tiles otherwise land three across, with the fourth alone beside two
   empty tracks. Capping the row at two squares them up and keeps each tile the
   width the three-tile pages already use. */
.tiles.two { max-width: 720px; margin: 0 auto; }
.tile h3 { margin: 0; font-size: 17px; }
.tile .what { color: var(--text-quiet); font-size: 14px; flex: 1; margin: 0 0 12px; }
.tile a.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--button); color: #fff; text-decoration: none; font-weight: 600;
  padding: 11px 16px; border-radius: 10px; font-size: 15px;
}
.tile a.button:hover { background: var(--button-hover); }
.tile a.button[aria-disabled="true"] { background: var(--button-off); pointer-events: none; }
.tile .size { color: var(--text-quiet); font-size: 13px; min-height: 18px; }

.note {
  margin: 26px auto 0; max-width: 760px; font-size: 14px; color: var(--text-quiet);
  border-left: 3px solid var(--border); padding: 4px 0 4px 16px;
}

/* Sections */
section { padding: 56px 0; }
section h2 { font-size: 28px; letter-spacing: -.02em; margin: 0 0 8px; }
section p.intro { color: var(--text-quiet); margin: 0 0 32px; max-width: 620px; }
.band { background: var(--bg-card); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 28px; }
.feature h3 { margin: 0 0 6px; font-size: 17px; }
.feature p { margin: 0; color: var(--text-quiet); font-size: 15px; }

/* Screenshots */
.shots { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); gap: 20px; }
.shots figure { margin: 0; }
.shots img { width: 100%; border-radius: var(--radius); border: 1px solid var(--border); display: block; }
.shots figcaption,
.shot-wide figcaption { font-size: 14px; color: var(--text-quiet); text-align: center; margin-top: 10px; }
/* Desktop screenshots are wider than phone ones, so a page can ask for fewer,
   larger columns than the default. */
.shots.two { grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); }
/* Two shots side by side rarely share an aspect ratio, so the caption sits at
   the bottom of the row instead of straight under its own image. */
.shots figure { display: flex; flex-direction: column; }
.shots figcaption { margin-top: auto; padding-top: 10px; }
.shot-wide { margin: 28px 0 0; }
.shot-wide img { width: 100%; border-radius: var(--radius); border: 1px solid var(--border); display: block; }

/* Project list on the front page. Each project adds one card; the grid lays
   them out on its own. */
.projects {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  max-width: 860px; margin: 0 auto; /* one card alone should not span the page */
}
.project {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card);
  padding: 24px; display: flex; flex-direction: column; gap: 10px;
  text-decoration: none; color: inherit;
}
.project:hover { border-color: var(--accent-soft); }
.project .head { display: flex; align-items: center; gap: 12px; }
.project .head img { width: 34px; height: 34px; border-radius: 8px; }
.project h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.project p { margin: 0; color: var(--text-quiet); font-size: 15px; flex: 1; }
.project .platforms { display: flex; flex-wrap: wrap; gap: 8px; }
.project .platforms span {
  border: 1px solid var(--border); background: var(--bg); border-radius: 999px;
  padding: 2px 12px; font-size: 13px; color: var(--text-quiet);
}
.project .go { color: var(--accent); font-weight: 600; font-size: 15px; }

footer {
  padding: 40px 0 60px; color: var(--text-quiet); font-size: 14px;
  border-top: 1px solid var(--border); margin-top: 20px;
}
footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 26px; align-items: center; }
footer a { color: var(--text-quiet); }

/* On a phone the header bar does not fit the name, the links and the theme
   button in one row, so the navigation is allowed to drop to a second one.
   With few links, as on the project list, it stays where it was. */
@media (max-width: 640px) {
  header.top .wrap { flex-wrap: wrap; height: auto; padding: 10px 20px; row-gap: 6px; }
  header.top nav { gap: 16px; row-gap: 4px; font-size: 14px; flex-wrap: wrap; }
  .theme { padding: 6px 12px; min-width: 68px; }
}
