/* The leafen.org pages, in Leafen's own colors (Notion's), light and dark by
   the system's choice. Every page has the same top bar and footer. The home
   page leads with one download button for the visitor's computer (the other
   downloads behind ▾, as GitHub Desktop's page) and the product window under
   it, or "coming soon" in the button's place before the first release; the
   privacy page is one column of text. */
:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --text: #37352f;
  --muted: rgba(55, 53, 47, 0.65);
  --faint: rgba(55, 53, 47, 0.5);
  --line: rgba(55, 53, 47, 0.09);
  --soft: #f7f6f3;
  --accent: #2383e2;
  --accent-hover: #0077d4;
  --on-accent: #ffffff;
  --link: #2383e2;
  --focus: rgba(35, 131, 226, 0.57);
  --card: #ffffff;
  --card-line: rgba(55, 53, 47, 0.13);
  --pick-tint: rgba(35, 131, 226, 0.08);
  --ground-a: #f7f6f3;
  --ground-b: #ffffff;
  --dot: rgba(55, 53, 47, 0.07);
  --shadow: 0 1px 2px rgba(15, 15, 15, 0.05), 0 24px 48px -16px rgba(15, 15, 15, 0.22);
  --card-shadow: 0 1px 2px rgba(15, 15, 15, 0.04), 0 6px 16px -8px rgba(15, 15, 15, 0.14);
  --wide: 1080px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", Helvetica,
    "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", "Apple Color Emoji", Arial, sans-serif;
  --mono: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* The one dark block (serve.mjs's ?scheme= preview unwraps or drops it). */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191919;
    --text: rgba(255, 255, 255, 0.81);
    --muted: rgba(255, 255, 255, 0.52);
    --faint: rgba(255, 255, 255, 0.4);
    --line: rgba(255, 255, 255, 0.094);
    --soft: #202020;
    --accent-hover: #3b91e6;
    --link: #529cca;
    --card: #202020;
    --card-line: rgba(255, 255, 255, 0.12);
    --pick-tint: rgba(82, 156, 202, 0.14);
    --ground-a: #1f1f1f;
    --ground-b: #191919;
    --dot: rgba(255, 255, 255, 0.05);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 24px 48px -16px rgba(0, 0, 0, 0.7);
    --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 6px 16px -8px rgba(0, 0, 0, 0.6);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

/* The page carries both languages; the one not chosen is hidden. */
html[lang="ko"] body [lang="en"]:not([data-set-lang]),
html[lang="en"] body [lang="ko"]:not([data-set-lang]) {
  display: none;
}

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

code { font-family: var(--mono); font-size: 0.875em; }

h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.01em;
  word-break: keep-all;
}

h2 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 600;
}

main { flex: 1; width: 100%; }

