/* ==========================================================================
   Stylesheet — KeyBeam product site
   System-font stack only. No external assets. Light + dark via
   prefers-color-scheme.
   ========================================================================== */

:root {
  /* Light palette (default) */
  --bg: #f7f7fb;
  --bg-elevated: #ffffff;
  --bg-muted: #eef0f6;
  --text: #16161d;
  --text-muted: #52525f;
  --text-faint: #7b7b8a;
  --border: #dfe1ea;
  --border-strong: #c3c6d6;
  --link: #4338ca;
  --link-hover: #312e81;
  --focus-ring: #2563eb;
  --code-bg: #eceefa;
  --callout-bg: #fff7e0;
  --callout-border: #e8b93a;
  --callout-text: #6b5406;
  --todo-bg: #ffe9e6;
  --todo-border: #e0685a;
  --todo-text: #7a2a20;
  --placeholder-bg: #fff1c2;
  --placeholder-text: #6b4e00;
  --placeholder-border: #d9a900;
  --card-shadow: 0 1px 2px rgba(20, 20, 30, 0.06), 0 8px 24px -12px rgba(20, 20, 30, 0.12);
  --table-stripe: #f2f3f9;

  /* Accent = cyan, matching the launcher icon glow */
  --accent: #0891b2;
  --accent-strong: #0e7490;
  --accent-soft: #e3f7fb;
  --accent-contrast: #ffffff;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101014;
    --bg-elevated: #17171e;
    --bg-muted: #1d1d26;
    --text: #eeeef4;
    --text-muted: #b6b6c4;
    --text-faint: #8a8a99;
    --border: #2c2c38;
    --border-strong: #3c3c4c;
    --link: #a5b4fc;
    --link-hover: #c7d2fe;
    --focus-ring: #93c5fd;
    --code-bg: #1f1f2b;
    --callout-bg: #2a230c;
    --callout-border: #b48a1f;
    --callout-text: #f1cf7e;
    --todo-bg: #2c1714;
    --todo-border: #b1493a;
    --todo-text: #f3a89a;
    --placeholder-bg: #332701;
    --placeholder-text: #f6d976;
    --placeholder-border: #a9820f;
    --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
    --table-stripe: #1b1b24;

    --accent: #22d3ee;
    --accent-strong: #67e8f9;
    --accent-soft: #12262b;

    color-scheme: dark;
  }
}

/* Explicit theme override (not currently toggled in UI, kept for completeness) */
:root[data-theme="dark"] {
  --bg: #101014;
  --bg-elevated: #17171e;
  --bg-muted: #1d1d26;
  --text: #eeeef4;
  --text-muted: #b6b6c4;
  --text-faint: #8a8a99;
  --border: #2c2c38;
  --border-strong: #3c3c4c;
  --link: #a5b4fc;
  --link-hover: #c7d2fe;
  --focus-ring: #93c5fd;
  --code-bg: #1f1f2b;
  --callout-bg: #2a230c;
  --callout-border: #b48a1f;
  --callout-text: #f1cf7e;
  --todo-bg: #2c1714;
  --todo-border: #b1493a;
  --todo-text: #f3a89a;
  --placeholder-bg: #332701;
  --placeholder-text: #f6d976;
  --placeholder-border: #a9820f;
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  --table-stripe: #1b1b24;
  --accent: #22d3ee;
  --accent-strong: #67e8f9;
  --accent-soft: #12262b;
  color-scheme: dark;
}

/* ---------- Reset & base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.55;
  overflow-x: hidden;
}

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

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

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 4px;
}

h1,
h2,
h3,
h4 {
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.01em;
}

p {
  color: var(--text-muted);
}

code {
  background: var(--code-bg);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.92em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 0.6rem 1rem;
  border-radius: 6px;
  z-index: 100;
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: 1rem;
}

/* ---------- Layout shell ---------- */
.wrap {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

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

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}
.brand:hover {
  color: var(--text);
}
.brand img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.site-nav {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  font-size: 0.95rem;
}
.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
}
.site-nav a:hover {
  color: var(--accent);
}

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  padding: 2.5rem 0 3rem;
  color: var(--text-faint);
  font-size: 0.9rem;
}
.site-footer .wrap {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
}
.footer-links a {
  color: var(--text-muted);
}

/* ---------- Hero ---------- */
.hero {
  padding: 3.5rem 0 3rem;
}
.hero .wrap {
  display: flex;
  align-items: center;
  gap: 2.5rem;
  flex-wrap: wrap;
}
.hero-copy {
  flex: 1 1 26rem;
  min-width: 0;
}
.hero-icon {
  flex: 0 0 auto;
}
.hero-icon img {
  width: 128px;
  height: 128px;
  border-radius: 26px;
  box-shadow: var(--card-shadow);
}
.eyebrow {
  display: inline-block;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  margin-bottom: 0.9rem;
}
.hero h1 {
  font-size: clamp(1.9rem, 4.5vw, 2.9rem);
  margin: 0 0 0.7rem;
}
.hero .lede {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 42rem;
  margin: 0 0 1.6rem;
}
.hero-actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.3rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.98rem;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}
.btn-primary:hover {
  background: var(--accent-strong);
  color: var(--accent-contrast);
}
.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.btn[data-todo] {
  position: relative;
}

/* ---------- Sections ---------- */
section {
  padding: 2.5rem 0;
}
.section-heading {
  max-width: 42rem;
  margin: 0 0 2rem;
}
.section-heading h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin: 0 0 0.5rem;
}
.section-heading p {
  margin: 0;
}

