@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

/* ── Reset & Variables ── */

:root {
  --red: #C41E3A;
  --red-hover: #a3182f;
  --red-light: #fef0f2;
  --bg: #fff;
  --text: #1a1a1a;
  --text-muted: #666;
  --border: #e0e0e0;
  --code-bg: #1a1a1a;
  --code-text: #e8e8e8;
  --surface: #f7f7f7;
  --mono: 'JetBrains Mono', 'IBM Plex Mono', 'Fira Code', ui-monospace, monospace;
}

html {
  overflow-y: scroll;
}

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

/* ── Base ── */

body {
  font-family: var(--mono);
  color: var(--text);
  background: var(--bg);
  max-width: 720px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  line-height: 1.7;
  font-size: 0.9rem;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Typography ── */

h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
}

h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.75rem;
  padding-left: 0.75rem;
  border-left: 3px solid var(--red);
}

h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

p {
  margin-bottom: 0.75rem;
}

/* ── Emphasis: red highlight ── */

mark, .hl {
  background: var(--red);
  color: #fff;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-weight: 600;
  font-size: 0.88em;
}

mark.soft, .hl-soft {
  background: var(--red-light);
  color: var(--red);
  border: 1px solid #f0c4ca;
}

/* ── Links ── */

a {
  color: var(--red);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

a:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

/* ── Header ── */

header {
  margin-bottom: 1.5rem;
}

header h1 {
  margin-bottom: 0.25rem;
}

header h1::before {
  content: "> ";
  color: var(--red);
  font-weight: 400;
}

header p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0;
}

/* ── Navigation ── */

nav {
  display: flex;
  gap: 0;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

nav a {
  text-decoration: none;
  font-weight: 500;
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

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

nav a[aria-current="page"] {
  color: var(--red);
  border-bottom-color: var(--red);
}

nav a:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: -2px;
}

/* ── Dividers ── */

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* ── Sections ── */

section {
  margin-bottom: 0.5rem;
}

/* ── Lists ── */

ul, ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

ul li, ol li {
  margin-bottom: 0.5rem;
  padding-left: 0.25rem;
}

ol li {
  margin-bottom: 0.75rem;
}

/* ── Code & Pre ── */

code {
  font-family: var(--mono);
  font-size: 0.85em;
}

pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  overflow-x: auto;
  border-radius: 4px;
  font-size: 0.85rem;
  line-height: 1.6;
}

pre code {
  color: inherit;
  font-size: inherit;
}

/* ── Inline code ── */

p code, li code {
  background: var(--surface);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  border: 1px solid var(--border);
  font-size: 0.85em;
}

/* ── Badge ── */

.badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border: 1px solid var(--red);
  color: var(--red);
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 999px;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

/* ── Callout boxes ── */

.callout {
  background: var(--surface);
  border-left: 3px solid var(--red);
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  border-radius: 0 4px 4px 0;
  font-size: 0.85rem;
}

.callout p:last-child {
  margin-bottom: 0;
}

/* ── Diagrams ── */

.diagram {
  margin: 1.5rem 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.5rem 1rem;
  overflow-x: auto;
}

.diagram .mermaid {
  display: flex;
  justify-content: center;
}

.diagram-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.75rem;
  font-style: italic;
}

/* ── Performance table ── */

.perf-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.85rem;
}

.perf-table th,
.perf-table td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.perf-table th {
  font-weight: 600;
  background: var(--surface);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.perf-table td:last-child {
  font-weight: 600;
  color: var(--red);
  text-align: right;
}

/* ── Forms ── */

label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
}

input, button {
  font-family: var(--mono);
  font-size: 0.85rem;
}

input[type="text"] {
  width: 100%;
  border: 1px solid var(--border);
  padding: 0.6rem 0.75rem;
  margin-bottom: 1rem;
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--red);
}

input[type="text"]::placeholder {
  color: #aaa;
}

button {
  background: var(--red);
  color: #fff;
  border: none;
  cursor: pointer;
  padding: 0.6rem 1.5rem;
  font-weight: 600;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

button:hover {
  background: var(--red-hover);
}

button:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

/* ── Verify Result ── */

#result {
  padding: 0.75rem 1rem;
  margin-top: 1rem;
  font-weight: 600;
  font-size: 0.85rem;
  border-radius: 4px;
}

#result:not(:empty) {
  border: 1px solid var(--border);
}

.ok {
  color: #1a7d34;
  background: #f0faf3;
  border-color: #b5e2c4;
}

.fail {
  color: var(--red);
  background: #fef5f6;
  border-color: #f0c4ca;
}

/* ── Verify Form ── */

#verify-form {
  margin-top: 1rem;
}

/* ── Wiki Search ── */

.wiki-search {
  position: relative;
}

#wiki-search {
  width: 100%;
  border: 2px solid var(--border);
  padding: 0.7rem 1rem;
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.9rem;
  transition: border-color 0.15s;
}

#wiki-search:focus {
  outline: none;
  border-color: var(--red);
}

#wiki-search::placeholder {
  color: #aaa;
}

.wiki-search-hint {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  min-height: 1.1em;
}

/* ── FAQ Details ── */

details {
  margin-bottom: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
}

details[open] {
  padding-bottom: 0.75rem;
}

summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.75rem 1rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

summary::-webkit-details-marker {
  display: none;
}

summary::before {
  content: "+";
  color: var(--red);
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
  width: 1rem;
  text-align: center;
}

details[open] summary::before {
  content: "\2212";
}

summary:hover {
  color: var(--red);
}

summary:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: -2px;
}

details > *:not(summary) {
  padding-left: 2.5rem;
  padding-right: 1rem;
}

details p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

details p:last-child {
  margin-bottom: 0;
}

details ul,
details ol {
  padding-left: 4rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

details h3 {
  font-size: 0.9rem;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

details .diagram {
  margin-left: 2.5rem;
  margin-right: 1rem;
  padding-left: 0;
  padding-right: 0;
}

details .perf-table {
  width: calc(100% - 3.5rem);
  margin-left: 2.5rem;
  padding-left: 0;
  padding-right: 0;
}

details pre {
  margin-left: 2.5rem;
  margin-right: 1rem;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

/* ── OS Tabs ── */

.os-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.os-tab {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  letter-spacing: 0;
}

.os-tab:hover {
  color: var(--text);
  background: transparent;
}

.os-tab.active {
  color: var(--red);
  border-bottom-color: var(--red);
}

.os-tab svg {
  flex-shrink: 0;
  opacity: 0.6;
}

.os-tab.active svg {
  opacity: 1;
}

.os-panel {
  display: none;
}

.os-panel.active {
  display: block;
}

.os-panel .copy-block pre {
  border-radius: 0 0 4px 4px;
  margin-top: 0;
}

/* ── Copy block ── */

.copy-block {
  position: relative;
}

.copy-block pre {
  padding-right: 3.5rem;
}

.copy-btn {
  position: absolute;
  top: 50%;
  right: 0.75rem;
  transform: translateY(-50%);
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--code-text);
  padding: 0.35rem;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}

.copy-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.3);
}

.copy-btn .check-icon {
  display: none;
  color: #4ade80;
}

.copy-btn .copy-icon {
  display: block;
}

.copy-btn.copied .copy-icon {
  display: none;
}

.copy-btn.copied .check-icon {
  display: block;
  animation: checkPop 0.3s ease-out;
}

.copy-btn.copied {
  border-color: #4ade80;
}

@keyframes checkPop {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); opacity: 1; }
}

/* ── Hash display ── */

pre.hash {
  word-break: break-all;
  white-space: pre-wrap;
}

/* ── Footer ── */

footer {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  margin-top: 0.5rem;
}

footer p {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 0;
}

footer a {
  color: var(--text-muted);
}

footer a:hover {
  color: var(--red);
}

/* ── Responsive ── */

@media (max-width: 480px) {
  body {
    padding: 2rem 1rem;
    font-size: 0.85rem;
  }

  h1 {
    font-size: 1.6rem;
  }

  nav {
    flex-direction: column;
    gap: 0;
    border-bottom: none;
    border-left: 1px solid var(--border);
  }

  nav a {
    border-bottom: none;
    border-left: 2px solid transparent;
    margin-bottom: 0;
    margin-left: -1px;
    padding: 0.4rem 0.75rem;
  }

  nav a[aria-current="page"] {
    border-bottom-color: transparent;
    border-left-color: var(--red);
  }

  pre {
    padding: 0.75rem;
    font-size: 0.8rem;
  }

  .diagram {
    padding: 1rem 0.5rem;
  }

  .skills-controls {
    flex-direction: column;
  }

  .skill-cards {
    grid-template-columns: 1fr;
  }
}

/* ── Skills Directory ── */

.skills-controls {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.skills-controls input[type="text"] {
  flex: 1;
  margin-bottom: 0;
}

.skills-controls select {
  font-family: var(--mono);
  font-size: 0.85rem;
  border: 1px solid var(--border);
  padding: 0.6rem 0.75rem;
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}

.skills-controls select:focus {
  outline: none;
  border-color: var(--red);
}

.skill-category {
  margin-bottom: 2rem;
}

.skill-category h3 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  padding-left: 0.75rem;
  border-left: 3px solid var(--red);
}

.skill-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}

.skill-card {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color 0.15s;
}

.skill-card:hover {
  border-color: var(--red);
}

.skill-card-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.skill-card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  flex: 1;
}

.skill-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.25rem;
}

.skill-view {
  font-size: 0.8rem;
  font-weight: 500;
}

.no-results {
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 2rem 0;
  text-align: center;
}

/* ── Skill Detail ── */

.detail-back {
  display: inline-block;
  font-size: 0.8rem;
  margin-bottom: 1.5rem;
  color: var(--text-muted);
}

.detail-back:hover {
  color: var(--red);
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.detail-header h2 {
  border: none;
  padding-left: 0;
  margin-bottom: 0;
}

.detail-author {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 1rem;
}

.detail-caps {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.install-box {
  background: var(--code-bg);
  border-radius: 4px;
  padding: 1rem 1.25rem;
  margin: 1rem 0 0.5rem;
}

.install-box pre {
  background: transparent;
  margin: 0;
  padding: 0;
  margin-bottom: 0.75rem;
}

.install-copy-btn {
  width: 100%;
}

.install-copy-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.install-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}
