/* ==========================================================================
   Mars Market — main.css
   A dark, terminal-adjacent editorial layout. One content width is shared by
   the header, nav, breadcrumbs, main and footer so everything lines up.
   Palette: near-black neutrals + a single purple accent (from the brand mark).
   Type: IBM Plex Mono for display/labels/addresses, system sans for body.
   ========================================================================== */

/* Self-hosted display face. Preloaded in <head>; swap keeps text visible
   while it loads so it never blocks first paint (LCP friendly). */
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/ibm-plex-mono-500.woff2") format("woff2");
}

:root {
  --bg: #0d0d10;
  --bg-soft: #121217;
  --panel: #16161c;
  --panel-2: #1b1b23;
  --line: #26262f;
  --line-soft: #1e1e26;
  --text: #e8e5dd;
  --muted: #9b988f;
  --faint: #6f6d66;
  --accent: #9b6dff;
  --accent-strong: #7c4dff;
  --accent-soft: rgba(155, 109, 255, 0.14);
  --danger: #e5484d;
  --ok: #3fb950;

  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --wrap: 820px;
  --radius: 9px;
}

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

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  /* faint top glow, not a gradient hero */
  background-image: radial-gradient(1200px 380px at 50% -120px, rgba(124, 77, 255, 0.10), transparent 70%);
  background-repeat: no-repeat;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #b795ff; }

::selection { background: var(--accent-soft); color: #fff; }

/* Shared content width. Header, nav, breadcrumbs, main and footer all use it. */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 22px;
}

/* ------------------------------------------------------------------ *
   Header
   ------------------------------------------------------------------ */
.site-head {
  border-bottom: 1px solid var(--line);
  background: rgba(13, 13, 16, 0.85);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.head-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
  gap: 16px;
}
.brand { display: inline-flex; align-items: center; }
.brand img { height: 22px; width: auto; display: block; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(63, 185, 80, 0.5);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(63, 185, 80, 0.45); }
  70% { box-shadow: 0 0 0 7px rgba(63, 185, 80, 0); }
  100% { box-shadow: 0 0 0 0 rgba(63, 185, 80, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .dot { animation: none; }
  html { scroll-behavior: auto; }
}

/* ------------------------------------------------------------------ *
   Nav
   ------------------------------------------------------------------ */
.site-nav { border-bottom: 1px solid var(--line); background: var(--bg-soft); }
.nav-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 4px;
  padding-top: 0;
  padding-bottom: 0;
}
.site-nav a {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 12px 12px;
  border-bottom: 2px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}
.site-nav a:hover { color: var(--text); border-bottom-color: var(--accent); }

/* ------------------------------------------------------------------ *
   Breadcrumbs (same .wrap width as content)
   ------------------------------------------------------------------ */
.crumbs { padding-top: 16px; padding-bottom: 0; }
.crumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--faint);
}
.crumbs li { display: inline-flex; align-items: center; gap: 6px; }
.crumbs li + li::before { content: "/"; color: var(--line); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }

/* ------------------------------------------------------------------ *
   Main / page
   ------------------------------------------------------------------ */
main.wrap { padding-top: 30px; padding-bottom: 40px; }
.page { min-width: 0; }

.page-head { margin-bottom: 8px; }
h1 {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 24px;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: #fff;
  margin-bottom: 16px;
}
.lead {
  font-size: 17px;
  line-height: 1.75;
  color: #cfccc4;
  margin-bottom: 14px;
}
.lead:last-child { margin-bottom: 0; }

