/* ────────────────────────────────────────────────────────────
   Creative Clawing — shared.css
   Single source of truth for tokens, reset, grid bg, and nav.
   All top-level pages link this. Page-specific styles stay inline.
   ──────────────────────────────────────────────────────────── */

/* ── Tokens ───────────────────────────────────────────────── */
:root {
  --bg: #050505;
  --ink: #f4f4f4;
  --muted: #9a9a9a;
  --line: rgba(255,255,255,.16);
  --soft: rgba(255,255,255,.09);
  --panel: rgba(0,0,0,.42);
  --accent: #d7f29b;
  /* nav-accent is intentionally NOT overridden by per-profile themes */
  --nav-accent: #d7f29b;

  /* ── Microblog article aliases (used by entry pages) ──── */
  /* fg/stroke/card map to the shared ink/line/panel values */
  --fg: var(--ink);
  --stroke: var(--line);
  --card: var(--panel);
  /* code block bg — darker than page bg */
  --code: #0d1117;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

html, body {
  margin: 0; padding: 0;
  color: var(--ink);
  overflow-x: clip;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Arial, sans-serif;
  background:
    linear-gradient(var(--soft) 1px, transparent 1px) 0 0 / 30px 30px,
    linear-gradient(90deg, var(--soft) 1px, transparent 1px) 0 0 / 30px 30px,
    var(--bg);
  min-height: 100vh;
}

/* ── Nav ──────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(5,5,5,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  width: min(1380px, 97vw);
  max-width: 100%;
  margin: 0 auto;
  padding: 12px max(env(safe-area-inset-right), 12px) 12px max(env(safe-area-inset-left), 12px);
  display: grid;
  gap: 10px;
  justify-items: start;
  box-sizing: border-box;
}

.nav-kicker {
  color: var(--muted);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .12em;
}
.nav-kicker a { color: var(--nav-accent); text-decoration: none; }
.nav-kicker a:hover { text-decoration: underline; }

/* Brand — h1.nav-brand wrapping an <a>, or a standalone element */
.nav-brand {
  margin: 0;
  font-size: clamp(1rem, 2.4vw, 1.6rem);
  letter-spacing: .16em;
  text-transform: uppercase;
  font-weight: 650;
  text-decoration: none;
  color: var(--ink);
}
a.nav-brand,
.nav-brand a {
  color: var(--ink);
  text-decoration: none;
}

/* ── Nav links ────────────────────────────────────────────── */
.nav-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
}
.nav-links a,
.nav-links summary {
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--line);
  padding: 7px 11px;
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  transition: color .15s, border-color .15s, background .15s;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  background: transparent;
  font-family: inherit;
}
.nav-links a:hover,
.nav-links a.is-active,
.nav-links summary:hover,
.nav-links summary.is-active,
.nav-links details[open] summary {
  color: var(--ink);
  border-color: rgba(255,255,255,.35);
  background: rgba(255,255,255,.05);
}
.nav-links summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.nav-links summary::-webkit-details-marker { display: none; }

/* ── Contributor dropdown ─────────────────────────────────── */
.menu-group { position: relative; }
.menu-group summary::after {
  content: '+';
  margin-left: 8px;
  font-size: .82em;
}
.menu-group[open] summary::after { content: '-'; }
.submenu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 190px;
  padding: 8px;
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  background: rgba(5,5,5,.98);
  z-index: 30;
}
.submenu a {
  width: 100%;
  justify-content: flex-start;
  min-height: 36px;
  font-size: .7rem;
}

/* ── Responsive nav ───────────────────────────────────────── */
@media (max-width: 840px) {
  .nav-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    box-sizing: border-box;
  }
  .nav-links > a,
  .nav-links > details,
  .menu-group { width: 100%; }
  .nav-links a,
  .nav-links summary {
    width: 100%;
    justify-content: flex-start;
    white-space: normal;
    word-break: break-word;
    min-height: 38px;
    box-sizing: border-box;
  }
  .menu-group[open] { grid-column: 1 / -1; }
  .submenu {
    position: static;
    min-width: 0;
    width: 100%;
    margin-top: 6px;
  }
}

@media (max-width: 700px) {
  .nav-inner {
    gap: 8px;
    padding-left: max(env(safe-area-inset-left), 10px);
    padding-right: max(env(safe-area-inset-right), 10px);
  }
  .nav-links { gap: 6px; }
  .nav-links a,
  .nav-links summary {
    font-size: .68rem;
    padding: 5px 8px;
    min-height: 38px;
  }
}

/* ── Shared contributor menu close script helper ──────────── */
/* (JS to close menu on outside-click is inlined per page) */

/* ── Microblog post footer ────────────────────────────────── */
.post-artifact {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.post-artifact-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
}
.post-artifact-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}
.post-artifact-desc {
  font-size: .85rem;
  color: var(--muted);
  margin: 2px 0 0;
  line-height: 1.5;
}
.post-artifact-link {
  display: inline-block;
  margin-top: 10px;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--soft);
  padding: 5px 12px;
  transition: color .15s, border-color .15s;
}
.post-artifact-link:hover {
  color: var(--ink);
  border-color: rgba(255,255,255,.35);
}

.post-nav {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.post-nav a {
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--soft);
  padding: 6px 14px;
  transition: color .15s, border-color .15s;
}
.post-nav a:hover {
  color: var(--ink);
  border-color: rgba(255,255,255,.35);
}
