/* Public pages of apps. No web fonts and no scripts: the CSP allows this file and nothing else. */
:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --card: #ffffff;
  --fg: #14171c;
  --muted: #545d6b;
  --line: #e1e4ea;
  --accent: #2563eb;
  --accent-fg: #ffffff;
  --error: #b42318;
  --error-bg: #fdecea;
  --notice-bg: #eaf1ff;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0e13;
    --card: #141922;
    --fg: #e8ebf0;
    --muted: #a0a8b6;
    --line: #262d39;
    --accent: #6d9bff;
    --accent-fg: #0b0e13;
    --error: #ff9a8f;
    --error-bg: #2b1614;
    --notice-bg: #15213a;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); text-underline-offset: 2px; }
a:focus-visible, input:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.shell { max-width: 720px; min-height: 100vh; margin: 0 auto; padding: 24px 20px 40px; display: flex; flex-direction: column; }
main { flex: 1; }

header.app { display: flex; align-items: center; gap: 12px; margin-bottom: 32px; }
.icon { width: 48px; height: 48px; border-radius: 11px; flex: none; }
.icon-blank { display: grid; place-items: center; background: var(--accent); color: var(--accent-fg); font-weight: 600; font-size: 22px; }
.app-name { color: var(--fg); font-weight: 600; font-size: 18px; text-decoration: none; }

h1 { margin: 0 0 12px; font-size: clamp(26px, 5vw, 34px); line-height: 1.2; letter-spacing: -0.01em; text-wrap: balance; }
.meta { margin: 0 0 28px; color: var(--muted); font-size: 14px; }

.doc h2 { margin: 36px 0 8px; font-size: 21px; line-height: 1.3; }
.doc h3 { margin: 26px 0 6px; font-size: 17px; }
.doc ul, .doc ol { padding-inline-start: 22px; }
.doc li + li { margin-top: 4px; }
.doc code { padding: 1px 5px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); font-size: 0.92em; }
.doc table { display: block; overflow-x: auto; border-collapse: collapse; }
.doc th, .doc td { padding: 6px 10px; border: 1px solid var(--line); text-align: start; }
/* Logical sides, so Arabic pages mirror without a stylesheet of their own. */
.doc blockquote { margin: 16px 0; padding: 4px 16px; border-inline-start: 3px solid var(--line); color: var(--muted); }

/* App home page: the live App Store listing, then the documents. */
.home { margin-bottom: 24px; }
.home-top { display: flex; align-items: center; gap: 16px; }
.home h1 { margin: 0; }
/* The store masks icons to a squircle; 22.5% is the usual approximation. */
.icon-large { width: 96px; height: 96px; border-radius: 22.5%; font-size: 40px; }
.subtitle { margin: 4px 0 0; color: var(--muted); font-size: 17px; }
.store-row { margin: 20px 0 0; }
.store { display: inline-block; padding: 11px 18px; border-radius: 12px; background: var(--accent); color: var(--accent-fg); font-weight: 600; text-decoration: none; }
.shots { display: flex; gap: 12px; margin: 0 0 24px; padding: 0 0 8px; list-style: none; overflow-x: auto; scroll-snap-type: x mandatory; }
.shots li { flex: none; scroll-snap-align: start; }
.shots img { display: block; width: 230px; height: auto; border: 1px solid var(--line); border-radius: 18px; }
.promo-text { margin: 0 0 12px; font-size: 17px; font-weight: 500; }
/* Store descriptions are plain text with line breaks, not Markdown. */
.description { white-space: pre-line; overflow-wrap: anywhere; }
.docs-title { margin: 36px 0 0; font-size: 21px; }

.docs { margin: 20px 0 0; padding: 0; list-style: none; }
.docs li + li { margin-top: 10px; }
.docs a { display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--fg); font-weight: 500; text-decoration: none; }

.lead { margin-bottom: 22px; color: var(--muted); font-size: 17px; }
.lead p { margin: 0 0 8px; }
.card { display: grid; gap: 18px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.field { display: grid; gap: 6px; }
.field span { font-size: 15px; font-weight: 500; }
.field small { color: var(--muted); font-size: 13px; }
input[type="email"], input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 17px;
}
.agree { display: flex; align-items: flex-start; gap: 10px; color: var(--muted); font-size: 14px; }
.agree input { width: 18px; height: 18px; margin-top: 3px; flex: none; accent-color: var(--accent); }
button {
  padding: 14px 18px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-fg);
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
}
button:hover { filter: brightness(1.06); }
.error, .notice, .applied { margin: 0; font-size: 15px; }
.error { padding: 10px 12px; border-radius: 10px; background: var(--error-bg); color: var(--error); }
.notice { padding: 10px 12px; border-radius: 10px; background: var(--notice-bg); }
.hint { margin: 12px 0 0; color: var(--muted); font-size: 15px; }
.state { padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); font-size: 18px; }
.message p { font-size: 17px; }
/* The honeypot: out of sight and out of the tab order, still in the markup a script fills in. */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

footer { margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
footer nav { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 8px; }
footer a { color: var(--muted); }
.langs { font-size: 13px; }
.langs [aria-current] { color: var(--fg); font-weight: 600; }
.hosted { margin: 0; }

/* «Open in the app» on an app's own domain. */
.open .home-top { margin-bottom: 20px; }
.open-body { font-size: 17px; }
.open-code-label { margin: 20px 0 4px; color: var(--muted); font-size: 15px; }
.open-code { margin: 0; font: 600 22px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.04em; word-break: break-all; }
.open-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0 0; }
.store-secondary { border: 1px solid var(--line); background: transparent; color: var(--accent); }
