/*
 * site.scss — the 2.0 (Mac App Store) site design, used by every page built
 * from pug/_layout.pug and by the hand-written help, support and privacy pages.
 * Plain CSS on purpose (no Sass features), so css/site.css can also be edited
 * directly; CodeKit compiles this file to css/site.css.
 *
 * The older stylesheets (styles, overrides, standardize, index-grid) are kept
 * only for pppp.html and the 1.x release notes, which old app versions load.
 */

/* Dark is the default; light comes from the visitor's system setting or the
   header toggle (js/site.js stores the choice as data-theme on <html>). */
:root {
  color-scheme: dark;
  --bg: #132a31;
  --bg-top: #22434a;
  --bg-bottom: #0b1a1f;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-strong: rgba(255, 255, 255, 0.075);
  --border: rgba(255, 255, 255, 0.10);
  --text: #e9eff1;
  --text-soft: #cfdbdf;
  --strong: #ffffff;
  --muted: #a8b9be;
  --link: #8fd6e2;
  --link-hover: #c4ecf2;
  --accent: #f1c66a;
  --shot-bg: #102329;
  --shadow: rgba(0, 0, 0, 0.35);
  --rule: rgba(255, 255, 255, 0.28);
  --show-sun: inline;
  --show-moon: none;
  --radius: 14px;
  --content: 1120px;
  --prose: 46rem;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f7f7;
  --bg-top: #dcebee;
  --bg-bottom: #f8fafa;
  --surface: #ffffff;
  --surface-strong: #e8f0f2;
  --border: rgba(16, 42, 49, 0.13);
  --text: #12262c;
  --text-soft: #34494f;
  --strong: #0b1a1f;
  --muted: #5a6e74;
  --link: #0a6a7b;
  --link-hover: #06495a;
  --accent: #9a6200;
  --shot-bg: #1d383e;
  --shadow: rgba(15, 40, 48, 0.20);
  --rule: rgba(16, 42, 49, 0.30);
  --show-sun: none;
  --show-moon: inline;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f3f7f7;
    --bg-top: #dcebee;
    --bg-bottom: #f8fafa;
    --surface: #ffffff;
    --surface-strong: #e8f0f2;
    --border: rgba(16, 42, 49, 0.13);
    --text: #12262c;
    --text-soft: #34494f;
    --strong: #0b1a1f;
    --muted: #5a6e74;
    --link: #0a6a7b;
    --link-hover: #06495a;
    --accent: #9a6200;
    --shot-bg: #1d383e;
    --shadow: rgba(15, 40, 48, 0.20);
    --rule: rgba(16, 42, 49, 0.30);
    --show-sun: none;
    --show-moon: inline;
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  background-image: linear-gradient(180deg, var(--bg-top) 0, var(--bg) 640px, var(--bg-bottom) 100%);
  transition: background-color 0.2s ease, color 0.2s ease;
  color: var(--text);
  font: 400 1.0625rem/1.6 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "PingFang TC", "Noto Sans TC", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; text-underline-offset: 0.15em; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 0.5em; }
h1 { font-size: clamp(2rem, 4.5vw, 3rem); font-weight: 700; }
h2 { font-size: clamp(1.45rem, 3vw, 1.9rem); font-weight: 650; }
h3 { font-size: 1.15rem; font-weight: 650; }
p { margin: 0 0 1em; }
code { font: 0.92em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-strong); padding: 0.1em 0.35em; border-radius: 5px; }
strong { font-weight: 650; color: var(--strong); }

/* ── Header ─────────────────────────────────────────────────────────── */

.site-header {
  width: 100%;
  max-width: var(--content);
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; font-size: 1.05rem; }
.brand:hover { color: var(--strong); text-decoration: none; }
.brand img { width: 36px; height: 36px; }

.site-nav { display: flex; align-items: center; gap: 4px 22px; flex-wrap: wrap; font-size: 0.95rem; }
.site-nav a { color: var(--muted); }
.site-nav a:hover { color: var(--text); text-decoration: none; }
.site-nav a.nav-cta {
  color: var(--text);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 6px 14px;
  border-radius: 999px;
}
.site-nav a.nav-cta:hover { background: var(--surface-strong); }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--text); background: var(--surface-strong); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: var(--show-sun); }
.theme-toggle .icon-moon { display: var(--show-moon); }

/* ── Page frame ─────────────────────────────────────────────────────── */

.page { flex: 1; width: 100%; max-width: var(--content); margin: 0 auto; padding: 8px 24px 64px; }

/* ── Home: hero ─────────────────────────────────────────────────────── */

.hero { text-align: center; padding: 40px 0 8px; }
.hero-icon { width: 112px; height: 112px; margin: 0 auto 18px; }
.hero h1 { margin-bottom: 0.25em; }
.hero .lede { font-size: clamp(1.2rem, 2.6vw, 1.55rem); color: var(--text); margin-bottom: 0.4em; }
.hero .sub { color: var(--muted); max-width: 36rem; margin: 0 auto 1.6em; }

.badge-link { display: inline-block; border-radius: 10px; }
.badge-link img { height: 54px; width: auto; }
.badge-link:hover { opacity: 0.88; }

.buy-meta { color: var(--muted); font-size: 0.9rem; margin-top: 14px; }
.buy-meta span + span::before { content: "·"; margin: 0 0.6em; opacity: 0.7; }

.shot {
  margin: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px var(--shadow);
  background: var(--shot-bg);
}
.hero .shot { margin-top: 48px; }

/* ── Home: feature rows ─────────────────────────────────────────────── */

