/* Kiipr — minimal editorial dark theme */

:root {
  --background: #101012;
  --foreground: #fafafa;
  --card: #101012;
  --secondary: #1d1d20;
  --accent: #262629;
  --muted-foreground: #a1a1aa;
  --border: #2a2a2e;
  --radius: 0.5rem;

  --font-sans: "Work Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-display: "Instrument Serif", ui-serif, Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

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

body {
  margin: 0;
  min-height: 100dvh;
  overflow-x: hidden;
  background: var(--background);
  color: var(--muted-foreground);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--muted-foreground);
  outline-offset: 2px;
}

.wrap {
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
  padding-inline: 1.25rem;
}

.eyebrow {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.32em;
  color: var(--muted-foreground);
}

.eyebrow.mb {
  margin-bottom: 0.75rem;
}

/* Header ------------------------------------------------------------- */

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

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1rem;
}

.brand {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  color: var(--muted-foreground);
}

.gh {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  font-size: 0.875rem;
  text-decoration: none;
  color: var(--muted-foreground);
  transition: color 0.15s ease;
}

.gh:hover,
.gh:focus-visible {
  color: var(--foreground);
}

.gh-label {
  display: none;
}

.stars {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-width: 2.75rem;
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

/* Layout ------------------------------------------------------------- */

.main {
  padding-top: 3rem;
  padding-bottom: max(3rem, env(safe-area-inset-bottom));
}

.hero-grid {
  display: grid;
  gap: 3.5rem;
}

.col {
  min-width: 0;
}

.display-xl {
  margin: 1.25rem 0 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(3.25rem, 12vw, 6rem);
  line-height: 0.9;
  letter-spacing: -0.03em;
  color: var(--foreground);
}

.display-sub {
  margin: 1rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 4vw, 1.85rem);
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: rgba(250, 250, 250, 0.85);
}

.lede {
  margin: 1.25rem 0 0;
  max-width: 60ch;
  font-size: 1rem;
  line-height: 1.7;
}

/* Command tabs ------------------------------------------------------- */

.commands {
  margin-top: 2.5rem;
}

.cmd-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin-top: 0.75rem;
}

.cmd-tabs button {
  min-height: 2.75rem;
  padding: 0;
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.cmd-tabs button:hover {
  color: var(--foreground);
}

.cmd-tabs button[aria-selected="true"] {
  color: var(--foreground);
  border-bottom-color: var(--foreground);
}

.cmd-box {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  margin-top: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.cmd-box code {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  min-width: 0;
  min-height: 3.5rem;
  padding: 0.75rem 1rem;
  overflow-x: auto;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--foreground);
}

.cmd-copy {
  flex: 0 0 6rem;
  width: 6rem;
  border: 0;
  border-left: 1px solid var(--border);
  background: var(--secondary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--foreground);
  cursor: pointer;
  transition: background 0.15s ease;
}

.cmd-copy:hover {
  background: var(--accent);
}

/* Terminal ----------------------------------------------------------- */

.term {
  display: flex;
  flex-direction: column;
  height: 30rem;
  border: 1px solid var(--border);
  border-radius: 0.625rem;
  background: var(--card);
  overflow: hidden;
  outline: none;
}

.term:focus-visible {
  border-color: rgba(250, 250, 250, 0.4);
}

.term-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--border);
}

.dot {
  width: 0.625rem;
  height: 0.625rem;
  border: 1px solid var(--border);
  border-radius: 50%;
}

.term-title {
  margin-left: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.term-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.term-tabs button {
  flex: 1 1 0;
  min-width: 0;
  min-height: 2.75rem;
  border: 0;
  border-right: 1px solid var(--border);
  background: none;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.term-tabs button:last-child {
  border-right: 0;
}

.term-tabs button:hover {
  color: var(--foreground);
}

.term-tabs button[aria-selected="true"] {
  background: var(--secondary);
  color: var(--foreground);
}

.term-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.mode {
  padding: 0.1rem 0.375rem;
  border-radius: 0.25rem;
  background: var(--secondary);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--muted-foreground);
}

.mode.search {
  background: var(--foreground);
  color: var(--background);
}

.slash {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

#search {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--foreground);
  outline: none;
}

#search::placeholder {
  color: rgba(161, 161, 170, 0.6);
}

