/* wiki.cpunk.io — shared stylesheet (design tokens mirrored from cpunk.io) */

/* Self-hosted fonts (see /fonts/) — no third-party requests */
@font-face {
  font-family: 'Orbitron';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(/fonts/orbitron-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url(/fonts/inter-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url(/fonts/inter-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #050712;
  --bg-alt: #080c1a;
  --panel: #0e1225;
  --panel-alt: #131733;
  --teal: #06c5d2;
  --teal-soft: rgba(6, 197, 210, 0.08);
  --teal-dim: rgba(6, 197, 210, 0.15);
  --orange: #f26229;
  --orange-soft: rgba(242, 98, 41, 0.08);
  --orange-dim: rgba(242, 98, 41, 0.15);
  --text-main: #f0f2ff;
  --text-muted: #8a94c0;
  --border-subtle: rgba(255, 255, 255, 0.06);
  --shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.5);
  --radius-lg: 20px;
  --radius-pill: 999px;
  --transition-fast: 150ms ease-out;
  --nav-height: 72px;
  --max-width: 1120px;
  --font-display: 'Orbitron', sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }

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

/* ── Header / Nav ── */

header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
  background: linear-gradient(to bottom, rgba(5,7,18,0.96), rgba(5,7,18,0.88), transparent);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.nav {
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand { display: flex; align-items: center; gap: 0.75rem; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 1rem;
  text-transform: uppercase;
}

.brand-name .accent { color: var(--teal); }
.brand-tag { font-size: 0.7rem; color: var(--text-muted); }

.nav-menu { display: flex; align-items: center; gap: 1.5rem; }
.nav-links { display: flex; align-items: center; gap: 1.5rem; font-size: 0.9rem; }

.nav-links a {
  color: var(--text-muted);
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color var(--transition-fast), border-bottom-color var(--transition-fast);
}

.nav-links a.active { color: var(--text-main); border-bottom-color: var(--teal); }
.nav-links a:hover { color: var(--orange); border-bottom-color: var(--orange); }

.mobile-menu-toggle {
  display: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(7,9,25,0.9);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mobile-menu-toggle span {
  display: block; width: 16px; height: 2px;
  border-radius: 999px; background: #fff; position: relative;
}

.mobile-menu-toggle span::before,
.mobile-menu-toggle span::after {
  content: ""; position: absolute; left: 0;
  width: 16px; height: 2px; border-radius: inherit; background: inherit;
}

.mobile-menu-toggle span::before { top: -5px; }
.mobile-menu-toggle span::after { top: 5px; }

/* ── Wiki layout: sidebar + article ── */

.wiki-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
  padding: 2.5rem 0 4rem;
}

.sidebar {
  position: sticky;
  top: calc(var(--nav-height) + 1.5rem);
}

.sidebar-group { margin-bottom: 1.6rem; }

.sidebar-group h4 {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 0.6rem;
}

.sidebar-group a {
  display: block;
  font-size: 0.86rem;
  color: var(--text-muted);
  padding: 0.3rem 0.6rem;
  border-left: 2px solid transparent;
  border-radius: 0 8px 8px 0;
  transition: color var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
}

.sidebar-group a:hover { color: var(--orange); background: rgba(255,255,255,0.03); }
.sidebar-group a.active {
  color: var(--text-main);
  border-left-color: var(--teal);
  background: var(--teal-soft);
}

/* ── Article ── */

article {
  max-width: 46rem;
  line-height: 1.75;
}

.breadcrumb {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 1.4rem;
}

.breadcrumb a:hover { color: var(--orange); }
.breadcrumb .sep { margin: 0 0.4rem; opacity: 0.5; }

article h1 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.25;
  margin-bottom: 0.8rem;
}

.article-lead {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 2rem;
}

article h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--teal);
  margin: 2.2rem 0 0.7rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border-subtle);
}

article h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 1.4rem 0 0.4rem;
}

article p { font-size: 0.92rem; color: var(--text-muted); margin-bottom: 0.9rem; }
article p strong, article li strong { color: var(--text-main); font-weight: 600; }

article a.inline {
  color: var(--teal);
  border-bottom: 1px dashed rgba(6,197,210,0.4);
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
article a.inline:hover { color: var(--orange); border-color: var(--orange); }

article ul, article ol {
  margin: 0 0 1rem 1.3rem;
  font-size: 0.92rem;
  color: var(--text-muted);
}

article li { margin-bottom: 0.4rem; }

/* Numbered step cards */
.steps { list-style: none; margin: 1.2rem 0 1.4rem; counter-reset: step; }

.steps li {
  counter-increment: step;
  position: relative;
  padding: 0.9rem 1.1rem 0.9rem 3.2rem;
  margin-bottom: 0.6rem;
  background: var(--panel);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 1rem;
  top: 0.95rem;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--teal-soft);
  border: 1px solid rgba(6,197,210,0.3);
  color: var(--teal);
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
}

