/* datcrazy — shared design system for the static site (pi.datcrazy.co) */

:root {
  color-scheme: dark;

  --bg: #07080b;
  --bg-soft: #0b0e13;
  --panel: #10141a;
  --panel-2: #0c1016;
  --border: #1e2531;
  --border-strong: #2b3543;

  --text: #eef2f7;
  --muted: #9aa6b6;
  --dim: #8b98aa;

  --ember: #ff6b35;
  --ember-soft: #ffa06b;
  --mint: #3ddc97;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  --shell: 980px;

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

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 520px at 12% -8%, rgba(255, 107, 53, 0.14), transparent 60%),
    radial-gradient(900px 460px at 92% 4%, rgba(61, 220, 151, 0.07), transparent 62%),
    linear-gradient(180deg, var(--bg-soft) 0%, var(--bg) 42%);
  background-attachment: fixed;
  color: var(--text);
  font: 16px/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
  padding: 0 20px 72px;
}

a { color: var(--ember-soft); text-decoration: none; }
a:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }

:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ── shell ─────────────────────────────────────────────────────────────── */

.shell { width: 100%; max-width: var(--shell); margin: 0 auto; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  /* full-bleed band: escapes the body padding so the fill and rule span the viewport */
  margin: 0 -20px 26px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  /* mirrors the shell column exactly: shell width + the body gutters */
  max-width: calc(var(--shell) + 40px);
  margin: 0 auto;
  padding: 14px 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 650;
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--text); text-decoration: none; }

.mark { position: relative; width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--ember); flex: none; }
.mark::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--ember); }

.topnav { display: flex; gap: 18px; margin-left: auto; font-size: 14px; }
.topnav a { color: var(--muted); }
.topnav a:hover { color: var(--text); text-decoration: none; }
.topnav a[aria-current="page"] { color: var(--text); }

/* ── hero ──────────────────────────────────────────────────────────────── */

.hero { padding: 34px 0 10px; }
.hero > * { max-width: 640px; }
.hero h1,
.hero .lede { max-width: 560px; }
.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(30px, 5.2vw, 46px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  max-width: 20ch;
}
.hero .lede { margin: 0 0 10px; font-size: 18px; color: var(--muted); max-width: 62ch; }
.hero .sub { margin: 0; color: var(--dim); font-size: 14px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px;
  margin-bottom: 16px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge--live { color: var(--mint); border-color: color-mix(in srgb, var(--mint) 35%, var(--border)); }
.badge--soon { color: var(--ember-soft); border-color: color-mix(in srgb, var(--ember) 35%, var(--border)); }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0 6px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 18px;
  border-radius: 11px;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--text);
  font-size: 15px;
  font-weight: 550;
}
.btn:hover { border-color: var(--ember); color: var(--text); text-decoration: none; }
.btn--primary {
  border-color: transparent;
  background: linear-gradient(180deg, var(--ember) 0%, #e8541f 100%);
  color: #14060a;
  font-weight: 650;
  box-shadow: 0 10px 26px rgba(255, 107, 53, 0.28);
}
.btn--primary:hover { color: #14060a; filter: brightness(1.06); }

/* ── sections ──────────────────────────────────────────────────────────── */

section { margin-top: 54px; }
h2 { margin: 0 0 14px; font-size: 23px; letter-spacing: -0.02em; }
h3 { margin: 0 0 6px; font-size: 16px; letter-spacing: -0.01em; }
p { margin: 0 0 14px; color: var(--muted); }
p.small { font-size: 14px; }
ul, ol { margin: 0 0 16px; padding-left: 20px; }
li { margin: 6px 0; color: var(--muted); }
li::marker { color: var(--dim); }
strong { color: var(--text); font-weight: 600; }

/* ── cards ─────────────────────────────────────────────────────────────── */

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.card {
  display: block;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel) 92%, transparent), var(--panel-2));
  color: inherit;
}
.card:hover { border-color: var(--border-strong); text-decoration: none; }
.card--link:hover { border-color: color-mix(in srgb, var(--ember) 45%, var(--border)); transform: translateY(-1px); }
.card--link { transition: transform 0.15s ease, border-color 0.15s ease; }
.card p { margin: 0; font-size: 14.5px; }
.card ul { margin: 12px 0 0; padding-left: 18px; font-size: 14px; }
.card .kicker {
  display: block;
  margin-bottom: 8px;
  color: var(--dim);
  font-size: 11.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.callout {
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--ember);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--ember) 5%, var(--panel-2));
}
.callout p:last-child { margin-bottom: 0; }

