// jiq docs — clean, minimal, readable on every screen size.
// Minimum font size rule: prose ≥ 15px (0.9375rem), decorative labels ≥ 13px.

// ─── Type scale ──────────────────────────────────────────────────────
// Body is 17px. Headings follow a strict proportional scale at every breakpoint.
// Nothing in the reading flow drops below 15px; only uppercase decorative labels
// may be 13px (they visually read larger due to letter-spacing).

body {
  font-size: 1.0625rem !important; // 17px
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.75;
}

.main-content {
  font-size: 1.0625rem !important;

  h1 { font-size: 2rem !important;  font-weight: 700; letter-spacing: -0.025em; line-height: 1.15; margin-top: 0; margin-bottom: 0.5rem; }
  h2 { font-size: 1.4rem !important; font-weight: 650; letter-spacing: -0.015em; line-height: 1.3; margin-top: 2.5rem; padding-bottom: 0.5rem; border-bottom: 1px solid #21262d; }
  h3 { font-size: 1.1rem !important; font-weight: 600; letter-spacing: -0.01em; margin-top: 1.75rem; }
  p, li, td, th { font-size: 1.0625rem !important; line-height: 1.75; }
}

// Tablet ≤800px
@media (max-width: 50rem) {
  body, .main-content { font-size: 1.0625rem !important; }
  .main-content {
    h1 { font-size: 1.8rem !important; }
    h2 { font-size: 1.3rem !important; margin-top: 2rem; }
    h3 { font-size: 1.05rem !important; margin-top: 1.5rem; }
    p, li, td, th { font-size: 1.0625rem !important; }
  }
}

// Phone ≤480px — same size, arm's length reading
@media (max-width: 30rem) {
  body, .main-content { font-size: 1.0625rem !important; }
  .main-content {
    h1 { font-size: 1.6rem !important; }
    h2 { font-size: 1.2rem !important; }
    h3 { font-size: 1.05rem !important; }
    p, li, td, th { font-size: 1.0625rem !important; }
  }
}

// Sidebar nav — bump from theme default (~14px) to 15px
.nav-list .nav-list-link {
  font-size: 0.9375rem;
}

// ─── Links ───────────────────────────────────────────────────────────
.main-content a {
  text-decoration: underline;
  text-decoration-color: rgba(88, 166, 255, 0.35);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.12s;

  &:hover { text-decoration-color: #58a6ff; }
}

// ─── Code & code blocks ──────────────────────────────────────────────
.main-content code {
  background: #161b22;
  border: 1px solid #21262d;
  color: #c9d1d9;
  font-size: 0.92em;
  padding: 1px 5px;
  border-radius: 4px;
}

.main-content pre.highlight,
.main-content figure.highlight,
.main-content pre {
  background: #0a0e14;
  border: 1px solid #21262d;
  border-radius: 8px;
  padding: 16px 18px;
  font-size: 0.9375rem; // 15px — never goes smaller
  line-height: 1.65;
  overflow-x: auto;
}

// Code inside <pre> blocks: inherit everything from the pre.
.main-content pre code {
  background: transparent;
  border: none;
  padding: 0;
  font-size: 1em;
}

// ─── Keyboard chips ──────────────────────────────────────────────────
kbd, .kbd {
  display: inline-block;
  padding: 2px 7px;
  font-family: $mono-font-family;
  font-size: 0.875em;
  background: #161b22;
  color: #e6edf3;
  border: 1px solid #30363d;
  border-bottom-width: 2px;
  border-radius: 5px;
  white-space: nowrap;
  vertical-align: baseline;
  line-height: 1.45;
}

// ─── Tables ──────────────────────────────────────────────────────────
// Wrap tables in a scrollable div so long content scrolls rather than clips.
// Can't add a wrapper in markdown, so make the table itself block-scrollable.
.main-content table {
  border: 1px solid #21262d;
  border-radius: 8px;
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  // No overflow: hidden — that was trapping content off-screen on mobile.
  // Border-radius still works because border-collapse: separate keeps
  // the table border distinct from cell borders.

  th, td {
    border: none;
    border-bottom: 1px solid #21262d;
    padding: 10px 14px;
    text-align: left;
    vertical-align: top;
    font-size: 1rem !important;
  }

  th {
    background: #161b22;
    font-weight: 600;
    color: #f0f6fc;
  }

  // Inline code inside table cells: monospace looks ~10% visually larger
  // than proportional text at the same px size, so scale it down slightly.
  td code, th code { font-size: 0.88em !important; }

  tr:last-child td { border-bottom: none; }
  tr:nth-child(even) td { background: rgba(255, 255, 255, 0.02); }
}

// On mobile, enable horizontal scroll so long content doesn't clip off-screen.
@media (max-width: 50rem) {
  .main-content table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 6px; // block display clips corners slightly differently — keep it
  }
  .main-content table th,
  .main-content table td { padding: 9px 11px; }
}

// ─── Buttons ─────────────────────────────────────────────────────────
.btn {
  border-radius: 6px;
  font-weight: 550;
  font-size: 0.9375rem;
  padding: 8px 16px;
  text-decoration: none;
  border: 1px solid #30363d;
  transition: background 0.12s, border-color 0.12s;

  &:hover { text-decoration: none; }
}

.btn-primary {
  background: #1f6feb;
  color: #fff;
  border-color: #1f6feb;

  &:hover { background: #2879f5; border-color: #2879f5; color: #fff; }
}

// ─── TUI mockup ──────────────────────────────────────────────────────
.tui-mockup {
  background: #0a0e14;
  color: #c9d1d9;
  font-family: $mono-font-family;
  font-size: 0.9375rem; // 15px minimum
  line-height: 1.6;
  border: 1px solid #21262d;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1.4rem 0;

  pre {
    background: transparent;
    border: none;
    margin: 0;
    padding: 14px 16px;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
    overflow-x: auto;
  }

  &.with-title::before {
    content: attr(data-title);
    display: block;
    padding: 8px 14px;
    font-family: $body-font-family;
    font-size: 0.8125rem; // 13px uppercase label — visually reads larger
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #8b949e;
    background: #0d1117;
    border-bottom: 1px solid #21262d;
    border-radius: 8px 8px 0 0;
  }
}

// Never scale tui-mockup below 14px on phones
@media (max-width: 30rem) {
  .tui-mockup {
    font-size: 0.875rem; // 14px — acceptable for ASCII art at arm's length
    pre { padding: 12px 14px; }
  }
}

// ─── I/O pair ────────────────────────────────────────────────────────
.io-pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: stretch;
  margin: 1.4rem 0;

  @media (max-width: 50rem) {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .io-block {
    background: #0a0e14;
    border: 1px solid #21262d;
    border-radius: 8px;
    padding: 12px 14px;
    font-family: $mono-font-family;
    font-size: 0.9375rem; // 15px — never scaled down (was 0.78rem = 12.5px on mobile, broken)
    line-height: 1.6;
    color: #c9d1d9;
    overflow-x: auto;
    white-space: pre;
  }

  .io-label {
    font-family: $body-font-family;
    font-size: 0.8125rem; // 13px uppercase — reads proportionally larger
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #8b949e;
    margin-bottom: 6px;
  }

  .io-arrow {
    align-self: center;
    color: #58a6ff;
    font-size: 1.3rem;
    text-align: center;

    @media (max-width: 50rem) { transform: rotate(90deg); }
  }
}

// ─── Drill chain ─────────────────────────────────────────────────────
.drill-chain {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-family: $mono-font-family;
  font-size: 0.9375rem; // 15px
  margin: 1.4rem 0;

  .step {
    background: #161b22;
    border: 1px solid #21262d;
    border-radius: 5px;
    padding: 5px 10px;
    color: #c9d1d9;
  }

  .step.active {
    border-color: #58a6ff;
    color: #f0f6fc;
    background: rgba(88, 166, 255, 0.08);
  }

  .arrow { color: #8b949e; }
}

// ─── Feature grid (landing & features index) ─────────────────────────
.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 1.5rem 0 2rem;

  @media (max-width: 40rem) { grid-template-columns: 1fr; }
}

a.feature-card {
  display: block;
  background: #0f1319;
  border: 1px solid #21262d;
  border-radius: 8px;
  padding: 16px 18px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;

  &:hover {
    border-color: #30363d;
    background: #161b22;
    text-decoration: none;
  }

  .feature-card-title {
    font-weight: 600;
    font-size: 1rem; // 16px — slightly tighter than body, card context
    color: #f0f6fc;
    display: block;
    margin-bottom: 5px;
  }

  &:hover .feature-card-title { color: #58a6ff; }

  .feature-card-desc {
    color: #8b949e;
    font-size: 0.9375rem; // 15px minimum
    line-height: 1.55;
    margin: 0;
  }
}

// ─── VIM mode badge ──────────────────────────────────────────────────
.mode-demo {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin: 1.4rem 0;
}

.mode-badge {
  border: 2px solid;
  border-radius: 8px;
  padding: 12px 16px;
  font-family: $mono-font-family;
  font-size: 0.9375rem; // 15px
  line-height: 1.5;
  background: #0a0e14;
  flex: 1;
  min-width: 200px;

  .mode-label {
    font-family: $body-font-family;
    font-size: 0.8125rem; // 13px uppercase
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 8px;
  }

  .mode-content { color: #c9d1d9; }

  &.insert { border-color: #39d0c9; .mode-label { color: #39d0c9; } }
  &.normal  { border-color: #e5c07b; .mode-label { color: #e5c07b; } }
}

// ─── Tagline ─────────────────────────────────────────────────────────
.tagline {
  font-size: 1.15rem; // ~18px
  color: #8b949e;
  line-height: 1.65;
  margin: 0.5rem 0 1.75rem;
  max-width: 40rem;
}

@media (max-width: 50rem) {
  .tagline { font-size: 1.0625rem; } // matches body — no smaller
}

// ─── Sidebar ─────────────────────────────────────────────────────────
.side-bar { border-right: 1px solid #21262d; }

.site-title {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

// ─── Blockquotes / callouts ──────────────────────────────────────────
.main-content blockquote {
  border-left: 3px solid #30363d;
  background: #0f1319;
  border-radius: 0 8px 8px 0;
  padding: 12px 16px;
  color: #c9d1d9;
  margin: 1.25rem 0;
}
