/* KhmerIME download page: paper, ink, one accent, one screen.
   Khmer text uses the self-hosted Kantumruy Pro (Khmer letters only, OFL);
   Latin text uses the visitor's system font. The demo videos are rendered with
   Codimate by scripts/web/demo/render_demo.py on the same paper colour. */

@font-face {
  font-family: "Kantumruy Pro";
  src: url("assets/fonts/KantumruyPro-Khmer.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+1780-17FF, U+19E0-19FF, U+200C-200D, U+25CC;
}

:root {
  --paper: #f6f4ef;
  --ink: #1b1a17;
  --muted: #6b665f;
  --rule: #dcd7cc;
  --accent: #b5441b;
  --sans: "Kantumruy Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 400 clamp(1rem, 0.85rem + 0.35vw, 1.125rem)/1.7 var(--sans);
  -webkit-text-size-adjust: 100%;
}

a {
  color: var(--accent);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

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

code {
  font-family: var(--mono);
  font-size: 0.85em;
  overflow-wrap: anywhere;
}

.wrap {
  width: 100%;
  max-width: 104rem;
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 3rem);
}

/* Bars ------------------------------------------------------------------- */

.topbar,
.footer {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding-block: 1rem;
  font-size: 0.9375rem;
  color: var(--muted);
}

.topbar {
  justify-content: space-between;
}

.wordmark {
  color: var(--ink);
  font-weight: 700;
}

.topbar a,
.footer a,
.footer summary {
  color: var(--muted);
}

/* One screen: copy on the left, demo on the right ----------------------- */

.stage {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(2rem, 4vw, 4.5rem);
  padding-block: clamp(0.5rem, 2dvh, 1.5rem);
}

h1 {
  margin: 0;
  font-size: clamp(1.9rem, min(3.8vw, 7dvh), 5rem);
  white-space: nowrap;
  font-weight: 700;
  line-height: 1.35;
}

.lead {
  margin: 1rem 0 0;
  max-width: 30em;
  color: var(--muted);
}

.cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-top: 1.5rem;
}

.button {
  padding: 0.7rem 1.4rem;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.button:hover {
  background: #9c3814;
}

.cta-note {
  color: var(--muted);
  font-size: 0.875rem;
}

.other-os {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.9rem;
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.other-os a[data-available="false"] {
  color: var(--muted);
}

/* Install --------------------------------------------------------------- */

.install {
  margin-top: 1.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9375rem;
}

.tabs {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.25rem;
  padding-bottom: 0.25rem;
}

.tab-ink {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 0;
  background: var(--accent);
  transition: transform 0.25s ease, width 0.25s ease;
}

.tabs a {
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

.tabs a[aria-current="true"] {
  color: var(--ink);
}

/* Without JavaScript the underline sits under the tab you jumped to. */
html:not(.js) .tabs a:target,
html:not(.js) .tab-ink {
  display: none;
}

/* All panels share one grid cell, so the slot is as tall as the tallest panel and
   switching tabs never moves anything. Without JavaScript they stack instead. */
.js .panels {
  display: grid;
}

.js .panel {
  grid-area: 1 / 1;
  transition: opacity 0.2s ease;
}

.js .panel.is-off {
  opacity: 0;
  visibility: hidden;
}

.panel ol {
  margin: 0.5rem 0 0;
  padding-left: 1.4rem;
}

.panel li {
  margin: 0.2rem 0;
}

.panel li::marker {
  color: var(--muted);
}

.soon {
  margin: 0.5rem 0 0;
  color: var(--muted);
}

details {
  color: var(--muted);
  font-size: 0.875rem;
}

.panel details {
  margin-top: 0.5rem;
}

summary {
  cursor: pointer;
}

details p {
  margin: 0.25rem 0 0;
}

/* Demo ------------------------------------------------------------------ */

.demo {
  margin: 0;
}

/* A fixed frame: the desktop and phone videos both fit inside it, so switching
   between them never moves the page. */
.demo {
  height: calc(100dvh - 11rem);
  position: relative;
}

.demo video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--paper);
}

/* Support popover in the footer ------------------------------------------ */

.footer .support {
  position: relative;
  font-size: inherit;
}

.support-pop {
  position: absolute;
  bottom: calc(100% + 0.75rem);
  left: 0;
  width: 18rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  background: #fffdf8;
  border: 1px solid var(--rule);
  border-radius: 8px;
  color: var(--ink);
  font-size: 0.875rem;
}

.support-pop img {
  flex: none;
  width: 96px;
  height: auto;
}

.support-pop p {
  margin: 0;
}

/* Narrow screens: one column, phone demo on top ------------------------- */

@media (max-width: 760px) {
  .stage {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .demo {
    order: -1;
    height: min(56dvh, 30rem);
  }


  .support-pop {
    left: auto;
    right: -6rem;
  }
}

[hidden] {
  display: none !important;
}

/* Until installers are public (site.config.json "downloads_enabled"), the download
   button is hidden and installer links read as plain text. */
.if-no-downloads {
  display: none;
}

[data-downloads="off"] .if-no-downloads {
  display: block;
}

[data-downloads="off"]:not(.store) .cta {
  display: none;
}

[data-downloads="off"] a[download] {
  color: inherit;
  text-decoration: none;
  pointer-events: none;
}
