/* Crystor · crystor.com
   Single stylesheet, no frameworks, no external assets. */

:root {
  --bg: #0b0e14;
  --bg-raised: #11151f;
  --bg-inset: #0e1219;
  --border: #1f2733;
  --border-strong: #2c3646;
  --text: #d7dde6;
  --text-dim: #8b95a5;
  --text-faint: #5c6674;
  --accent: #4fd1c5;
  --accent-dim: #2c7a73;
  --btn-text: #06231f;
  --danger: #e5484d;
  --header-bg: rgba(11, 14, 20, 0.88);
  --max: 60rem;
  --radius: 8px;
  font-size: 100%;
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f6f8fa;
  --bg-raised: #ffffff;
  --bg-inset: #eceff3;
  --border: #d9dfe7;
  --border-strong: #c4cdd8;
  --text: #1c2530;
  --text-dim: #4d5a6b;
  --text-faint: #8a94a3;
  --accent: #0c7a70;
  --accent-dim: #7fc9c1;
  --btn-text: #ffffff;
  --header-bg: rgba(246, 248, 250, 0.9);
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

code, .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", monospace;
  font-size: 0.9em;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---------- header ---------- */

header.site {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--header-bg);
  backdrop-filter: blur(8px);
  z-index: 10;
}

header.site > .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0.02em;
  font-size: 1.05rem;
}
.brand:hover { text-decoration: none; }
.brand svg { display: block; }

.brand-mark {
  display: inline-block;
  width: 22px;
  height: 22px;
  flex: none;
  background: var(--accent);
  -webkit-mask: url("/assets/crystor-mark.svg") no-repeat center / contain;
  mask: url("/assets/crystor-mark.svg") no-repeat center / contain;
}

.theme-toggle {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0.2rem;
  margin-left: 1.4rem;
  vertical-align: middle;
  line-height: 0;
}
.theme-toggle:hover { color: var(--text); }
.theme-toggle .icon-moon { display: none; }
html[data-theme="light"] .theme-toggle .icon-moon { display: inline; }
html[data-theme="light"] .theme-toggle .icon-sun { display: none; }

nav.top a {
  color: var(--text-dim);
  margin-left: 1.4rem;
  font-size: 0.9rem;
}
nav.top a:hover { color: var(--text); text-decoration: none; }
nav.top a.cta {
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius);
}
nav.top a.cta:hover { border-color: var(--accent); }
nav.top a.gh { vertical-align: middle; }
nav.top a.gh svg { display: inline-block; vertical-align: -0.25em; }

/* ---------- mega menu ---------- */

nav.top .menu-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0;
}
nav.top .menu-btn:hover,
nav.top .menu-btn[aria-expanded="true"] { color: var(--text); }
nav.top .menu-btn .caret { font-size: 0.7em; }

.mega {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
}

.mega-inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  padding-top: 1.5rem;
  padding-bottom: 1.75rem;
}

.mega-col h4 {
  color: var(--text-faint);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}

.mega-col a {
  display: block;
  color: var(--text-dim);
  font-size: 0.9rem;
  padding: 0.28rem 0;
}
.mega-col a:hover { color: var(--accent); text-decoration: none; }

/* ---------- hero ---------- */

.hero {
  padding: 5.5rem 0 4rem;
  text-align: left;
}

.kicker {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.hero h1 {
  font-size: clamp(2rem, 5.5vw, 3.4rem);
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.02em;
  max-width: 46rem;
}

.hero .hero-em {
  margin-top: 0.9rem;
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  line-height: 1.25;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--accent);
  max-width: 46rem;
}

.hero p.sub {
  margin-top: 1.2rem;
  font-size: 1.12rem;
  color: var(--text-dim);
  max-width: 40rem;
}
.hero h1 + p.sub { margin-top: 1.6rem; }

.hero .usecases {
  margin-top: 1.2rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95rem;
  line-height: 2;
}
.hero .usecases p {
  color: var(--text);
  padding-left: 2ch;   /* hanging indent: wrapped lines align under the text */
  text-indent: -2ch;
}
.hero .usecases p::first-letter { color: var(--accent); }

.hero .actions {
  margin-top: 2.2rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.hero .note {
  font-size: 0.85rem;
  color: var(--text-faint);
}

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

section { padding: 3.5rem 0; border-top: 1px solid var(--border); }

h2 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
}

.section-lede {
  color: var(--text-dim);
  max-width: 42rem;
  margin-bottom: 2rem;
}

/* ---------- how it works steps ---------- */

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }

.step {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
}

.step .num {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  margin-bottom: 0.6rem;
}

.step h3 { font-size: 1.05rem; margin-bottom: 0.45rem; }
.step p { font-size: 0.92rem; color: var(--text-dim); }

/* ---------- log sample (terminal-window chrome) ---------- */

.logwin {
  margin-top: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-inset);
}

.logwin-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.9rem;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
}

