/* rgl-base.css — Replyglint design tokens, reset, and typography */

/* ====================================================================
   1. DESIGN TOKENS
   ==================================================================== */
:root {
  /* Brand palette */
  --rgl-navy:           #0B1829;
  --rgl-navy-alt:       #111E30;
  --rgl-navy-card:      #162035;
  --rgl-teal:           #00C9A7;
  --rgl-teal-aa:        #007B68;
  --rgl-amber:          #F59E0B;

  /* Foreground tokens */
  --rgl-fg-light-primary:   #0B1829;
  --rgl-fg-light-secondary: #475569;
  --rgl-fg-dark-primary:    #EEF2F7;
  --rgl-fg-dark-secondary:  #94A3B8;

  /* Background tokens */
  --rgl-bg-light:  #F5F8FB;
  --rgl-bg-white:  #FFFFFF;
  --rgl-bg-dark:   #0B1829;
  --rgl-bg-dark-alt: #111E30;
  --rgl-bg-card:   #162035;

  /* Borders */
  --rgl-border-light: rgba(11,24,41,0.10);
  --rgl-border-dark:  rgba(238,242,247,0.12);

  /* Typography */
  --rgl-font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --rgl-font-mono: 'JetBrains Mono', 'Fira Code', Consolas, 'Courier New', monospace;

  /* Spacing scale */
  --rgl-space-xs:  0.25rem;
  --rgl-space-sm:  0.5rem;
  --rgl-space-md:  1rem;
  --rgl-space-lg:  1.5rem;
  --rgl-space-xl:  2rem;
  --rgl-space-2xl: 3rem;
  --rgl-space-3xl: 4rem;
  --rgl-space-4xl: 6rem;

  /* Border radius */
  --rgl-radius-sm: 4px;
  --rgl-radius:    8px;
  --rgl-radius-lg: 12px;
  --rgl-radius-xl: 16px;
  --rgl-radius-pill: 100px;

  /* Transitions */
  --rgl-transition: 200ms ease;
  --rgl-transition-md: 300ms ease;

  /* Container */
  --rgl-container-max: 1200px;
  --rgl-container-pad: clamp(1rem, 5vw, 3rem);
}

/* ====================================================================
   2. RESET + BOX MODEL
   ==================================================================== */
*, *::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(--rgl-font-sans);
  font-size: 1rem;
  line-height: 1.625;
  color: var(--rgl-fg-light-primary);
  background: var(--rgl-bg-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.rgl-page--dark-top {
  background: var(--rgl-bg-dark);
}

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

img {
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

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

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

address {
  font-style: normal;
}

/* ====================================================================
   3. TYPOGRAPHY
   ==================================================================== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--rgl-font-sans);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2.25rem, 5vw, 3.5rem); line-height: 1.1; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.75rem, 3.5vw, 2.25rem); line-height: 1.2; font-weight: 600; letter-spacing: -0.015em; }
h3 { font-size: 1.5rem; line-height: 1.35; font-weight: 600; letter-spacing: -0.01em; }
h4 { font-size: 1.25rem; font-weight: 600; }
h5 { font-size: 1rem; font-weight: 600; }

p { line-height: 1.7; }

.rgl-eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rgl-body-lg {
  font-size: 1.125rem;
  line-height: 1.75;
}

.rgl-text-muted {
  opacity: 0.7;
}

/* ====================================================================
   4. LAYOUT HELPERS
   ==================================================================== */
.rgl-container {
  width: 100%;
  max-width: var(--rgl-container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--rgl-container-pad);
  padding-right: var(--rgl-container-pad);
}

.rgl-section {
  padding-top: var(--rgl-space-4xl);
  padding-bottom: var(--rgl-space-4xl);
}

.rgl-section--sm {
  padding-top: var(--rgl-space-2xl);
  padding-bottom: var(--rgl-space-2xl);
}

.rgl-section--lg {
  padding-top: 7rem;
  padding-bottom: 7rem;
}

/* Section background contexts */
.rgl-bg--dark     { background: var(--rgl-bg-dark); }
.rgl-bg--dark-alt { background: var(--rgl-bg-dark-alt); }
.rgl-bg--light    { background: var(--rgl-bg-light); }
.rgl-bg--white    { background: var(--rgl-bg-white); }

/* Grid utilities */
.rgl-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--rgl-space-xl);
}

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

.rgl-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--rgl-space-xl);
}