.features { margin-top: 96px; display: grid; gap: 96px; }

.feature {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 48px;
  align-items: center;
  scroll-margin-top: 24px;
}
.feature:nth-child(even) .feature-text { order: 2; }
.feature:nth-child(even) { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }

.eyebrow { color: var(--accent); font-size: 0.8rem; font-weight: 650; letter-spacing: 0.09em; text-transform: uppercase; margin-bottom: 0.6em; }
.feature-text p { color: var(--text-soft); }
.more { font-weight: 600; }

/* ── Home: the two apps (iPhone, Mac) ───────────────────────────────── */

.products {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  max-width: 760px;
  margin: 8px auto 0;
  text-align: left;
}
.product {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px 6px;
  color: var(--text);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.product:hover { color: var(--text); background: var(--surface-strong); border-color: var(--rule); text-decoration: none; }
.product h2 { font-size: 1.2rem; margin-bottom: 0.35em; }
.product p:last-child { color: var(--text-soft); font-size: 0.97rem; }

/* Each app's own icon: iPhone (rounded square, like the Home Screen) and Mac. */
.product-icon { width: 56px; height: 56px; margin-bottom: 12px; }
.app-icon { width: 88px; height: 88px; margin: 0 auto 16px; }
.ios-icon { border-radius: 22.5%; box-shadow: 0 6px 18px var(--shadow); }

.app-section { margin-top: 112px; scroll-margin-top: 24px; }
.app-intro { text-align: center; max-width: 42rem; margin: 0 auto 40px; }
.app-intro .sub { color: var(--muted); margin-bottom: 1.6em; }

/* Until the Mac app is released (macReleased in pug/_site.pug). */
.badge-soon {
  display: inline-block;
  padding: 13px 20px;
  border: 1px dashed var(--rule);
  border-radius: 10px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
}
.badges { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px 16px; }

/* iPhone screenshots: a strip that scrolls sideways. */
.phone-gallery {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  margin: 0 -24px 40px;
  padding: 8px 24px 24px;
  scroll-padding-inline: 24px;
  scrollbar-width: thin;
}
.phone-gallery:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--radius); }
.phone-shot { flex: 0 0 auto; width: 230px; margin: 0; scroll-snap-align: start; }
.phone-shot img {
  border-radius: 28px;
  border: 1px solid var(--border);
  box-shadow: 0 18px 40px var(--shadow);
  background: #ffffff;
}
.phone-shot figcaption { text-align: center; color: var(--muted); font-size: 0.9rem; margin-top: 12px; }

/* ── Home: also-included grid ───────────────────────────────────────── */

.section { margin-top: 112px; scroll-margin-top: 24px; }
.section > h2 { text-align: center; margin-bottom: 1.2em; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.cards-4 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 22px 8px; }
.card h3 { margin-bottom: 0.4em; }
.card p { color: var(--text-soft); font-size: 0.97rem; }

.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }

.cta { text-align: center; margin-top: 112px; padding: 56px 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.cta h2 { margin-bottom: 0.3em; }
.cta p { color: var(--muted); }

/* ── Text pages (help, support, privacy, about…) ────────────────────── */

.prose {
  max-width: var(--prose);
  margin: 24px auto 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(24px, 5vw, 48px);
}
.prose h1 { font-size: clamp(1.9rem, 4vw, 2.4rem); }
.prose h2 { font-size: 1.4rem; margin-top: 1.8em; scroll-margin-top: 24px; }
.prose h3 { margin-top: 1.5em; scroll-margin-top: 24px; }
.prose ul,
.prose ol { padding-left: 1.4em; margin: 0 0 1.2em; }
.prose li { margin: 0.45em 0; }
.prose li::marker { color: var(--muted); }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.prose .badge-link { margin: 0.4em 0 0.6em; }
.prose .badges { justify-content: flex-start; }
.prose .note { color: var(--muted); font-size: 0.95rem; }

/* Help: the palace key */
.palace { border-collapse: collapse; margin: 0.5em 0 1.2em; }
.palace td { border: 1px solid var(--rule); padding: 0.45em 0.9em; text-align: center; font-size: 0.9em; }
.palace .big { font-size: 1.35em; font-weight: 700; }
.help-toc li { margin: 0.2em 0; }

/* ── Footer ─────────────────────────────────────────────────────────── */

.site-footer {
  width: 100%;
  max-width: var(--content);
  margin: 0 auto;
  padding: 28px 24px 40px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 24px;
  font-size: 0.9rem;
  color: var(--muted);
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }
.site-footer .copyright { margin: 0; }
.site-footer .copyright a { text-decoration: underline dotted; text-underline-offset: 0.2em; }

/* ── Small screens ──────────────────────────────────────────────────── */

@media (max-width: 820px) {
  .feature,
  .feature:nth-child(even) { grid-template-columns: 1fr; gap: 24px; }
  .feature:nth-child(even) .feature-text { order: 0; }
  .features { margin-top: 72px; gap: 72px; }
  .section, .cta, .app-section { margin-top: 80px; }
}

@media (max-width: 560px) {
  .phone-gallery { margin: 0 -16px 32px; padding: 8px 16px 20px; scroll-padding-inline: 16px; gap: 14px; }
  .phone-shot { width: 64vw; max-width: 240px; }
  .site-header { padding: 14px 16px; }
  .site-nav { gap: 4px 16px; }
  .page { padding: 4px 16px 48px; }
  .hero { padding-top: 24px; }
  .hero-icon { width: 88px; height: 88px; }
  .hero .shot { margin-top: 32px; }
  .site-footer { padding: 24px 16px 32px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
