/* ==========================================================================
   Kkindle — minimal monochrome landing page
   1 tokens · 2 base · 3 layout · 4 header · 5 hero · 6 features
   7 about · 8 downloads · 9 faq · 10 footer · 11 responsive
   ========================================================================== */

/* 1 · Tokens ============================================================== */

:root {
  /* Grayscale only — no accent hue anywhere. */
  --bg: #fbfbfa;
  --bg-sunken: #f3f3f1;
  --surface: #ffffff;
  --ink: #131313;
  --ink-2: #4a4a48;
  --muted: #797976;
  --line: #e3e3df;
  --line-2: #cfcfc9;

  /* Latin from a serif, CJK from the system UI face — both are local fonts,
     so the page ships with no webfont request. */
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei",
    "PingFang SC", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Iowan Old Style", Georgia, "Songti SC", "Source Han Serif SC",
    "Microsoft YaHei", serif;

  --fs-display: clamp(34px, 4.6vw, 58px);
  --fs-h2: clamp(26px, 3.2vw, 42px);
  --fs-h3: clamp(21px, 2.1vw, 28px);
  --fs-lead: 16px;
  --fs-body: 15px;
  --fs-meta: 12px;
  --fs-label: 11px;

  --wrap: 1160px;
  --pad: clamp(20px, 4.5vw, 40px);
  --section-y: clamp(72px, 9vw, 120px);
  --header-h: 64px;

  --ease: 160ms ease;
}

/* 2 · Base =============================================================== */

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

html {
  background: var(--bg);
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--sans);
  font-size: var(--fs-body);
  line-height: 1.7;
}

h1,
h2,
h3,
p,
ul,
figure {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

/* Weight 400 keeps the CJK face out of Bold, which reads much quieter at
   display sizes; the tracking stays mild so it does not cramp CJK glyphs. */
h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

h1 {
  font-size: var(--fs-display);
}

h2 {
  font-size: var(--fs-h2);
}

h3 {
  font-size: var(--fs-h3);
}

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

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--ease), opacity var(--ease);
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 60;
  padding: 10px 14px;
  color: var(--surface);
  background: var(--ink);
  font-size: var(--fs-meta);
  transform: translateY(-150%);
  transition: transform var(--ease);
}

.skip-link:focus-visible {
  transform: none;
}

/* 3 · Layout primitives ================================================== */

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--pad);
}

.section {
  padding-block: var(--section-y);
}

.section-head {
  max-width: 720px;
}

.section-head h2 {
  margin-block: 14px 18px;
}

/* Small caps label. Optionally prefixed with a hairline-separated number. */
.label {
  color: var(--muted);
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: 0.16em;
  line-height: 1.4;
  text-transform: uppercase;
}

.label-num {
  margin-right: 12px;
  padding-right: 12px;
  border-right: 1px solid var(--line-2);
}

.lead {
  max-width: 560px;
  color: var(--ink-2);
  font-size: var(--fs-lead);
  line-height: 1.85;
}

.body-copy {
  color: var(--ink-2);
  line-height: 1.85;
}

/* Hairline-separated inline list — the one separator idiom used site-wide. */
.inline-list {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  row-gap: 6px;
  color: var(--muted);
  font-size: var(--fs-meta);
}

.inline-list > * + * {
  margin-left: 14px;
  padding-left: 14px;
  border-left: 1px solid var(--line-2);
}

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-inline: 22px;
  border: 1px solid var(--ink);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: color var(--ease), background var(--ease), border-color var(--ease);
}

.button-primary {
  color: var(--surface);
  background: var(--ink);
}

.button-primary:hover,
.button-primary:focus-visible {
  color: var(--ink);
  background: transparent;
}

.button-quiet {
  color: var(--ink-2);
  border-color: var(--line-2);
}

.button-quiet:hover,
.button-quiet:focus-visible {
  color: var(--ink);
  border-color: var(--ink);
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-2);
  font-size: var(--fs-meta);
}