.block {
  padding-top: 26px;
  margin-top: 26px;
  border-top: 1px solid var(--line-soft);
}
.block h2 {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.block h2::before {
  content: "";
  width: 14px; height: 2px;
  background: var(--accent);
  display: inline-block;
}
.block p { margin-bottom: 14px; color: var(--text); }
.block p:last-child { margin-bottom: 0; }

/* ------------------------------------------------------------------ *
   Mirrors (home hero, functional directory)
   ------------------------------------------------------------------ */
.mirrors { margin-bottom: 6px; }
.mirrors-kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 12px;
}
.mirror-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 22px 0 16px;
}
.mirror-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  transition: border-color .15s ease, background .15s ease;
}
.mirror-item:hover { border-color: var(--accent); background: var(--panel-2); }
.mirror-link {
  flex: 1;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  word-break: break-all;
}
.mirror-item:hover .mirror-link { color: #fff; }
.copy-btn {
  flex: none;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  transition: all .15s ease;
}
.copy-btn:hover { color: #fff; border-color: var(--accent); background: var(--accent-soft); }
.copy-btn.copied { color: var(--ok); border-color: var(--ok); }
.mirrors-note { font-size: 14px; color: var(--muted); }

/* ------------------------------------------------------------------ *
   News
   ------------------------------------------------------------------ */
.news-list { display: flex; flex-direction: column; }
.news-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--line-soft);
}
.news-item:first-child { padding-top: 4px; }
.news-item:last-child { border-bottom: none; }
.news-meta {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 8px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.tag {
  color: var(--accent);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 10px;
  letter-spacing: 0.1em;
}
.news-item h3 {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 15px;
  color: #fff;
  margin-bottom: 6px;
}
.dek { font-size: 14px; color: var(--muted); }

/* ------------------------------------------------------------------ *
   FAQ
   ------------------------------------------------------------------ */
.faq-list { display: flex; flex-direction: column; gap: 10px; }
.qa {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}
.qa summary {
  list-style: none;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.qa summary::-webkit-details-marker { display: none; }
.qa summary::after {
  content: "+";
  font-family: var(--mono);
  color: var(--accent);
  font-size: 16px;
  transition: transform .18s ease;
}
.qa[open] summary::after { transform: rotate(45deg); }
.qa[open] summary { border-bottom: 1px solid var(--line-soft); }
.qa p { padding: 14px 16px; font-size: 15px; color: var(--muted); margin: 0; }

/* ------------------------------------------------------------------ *
   Guides grid (home)
   ------------------------------------------------------------------ */
.guides { margin-top: 34px; padding-top: 26px; border-top: 1px solid var(--line-soft); }
.guides h2 {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
}
.guides h2::before { content: ""; width: 14px; height: 2px; background: var(--accent); }
.guides-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.guide-card {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 14px 16px;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.guide-card:hover { border-color: var(--accent); background: var(--panel-2); transform: translateY(-2px); }
.guide-card h3 {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 14px;
  color: #fff;
  margin-bottom: 6px;
}
.guide-card p { font-size: 13px; color: var(--muted); line-height: 1.55; }
.guide-all { background: var(--accent-soft); border-color: var(--accent); }
.guide-all h3 { color: var(--accent); }

/* ------------------------------------------------------------------ *
   Blog index + article cards
   ------------------------------------------------------------------ */
.article-list { display: flex; flex-direction: column; margin-top: 18px; }
.article-card {
  display: block;
  padding: 20px 0;
  border-bottom: 1px solid var(--line-soft);
  transition: background .15s ease;
}
.article-card:first-child { padding-top: 6px; }
.article-card:hover { background: linear-gradient(90deg, var(--accent-soft), transparent 60%); }
.article-meta {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 8px;
  display: flex; gap: 10px; align-items: center;
}
.article-card h2 {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 18px;
  color: #fff;
  margin-bottom: 8px;
  line-height: 1.35;
}
.article-card:hover h2 { color: var(--accent); }
.article-card .dek { font-size: 15px; color: var(--muted); max-width: 64ch; }

/* ------------------------------------------------------------------ *
   Related
   ------------------------------------------------------------------ */
.related { margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--line-soft); }
.related h2 {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}
.related-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.related-list a {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 12px;
  transition: all .15s ease;
}
.related-list a:hover { color: #fff; border-color: var(--accent); background: var(--accent-soft); }

/* ------------------------------------------------------------------ *
   Buttons
   ------------------------------------------------------------------ */
.btn {
  display: inline-block;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: #0d0d10;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 7px;
  padding: 10px 18px;
  transition: background .15s ease;
}
.btn:hover { background: #b795ff; color: #0d0d10; }

/* ------------------------------------------------------------------ *
   404
   ------------------------------------------------------------------ */
.error-404 h1 { font-size: 40px; }

/* ------------------------------------------------------------------ *
   Footer (same .wrap width as content)
   ------------------------------------------------------------------ */
.site-foot {
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  margin-top: 30px;
}
.foot-inner { padding-top: 30px; padding-bottom: 34px; }
.foot-notice {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 26px;
}
.foot-notice .rule { flex: 1; height: 1px; background: var(--line); }
.foot-notice p {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  text-align: center;
  white-space: nowrap;
}
.foot-cols {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
  margin-bottom: 28px;
}
.foot-col h2 {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}
.foot-col ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.foot-col a { font-size: 13px; color: var(--muted); }
.foot-col a:hover { color: var(--accent); }
.foot-legal { border-top: 1px solid var(--line-soft); padding-top: 18px; }
.foot-legal p { font-size: 12px; color: var(--faint); margin-bottom: 6px; }
.foot-legal a { color: var(--muted); }
.foot-legal a:hover { color: var(--accent); }
.foot-meta { font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; }

/* ------------------------------------------------------------------ *
   Responsive (designed, not shrunk)
   ------------------------------------------------------------------ */
@media (max-width: 640px) {
  .wrap { padding: 0 18px; }
  .head-inner { height: 56px; }
  .brand img { height: 19px; }
  .status-text { display: none; }
  .status { padding-right: 4px; }

  h1 { font-size: 21px; }
  .lead { font-size: 16px; }

  .site-nav a { padding: 11px 10px; font-size: 11.5px; }

  .mirror-item { flex-wrap: wrap; }
  .mirror-link { flex-basis: 100%; }
  .copy-btn { margin-top: 2px; }

  .guides-grid { grid-template-columns: 1fr; }
  .foot-cols { grid-template-columns: repeat(2, 1fr); gap: 20px; }
  .foot-notice p { font-size: 10px; letter-spacing: 0.1em; }
  .foot-notice .rule { display: none; }
  .foot-notice { justify-content: center; }
}