.logwin-bar .dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex: none;
}
.dot-close { background: #f2555a; }
.dot-min { background: #f5b942; }
.dot-max { background: #57c25b; }

.logwin-bar .logwin-title {
  margin-left: 0.5rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  color: var(--text-faint);
}

.log {
  padding: 1rem 1.2rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  color: var(--text-dim);
  overflow-x: auto;
  white-space: pre;
  line-height: 1.7;
}
.log .t { color: var(--text-faint); }
.log .ok { color: var(--accent); }

/* ---------- layers ---------- */

.layers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }

.layer {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
}
.layer h3 { font-size: 1.05rem; margin-bottom: 0.45rem; }
.layer h3 span { color: var(--text-faint); font-weight: 400; }
.layer p { font-size: 0.92rem; color: var(--text-dim); }

/* ---------- honest limits ---------- */

.limits {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-dim);
  border-radius: var(--radius);
  padding: 1.4rem 1.6rem;
  max-width: 46rem;
}
.limits ul { margin: 0.8rem 0 0 1.1rem; }
.limits li { margin-bottom: 0.7rem; color: var(--text-dim); font-size: 0.95rem; }
.limits li strong { color: var(--text); }

/* ---------- who it's for ---------- */

.audience { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.audience .card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
}
.audience h3 { font-size: 1rem; margin-bottom: 0.4rem; }
.audience p { font-size: 0.92rem; color: var(--text-dim); }

/* ---------- install commands ---------- */

.install-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  max-width: 100%;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.55rem 0.9rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92rem;
  color: var(--text);
}
.install-pill code {
  font-family: inherit;
  overflow-x: auto;
  white-space: nowrap;
}
.install-pill code::before { content: "$ "; color: var(--accent); }

.copy-btn {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 0.15rem;
  line-height: 0;
  flex: none;
}
.copy-btn:hover { color: var(--text); }
.copy-btn.copied { color: var(--accent); }
.copy-btn .ic-check { display: none; }
.copy-btn.copied .ic-check { display: inline; }
.copy-btn.copied .ic-copy { display: none; }

.hero .install-pill { margin-top: 1.8rem; }
.hero .install-pill + .actions { margin-top: 1rem; }

.pm-switch {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin: 1.5rem 0 0.8rem;
}
.pm-tab {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  padding: 0.3rem 0.8rem;
  cursor: pointer;
}
.pm-tab:hover { color: var(--text); }
.pm-tab.active { color: var(--accent); border-color: var(--accent-dim); }

.pm-note {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-faint);
  min-height: 1.2em;
}

.term { margin-top: 1.5rem; }
.logwin-bar .copy-btn { margin-left: auto; }

/* ---------- download ---------- */

a.button-primary {
  background: var(--accent);
  color: var(--btn-text);
  border: none;
  border-radius: var(--radius);
  padding: 0.7rem 1.3rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: inline-block;
}
a.button-primary:hover {
  filter: brightness(1.1);
  text-decoration: none;
}

a.button-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem 1.3rem;
  font-size: 1rem;
  font-weight: 600;
}
a.button-ghost:hover {
  border-color: var(--accent-dim);
  text-decoration: none;
}
a.button-ghost svg { flex: none; }

.dl {
  margin-top: 1.6rem;
  display: flex;
  gap: 0.8rem;
  align-items: center;
  flex-wrap: wrap;
}

.dl-alt {
  margin-top: 1rem;
  font-size: 0.92rem;
  color: var(--text-dim);
}

.dl-note {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-faint);
  max-width: 32rem;
}

/* ---------- mega footer ---------- */

footer.site {
  border-top: 1px solid var(--border);
  padding: 3rem 0 2rem;
  font-size: 0.85rem;
  color: var(--text-faint);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(4, 1fr);
  gap: 2rem;
  padding-bottom: 2.25rem;
}

.f-brand .brand { margin-bottom: 0.7rem; }
.f-brand p { max-width: 15rem; line-height: 1.5; }

.f-col h4 {
  color: var(--text-faint);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}
.f-col h4 + h4,
.f-col a + h4 { margin-top: 1.2rem; }

.f-col a {
  display: block;
  color: var(--text-dim);
  padding: 0.18rem 0;
}
.f-col a:hover { color: var(--text); text-decoration: none; }

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 1.4rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.footer-bottom a { color: var(--text-dim); }
.footer-bottom a:hover { color: var(--text); }

/* ---------- legal pages ---------- */

main.legal { padding: 3.5rem 0 4rem; }
main.legal h1 { font-size: 1.9rem; margin-bottom: 0.4rem; letter-spacing: -0.01em; }
main.legal .updated { color: var(--text-faint); font-size: 0.85rem; margin-bottom: 2rem; }
main.legal h2 { font-size: 1.15rem; margin: 2rem 0 0.6rem; }
main.legal p, main.legal li { color: var(--text-dim); max-width: 44rem; }
main.legal p { margin-bottom: 0.9rem; }
main.legal ul { margin: 0 0 0.9rem 1.2rem; }
main.legal li { margin-bottom: 0.4rem; }

/* ---------- responsive ---------- */

@media (max-width: 46rem) {
  .steps, .layers, .audience { grid-template-columns: 1fr; }
  .hero { padding: 3.5rem 0 3rem; }
  nav.top a { margin-left: 0.9rem; }
  /* keep the sticky header to one row on phones:
     nav collapses to Solutions + theme toggle + Download */
  nav.top a:not(.cta) { display: none; }
  .theme-toggle { margin-left: 0.7rem; }
  nav.top a.cta { margin-left: 0.7rem; padding: 0.3rem 0.55rem; }
  .mega { max-height: 70vh; overflow-y: auto; }
  .mega-inner { grid-template-columns: 1fr; gap: 1.1rem; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .f-brand { grid-column: 1 / -1; }
}

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