/* ==========================================================================
   0x00 Tools — styles.css
   Site styles. System fonts only, mobile-first.
   ========================================================================== */

/* ---- Reset --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body, h1, h2, h3, p, ul, figure { margin: 0; }
ul { padding: 0; list-style: none; }
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; }

/* ---- Design tokens --------------------------------------------------------
   Palette taken directly from the project brief: dark, technical, calm,
   with a green/cyan accent pair (no warm-cream / acid-green defaults).
   ---------------------------------------------------------------------- */
:root {
  color-scheme: dark;

  --bg: #0b0f14;
  --surface: #111827;
  --surface-soft: #162033;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --accent: #22c55e;
  --accent-hover: #1ea34f;
  --accent-soft: rgba(34, 197, 94, 0.12);
  --accent-cyan: #22d3ee;
  --border: rgba(255, 255, 255, 0.1);
  --header-bg: rgba(11, 15, 20, 0.86);
  --grid-line: rgba(255, 255, 255, 0.05);
  --terminal-head-bg: rgba(255, 255, 255, 0.03);
  --button-on-accent: #04140a;
  --badge-border: rgba(34, 197, 94, 0.35);

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;

  --shadow-soft: 0 24px 60px -28px rgba(0, 0, 0, 0.6);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --header-h: 64px;
  --container-w: 1120px;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f7fafc;
  --surface: #ffffff;
  --surface-soft: #eef4f8;
  --text: #111827;
  --muted: #4b5563;
  --accent: #12833d;
  --accent-hover: #0f6f34;
  --accent-soft: rgba(18, 131, 61, 0.12);
  --accent-cyan: #0e7490;
  --border: rgba(17, 24, 39, 0.14);
  --header-bg: rgba(247, 250, 252, 0.88);
  --grid-line: rgba(17, 24, 39, 0.08);
  --terminal-head-bg: rgba(17, 24, 39, 0.04);
  --button-on-accent: #ffffff;
  --badge-border: rgba(18, 131, 61, 0.28);

  --shadow-soft: 0 24px 60px -32px rgba(15, 23, 42, 0.34);
}

/* ---- Base ------------------------------------------------------------- */
html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main {
  display: block;
}

