/* Flowie website — one stylesheet.
   1. Tokens   2. Base   3. Toolbar   4. Controls   5. Surfaces   6. Home   7. Pages   8. Footer   9. Language */

/* 1. Tokens ------------------------------------------------------------------ */
:root {
  color-scheme: light dark;

  /* Type */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Spacing scale (4px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;
  --gutter: var(--space-4);

  /* Radii */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-pill: 999px;
  --radius-window: 12px;

  /* Colours — light */
  --bg: #f4f6f5;
  --bg-top: #fbfcfa;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --sunken: #ececf0;
  --text: #1d1d1f;
  --text-2: #515154;
  --text-3: #6e6e73;
  --hairline: rgba(0, 0, 0, .1);
  --hairline-strong: rgba(0, 0, 0, .16);
  --accent: #087c78;
  --accent-hover: #066561;
  --glow: rgba(24, 148, 128, .1);
  --toolbar: rgba(246, 246, 248, .78);
  --code-bg: rgba(0, 0, 0, .05);
  --fill: rgba(118, 118, 128, .12);

  /* Bevel: the 1px light edge along the top of raised surfaces */
  --bevel: inset 0 1px 0 rgba(255, 255, 255, .9);
  --bevel-soft: inset 0 1px 0 rgba(255, 255, 255, .6);

  /* Layered shadows */
  --shadow-1: 0 1px 1px rgba(0, 0, 0, .04), 0 1px 3px rgba(0, 0, 0, .06);
  --shadow-2: 0 1px 2px rgba(0, 0, 0, .05), 0 4px 12px rgba(0, 0, 0, .06), 0 12px 28px rgba(0, 0, 0, .05);
  --shadow-window: 0 0 0 .5px rgba(0, 0, 0, .18), 0 2px 4px rgba(0, 0, 0, .06), 0 12px 24px rgba(0, 0, 0, .1), 0 32px 64px rgba(0, 0, 0, .14);
  --shadow-icon: 0 2px 4px rgba(0, 0, 0, .1), 0 10px 24px rgba(0, 0, 0, .14);

  /* Glossy control (button, segmented control) */
  --control-top: #ffffff;
  --control-bottom: #f1f1f4;
  --control-edge: rgba(0, 0, 0, .14);
  --control-shadow: 0 .5px 1px rgba(0, 0, 0, .12), 0 1px 3px rgba(0, 0, 0, .06);
  --control-pressed: #e4e4e9;

  /* Feature tile tints (top, bottom) */
  --tint-blue: #4c9dff, #1a6cf0;
  --tint-purple: #b88cff, #7d4be0;
  --tint-green: #4cd97b, #20a64c;
  --tint-orange: #ffb340, #f27b0c;
  --tint-teal: #5bc8e6, #1c8fb8;
  --tint-indigo: #7f86ff, #4a4fd8;

  --ease: cubic-bezier(.25, .1, .25, 1);
  --max: 1160px;
  --max-narrow: 760px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161618;
    --bg-top: #202023;
    --surface: #232326;
    --surface-2: #29292d;
    --sunken: #1b1b1d;
    --text: #f5f5f7;
    --text-2: #c7c7cc;
    --text-3: #a1a1a6;
    --hairline: rgba(255, 255, 255, .1);
    --hairline-strong: rgba(255, 255, 255, .16);
    --accent: #4aa3ff;
    --accent-hover: #74b8ff;
    --glow: rgba(80, 130, 255, .18);
    --toolbar: rgba(30, 30, 33, .72);
    --code-bg: rgba(255, 255, 255, .08);
    --fill: rgba(118, 118, 128, .3);

    --bevel: inset 0 1px 0 rgba(255, 255, 255, .07);
    --bevel-soft: inset 0 1px 0 rgba(255, 255, 255, .05);

    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-2: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .3);
    --shadow-window: 0 0 0 1px rgba(255, 255, 255, .1), 0 2px 4px rgba(0, 0, 0, .3), 0 16px 32px rgba(0, 0, 0, .35), 0 40px 80px rgba(0, 0, 0, .45);
    --shadow-icon: 0 2px 4px rgba(0, 0, 0, .35), 0 12px 28px rgba(0, 0, 0, .45);

    --control-top: #4a4a4f;
    --control-bottom: #3a3a3e;
    --control-edge: rgba(0, 0, 0, .5);
    --control-shadow: 0 .5px 1px rgba(0, 0, 0, .4), 0 1px 3px rgba(0, 0, 0, .25);
    --control-pressed: #2c2c30;
  }
}