.link-arrow:hover,
.link-arrow:focus-visible {
  color: var(--ink);
}

.shot {
  border: 1px solid var(--line);
  background: var(--surface);
}

/* 4 · Header ============================================================= */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 32px;
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  color: var(--surface);
  background: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1;
}

.brand-name {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.main-nav {
  display: flex;
  gap: 26px;
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
}

.main-nav a:hover,
.main-nav a:focus-visible {
  color: var(--ink);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 13px;
}

.language-toggle {
  color: var(--muted);
  transition: color var(--ease);
}

.language-toggle:hover,
.language-toggle:focus-visible,
.header-github:hover,
.header-github:focus-visible {
  color: var(--ink);
}

.header-github {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
}

.menu-toggle {
  display: none;
  padding: 8px 0 8px 8px;
}

.menu-toggle span {
  display: block;
  width: 19px;
  height: 1px;
  background: var(--ink);
}

.menu-toggle span + span {
  margin-top: 5px;
}

/* 5 · Hero =============================================================== */

.hero {
  padding-block: clamp(64px, 8vw, 104px) clamp(48px, 6vw, 76px);
}

.hero-copy {
  max-width: 900px;
}

.hero h1 {
  max-width: 900px;
  margin-block: 18px 22px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 32px;
}

.hero-facts {
  margin-top: 30px;
}

.hero-facts li {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.fact-value {
  color: var(--ink);
  font-weight: 600;
}

.hero-shot {
  margin-top: clamp(48px, 6vw, 76px);
}

/* 6 · Signal strip + features ============================================ */

.strip {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.strip .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 28px;
  padding-block: 16px;
}

.features {
  display: flex;
  flex-direction: column;
  gap: clamp(64px, 8vw, 108px);
  margin-top: clamp(56px, 7vw, 92px);
}

.feature {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(32px, 6vw, 88px);
  align-items: center;
}

.feature-reverse .feature-shot {
  order: 2;
}

.feature-copy {
  max-width: 480px;
}

.feature-copy h3 {
  margin-block: 16px 14px;
}

.feature-copy .meta-list {
  margin-top: 20px;
}

/* 7 · About ============================================================== */

.about {
  border-top: 1px solid var(--line);
}

.about-points {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-top: clamp(40px, 5vw, 64px);
}

.about-points li {
  padding-top: 14px;
  border-top: 1px solid var(--line-2);
  color: var(--muted);
  font-size: var(--fs-meta);
}

.about-actions {
  margin-top: 32px;
}

/* 8 · Downloads ========================================================== */

.downloads {
  background: var(--bg-sunken);
}

.release-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  margin-top: clamp(40px, 5vw, 64px);
  padding-block: 18px;
  border-top: 1px solid var(--line-2);
  border-bottom: 1px solid var(--line-2);
}

.release-version {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px;
  margin-top: 6px;
}

#latest-version {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

#release-published {
  color: var(--muted);
  font-size: var(--fs-meta);
}

.platforms {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(28px, 4vw, 56px);
  margin-top: clamp(36px, 4vw, 52px);
}

.platform-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line-2);
  transition: border-color var(--ease);
}

/* The detected platform is marked with weight, not colour. */
.platform.is-recommended .platform-head {
  border-top-color: var(--ink);
}

.platform-head h3 {
  font-size: 24px;
}

.platform-badge {
  color: var(--muted);
  font-size: var(--fs-label);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.platform-note {
  margin-top: 8px;
  min-height: 3.4em;
  color: var(--muted);
  font-size: var(--fs-meta);
  line-height: 1.7;
}

.asset-list {
  margin-top: 12px;
}

.asset {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding-block: 13px;
  border-bottom: 1px solid var(--line);
}

.asset:first-child {
  border-top: 1px solid var(--line);
}

.asset-name {
  display: block;
  font-size: 14px;
}

.asset-meta {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-arrow {
  color: var(--muted);
  transition: color var(--ease), transform var(--ease);
}

.asset:hover .asset-arrow,
.asset:focus-visible .asset-arrow {
  color: var(--ink);
  transform: translateY(2px);
}

.asset:hover,
.asset:focus-visible {
  border-bottom-color: var(--ink);
}

/* Applied by app.js when a release does not ship a given asset. */
.disabled {
  opacity: 0.42;
}

.downloads-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-top: clamp(28px, 3vw, 40px);
}

.release-status {
  color: var(--muted);
  font-size: var(--fs-meta);
}

/* 9 · Changelog ========================================================== */

.changelog {
  border-top: 1px solid var(--line);
}

.changelog-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(32px, 7vw, 104px);
  align-items: start;
}

