/* hub.gazar.dev — shared design system
 * Mirrors the gaz-frontend brand: navy ink, cream surface, serif body,
 * system-sans headings, mono accents. Structural shapes (cards, buttons,
 * dividers) are drawn hand-sketched by Rough.js — see assets/hub-rough.js.
 * Every page links this file via <link rel="stylesheet" href="/assets/hub.css">. */

:root {
  /* Brand */
  --brand-navy: #09244B;
  --brand-red: #C8102E;
  --brand-sky: #4A90D9;
  --brand-cream: #F7F5F2;

  /* Semantic — derived from brand-navy */
  --ink-strong: #09244B;
  --ink-soft: rgba(9, 36, 75, 0.72);
  --ink-muted: rgba(9, 36, 75, 0.48);
  --surface: #F7F5F2;
  --surface-muted: rgba(9, 36, 75, 0.03);
  --surface-overlay: rgba(9, 36, 75, 0.05);
  --border-subtle: rgba(9, 36, 75, 0.10);
  --border-strong: rgba(9, 36, 75, 0.25);

  /* Type */
  --font-heading: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  --font-body: charter, Georgia, Cambria, 'Times New Roman', Times, serif;
  --font-accent: 'IBM Plex Mono', 'SFMono-Regular', ui-monospace, Menlo, monospace;

  --size-display: clamp(2.75rem, 5vw, 4rem);
  --size-h1: clamp(2rem, 4vw, 3rem);
  --size-h2: clamp(1.5rem, 3vw, 2.25rem);
  --size-h3: clamp(1.25rem, 2vw, 1.5rem);
  --size-body: 1.0625rem;
  --size-small: 0.9375rem;
  --size-label: 0.6875rem;

  /* Radii (used only by the no-JS fallback; Rough.js ignores them) */
  --radius-xs: 0.375rem;
  --radius: 0.625rem;
  --radius-lg: 0.875rem;

  --tracking-wide: 0.18em;

  /* ONE content width, used everywhere for a consistent wide layout. */
  --content-width: 1320px;
  --content-pad: 2rem;

  /* Rough.js defaults (overridable per component) */
  --rough-stroke: var(--brand-navy);
  --rough-fill-style: solid;
}

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

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

body {
  margin: 0;
  background-color: var(--surface);
  color: var(--ink-strong);
  font-family: var(--font-body);
  font-size: var(--size-body);
  line-height: 1.58;
  letter-spacing: -0.003em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  word-break: break-word;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink-strong);
  margin: 0 0 0.5em;
}
h1 { font-size: var(--size-h1); }
h2 { font-size: var(--size-h2); }
h3 { font-size: var(--size-h3); }

p { margin: 0 0 1.15em; color: var(--ink-soft); }

a { color: var(--brand-sky); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre, kbd { font-family: var(--font-accent); font-size: 0.9em; }
pre {
  background: var(--brand-navy);
  color: var(--brand-cream);
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
}
code { background: var(--surface-overlay); padding: 0.1em 0.35em; border-radius: var(--radius-xs); }
pre code { background: none; padding: 0; }

/* ---- Layout: one consistent, wide container everywhere ---- */
.hub-container {
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--content-pad);
}
/* Back-compat alias — same width as the default container now. */
.hub-container--wide { max-width: var(--content-width); }

.hub-eyebrow {
  font-family: var(--font-accent);
  font-size: var(--size-label);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 0.75rem;
}

/* ---- Buttons ---- */
.hub-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-heading);
  font-size: var(--size-small);
  font-weight: 600;
  letter-spacing: -0.01em;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.12s ease;
  text-decoration: none;
}
.hub-btn:hover { text-decoration: none; transform: translateY(-1px); }
.hub-btn--primary { background: var(--brand-navy); color: #fff; --rough-fill: var(--brand-navy); --rough-stroke: var(--brand-navy); }
.hub-btn--primary:hover { background: #0c2f63; }
.hub-btn--ghost { background: transparent; color: var(--ink-strong); border-color: var(--border-strong); --rough-stroke: var(--brand-navy); }
.hub-btn--ghost:hover { background: var(--surface-overlay); }

/* ---- Card ---- */
.hub-card {
  display: block;
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  --rough-fill: #ffffff;
  --rough-stroke: var(--brand-navy);
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}
a.hub-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: 0 12px 28px -18px rgba(9, 36, 75, 0.45);
}

/* ---- Chrome ---- */
.hub-header { padding: 4rem 0 2.5rem; }
.hub-footer {
  padding: 3rem 0 4rem;
  margin-top: 4rem;
  border-top: 1px solid var(--border-subtle);
  color: var(--ink-muted);
  font-family: var(--font-accent);
  font-size: var(--size-small);
}

/* ---- Dividers (rendered as sketchy lines when rough is on) ---- */
hr, .hub-rule { border: 0; border-top: 1px solid var(--border-subtle); margin: 2.5rem 0; height: 1px; }

/* ---- Index layouts ---- */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}
/* Full-width stacked list — one card per row spanning the container. */
.hub-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
.hub-grid h3, .hub-list h3 { margin-bottom: 0.35rem; }
.hub-grid p, .hub-list p { margin: 0; font-size: var(--size-small); color: var(--ink-soft); }
.hub-card .hub-slug {
  display: inline-block;
  margin-top: 0.85rem;
  font-family: var(--font-accent);
  font-size: var(--size-label);
  letter-spacing: 0.04em;
  color: var(--ink-muted);
}

/* ====================================================================
 * Rough.js layer. `.rough-on` is added to <html> by hub-rough.js once it
 * runs. Until then the plain-CSS borders above are the fallback.
 * ==================================================================== */
.rough-on .hub-card,
.rough-on .hub-btn,
.rough-on [data-rough] {
  position: relative;
  isolation: isolate;          /* keep the negative-z sketch behind content */
}
.hub-rough-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;                 /* behind text, in front of nothing else */
  pointer-events: none;
  overflow: visible;
}

/* Hand off the visible border/fill to Rough.js. */
.rough-on .hub-card {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.rough-on a.hub-card:hover { box-shadow: none; transform: translateY(-2px); }

.rough-on .hub-btn { background: transparent !important; border-color: transparent; }

/* Dividers: hide the CSS rule and let Rough.js draw the line. */
.rough-on hr,
.rough-on .hub-rule {
  border: 0;
  height: 1.4rem;
  position: relative;
  isolation: isolate;
}

@media (prefers-reduced-motion: reduce) {
  .hub-btn, .hub-card { transition: none; }
}