/* 2. Base -------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 72px;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg) linear-gradient(180deg, var(--bg-top) 0, var(--bg) 560px) no-repeat;
  color: var(--text);
  font: 17px/1.55 var(--font);
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

main { flex: 1; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 2px; }

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--text);
  letter-spacing: 0;
  line-height: 1.15;
  margin: 0;
}

code {
  font-family: var(--font-mono);
  font-size: .86em;
  background: var(--code-bg);
  border-radius: var(--radius-xs);
  padding: .1em .35em;
  overflow-wrap: anywhere;
}

b, strong { font-weight: 600; }

.container {
  width: 100%;
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.container.narrow { max-width: calc(var(--max-narrow) + 2 * var(--gutter)); }

.skip {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-2);
}
.skip:focus { top: var(--space-2); }

/* 3. Toolbar (a translucent macOS-style title bar) --------------------------- */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--toolbar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 .5px 0 var(--hairline-strong);
}

.toolbar-inner {
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: var(--space-2) var(--gutter);
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0;
}
.brand:hover { color: var(--text); text-decoration: none; }
.brand img { width: 28px; height: 28px; filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, .2)); }
.brand.small { font-size: 15px; }
.brand.small img { width: 20px; height: 20px; }

.nav-links {
  display: flex;
  gap: var(--space-5);
  margin-left: auto;
  font-size: 14px;
}
.nav-links a { color: var(--text-2); }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-links a[aria-current="page"] { color: var(--text); font-weight: 600; }

/* 4. Controls ---------------------------------------------------------------- */
/* Glossy push button: a soft vertical gradient, a light bevel and a hairline edge. */
.button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 40px;
  padding: 0 var(--space-5);
  border-radius: var(--radius-pill);
  border: .5px solid var(--control-edge);
  background: linear-gradient(180deg, var(--control-top), var(--control-bottom));
  box-shadow: var(--bevel), var(--control-shadow);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  transition: box-shadow .2s var(--ease), transform .2s var(--ease);
}
.button:hover {
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--bevel), var(--control-shadow), 0 4px 12px rgba(0, 0, 0, .08);
}
.button:active { background: var(--control-pressed); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .15); }
.button .chevron { font-size: 1.25em; line-height: 1; color: var(--text-3); margin-top: -1px; }

/* Segmented control (language) */
.segmented {
  display: inline-flex;
  flex: none;
  padding: 2px;
  border-radius: var(--radius-sm);
  background: var(--fill);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1), inset 0 0 0 .5px var(--hairline);
}
.segmented button {
  font: 500 13px/1 var(--font);
  color: var(--text-2);
  background: transparent;
  border: 0;
  border-radius: var(--radius-xs);
  padding: 6px 12px;
  min-width: 44px;
  min-height: 28px;
  cursor: pointer;
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] {
  color: var(--text);
  background: linear-gradient(180deg, var(--control-top), var(--control-bottom));
  box-shadow: var(--bevel), 0 0 0 .5px var(--control-edge), 0 1px 2px rgba(0, 0, 0, .12);
}
/* Without JavaScript the control can't do anything, so hide it. */
html:not(.lang-en):not(.lang-zh) .segmented { display: none; }

.badge { display: inline-block; line-height: 0; border-radius: var(--radius-sm); }
.badge:hover { text-decoration: none; }
.badge img { height: 48px; width: auto; }