.changelog-full {
  margin-top: 26px;
}

.changelog-list {
  border-top: 1px solid var(--line-2);
}

.changelog-entry {
  padding-block: 24px 30px;
  border-bottom: 1px solid var(--line);
}

.changelog-entry.is-latest {
  padding-top: 18px;
}

.changelog-entry-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.changelog-entry-head .label {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 0;
}

.changelog-entry-head time {
  color: var(--muted);
  letter-spacing: 0.01em;
  text-transform: none;
}

.changelog-badge {
  color: var(--muted);
  font-size: var(--fs-label);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.changelog-entry h3 {
  margin-block: 16px 14px;
  font-size: 24px;
}

.changelog-points {
  border-top: 1px solid var(--line);
}

.changelog-points li {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 16px;
  padding-block: 10px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.75;
}

.changelog-type {
  color: var(--muted);
  font-size: var(--fs-label);
  letter-spacing: 0.08em;
  line-height: 1.75;
}

/* 10 · FAQ ================================================================ */

.faq-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(32px, 6vw, 88px);
  align-items: start;
}

.faq-list {
  border-top: 1px solid var(--line-2);
}

.faq-list details {
  border-bottom: 1px solid var(--line);
}

.faq-list summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding-block: 18px;
  list-style: none;
  cursor: pointer;
  font-size: var(--fs-lead);
  transition: color var(--ease);
}

.faq-list summary::-webkit-details-marker {
  display: none;
}

.faq-list summary::after {
  color: var(--muted);
  content: "+";
  font-size: 17px;
  font-weight: 300;
}

.faq-list summary:hover {
  color: var(--ink);
}

.faq-list details[open] summary::after {
  content: "\2212";
}

.faq-list details p {
  max-width: 620px;
  padding-bottom: 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.85;
}

/* 10 · Footer ============================================================ */

.site-footer {
  border-top: 1px solid var(--line);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px 32px;
  padding-block: 32px 14px;
}

.footer-brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.footer-brand strong {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
}

.footer-brand p {
  color: var(--muted);
  font-size: var(--fs-meta);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  color: var(--muted);
  font-size: var(--fs-meta);
}

.footer-links a:hover,
.footer-links a:focus-visible {
  color: var(--ink);
}

.footer-note {
  padding-bottom: 32px;
  color: #a3a39e;
  font-size: 11px;
}

.noscript-note {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 40;
  max-width: 340px;
  padding: 12px 14px;
  color: var(--surface);
  background: var(--ink);
  font-size: var(--fs-meta);
}

/* 11 · Responsive ======================================================== */

@media (max-width: 900px) {
  .feature,
  .faq-grid,
  .changelog-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }

  .feature-reverse .feature-shot {
    order: 0;
  }

  .feature-copy {
    max-width: none;
  }

  .platforms {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }

  .platform-note {
    min-height: 0;
  }
}

@media (max-width: 760px) {
  :root {
    --header-h: 56px;
  }

  .main-nav {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    display: none;
    flex-direction: column;
    gap: 0;
    padding: 4px var(--pad) 16px;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
  }

  .main-nav.is-open {
    display: flex;
  }

  .main-nav a {
    padding-block: 10px;
  }

  .menu-toggle {
    display: block;
  }

  .header-github {
    display: none;
  }

  .strip .wrap {
    justify-content: flex-start;
    gap: 8px 20px;
  }

  .about-points {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

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

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