h1, h2, h3 {
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

h1 { font-size: clamp(1.9rem, 1.35rem + 2.6vw, 3.1rem); }
h2 { font-size: clamp(1.5rem, 1.25rem + 1.2vw, 2.1rem); }
h3 { font-size: 1.1rem; }

p { color: var(--text); }

.section-lead {
  color: var(--muted);
  max-width: 46rem;
  font-size: 1.02rem;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---- Layout helpers ------------------------------------------------------ */
.container {
  width: 100%;
  max-width: var(--container-w);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

.section {
  padding-block: clamp(3rem, 2.4rem + 3vw, 5.5rem);
  border-top: 1px solid var(--border);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.6rem;
}

.section h2 {
  margin-bottom: 0.85rem;
}

.section .section-lead {
  margin-bottom: 2.25rem;
}

/* ---- Skip link ------------------------------------------------------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--accent);
  color: var(--button-on-accent);
  font-weight: 600;
  padding: 0.6rem 1rem;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus {
  left: 0;
}

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease),
    color 0.15s var(--ease), transform 0.15s var(--ease);
  cursor: pointer;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--button-on-accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.btn-block { width: 100%; }

/* ---- Header ------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: var(--header-bg);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 100%;
}

.logo {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  color: var(--text);
}
.logo-mark { color: var(--accent); }
.logo-suffix { color: var(--muted); font-weight: 500; font-size: 0.85rem; }

.main-nav {
  display: none;
  position: absolute;
  top: var(--header-h);
  left: 0;
  right: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 1.25rem 1.25rem;
}
.main-nav.is-open { display: block; }
.main-nav ul {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.main-nav a {
  display: block;
  padding: 0.75rem 0.25rem;
  text-decoration: none;
  color: var(--text);
  font-size: 0.98rem;
  border-bottom: 1px solid var(--border);
}
.main-nav li:last-child a { border-bottom: none; }
.main-nav a:hover { color: var(--accent); }

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease),
    color 0.15s var(--ease), transform 0.15s var(--ease);
}
.theme-toggle:hover {
  background: var(--surface);
  border-color: var(--accent-cyan);
}
.theme-toggle:active { transform: translateY(1px); }

.theme-toggle-icon {
  position: relative;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow:
    0 -7px 0 -5px var(--accent),
    0 7px 0 -5px var(--accent),
    7px 0 0 -5px var(--accent),
    -7px 0 0 -5px var(--accent),
    5px 5px 0 -5px var(--accent),
    -5px 5px 0 -5px var(--accent),
    5px -5px 0 -5px var(--accent),
    -5px -5px 0 -5px var(--accent);
}

:root[data-theme="light"] .theme-toggle-icon {
  width: 18px;
  height: 18px;
  background: transparent;
  box-shadow: inset -5px -3px 0 0 var(--text);
}

.nav-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  padding: 8px;
  border-radius: var(--radius-sm);
}
.nav-toggle:hover { background: var(--surface); }
.nav-toggle-bar {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.15s var(--ease), opacity 0.15s var(--ease);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---- Hero ------------------------------------------------------------- */
.hero {
  padding-block: clamp(2.5rem, 2rem + 3vw, 5rem) clamp(2.75rem, 2.2rem + 3vw, 5rem);
  overflow: hidden;
}

.hero-inner {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.hero-content { max-width: 38rem; }

.hero h1 { margin-block: 0.75rem 1rem; }

.hero-lead {
  color: var(--muted);
  font-size: 1.05rem;
  margin-bottom: 1.75rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.hero-visual {
  position: relative;
  display: flex;
  justify-content: center;
  padding: 1.5rem 0;
}

.hex-field {
  position: absolute;
  inset: -15% -5%;
  background-image:
    radial-gradient(circle at 28% 25%, var(--accent-soft), transparent 55%),
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: auto, 26px 26px, 26px 26px;
  -webkit-mask-image: radial-gradient(circle at center, #000 35%, transparent 72%);
  mask-image: radial-gradient(circle at center, #000 35%, transparent 72%);
  pointer-events: none;
}

.terminal-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.terminal-card-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 0.9rem;
  background: var(--terminal-head-bg);
  border-bottom: 1px solid var(--border);
}

.terminal-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.6;
}
.terminal-dot.is-accent { background: var(--accent); opacity: 1; }

.terminal-title {
  margin-left: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
}

.terminal-body {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.7;
  padding: 1.1rem 1.25rem 1.4rem;
  overflow-x: auto;
  white-space: pre;
}

.tok-muted { color: var(--muted); }
.tok-accent { color: var(--accent); font-weight: 600; }
.tok-fn { color: var(--text); }
.tok-bracket { color: var(--muted); }
.tok-string { color: var(--accent-cyan); }

.cursor {
  display: inline-block;
  width: 7px;
  height: 1em;
  margin-left: 2px;
  background: var(--accent);
  vertical-align: text-bottom;
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ---- Card grids ----------------------------------------------------- */
.card-grid {
  display: grid;
  gap: 1.1rem;
  grid-template-columns: 1fr;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

.card-tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-cyan);
  margin-bottom: 0.6rem;
}

.card h3 { margin-bottom: 0.5rem; }
.card p { color: var(--muted); font-size: 0.95rem; }

.card-plan { border-style: dashed; }
.card-plan .card-tag { color: var(--muted); }

.section--flush { border-top: none; }

/* ---- Tool card (json2fit) -------------------------------------------- */
.tool-card {
  background: linear-gradient(165deg, var(--surface-soft), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(1.5rem, 1.2rem + 1.4vw, 2.25rem);
  box-shadow: var(--shadow-soft);
}

.tool-card-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.tool-card-head h3,
.tool-card-head .tool-card-title {
  font-size: 1.4rem;
  font-family: var(--font-mono);
  margin: 0;
}

.badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--badge-border);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
}

.tool-card p.tool-desc {
  color: var(--muted);
  max-width: 42rem;
  margin-bottom: 1.4rem;
}

.tool-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.6rem;
}

.tool-highlights li {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.7rem;
}

/* ---- Notice (used on tool status pages) ------------------------------- */
.notice {
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 1.1rem 1.3rem;
  color: var(--muted);
  font-size: 0.92rem;
  margin-block: 1.5rem;
}
.notice strong { color: var(--text); }

.breadcrumb {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.breadcrumb a { color: var(--accent-cyan); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* ---- Footer ------------------------------------------------------------ */
.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 2.25rem;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-note { color: var(--muted); font-size: 0.88rem; }

.footer-nav {
  display: flex;
  gap: 1.25rem;
  margin-top: 0.5rem;
}
.footer-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}
.footer-nav a:hover { color: var(--accent); }

/* ==========================================================================
   Breakpoints — mobile-first
   ========================================================================== */

/* ---- ≥ 640px : small tablets / large phones ---------------------------- */
@media (min-width: 640px) {
  .card-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

/* ---- ≥ 900px : tablet / desktop nav ------------------------------------ */
@media (min-width: 900px) {
  .nav-toggle { display: none; }

  .main-nav {
    display: block;
    position: static;
    background: transparent;
    border-bottom: none;
    padding: 0;
    margin-left: auto;
  }
  .main-nav ul { flex-direction: row; gap: 1.75rem; }
  .main-nav a {
    border-bottom: none;
    padding: 0.4rem 0.1rem;
  }
  .header-actions { margin-left: 0; }

  .hero-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .hero-content { flex: 1 1 50%; }
  .hero-visual { flex: 1 1 42%; padding: 0; }

  .card-grid-3 { grid-template-columns: repeat(3, 1fr); }

  .tool-card-head h3,
  .tool-card-head .tool-card-title {
    font-size: 1.6rem;
  }
}

/* ---- ≥ 1200px : large desktop ------------------------------------------ */
@media (min-width: 1200px) {
  .container { padding-inline: 1.5rem; }
}

/* ---- Reduced motion ------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cursor { animation: none; opacity: 1; }
  .btn, .nav-toggle-bar { transition: none; }
  .theme-toggle { transition: none; }
}