/* 5. Surfaces ---------------------------------------------------------------- */
/* Card: raised paper with a top bevel and a layered shadow. */
.card {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border-radius: var(--radius-lg);
  box-shadow: var(--bevel), 0 0 0 .5px var(--hairline), var(--shadow-2);
}

/* Window: a screenshot that already has its own title bar and traffic lights;
   the frame supplies the corners, the edge and the window shadow. */
.window { margin: 0; }
.window img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-window);
  background: #fff;
  box-shadow: var(--shadow-window);
}
.window figcaption {
  margin-top: var(--space-3);
  text-align: center;
  font-size: 14px;
  color: var(--text-3);
}

/* 6. Home -------------------------------------------------------------------- */
.hero {
  position: relative;
  text-align: center;
  padding: var(--space-8) 0 var(--space-6);
}
.hero::before {
  content: none;
}
.app-icon {
  display: block;
  width: 78px;
  height: 78px;
  margin: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .12)) drop-shadow(0 14px 24px rgba(0, 0, 0, .16));
}
.hero-brand { display: flex; justify-content: center; align-items: center; gap: var(--space-4); }
.hero h1 {
  font-size: clamp(40px, 6vw, 60px);
  font-weight: 700;
  letter-spacing: 0;
}
.tagline {
  max-width: 700px;
  margin: var(--space-4) auto var(--space-6);
  font-size: 19px;
  line-height: 1.45;
  color: var(--text-2);
}
.cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: var(--space-4);
}

/* The desk the main window sits on */
.stage { padding: var(--space-4) 0 var(--space-8); }
.stage .window { max-width: 1080px; margin: 0 auto; }

.band { padding: var(--space-8) 0; }
.band + .band { border-top: .5px solid var(--hairline); }

.section-title {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  text-align: center;
  margin-bottom: var(--space-6);
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: var(--space-4);
}
.feature { padding: var(--space-5); border-radius: var(--radius-md); }
.feature h3 { font-size: 19px; font-weight: 600; margin: var(--space-4) 0 var(--space-2); }
.feature ul { margin: 0; padding: 0; list-style: none; color: var(--text-2); font-size: 15px; }
.feature li { position: relative; padding-left: var(--space-4); margin: var(--space-2) 0; }
.feature li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .62em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-3);
}

/* Icon tile: a little app-icon squircle with a gloss highlight */
.tile {
  --tint: var(--tint-blue);
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(180deg, var(--tint));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), inset 0 -1px 0 rgba(0, 0, 0, .12), 0 1px 2px rgba(0, 0, 0, .15), 0 4px 10px rgba(0, 0, 0, .1);
  overflow: hidden;
}
.tile::after {
  content: "";
  position: absolute;
  inset: 0 0 50% 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, 0));
}
.tile svg { position: relative; z-index: 1; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .15)); }
.tile-blue { --tint: var(--tint-blue); }
.tile-purple { --tint: var(--tint-purple); }
.tile-green { --tint: var(--tint-green); }
.tile-orange { --tint: var(--tint-orange); }
.tile-teal { --tint: var(--tint-teal); }
.tile-indigo { --tint: var(--tint-indigo); }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 500px), 1fr));
  gap: var(--space-8) var(--space-6);
}
.gallery .window img { border-radius: var(--radius-md); }

/* Support: a contact card and a grouped list, like a Settings pane */
.contact { padding: var(--space-5); margin: 0 0 var(--space-5); color: var(--text-2); }
.inset-list { margin: 0; padding: 0 var(--space-5); }
.inset-list .row { padding: var(--space-4) 0; }
.inset-list .row + .row { border-top: .5px solid var(--hairline-strong); }
.inset-list dt { font-weight: 600; }
.inset-list dd { margin: var(--space-1) 0 0; color: var(--text-2); }

/* 7. Pages (privacy, terms) -------------------------------------------------- */
.page-main { padding-top: var(--space-7); padding-bottom: var(--space-8); }

