/* ============================================================
   GUARDJO — Base Styles
   Reset + Typography + Global foundations
   ============================================================ */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  tab-size: 4;
}

body {
  font-family: var(--g-font-sans);
  font-size: var(--g-text-base);
  font-weight: var(--g-weight-regular);
  line-height: var(--g-leading-normal);
  letter-spacing: var(--g-tracking-normal);
  color: var(--g-ink-primary);
  background-color: var(--g-canvas);
  transition: background-color var(--g-duration-slow) var(--g-ease-default),
              color var(--g-duration-slow) var(--g-ease-default);
}

/* ── Canvas background pattern (subtle mesh for glass to sit on) ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(26, 86, 219, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(59, 111, 246, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 0%, rgba(26, 86, 219, 0.03) 0%, transparent 40%);
  pointer-events: none;
}

[data-theme="dark"] body::before {
  background:
    radial-gradient(ellipse at 20% 20%, rgba(26, 86, 219, 0.10) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(59, 111, 246, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 0%, rgba(26, 86, 219, 0.05) 0%, transparent 40%);
}

/* ── Base element resets ─────────────────────────────────── */
a {
  color: var(--g-accent);
  text-decoration: none;
  transition: color var(--g-duration-fast) var(--g-ease-default);
}
a:hover {
  color: var(--g-accent-hover);
}

img, svg {
  display: block;
  max-width: 100%;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

ul, ol {
  list-style: none;
}

table {
  border-collapse: collapse;
  width: 100%;
}

hr {
  border: none;
  height: 1px;
  background: var(--g-border-default);
  margin: var(--g-space-8) 0;
}

code, pre {
  font-family: var(--g-font-mono);
}

::selection {
  background: var(--g-royal-200);
  color: var(--g-royal-900);
}

[data-theme="dark"] ::selection {
  background: var(--g-royal-800);
  color: var(--g-royal-100);
}


/* ── Typography Scale ────────────────────────────────────── */

/* Display — Hero headlines, landing pages */
.text-display {
  font-size: var(--g-text-5xl);
  font-weight: var(--g-weight-extrabold);
  line-height: var(--g-leading-tight);
  letter-spacing: var(--g-tracking-tight);
  color: var(--g-ink-primary);
}

/* H1 — Page titles */
.text-h1,
h1 {
  font-size: var(--g-text-4xl);
  font-weight: var(--g-weight-bold);
  line-height: var(--g-leading-tight);
  letter-spacing: var(--g-tracking-tight);
  color: var(--g-ink-primary);
}

/* H2 — Section headers */
.text-h2,
h2 {
  font-size: var(--g-text-2xl);
  font-weight: var(--g-weight-bold);
  line-height: var(--g-leading-snug);
  letter-spacing: var(--g-tracking-tight);
  color: var(--g-ink-primary);
}

/* H3 — Card titles, subsections */
.text-h3,
h3 {
  font-size: var(--g-text-xl);
  font-weight: var(--g-weight-semibold);
  line-height: var(--g-leading-snug);
  color: var(--g-ink-primary);
}

/* H4 — Small headings */
.text-h4,
h4 {
  font-size: var(--g-text-md);
  font-weight: var(--g-weight-semibold);
  line-height: var(--g-leading-snug);
  color: var(--g-ink-primary);
}

/* H5/H6 — Labels used as mini-headings */
.text-h5, h5,
.text-h6, h6 {
  font-size: var(--g-text-sm);
  font-weight: var(--g-weight-semibold);
  line-height: var(--g-leading-normal);
  letter-spacing: var(--g-tracking-wide);
  text-transform: uppercase;
  color: var(--g-ink-tertiary);
}

/* Body */
.text-body {
  font-size: var(--g-text-base);
  font-weight: var(--g-weight-regular);
  line-height: var(--g-leading-normal);
  color: var(--g-ink-primary);
}

.text-body-lg {
  font-size: var(--g-text-md);
  font-weight: var(--g-weight-regular);
  line-height: var(--g-leading-relaxed);
  color: var(--g-ink-secondary);
}

/* Small / Supporting text */
.text-small {
  font-size: var(--g-text-sm);
  line-height: var(--g-leading-normal);
  color: var(--g-ink-secondary);
}

/* Caption / Metadata */
.text-caption {
  font-size: var(--g-text-xs);
  font-weight: var(--g-weight-medium);
  line-height: var(--g-leading-normal);
  letter-spacing: var(--g-tracking-wide);
  color: var(--g-ink-tertiary);
}

/* Label (form labels, data labels) */
.text-label {
  font-size: var(--g-text-sm);
  font-weight: var(--g-weight-medium);
  line-height: var(--g-leading-normal);
  color: var(--g-ink-secondary);
}

/* Overline — section pre-titles */
.text-overline {
  font-size: var(--g-text-xs);
  font-weight: var(--g-weight-bold);
  line-height: var(--g-leading-normal);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--g-accent);
}