/* ---------- Feature cards ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.1rem;
}
.feature-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.4rem;
  box-shadow: var(--card-shadow);
}
.feature-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  color: var(--text);
}
.feature-card p {
  margin: 0;
  font-size: 0.95rem;
}
.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
  margin-bottom: 0.8rem;
}

/* ---------- How it works ---------- */
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1.1rem;
}
.steps li {
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.3rem;
}
.steps .step-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.7rem;
}
.steps h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}
.steps p {
  margin: 0;
  font-size: 0.92rem;
}

.requirements {
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.4rem 1.6rem;
}
.requirements h2 {
  margin-top: 0;
  font-size: 1.2rem;
}
.requirements ul {
  margin: 0.6rem 0 0;
  padding-left: 1.2rem;
}
.requirements li {
  margin-bottom: 0.35rem;
}

/* ---------- Pro-feature callout ---------- */
.pro-note {
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  font-size: 0.92rem;
  color: var(--text-muted);
  background: var(--bg-elevated);
}

/* ---------- Placeholder + TODO markers ---------- */
.placeholder {
  background: var(--placeholder-bg);
  color: var(--placeholder-text);
  border: 1px solid var(--placeholder-border);
  border-radius: 4px;
  padding: 0.05em 0.4em;
  font-size: 0.94em;
  font-weight: 600;
  white-space: nowrap;
}

[data-todo] {
  outline: 2px dashed var(--placeholder-border);
  outline-offset: 3px;
}

/* ---------- Legal document layout ---------- */
.legal-page {
  padding-bottom: 4rem;
}
.legal-top-bar {
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.legal-top-bar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1.25rem;
  flex-wrap: wrap;
  font-size: 0.92rem;
}
.back-to-app {
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.legal-header {
  padding: 2.2rem 0 1rem;
}
.legal-header h1 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  margin: 0 0 0.4rem;
}
.legal-meta {
  color: var(--text-faint);
  font-size: 0.92rem;
}

.legal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2.5rem;
}
@media (min-width: 64rem) {
  .legal-layout {
    grid-template-columns: 16rem minmax(0, 1fr);
    align-items: start;
  }
}

.toc {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.3rem;
  font-size: 0.9rem;
}
@media (min-width: 64rem) {
  .toc {
    position: sticky;
    top: 4.5rem;
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
  }
}
.toc h2 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  margin: 0 0 0.6rem;
}
.toc ol {
  margin: 0;
  padding-left: 0;
  list-style: none;
}
.toc li {
  margin-bottom: 0.4rem;
}
.toc a {
  text-decoration: none;
  color: var(--text-muted);
}
.toc a:hover {
  color: var(--accent);
}

.legal-content {
  max-width: 70ch;
  min-width: 0;
}
.legal-content h2 {
  font-size: 1.35rem;
  margin: 2.2rem 0 0.8rem;
  scroll-margin-top: 4.5rem;
}
.legal-content h3 {
  font-size: 1.1rem;
  margin: 1.6rem 0 0.6rem;
  scroll-margin-top: 4.5rem;
}
.legal-content p,
.legal-content li {
  color: var(--text-muted);
}
.legal-content p {
  margin: 0 0 1rem;
}
.legal-content ul,
.legal-content ol {
  margin: 0 0 1rem;
  padding-left: 1.3rem;
}
.legal-content li {
  margin-bottom: 0.4rem;
}
.legal-content strong {
  color: var(--text);
}

.callout {
  border-left: 4px solid var(--callout-border);
  background: var(--callout-bg);
  color: var(--callout-text);
  padding: 0.9rem 1.1rem;
  border-radius: 6px;
  margin: 0 0 1.3rem;
  font-size: 0.95rem;
}
.callout p {
  color: inherit;
  margin: 0;
}
.callout p + p {
  margin-top: 0.6rem;
}
.callout-todo {
  border-left-color: var(--todo-border);
  background: var(--todo-bg);
  color: var(--todo-text);
}

.table-scroll {
  overflow-x: auto;
  margin: 0 0 1.3rem;
  border: 1px solid var(--border);
  border-radius: 10px;
}
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 34rem;
  font-size: 0.9rem;
}
.table-scroll table {
  margin: 0;
  border: none;
  border-radius: 0;
}
th,
td {
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
thead th {
  background: var(--bg-muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-faint);
  white-space: nowrap;
}
tbody tr:nth-child(even) {
  background: var(--table-stripe);
}

.legal-address {
  font-style: normal;
  color: var(--text-muted);
}

@media (max-width: 26rem) {
  .hero-icon img {
    width: 96px;
    height: 96px;
  }
}

/* ---------- Legal document: language picker, headline, summary ---------- */
.legal-page main {
  padding-top: 2.2rem;
}
.lang-picker {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
}
.legal-content h1 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  margin: 0 0 0.6rem;
  scroll-margin-top: 4.5rem;
}
.legal-content h1 + p {
  color: var(--text-faint);
  font-size: 0.92rem;
}
.legal-loading {
  color: var(--text-faint);
}
.summary-box {
  margin-top: 2.5rem;
  padding: 1.2rem 1.4rem;
  background: var(--bg-elevated);
  border: 1px dashed var(--border);
  border-radius: 12px;
}
.summary-box h3 {
  margin: 0 0 0.8rem;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.summary-box p {
  margin: 0 0 0.5rem;
}
.summary-box p:last-child {
  margin-bottom: 0;
}
