/* ==========================================================================
   RipRed AI Theme — Base Styles
   Brand tokens, reset, typography, globals
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Custom Properties (Brand Tokens)
   -------------------------------------------------------------------------- */
:root {
  /* Brand Colors */
  --color-primary-red:   #DD0B15;
  --color-deep-red:      #901914;
  --color-dark-red:      #490E12;
  --color-green:         #1FA63F;
  --color-light-green:   #59B039;
  --color-muted-rose:    #A66266;
  --color-soft-rose:     #C79396;
  --color-white:         #FFFFFF;
  --color-black:         #111111;
  --color-dark-bg:       #171313;
  --color-soft-bg:       #F7F7F7;
  --color-border:        #E6E6E6;
  --color-text:          #1F1F1F;
  --color-muted-text:    #6B6B6B;

  /* Semantic aliases */
  --color-bg:            var(--color-white);
  --color-surface:       var(--color-soft-bg);
  --color-surface-dark:  var(--color-dark-bg);
  --color-accent:        var(--color-primary-red);
  --color-accent-hover:  var(--color-deep-red);

  /* Typography */
  --font-logo-rip:      "One Slice", sans-serif;
  --font-logo-red-ai:   "Atemica Sans", sans-serif;
  --font-brand-display: "Forma DJR Display", "Sora", "Inter", Arial, sans-serif;
  --font-heading:       "Forma DJR Display", "Sora", "Inter", Arial, sans-serif;
  --font-body:          "Forma DJR Display", "Inter", "Manrope", Arial, sans-serif;
  --font-ui:            "Inter", "Manrope", Arial, sans-serif;

  /* Font sizes (fluid) */
  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;
  --text-4xl:  2.25rem;
  --text-5xl:  clamp(2.25rem, 5vw, 3rem);
  --text-6xl:  clamp(2.75rem, 6vw, 3.75rem);
  --text-hero: clamp(2.5rem, 7vw, 4.5rem);

  /* Line heights */
  --leading-tight:   1.15;
  --leading-snug:    1.25;
  --leading-normal:  1.5;
  --leading-relaxed: 1.65;
  --leading-loose:   1.8;

  /* Spacing scale */
  --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;
  --space-32: 8rem;

  /* Section spacing */
  --section-pad-y:       clamp(3rem, 8vw, 6rem);
  --section-pad-y-lg:    clamp(4rem, 10vw, 8rem);
  --section-pad-x:       clamp(1rem, 5vw, 2rem);

  /* Container */
  --container-max:       1200px;
  --container-wide:      1400px;
  --container-narrow:    760px;
  --container-px:        clamp(1rem, 5vw, 2rem);

  /* Border radius */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-2xl:  24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm:   0 1px 3px 0 rgb(0 0 0 / 0.08), 0 1px 2px -1px rgb(0 0 0 / 0.06);
  --shadow-md:   0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.06);
  --shadow-lg:   0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.06);
  --shadow-xl:   0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.06);
  --shadow-red:  0 4px 20px rgb(221 11 21 / 0.2);
  --shadow-red-lg: 0 8px 32px rgb(221 11 21 / 0.25);

  /* Transitions */
  --transition-fast:   150ms ease;
  --transition-base:   250ms ease;
  --transition-slow:   400ms ease;

  /* Z-index scale */
  --z-base:    0;
  --z-above:   10;
  --z-header:  100;
  --z-overlay: 200;
  --z-modal:   300;
  --z-toast:   400;
}

/* --------------------------------------------------------------------------
   2. CSS 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%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* --------------------------------------------------------------------------
   3. Typography
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: var(--leading-tight);
  color: var(--color-text);
  letter-spacing: -0.02em;
}

h1 { font-size: var(--text-hero); }
h2 { font-size: var(--text-5xl);  }
h3 { font-size: var(--text-3xl);  }
h4 { font-size: var(--text-2xl);  }
h5 { font-size: var(--text-xl);   font-weight: 600; }
h6 { font-size: var(--text-lg);   font-weight: 600; }

p {
  margin-bottom: var(--space-4);
  color: var(--color-text);
}

p:last-child { margin-bottom: 0; }

strong, b { font-weight: 700; }
em, i     { font-style: italic; }

small { font-size: var(--text-sm); }

a {
  color: var(--color-primary-red);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-deep-red);
  text-decoration: underline;
}

a:focus-visible {
  outline: 2px solid var(--color-primary-red);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Lists */
ul, ol {
  padding-left: var(--space-6);
  margin-bottom: var(--space-4);
}

ul { list-style: disc; }
ol { list-style: decimal; }

li { margin-bottom: var(--space-2); }

/* Blockquote */
blockquote {
  border-left: 4px solid var(--color-primary-red);
  padding: var(--space-4) var(--space-6);
  margin: var(--space-8) 0;
  background-color: var(--color-soft-bg);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: var(--text-lg);
  font-style: italic;
  color: var(--color-muted-text);
}

/* Code */
code, kbd, samp {
  font-family: "Fira Code", "Courier New", monospace;
  font-size: 0.9em;
  background-color: var(--color-soft-bg);
  padding: 0.1em 0.4em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

pre {
  background-color: var(--color-dark-bg);
  color: var(--color-white);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  margin-bottom: var(--space-6);
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: var(--text-sm);
  color: inherit;
}

/* --------------------------------------------------------------------------
   4. Images and Media
   -------------------------------------------------------------------------- */
img, video, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

img {
  border-style: none;
}

figure {
  margin: 0;
}

figcaption {
  font-size: var(--text-sm);
  color: var(--color-muted-text);
  margin-top: var(--space-2);
  text-align: center;
}

/* --------------------------------------------------------------------------
   5. Forms (base)
   -------------------------------------------------------------------------- */
input,
textarea,
select,
button {
  font-family: var(--font-ui);
  font-size: var(--text-base);
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background-color: var(--color-white);
  color: var(--color-text);
  line-height: var(--leading-normal);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-primary-red);
  box-shadow: 0 0 0 3px rgb(221 11 21 / 0.12);
}

input::placeholder,
textarea::placeholder {
  color: var(--color-muted-text);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

label {
  display: block;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

/* --------------------------------------------------------------------------
   6. Horizontal Rules / Dividers
   -------------------------------------------------------------------------- */
hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-8) 0;
}

/* --------------------------------------------------------------------------
   7. Tables
   -------------------------------------------------------------------------- */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-6);
}

th, td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

th {
  font-weight: 700;
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted-text);
  background-color: var(--color-soft-bg);
}

tr:hover td {
  background-color: var(--color-soft-bg);
}

/* --------------------------------------------------------------------------
   8. Accessibility Utilities
   -------------------------------------------------------------------------- */
.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.screen-reader-text:focus {
  background-color: var(--color-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  clip: auto;
  color: var(--color-text);
  display: block;
  font-size: var(--text-sm);
  font-weight: 700;
  height: auto;
  left: var(--space-4);
  line-height: normal;
  padding: var(--space-3) var(--space-6);
  text-decoration: none;
  top: var(--space-4);
  width: auto;
  z-index: var(--z-toast);
}

/* Focus visible for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--color-primary-red);
  outline-offset: 3px;
}

/* Remove focus outline for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