.term-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

.term-list {
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-y: auto;
}

.term-list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid rgba(42, 42, 46, 0.6);
  cursor: pointer;
}

.term-list li.sel {
  background: var(--secondary);
}

.caret {
  flex: 0 0 0.75rem;
  width: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.pin {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--foreground);
}

.marker {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--foreground);
}

.name {
  flex: 0 0 5.25rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: rgba(250, 250, 250, 0.85);
}

.badge {
  flex: 0 0 auto;
  padding: 0.05rem 0.3rem;
  border: 1px solid var(--border);
  border-radius: 0.2rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  color: var(--muted-foreground);
}

.text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted-foreground);
}

.term-list li.sel .text {
  color: var(--foreground);
}

.time {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted-foreground);
}

.empty {
  padding: 0.75rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--muted-foreground);
  cursor: default;
}

.help,
.view {
  position: absolute;
  inset: 0;
  padding: 1.25rem;
  overflow-y: auto;
  background: rgba(16, 16, 18, 0.97);
  backdrop-filter: blur(4px);
}

.help h2,
.view h2 {
  margin: 0;
}

.view pre {
  margin: 1rem 0 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--foreground);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.view-hint {
  margin: 1rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted-foreground);
}

.help-list {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.help-list li {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-top: 0.5rem;
  font-size: 0.875rem;
}

.help-list kbd {
  min-width: 5rem;
  padding: 0.1rem 0.375rem;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--foreground);
}

.help-list li.section {
  margin-top: 1rem;
}

.help-list li.section kbd {
  min-width: 0;
  padding: 0;
  border: 0;
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.toast {
  position: absolute;
  bottom: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  background: var(--secondary);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--foreground);
  pointer-events: none;
}

.term-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted-foreground);
}

.term-foot .hint {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

#count {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Features ----------------------------------------------------------- */

.features {
  display: grid;
  margin-top: 5rem;
  border-top: 1px solid var(--border);
}

.features article {
  min-width: 0;
  padding: 2rem 0;
  border-bottom: 1px solid var(--border);
}

.num {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.28em;
  color: var(--muted-foreground);
}

.features h2 {
  margin: 1rem 0 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  color: var(--foreground);
}

.features p {
  margin: 0.75rem 0 0;
  max-width: 60ch;
  font-size: 0.95rem;
}

.features code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--foreground);
}

/* FAQ ---------------------------------------------------------------- */

.faq {
  margin-top: 4rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border);
}

.faq dl {
  display: grid;
  gap: 2rem;
  margin: 1.5rem 0 0;
}

.faq dt {
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  color: var(--foreground);
}

.faq dd {
  margin: 0.5rem 0 0;
  max-width: 60ch;
  font-size: 0.95rem;
}

.faq code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--foreground);
}

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

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 3.5rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted-foreground);
}

.site-footer a {
  text-decoration: none;
  transition: color 0.15s ease;
}

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

/* Responsive --------------------------------------------------------- */

@media (min-width: 640px) {
  .wrap {
    padding-inline: 2rem;
  }
  .main {
    padding-top: 4rem;
  }
  .gh-label {
    display: inline;
  }
  .lede {
    font-size: 1.05rem;
  }
  .term {
    height: 32rem;
  }
  .features {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 7rem;
  }
  .features article {
    padding: 2rem 1.75rem;
    border-right: 1px solid var(--border);
  }
  .features article:first-child {
    padding-left: 0;
  }
  .faq dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .wrap {
    padding-inline: 2.5rem;
  }
  .main {
    padding-top: 6rem;
  }
  .hero-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
    gap: 4rem;
  }
  .sticky {
    position: sticky;
    top: 2.5rem;
  }
  .features {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .features article:last-child {
    border-right: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