@media (max-width: 1024px) {
  .rgl-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

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

/* Flex utilities */
.rgl-flex { display: flex; }
.rgl-flex-center { display: flex; align-items: center; justify-content: center; }
.rgl-flex-between { display: flex; align-items: center; justify-content: space-between; }

/* Text alignment */
.rgl-text-center { text-align: center; }
.rgl-text-left { text-align: left; }

/* Visibility */
.rgl-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;
}

/* ====================================================================
   5. BUTTONS
   ==================================================================== */
.rgl-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--rgl-radius);
  font-family: var(--rgl-font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--rgl-transition), color var(--rgl-transition),
              border-color var(--rgl-transition), box-shadow var(--rgl-transition),
              transform var(--rgl-transition);
  cursor: pointer;
  border: 2px solid transparent;
}

.rgl-btn:hover { transform: translateY(-1px); }
.rgl-btn:active { transform: translateY(0); }

/* primary — on light section */
.rgl-btn--primary {
  background: var(--rgl-teal-aa);
  color: #FFFFFF;
  border-color: var(--rgl-teal-aa);
}
.rgl-btn--primary:hover {
  background: #006657;
  border-color: #006657;
}

/* primary-dark — on dark section */
.rgl-btn--primary-dark {
  background: var(--rgl-teal);
  color: var(--rgl-navy);
  border-color: var(--rgl-teal);
}
.rgl-btn--primary-dark:hover {
  background: #00e0bb;
  border-color: #00e0bb;
}

/* outline-light — on light */
.rgl-btn--outline-light {
  background: transparent;
  color: var(--rgl-teal-aa);
  border-color: var(--rgl-teal-aa);
}
.rgl-btn--outline-light:hover {
  background: rgba(0,123,104,0.06);
}

/* outline-dark — on dark */
.rgl-btn--outline-dark {
  background: transparent;
  color: var(--rgl-teal);
  border-color: var(--rgl-teal);
}
.rgl-btn--outline-dark:hover {
  background: rgba(0,201,167,0.1);
}

/* ghost-on-dark */
.rgl-btn--ghost-on-dark {
  background: transparent;
  color: var(--rgl-fg-dark-primary);
  border-color: rgba(238,242,247,0.25);
}
.rgl-btn--ghost-on-dark:hover {
  background: rgba(238,242,247,0.08);
  border-color: rgba(238,242,247,0.4);
}

/* ghost-on-light */
.rgl-btn--ghost-on-light {
  background: transparent;
  color: var(--rgl-fg-light-primary);
  border-color: var(--rgl-border-light);
}
.rgl-btn--ghost-on-light:hover {
  background: rgba(11,24,41,0.05);
}

.rgl-btn--sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.rgl-btn--lg {
  padding: 1rem 2rem;
  font-size: 1rem;
}

/* ====================================================================
   6. SECTION HEADER
   ==================================================================== */
.rgl-section-header {
  max-width: 680px;
}

.rgl-section-header--center {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.rgl-section-header .rgl-eyebrow {
  margin-bottom: 0.75rem;
}

.rgl-section-header h2 {
  margin-bottom: 1rem;
}

.rgl-section-header p {
  font-size: 1.125rem;
  line-height: 1.7;
}

/* On dark sections */
.rgl-bg--dark .rgl-section-header h2,
.rgl-bg--dark-alt .rgl-section-header h2,
.rgl-bg--dark .rgl-section-header p,
.rgl-bg--dark-alt .rgl-section-header p { color: var(--rgl-fg-dark-primary); }

.rgl-bg--dark .rgl-eyebrow,
.rgl-bg--dark-alt .rgl-eyebrow { color: var(--rgl-teal); }

/* On light sections */
.rgl-bg--light .rgl-eyebrow,
.rgl-bg--white .rgl-eyebrow { color: var(--rgl-teal-aa); }

.rgl-bg--light .rgl-section-header h2,
.rgl-bg--white .rgl-section-header h2 { color: var(--rgl-fg-light-primary); }

.rgl-bg--light .rgl-section-header p,
.rgl-bg--white .rgl-section-header p { color: var(--rgl-fg-light-secondary); }

/* ====================================================================
   7. FADE-IN ANIMATION (with failsafe)
   ==================================================================== */
.rgl-fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.rgl-fade-in.is-visible {
  opacity: 1;
  transform: none;
}

/* Failsafe: force visible after 1.2s */
@keyframes rgl-force-visible {
  to { opacity: 1; transform: none; }
}
.rgl-fade-in {
  animation: rgl-force-visible 0.01s 1.2s forwards;
}