/* Data / Metric — big numbers */
.text-metric {
  font-family: var(--g-font-sans);
  font-size: var(--g-text-4xl);
  font-weight: var(--g-weight-extrabold);
  line-height: 1;
  letter-spacing: var(--g-tracking-tight);
  color: var(--g-ink-primary);
  font-variant-numeric: tabular-nums;
}

.text-metric-sm {
  font-size: var(--g-text-2xl);
  font-weight: var(--g-weight-bold);
  line-height: 1;
  letter-spacing: var(--g-tracking-tight);
  font-variant-numeric: tabular-nums;
}

/* Monospace / Code */
.text-mono {
  font-family: var(--g-font-mono);
  font-size: var(--g-text-sm);
  font-variant-numeric: tabular-nums;
}


/* ── Utility: Text Colors ────────────────────────────────── */
.text-primary   { color: var(--g-ink-primary); }
.text-secondary { color: var(--g-ink-secondary); }
.text-tertiary  { color: var(--g-ink-tertiary); }
.text-muted     { color: var(--g-ink-muted); }
.text-accent    { color: var(--g-accent); }
.text-success   { color: var(--g-success-text); }
.text-warning   { color: var(--g-warning-text); }
.text-danger    { color: var(--g-danger-text); }
.text-info      { color: var(--g-info-text); }
.text-inverse   { color: var(--g-ink-inverse); }

/* ── Utility: Font Weights ───────────────────────────────── */
.font-regular  { font-weight: var(--g-weight-regular); }
.font-medium   { font-weight: var(--g-weight-medium); }
.font-semibold { font-weight: var(--g-weight-semibold); }
.font-bold     { font-weight: var(--g-weight-bold); }
.font-extrabold { font-weight: var(--g-weight-extrabold); }

/* ── Utility: Layout ─────────────────────────────────────── */
.flex          { display: flex; }
.flex-col      { flex-direction: column; }
.flex-wrap     { flex-wrap: wrap; }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-1  { gap: var(--g-space-1); }
.gap-2  { gap: var(--g-space-2); }
.gap-3  { gap: var(--g-space-3); }
.gap-4  { gap: var(--g-space-4); }
.gap-5  { gap: var(--g-space-5); }
.gap-6  { gap: var(--g-space-6); }
.gap-8  { gap: var(--g-space-8); }
.gap-10 { gap: var(--g-space-10); }

.grid          { display: grid; }
.grid-cols-2   { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3   { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4   { grid-template-columns: repeat(4, 1fr); }

.w-full   { width: 100%; }
.h-full   { height: 100%; }
.mx-auto  { margin-inline: auto; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Utility: Spacing ────────────────────────────────────── */
.p-2  { padding: var(--g-space-2); }
.p-3  { padding: var(--g-space-3); }
.p-4  { padding: var(--g-space-4); }
.p-5  { padding: var(--g-space-5); }
.p-6  { padding: var(--g-space-6); }
.p-8  { padding: var(--g-space-8); }

.px-3 { padding-inline: var(--g-space-3); }
.px-4 { padding-inline: var(--g-space-4); }
.px-5 { padding-inline: var(--g-space-5); }
.px-6 { padding-inline: var(--g-space-6); }

.py-2 { padding-block: var(--g-space-2); }
.py-3 { padding-block: var(--g-space-3); }
.py-4 { padding-block: var(--g-space-4); }

.mb-1 { margin-bottom: var(--g-space-1); }
.mb-2 { margin-bottom: var(--g-space-2); }
.mb-3 { margin-bottom: var(--g-space-3); }
.mb-4 { margin-bottom: var(--g-space-4); }
.mb-6 { margin-bottom: var(--g-space-6); }
.mb-8 { margin-bottom: var(--g-space-8); }
.mb-10 { margin-bottom: var(--g-space-10); }
.mb-12 { margin-bottom: var(--g-space-12); }

.mt-1 { margin-top: var(--g-space-1); }
.mt-2 { margin-top: var(--g-space-2); }
.mt-4 { margin-top: var(--g-space-4); }
.mt-6 { margin-top: var(--g-space-6); }

/* ── Utility: Visibility ─────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Responsive Container ────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--g-content-max-width);
  margin-inline: auto;
  padding-inline: var(--g-space-6);
}

@media (max-width: 768px) {
  .text-display { font-size: var(--g-text-3xl); }
  h1, .text-h1 { font-size: var(--g-text-2xl); }
  h2, .text-h2 { font-size: var(--g-text-xl); }
  .text-metric { font-size: var(--g-text-2xl); }
  .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 { grid-template-columns: 1fr; }
}