/* ── code ──────────────────────────────────────────────────────────────── */

code { font: 13.5px/1.55 var(--mono); color: var(--text); }

pre {
  position: relative;
  margin: 0 0 8px;
  /* hug the command: the Copy chip must not sit 300px away from a 400px line */
  width: fit-content;
  max-width: 100%;
  padding: 14px 78px 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #05070a;
  overflow-x: auto;
}
pre code { color: #dbe4ef; }
pre .cmt { color: var(--dim); }

.copy {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font: 11.5px/1 var(--font);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}
.copy:hover { color: var(--text); border-color: var(--border-strong); }

/* ── tables ────────────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; background: var(--panel-2); }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--panel) 70%, transparent); }
th { color: var(--dim); font-size: 12px; letter-spacing: 0.07em; text-transform: uppercase; font-weight: 600; }
td { color: var(--muted); }
td:first-child { color: var(--text); white-space: nowrap; }
/* action tables: the action hugs the table edge instead of floating mid-row */
.table--actions { width: fit-content; max-width: 100%; }
.table--actions td:last-child { text-align: right; width: 1%; white-space: nowrap; }

/* ── steps ─────────────────────────────────────────────────────────────── */

.steps { counter-reset: step; list-style: none; padding: 0; }
.steps li { position: relative; padding-left: 42px; margin: 14px 0; }
.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 1px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--panel-2);
  color: var(--ember-soft);
  font: 600 13px/24px var(--mono);
  text-align: center;
}

/* ── footer ────────────────────────────────────────────────────────────── */

footer {
  margin-top: 64px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  color: var(--dim);
  font-size: 13.5px;
}
.foot-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
@media (min-width: 681px) { .foot-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.foot-grid h4 { margin: 0 0 8px; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }
.foot-grid ul { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.foot-grid li { margin: 6px 0; }
.foot-grid a { color: var(--muted); }
.foot-grid a:hover { color: var(--text); }
.fine { margin: 22px 0 0; color: var(--dim); font-size: 12.5px; }

.meta { color: var(--dim); font-size: 13.5px; }

/* ── narrow screens ────────────────────────────────────────────────────── */

@media (max-width: 680px) {
  body { padding: 0 16px 56px; }
  .topbar { margin: 0 -16px 18px; }
  .topbar-inner { max-width: none; padding: 13px 16px; gap: 12px; }
  .topnav { gap: 13px; font-size: 13.5px; }
  /* GitHub stays reachable from the footer on small screens. */
  .topnav .nav-gh { display: none; }
  section { margin-top: 42px; }
  .hero { padding-top: 18px; }
  /* Install lines and commands wrap instead of forcing a horizontal scroll. */
  pre { white-space: pre-wrap; overflow-wrap: anywhere; }
  .badge { line-height: 1.3; }
}

@media (max-width: 560px) {
  /* Label/value tables stack: no cut-off actions on a phone. */
  .table--stack tbody,
  .table--stack tr,
  .table--stack td { display: block; width: 100%; }
  .table--stack tr { padding: 10px 0; }
  .table--stack tr:last-child { padding-bottom: 2px; }
  .table--stack td { border-bottom: 0; padding: 2px 0; }
  .table--stack td:first-child { white-space: normal; }
  .table--stack td + td { padding-top: 4px; }
}

@media (max-width: 460px) {
  .actions { gap: 10px; }
  .actions .btn { flex: 1 1 100%; justify-content: center; }
  .hero h1 { font-size: clamp(26px, 8vw, 34px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card--link { transition: none; }
}