.paper {
  padding: var(--space-7) var(--space-7) var(--space-6);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border-radius: var(--radius-xl);
  box-shadow: var(--bevel), 0 0 0 .5px var(--hairline), var(--shadow-2);
}
.paper-mark {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  color: var(--text-3);
  font-weight: 500;
}
.paper-mark img { width: 48px; height: 48px; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .15)); }
.paper h1 { font-size: clamp(30px, 5vw, 40px); font-weight: 700; }
.paper .updated { margin: var(--space-2) 0 var(--space-5); color: var(--text-3); font-size: 15px; }
.paper .lead { font-size: 19px; color: var(--text); }
.paper p, .paper li { color: var(--text-2); }
.paper li b { color: var(--text); }
html:not(.lang-en):not(.lang-zh) .paper section + section {
  margin-top: var(--space-7);
  padding-top: var(--space-7);
  border-top: .5px solid var(--hairline-strong);
}
.terms { padding: 0; margin: var(--space-5) 0; list-style: none; }
.terms li {
  margin: 0 0 var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--code-bg);
  border-radius: var(--radius-md);
}
.contact-line { margin-top: var(--space-5); }

/* 8. Footer ------------------------------------------------------------------ */
.site-footer {
  border-top: .5px solid var(--hairline-strong);
  background: var(--sunken);
  font-size: 13px;
  color: var(--text-3);
}
.footer-inner {
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: var(--space-6) var(--gutter);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-5);
}
.footer-links { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); margin: 0; padding: 0; list-style: none; }
.footer-links a { color: var(--text-2); }
.copyright { margin: 0 0 0 auto; }
.trademark { flex-basis: 100%; margin: 0; font-size: 12px; }
/* The badge is Apple's artwork: no effects on it, and clear space of at least a quarter of its height. */
.badge { margin: var(--space-3); }

/* Narrow screens ------------------------------------------------------------- */
@media (max-width: 720px) {
  .toolbar-inner { flex-wrap: wrap; row-gap: var(--space-1); gap: var(--space-3); }
  .segmented { margin-left: auto; }
  .nav-links {
    order: 3;
    width: 100%;
    margin: 0;
    gap: var(--space-4);
    justify-content: space-between;
    font-size: 13px;
    padding: var(--space-1) 0 var(--space-1);
  }
  html { scroll-padding-top: 100px; }
  .hero { padding: var(--space-7) 0 var(--space-5); }
  .hero-brand { gap: var(--space-3); }
  .app-icon { width: 56px; height: 56px; }
  .hero h1 { font-size: 36px; }
  .tagline { font-size: 17px; margin-top: var(--space-3); }
  .stage { padding-bottom: var(--space-7); }
  .band { padding: var(--space-7) 0; }
  .window img { border-radius: var(--radius-sm); }
  .paper { padding: var(--space-6) var(--space-5) var(--space-5); border-radius: var(--radius-lg); }
  .terms li { padding: var(--space-3) var(--space-4); }
  .inset-list { padding: 0 var(--space-4); }
  .contact, .feature { padding: var(--space-4) var(--space-5) var(--space-5); }
  .copyright { margin-left: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* 9. Language ---------------------------------------------------------------- */
/* Without script both languages show; lang.js adds html.lang-en or html.lang-zh. */
html.lang-en [lang="zh-CN"]:not(html),
html.lang-zh [lang="en"]:not(html) { display: none; }
/* Both showing: separate paired labels ("Privacy Policy / 隐私政策"). */
html:not(.lang-en):not(.lang-zh) span[lang] + span[lang]::before { content: " / "; }
html:not(.lang-en):not(.lang-zh) .trademark span[lang] + span[lang]::before { content: " "; }
/* Both showing: space out the stacked hero blocks. */
html:not(.lang-en):not(.lang-zh) .hero-copy + .hero-copy,
html:not(.lang-en):not(.lang-zh) .stage [lang] + [lang],
html:not(.lang-en):not(.lang-zh) .band .container > [lang] + [lang] { margin-top: var(--space-8); }
