/* Krema landing page: shell styles. Palette: dark roast and caramel.
   Design tokens live here only; module stylesheets (wordnav, hero, features,
   shots, pagedock) consume them. */

:root {
  --night: #110c09;
  --ink: #18110d;
  --ink-2: #231a14;
  --line: rgba(244, 236, 224, 0.1);
  --line-strong: rgba(244, 236, 224, 0.18);
  --bone: #f4ece0;
  --bone-dim: #cdbfae;
  --muted: #a89684;
  --blue: #d69a5e;
  --blue-deep: #a8682f;
  --glow: rgba(214, 154, 94, 0.35);

  --r-tile: 22%;
  --r-win: 14px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --font: "Noto Sans", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Hack", "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;

  --wordnav-h: 64px;
  --pagedock-h: 90px;

  --wrap: 74rem;
  --pad: clamp(1.25rem, 4vw, 2.5rem);

  /* Shared z-order: wordnav < pagedock < preview popups < genie ghost. */
  --z-wordnav: 50;
  --z-pagedock: 60;
  --z-preview: 65;
  --z-genie: 70;

  color-scheme: dark;
}
@media (max-width: 600px) {
  :root { --pagedock-h: 75px; }
}

/* ---------- Reset & base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--wordnav-h);
  scrollbar-color: #5c4535 var(--night);
  background: var(--night);
}

body {
  margin: 0;
  padding-bottom: calc(var(--pagedock-h) + 24px);
  background:
    radial-gradient(90rem 46rem at 50% -12rem, rgb(214 154 94 / 0.07), transparent 62%),
    var(--night);
  color: var(--bone);
  font: 400 1.0625rem/1.65 var(--font);
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--blue);
}

::selection { background: var(--blue); color: var(--night); }

::-webkit-scrollbar { width: 12px; height: 10px; }
::-webkit-scrollbar-track { background: var(--night); }
::-webkit-scrollbar-thumb { background: #5c4535; border-radius: 999px; border: 3px solid var(--night); }
::-webkit-scrollbar-thumb:hover { background: #745743; }

h1, h2, h3 { margin: 0; line-height: 1.1; text-wrap: balance; font-weight: 700; }
p { margin: 0; text-wrap: pretty; }
li { list-style: none; }
img, svg { display: block; }
figure { margin: 0; }

a {
  color: var(--blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color 0.15s, text-decoration-color 0.15s;
}
a:where(:not(.btn, .skip, .wn-home, .wn-l, .wn-star, .pd-tile, .ex-open)):hover { color: #e0b78c; }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 6px;
}

code, kbd, pre { font-family: var(--mono); font-size: 0.92em; }
code { font-variant-ligatures: none; }

kbd {
  display: inline-block;
  min-width: 1.7em;
  padding: 0.05em 0.45em;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--ink-2);
  color: var(--bone);
  font-size: 0.82em;
  line-height: 1.5;
  text-align: center;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

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

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: calc(var(--z-wordnav) + 30);
  padding: 0.6rem 1rem;
  border-radius: 8px;
  background: var(--bone);
  color: var(--night);
  font-weight: 600;
  text-decoration: none;
}
.skip:focus { top: calc(var(--wordnav-h) + 1rem); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 3rem;
  padding: 0.7rem 1.35rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color 0.18s, color 0.18s, border-color 0.18s, transform 0.18s var(--ease-out);
}
.btn svg { width: 1.15rem; height: 1.15rem; flex: none; }
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--blue); color: var(--night); }
.btn-primary:hover { background: #dcaa78; color: var(--night); }
.btn-primary:active { background: var(--blue-deep); color: var(--bone); }

.btn-ghost {
  color: var(--bone);
  border: 1px solid var(--line-strong);
  background: rgb(244 236 224 / 0.02);
}
.btn-ghost:hover { color: var(--bone); border-color: rgb(244 236 224 / 0.4); background: rgb(244 236 224 / 0.06); }

/* ---------- GitHub star count chip (filled by js/site.js) ----------
   Hidden until a real count exists. While the count is loading the chip is
   laid out but invisible, and the number keeps a minimum width, so the
   arriving count does not shift the layout. */

.star-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.2em 0.55em 0.2em 0.45em;
  border-radius: 999px;
  background: rgb(244 236 224 / 0.07);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--bone-dim);
  font-size: 0.8125em;
  font-weight: 600;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition: opacity 0.25s var(--ease-out);
}
.star-chip[hidden] { display: none; }
.star-chip[data-state="pending"] { visibility: hidden; opacity: 0; }
.star-chip[data-state="ready"] { opacity: 1; }
.star-chip svg,
.btn .star-chip svg { width: 0.95em; height: 0.95em; color: var(--blue); flex: none; }
.star-chip [data-stars-n] { display: inline-block; min-width: 3.6ch; }

/* ---------- Generic layout ---------- */

main > section {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--pad);
}
main > section + section { margin-top: clamp(5rem, 12vw, 9rem); }

main > section > .section-title + * { margin-top: clamp(1.5rem, 3vw, 2.75rem); }