/* Side room, kept clear of a phone's rounded corners and notch. */
.gutter {
  padding-inline-start: max(16px, env(safe-area-inset-left, 0px));
  padding-inline-end: max(16px, env(safe-area-inset-right, 0px));
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Top bar: the name, the docs and GitHub, the language. */
.top-in {
  max-width: var(--wide);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding-block: 12px;
}

/* The name pushes the rest to the far side, with or without the links
   (a page before the first release, or without the documentation, has
   none). */
.brand { display: flex; align-items: center; gap: 8px; margin-inline-end: auto; color: var(--text); font-size: 15px; font-weight: 600; }
.brand:hover { text-decoration: none; }
.brand img { width: 24px; height: 24px; border-radius: 6px; }

.links-top { display: flex; gap: 2px; }
.links-top a { padding: 4px 8px; border-radius: 6px; color: var(--muted); font-size: 14px; }
.links-top a:hover { background: var(--line); color: var(--text); text-decoration: none; }

.langs { display: flex; gap: 2px; }

.langs button {
  appearance: none;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.langs button:hover { background: var(--line); }
.langs button[aria-pressed="true"] { color: var(--text); font-weight: 600; }

/* Home: the name and the button on the paper tone of a Notion page with a
   faint dot grid, ending in the product window. */
.hero {
  padding-block: 40px 0;
  background:
    radial-gradient(var(--dot) 1px, transparent 1.2px) 0 0 / 22px 22px,
    linear-gradient(180deg, var(--ground-a), var(--ground-b) 78%);
  text-align: center;
}

.hero-in { max-width: var(--wide); margin: 0 auto; }

.mark {
  display: block;
  width: 60px;
  height: 60px;
  margin: 0 auto 18px;
  border-radius: 14px;
  box-shadow: var(--card-shadow);
}

.hero h1 { font-size: 46px; line-height: 1.18; letter-spacing: -0.025em; text-wrap: balance; }

.sub {
  max-width: 560px;
  margin: 14px auto 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
  word-break: keep-all;
}

/* One button for this computer; ▾ opens the other downloads. */
.get { margin-block-start: 32px; display: flex; flex-direction: column; align-items: center; gap: 12px; }

.split {
  position: relative;
  display: inline-flex;
  max-width: 100%;
  border-radius: 10px;
  box-shadow: var(--card-shadow);
}

.split .main {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 52px;
  padding-block: 8px;
  padding-inline: 24px 22px;
  border-start-start-radius: 10px;
  border-end-start-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
}

.split .main:hover { background: var(--accent-hover); text-decoration: none; }
.split .main:focus-visible, .more-btn:focus-visible { outline-offset: 3px; }
.split .label { min-width: 0; }
.split .chip { font-weight: 500; opacity: 0.85; white-space: nowrap; }

.split svg {
  flex: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.more-btn {
  appearance: none;
  flex: none;
  display: grid;
  place-items: center;
  width: 46px;
  border: 0;
  border-inline-start: 1px solid rgba(255, 255, 255, 0.3);
  border-start-end-radius: 10px;
  border-end-end-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
}

.more-btn:hover, .more-btn[aria-expanded="true"] { background: var(--accent-hover); }

.menu {
  position: absolute;
  inset-block-start: calc(100% + 6px);
  inset-inline-end: 0;
  z-index: 4;
  min-width: 250px;
  max-width: calc(100vw - 32px);
  padding: 6px;
  border: 1px solid var(--card-line);
  border-radius: 10px;
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: start;
}

.menu a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
}

.menu a:hover, .menu a:focus-visible { background: var(--line); text-decoration: none; }
.menu a > span { color: var(--muted); font-size: 13px; white-space: nowrap; }
.menu a.current { background: var(--pick-tint); }

/* Before the first release (index.html's "soon" part): "coming soon" in a
   pill where the button goes, a line under it. */
.soon { margin-block-start: 32px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.soon-pill { margin: 0; padding: 8px 16px; border: 1px solid rgba(127, 127, 127, 0.35); border-radius: 999px; font-weight: 600; }

.get-sub { margin: 0; color: var(--faint); font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.get-sub .line { display: block; }
.get-sub:lang(ko), .phone-note:lang(ko), .release:lang(ko) { word-break: keep-all; }

.phone-note { max-width: 520px; margin: 14px auto 0; color: var(--muted); font-size: 14px; line-height: 1.6; }

.release { margin-block-start: 20px; color: var(--faint); font-size: 13px; }
.release p { margin: 0; }
.release a { color: var(--muted); }

/* The product window, the page's one picture. */
.window {
  max-width: var(--wide);
  margin: 44px auto 0;
  border: 1px solid var(--card-line);
  border-block-end: 0;
  border-start-start-radius: 14px;
  border-start-end-radius: 14px;
  overflow: hidden;
  background: var(--card);
  box-shadow: var(--shadow);
}

.window-bar { display: flex; gap: 7px; padding: 11px 14px; border-block-end: 1px solid var(--line); background: var(--soft); }
.window-bar i { width: 11px; height: 11px; border-radius: 50%; background: var(--card-line); }
.window img { display: block; width: 100%; height: auto; }

/* A few words for the curious, and where to read more. */
.points {
  max-width: var(--wide);
  margin: 0 auto;
  padding-block: 44px 8px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
}

.point { min-width: 0; }
.point b { display: block; font-size: 15px; font-weight: 600; }
.point span { display: block; margin-block-start: 4px; color: var(--muted); font-size: 14px; line-height: 1.55; word-break: keep-all; }

.dock { padding-block: 32px 8px; }

.dock-in {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px;
  border: 1px solid var(--card-line);
  border-radius: 14px;
  background: var(--card);
}

.dock h2 { margin: 0 0 8px; font-size: 17px; }
.dock p { margin: 0 0 12px; color: var(--muted); font-size: 15px; line-height: 1.6; word-break: keep-all; }
.dock p.small { margin: 12px 0 0; font-size: 13px; }

.cmd {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding-block: 10px;
  padding-inline: 14px 10px;
  border-radius: 8px;
  background: var(--soft);
  border: 1px solid var(--line);
}

/* The command stays one line, scrolled inside its box when it is wider. */
.cmd code {
  flex: 1;
  min-width: 0;
  padding: 3px 0 6px;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre;
  overflow-x: auto;
}

.copy {
  appearance: none;
  flex: none;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 3px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.copy:hover { background: var(--line); }

.read-more {
  max-width: var(--wide);
  margin: 0 auto;
  padding-block: 16px 40px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 14px;
}

/* A page of text (privacy): sections apart by a line. */
.doc { max-width: 760px; margin: 0 auto; padding-block: 24px 48px; }
.doc h1 { margin: 16px 0 4px; }
.doc .small { margin: 0; color: var(--muted); font-size: 14px; }
.doc section { margin-block-start: 32px; padding-block-start: 20px; border-block-start: 1px solid var(--line); }
.doc p, .doc li { line-height: 1.65; }
.doc section p { margin: 0 0 12px; }
.doc ul { margin: 0; padding-inline-start: 20px; }
.doc li { margin-block-end: 10px; }
.doc :lang(ko) { word-break: keep-all; }
.doc code { font-size: 0.92em; overflow-wrap: anywhere; }

/* No such page (404). */
.lost { padding-block: 56px 72px; text-align: center; }
.lost p { margin: 16px 0 0; font-size: 15px; }

.foot {
  width: 100%;
  max-width: var(--wide);
  margin: 0 auto;
  padding-block: 24px 32px;
  border-block-start: 1px solid var(--line);
  color: var(--faint);
  font-size: 12px;
}

.foot .links { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 8px; font-size: 13px; }
.foot .links a { color: var(--muted); }
.foot .tm { margin: 0; line-height: 1.6; }
.foot .tm:lang(ko) { word-break: keep-all; }

@media (max-width: 900px) {
  .points { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .links-top { display: none; }
  .hero { padding-block-start: 28px; }
  .hero h1 { font-size: 30px; }
  .sub { font-size: 16px; }
  .split .main { padding-inline: 18px 16px; font-size: 16px; }
  .window { margin-block-start: 32px; border-start-start-radius: 10px; border-start-end-radius: 10px; }
  .window-bar { padding: 8px 10px; }
  .points { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .dock-in { padding: 18px; }
  .doc { padding-block-start: 8px; }
  h1 { font-size: 26px; }
}

@media (prefers-reduced-motion: no-preference) {
  .split .main, .more-btn, .links-top a, .menu a { transition: background-color 120ms ease, color 120ms ease; }
}
