/* ==========================================================================
   TrustyRic — Main CSS
   Design system: tokens, reset, typography, layout, utilities
   ========================================================================== */

/* ── Design Tokens ──────────────────────────────────────────────────────── */
:root {
  /* Colors */
  --bg:            #0B0F1A;
  --bg-surface:    #111827;
  --bg-card:       #161D2F;
  --bg-card-hover: #1C2540;
  --border:        rgba(124, 58, 237, 0.15);
  --border-hover:  rgba(124, 58, 237, 0.35);
  --primary:       #7C3AED;
  --primary-light: #9D5FF5;
  --accent:        #A855F7;
  --accent-glow:   rgba(168, 85, 247, 0.12);
  --text:          #E5E7EB;
  --text-muted:    #9CA3AF;
  --text-faint:    #6B7280;
  --cream:         #EDE8DC;
  --gold:          #C8A96E;
  --success:       #22C55E;
  --danger:        #EF4444;
  --warning:       #F59E0B;

  /* Sponsor strip */
  --sponsor-bg:    rgba(124, 58, 237, 0.06);
  --sponsor-text:  #9CA3AF;

  /* Typography */
  --font-head: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Scale */
  --text-xs:   0.75rem;   /* 12px */
  --text-sm:   0.875rem;  /* 14px */
  --text-base: 1rem;      /* 16px */
  --text-lg:   1.125rem;  /* 18px */
  --text-xl:   1.25rem;   /* 20px */
  --text-2xl:  1.5rem;    /* 24px */
  --text-3xl:  1.875rem;  /* 30px */
  --text-4xl:  2.25rem;   /* 36px */
  --text-5xl:  3rem;      /* 48px */
  --text-6xl:  3.75rem;   /* 60px */

  /* Spacing */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Radius */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --transition: 200ms ease;
  --transition-slow: 350ms ease;

  /* Shadows */
  --shadow-card: 0 2px 16px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 24px rgba(124, 58, 237, 0.15);
  --shadow-glow-strong: 0 0 40px rgba(168, 85, 247, 0.2);

  /* Layout */
  --max-content: 760px;
  --max-wide:    1200px;
  --max-site:    1400px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--primary-light);
}

ul, ol {
  list-style: none;
}

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

button {
  cursor: pointer;
  border: none;
  background: none;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-head);
  line-height: 1.25;
  color: var(--cream);
  font-weight: 600;
}

p {
  color: var(--text);
  line-height: 1.75;
}

/* ── Typography ─────────────────────────────────────────────────────────── */
.heading-display {
  font-family: var(--font-head);
  font-size: clamp(var(--text-4xl), 6vw, var(--text-6xl));
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--cream);
}

.heading-1 { font-size: clamp(var(--text-3xl), 4vw, var(--text-5xl)); font-family: var(--font-head); }
.heading-2 { font-size: clamp(var(--text-2xl), 3vw, var(--text-4xl)); font-family: var(--font-head); }
.heading-3 { font-size: clamp(var(--text-xl), 2.5vw, var(--text-3xl)); font-family: var(--font-head); }
.heading-4 { font-size: var(--text-xl); font-family: var(--font-head); }

.text-muted  { color: var(--text-muted); }
.text-faint  { color: var(--text-faint); }
.text-accent { color: var(--accent); }
.text-gold   { color: var(--gold); }
.text-sm     { font-size: var(--text-sm); }
.text-xs     { font-size: var(--text-xs); }

/* ── Layout ─────────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-wide);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.container--narrow {
  max-width: var(--max-content);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.container--wide {
  max-width: var(--max-site);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.section {
  padding-block: var(--space-20);
}

.section--sm {
  padding-block: var(--space-12);
}

.section--lg {
  padding-block: var(--space-24);
}

/* Grid systems */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-6);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
}
.btn-primary:hover {
  background: var(--primary-light);
  border-color: var(--primary-light);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-hover);
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding-inline: var(--space-4);
}
.btn-ghost:hover {
  color: var(--text);
}

.btn--sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
}

.btn--lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
}

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-primary  { background: rgba(124, 58, 237, 0.15); color: var(--accent); border: 1px solid rgba(124, 58, 237, 0.2); }
.badge-success  { background: rgba(34, 197, 94, 0.12);  color: var(--success); border: 1px solid rgba(34, 197, 94, 0.2); }
.badge-danger   { background: rgba(239, 68, 68, 0.12);  color: var(--danger);  border: 1px solid rgba(239, 68, 68, 0.2); }
.badge-gold     { background: rgba(200, 169, 110, 0.12); color: var(--gold);   border: 1px solid rgba(200, 169, 110, 0.2); }
.badge-muted    { background: rgba(156, 163, 175, 0.1); color: var(--text-muted); border: 1px solid rgba(156, 163, 175, 0.15); }

/* ── Divider ─────────────────────────────────────────────────────────────── */
.divider {
  width: 100%;
  height: 1px;
  background: var(--border);
  margin-block: var(--space-8);
}

/* ── Section Headers ─────────────────────────────────────────────────────── */
.section-header {
  margin-bottom: var(--space-12);
}

.section-header .eyebrow {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-3);
}

.section-header h2 {
  margin-bottom: var(--space-3);
}

.section-header p {
  color: var(--text-muted);
  max-width: 540px;
  font-size: var(--text-lg);
}

/* ── Scroll bar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar        { width: 6px; height: 6px; }
::-webkit-scrollbar-track  { background: var(--bg); }
::-webkit-scrollbar-thumb  { background: var(--border-hover); border-radius: 3px; }

/* ── Selection ───────────────────────────────────────────────────────────── */
::selection {
  background: rgba(124, 58, 237, 0.3);
  color: var(--cream);
}

/* ── Focus ───────────────────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ── Reading content ─────────────────────────────────────────────────────── */
.entry-content h2,
.entry-content h3,
.entry-content h4 {
  margin-top: var(--space-8);
  margin-bottom: var(--space-4);
  color: var(--cream);
}

.entry-content p {
  margin-bottom: var(--space-5);
  font-size: var(--text-lg);
  line-height: 1.8;
}

.entry-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.entry-content ul,
.entry-content ol {
  list-style: disc;
  padding-left: var(--space-6);
  margin-bottom: var(--space-5);
}

.entry-content li {
  margin-bottom: var(--space-2);
  color: var(--text);
  font-size: var(--text-lg);
}

.entry-content blockquote {
  border-left: 3px solid var(--accent);
  padding: var(--space-4) var(--space-6);
  margin-block: var(--space-8);
  background: var(--bg-card);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.entry-content blockquote p {
  font-family: var(--font-head);
  font-size: var(--text-xl);
  color: var(--cream);
  font-style: italic;
  margin: 0;
}

.entry-content code {
  background: var(--bg-card);
  color: var(--accent);
  padding: 0.1em 0.4em;
  border-radius: var(--radius-sm);
  font-size: 0.9em;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .grid-cards { grid-template-columns: 1fr; }
  .container, .container--narrow, .container--wide { padding-inline: var(--space-4); }
  .section { padding-block: var(--space-12); }
  .section--lg { padding-block: var(--space-16); }
}

@media (max-width: 480px) {
  .container { padding-inline: var(--space-4); }
}