.section-title {
  max-width: 22ch;
  font-size: clamp(2rem, 4.4vw, 3.25rem);
  letter-spacing: -0.025em;
}

/* ---------- Install: two steps ---------- */

.steps {
  display: grid;
  gap: clamp(1rem, 3vw, 2rem);
  margin: 0;
  padding: 0;
}
.step {
  display: grid;
  align-content: start;
  gap: 1rem;
  min-width: 0;
  padding: clamp(1.1rem, 3vw, 1.6rem);
  border: 1px solid var(--line);
  border-radius: var(--r-win);
  background: var(--ink);
}
.step h3 { display: flex; align-items: center; gap: 0.7rem; font-size: 1.25rem; letter-spacing: -0.01em; }
.step-n {
  display: grid;
  place-items: center;
  flex: none;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--blue);
  color: var(--night);
  font-size: 1rem;
}
.step > p { color: var(--bone-dim); }
.step > p.step-fine { color: var(--muted); font-size: 0.9375rem; }

.inst-seg { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.inst-seg[hidden] { display: none; }
.inst-seg [role="tab"] {
  min-height: 2.5rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: none;
  color: var(--bone-dim);
  font: 600 0.9rem/1 var(--font);
  cursor: pointer;
}
.inst-seg [role="tab"]:hover { color: var(--bone); border-color: rgb(244 236 224 / 0.4); }
.inst-seg [role="tab"][aria-selected="true"] { background: var(--blue); border-color: var(--blue); color: var(--night); }

.inst-panel { display: grid; gap: 0.9rem; min-width: 0; }
.inst-panel[hidden] { display: none; }
.inst-note { color: var(--muted); font-size: 0.9375rem; }
.inst-note code { color: var(--bone-dim); font-size: 0.85em; }

/* Konsole window holding a real command. */
.cmd {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  min-width: 0;
  border-radius: 10px;
  background: var(--night);
  border: 1px solid var(--line);
  overflow: hidden;
}
.cmd::before {
  content: "krema · Konsole";
  flex: none;
  flex-basis: 100%;
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 0 1rem;
  padding-right: 6.75rem;
  background-color: var(--ink-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='78' height='16' viewBox='0 0 78 16'%3E%3Cg fill='none' stroke='%23A89684' stroke-opacity='0.32'%3E%3Ccircle cx='11' cy='8' r='6.25'/%3E%3Ccircle cx='39' cy='8' r='6.25'/%3E%3Ccircle cx='67' cy='8' r='6.25'/%3E%3C/g%3E%3Cg stroke='%23A89684' stroke-opacity='0.6' stroke-width='1.3' stroke-linecap='round'%3E%3Cpath d='M8.2 8h5.6'/%3E%3Cpath d='M36.4 5.4h5.2v5.2h-5.2z' fill='none'/%3E%3Cpath d='M64.4 5.4l5.2 5.2M69.6 5.4l-5.2 5.2'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  border-bottom: 1px solid var(--line);
  color: var(--bone-dim);
  font: 500 0.8125rem/1.4 var(--font);
}
/* A "$" column, then the command; multi-line commands stay aligned. */
.cmd pre {
  flex: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  min-width: 0;
  margin: 0;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  color: var(--bone);
  font-size: 0.9rem;
  line-height: 1.6;
  scrollbar-width: thin;
}
.cmd pre::before { content: "$"; padding-right: 0.7ch; color: var(--blue); user-select: none; -webkit-user-select: none; }
.cmd code { font: inherit; }
@media (max-width: 599px) {
  .cmd pre { white-space: pre-wrap; overflow-wrap: anywhere; }
}

.copy {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex: none;
  align-self: flex-start;
  min-width: 5.5rem;
  margin: 0.55rem 0.55rem 0.55rem 0;
  padding: 0.55rem 0.8rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--ink-2);
  color: var(--bone);
  font: 500 0.875rem/1 var(--font);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.copy[hidden] { display: none; }
.copy svg { width: 1rem; height: 1rem; }
.copy:hover { background: #453428; }
.copy.is-done { color: var(--night); background: var(--blue); }
.copy.is-failed { color: var(--bone); border-color: #ed4c5c; }

.status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (min-width: 900px) {
  .steps { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
}

/* ---------- Footer ---------- */

.foot {
  max-width: var(--wrap);
  margin: clamp(6rem, 14vw, 10rem) auto 0;
  padding: 0 var(--pad) 3.5rem;
}
.foot-grid {
  display: grid;
  gap: 2rem;
  padding: 2.5rem 0 0;
  border-top: 1px solid var(--line);
}
.foot-brand { display: flex; gap: 1rem; align-items: flex-start; max-width: 30rem; color: var(--muted); font-size: 0.9375rem; }
.foot-mark { width: 2.5rem; height: 2.5rem; flex: none; }
.foot-links { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; }
.foot-links a { color: var(--muted); text-decoration: none; display: inline-block; padding-block: 0.35rem; }
.foot-links a:hover { color: var(--bone); text-decoration: underline; }

@media (min-width: 900px) {
  .foot-grid { grid-template-columns: minmax(0, 30rem) 1fr; gap: 4rem; }
  .foot .foot-links { justify-content: flex-end; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