/* Callouts */
.callout {
  border-radius: 14px;
  padding: 1rem 1.2rem;
  margin: 1.2rem 0 1.4rem;
  font-size: 0.88rem;
  line-height: 1.6;
  border: 1px solid;
}

.callout p { margin: 0; }
.callout p + p { margin-top: 0.5rem; }

.callout-info {
  background: var(--teal-soft);
  border-color: rgba(6,197,210,0.25);
}
.callout-info p { color: var(--text-main); }

.callout-warn {
  background: var(--orange-soft);
  border-color: rgba(242,98,41,0.3);
}
.callout-warn p { color: var(--text-main); }

.callout-title {
  display: block;
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}
.callout-info .callout-title { color: var(--teal); }
.callout-warn .callout-title { color: var(--orange); }

/* FAQ blocks */
.faq { margin: 1.2rem 0; }

.faq details {
  background: var(--panel);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  margin-bottom: 0.6rem;
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.faq details:hover { border-color: rgba(6,197,210,0.25); }
.faq details[open] { border-color: rgba(6,197,210,0.35); }

.faq summary {
  cursor: pointer;
  padding: 0.9rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  list-style: none;
  position: relative;
  padding-right: 2.4rem;
}

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

.faq summary::after {
  content: "+";
  position: absolute;
  right: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--teal);
  font-size: 1.1rem;
  font-weight: 400;
}

.faq details[open] summary::after { content: "\2212"; }

.faq .faq-body { padding: 0 1.1rem 1rem; }
.faq .faq-body p { font-size: 0.88rem; margin-bottom: 0.6rem; }
.faq .faq-body p:last-child { margin-bottom: 0; }

/* Prev/next pager */
.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
}

.pager a {
  flex: 1;
  max-width: 48%;
  padding: 0.9rem 1.1rem;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  transition: border-color var(--transition-fast), transform var(--transition-fast);
}

.pager a:hover { border-color: rgba(242,98,41,0.4); transform: translateY(-2px); }
.pager a.next { text-align: right; margin-left: auto; }
.pager .pager-label { display: block; font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.2rem; }
.pager .pager-title { color: var(--teal); font-weight: 600; }
.pager a:hover .pager-title { color: var(--orange); }

/* ── Wiki home cards ── */

.home-hero {
  text-align: center;
  padding: 3.5rem 0 2.5rem;
}

.home-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4.5vw, 2.8rem);
  font-weight: 800;
  letter-spacing: 0.1em;
  background: linear-gradient(130deg, var(--teal), #4dd9e0, var(--orange));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 0.8rem;
}

.home-hero p {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 34rem;
  margin: 0 auto;
  line-height: 1.7;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.2rem;
  padding: 1.5rem 0 4rem;
}

.wiki-card {
  display: block;
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid var(--border-subtle);
  padding: 1.5rem 1.4rem;
  transition: border-color 0.4s, transform 0.4s, box-shadow 0.4s;
}

.wiki-card:hover {
  border-color: rgba(242,98,41,0.4);
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(242,98,41,0.12);
}

.wiki-card-icon { margin-bottom: 0.8rem; }

.wiki-card-icon svg {
  width: 40px;
  height: 40px;
  stroke: var(--orange);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  filter: drop-shadow(0 0 6px rgba(242,98,41,0.5));
}

.wiki-card h3 {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--teal);
  margin-bottom: 0.4rem;
  transition: color 0.3s;
}

.wiki-card:hover h3 { color: var(--orange); }

.wiki-card p { font-size: 0.85rem; color: var(--text-muted); line-height: 1.55; }

/* ── Footer ── */

footer {
  padding: 1.8rem 0 2.2rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
}

.footer-row {
  display: flex; flex-wrap: wrap; justify-content: space-between;
  gap: 1rem; align-items: center;
}

.footer-links { display: flex; flex-wrap: wrap; gap: 0.9rem; }
.footer-links a { color: var(--text-muted); font-size: 0.8rem; }
.footer-links a:hover { color: var(--orange); }

/* ── Responsive ── */

@media (max-width: 900px) {
  .wiki-layout { grid-template-columns: 1fr; gap: 1.5rem; }
  .sidebar { position: static; }
  .card-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .nav-menu {
    display: none; position: absolute; top: var(--nav-height);
    right: 0; left: 0; padding: 0.9rem 1rem 1rem; border-radius: 14px;
    background: rgba(5,7,18,0.98); border: 1px solid rgba(255,255,255,0.08);
    flex-direction: column; align-items: flex-start; gap: 0.7rem; z-index: 15;
  }

  .nav-menu.active { display: flex; }
  .nav-links { flex-direction: column; align-items: flex-start; width: 100%; gap: 0.75rem; }
  .nav-links a { width: 100%; padding: 0.25rem 0; }
  .mobile-menu-toggle { display: inline-flex; }

  .pager { flex-direction: column; }
  .pager a { max-width: 100%; }
  .pager a.next { text-align: left; }
}

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