/*
 * site.css: shared styles for chaparlabs.com pages.
 * Imports nothing. Pages link assets/colors.css first, then this file.
 *
 * Theme: the default set below is light, and dark under
 * prefers-color-scheme: dark. A page can opt into the always-dark product
 * palette by adding class="product-katagong" to <body>; it re-sets the same
 * custom properties, so every shared component picks it up unchanged.
 */

@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter-latin.woff") format("woff");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- theme tokens ---------- */

:root {
  color-scheme: light;
  --bg: #FFFFFF;
  --card: #F4F7FB;
  --text: var(--chapar-lapis);      /* #1E3A8A, 10:1 on white */
  --muted: #4B5A75;                 /* 6.9:1 on white */
  --rule: #D5DCE8;
  --link: var(--chapar-lapis);      /* firuza is too light for text on white */
  --accent: var(--chapar-lapis);    /* button fill */
  --on-accent: #FFFFFF;             /* text on the button fill */
  --good: #1E7A4C;                  /* small "free" line, 5.3:1 on white */
  --focus: var(--chapar-lapis);     /* focus ring, 3:1 or better */
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: var(--chapar-ink-dark);   /* #0F1B33 */
    --card: #16243F;
    --text: var(--chapar-on-dark);  /* #E8F6F5 */
    --muted: #A9BDD0;
    --rule: #2A3B5C;
    --link: var(--chapar-firuza);   /* 5.6:1 on #0F1B33 */
    --accent: var(--chapar-firuza);
    --on-accent: var(--chapar-ink-dark);
    --good: #5CD68F;                /* brand green middle tablet, 9.4:1 */
    --focus: var(--chapar-saffron);
  }
}

/* KataGong's own dark palette. Always dark, in both OS modes. */
body.product-katagong {
  color-scheme: dark;
  --bg: #15131f;
  --card: #1e1b2e;
  --rule: #2c2842;
  --text: #f2eef8;
  --muted: #a39dba;
  --link: #ffb454;
  --accent: #ffb454;
  --on-accent: #15131f;
  --good: #64d89a;
  --focus: #ffb454;
}

/* ---------- base ---------- */

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  overflow-wrap: break-word;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

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

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 12px;
  font-weight: 650;
  color: var(--text);
}

h1 {
  font-size: clamp(2rem, 1.5rem + 2.2vw, 3rem);
  letter-spacing: -0.015em;
  margin-bottom: 16px;
}

h2 {
  font-size: clamp(1.5rem, 1.25rem + 1vw, 2rem);
}

h3 {
  font-size: 1.125rem;
  margin-bottom: 8px;
}

p {
  margin: 0 0 16px;
  max-width: 65ch;
}

ul,
ol {
  margin: 0 0 16px;
  padding-left: 1.25rem;
  max-width: 65ch;
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

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

.wrap {
  max-width: 1080px;
  margin-inline: auto;
  padding-inline: 16px;
  width: 100%;
}

@media (min-width: 720px) {
  .wrap {
    padding-inline: 32px;
  }
}

.list-reset {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: none;
}

.lead {
  font-size: 1.125rem;
  color: var(--text);
}

.fineprint {
  color: var(--good);
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0;
}

.muted {
  color: var(--muted);
}

/* ---------- skip link ---------- */

.skip-link {
  position: absolute;
  top: 8px;
  left: 16px;
  z-index: 10;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}

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

/* ---------- header and footer ---------- */

.site-header {
  border-bottom: 1px solid var(--rule);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding-block: 16px;
}

.lockup {
  height: 32px;
  width: auto;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: none;
}

.site-nav a {
  text-decoration: none;
}

.site-nav a:hover {
  text-decoration: underline;
}

.site-footer {
  margin-top: 48px;
  border-top: 1px solid var(--rule);
  padding-block: 32px;
  color: var(--muted);
  font-size: 0.95rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  max-width: none;
}

.site-footer a {
  color: var(--link);
}

.copyright {
  margin: 0;
}

/* ---------- sections ---------- */

.section {
  padding-block: 48px;
  border-top: 1px solid var(--rule);
}

.intro {
  padding-block: 56px 8px;
}

.hero {
  display: grid;
  gap: 32px;
  align-items: center;
  padding-block: 40px 48px;
}

@media (min-width: 760px) {
  .hero {
    grid-template-columns: minmax(0, 1fr) minmax(0, 380px);
    gap: 48px;
  }
}

.hero-shot {
  margin: 0;
}

.hero-shot img {
  max-width: min(100%, 360px);
  margin-inline: auto;
  border: 1px solid var(--rule);
  border-radius: 16px;
}

.product-id {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.product-id img {
  width: 64px;
  height: auto;
  border-radius: 14px;
}

.product-name {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 650;
}

.demo {
  margin: 0 0 48px;
  padding-top: 0;
}

.demo video {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--rule);
}

/* ---------- buttons ---------- */

.btn {
  display: inline-block;
  max-width: 100%;
  padding: 14px 24px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.btn:hover {
  text-decoration: underline;
}

/* ---------- cards ---------- */

.card-grid {
  display: grid;
  gap: 20px;
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: none;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 560px) {
  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  padding: 20px;
  border: 1px solid var(--rule);
  border-radius: 16px;
  background: var(--card);
  color: var(--text);
  text-decoration: none;
}

a.card:hover {
  border-color: var(--link);
}

.card img {
  width: 120px;
  height: auto;
  border-radius: 16px;
}

.card h3 {
  margin: 0;
}

.card p {
  margin: 0;
  max-width: none;
  color: var(--muted);
}

/* ---------- screenshots ---------- */

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

@media (min-width: 640px) {
  .shots {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.shot {
  margin: 0;
}

.shot img {
  border: 1px solid var(--rule);
  border-radius: 12px;
}

.shot figcaption {
  margin-top: 12px;
  max-width: 65ch;
}

.shot-title {
  display: block;
  font-weight: 650;
  font-size: 1.125rem;
  margin-bottom: 4px;
}

/* A lone product card fills the row; a second card brings the normal grid back. */
@media (min-width: 560px) {
  .card-grid > li:only-child {
    grid-column: 1 / -1;
  }

  .card-grid > li:only-child > .card {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    column-gap: 28px;
    padding: 28px;
  }

  .card-grid > li:only-child > .card > img {
    grid-row: 1 / 3;
    width: 160px;
  }

  .card-grid > li:only-child > .card > h3 {
    align-self: end;
    font-size: 1.5rem;
  }
}

/* ---------- product-specific helpers ---------- */

.store-cta {
  text-align: left;
}
