/* ==========================================================================
   base.css — Reset, CSS Custom Properties, Typography Foundation
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties — Design Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Surface / Background */
  --color-bg:              #f8f9fa;
  --color-bg-alt:          #edeeef;
  --color-surface:         #f8f9fa;
  --color-surface-low:     #f3f4f5;
  --color-surface-high:    #e7e8e9;
  --color-surface-highest: #e1e3e4;
  --color-surface-lowest:  #ffffff;
  --color-border:          #c1c6d7;
  --color-border-subtle:   #e1e3e4;

  /* Text */
  --color-text-primary:    #191c1d;
  --color-text-secondary:  #414755;
  --color-text-muted:      #717786;

  /* Brand / Primary */
  --color-primary:         #007aff;
  --color-primary-hover:   #005fcb;
  --color-primary-text:    #ffffff;
  --color-primary-dim:     #adc6ff;

  /* Accent */
  --color-gold:            #f7bc6b;
  --color-gold-dark:       #7e5307;
  --color-red:             #ff5f6d;

  /* Macro colors */
  --color-protein:         #ff5f6d;
  --color-carbs:           #f7bc6b;
  --color-fats:            #81c995;

  /* Fonts */
  --font-sans:    system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif:   'Bodoni Moda', Georgia, 'Times New Roman', serif;
  --font-heading: var(--font-sans);
  --font-mono:    'Menlo', 'Consolas', monospace;

  /* Type scale */
  --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:  3rem;
  --text-6xl:  3.75rem;

  --weight-normal:   400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;
  --weight-black:    900;

  --leading-tight:   1.15;
  --leading-snug:    1.35;
  --leading-normal:  1.5;
  --leading-relaxed: 1.7;

  /* 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;
  --space-32: 8rem;

  /* Border radius — rounded */
  --radius-sm:   0.5rem;
  --radius-md:   0.75rem;
  --radius-lg:   1rem;
  --radius-xl:   1.5rem;
  --radius-2xl:  2rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg:  0 12px 24px rgba(0,0,0,0.08), 0 4px 8px rgba(0,0,0,0.04);
  --shadow-xl:  0 24px 48px rgba(0,0,0,0.10), 0 8px 16px rgba(0,0,0,0.04);
  --shadow-primary: 0 8px 24px rgba(0, 122, 255, 0.25);

  /* Transitions */
  --transition-fast:   150ms ease;
  --transition-normal: 280ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow:   500ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Layout */
  --container-max: 1280px;
  --container-pad: var(--space-6);
  --nav-height:    64px;
}

/* --------------------------------------------------------------------------
   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-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

input, button, select, textarea {
  font: inherit;
}

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

ul, ol {
  list-style: none;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  line-height: var(--leading-tight);
  font-weight: var(--weight-bold);
}

/* --------------------------------------------------------------------------
   Ambient Background
   -------------------------------------------------------------------------- */
.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  opacity: 0.35;
}

.ambient-bg::before {
  content: '';
  position: absolute;
  width: 70vw;
  height: 70vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 122, 255, 0.25) 0%, transparent 65%);
  top: -25%;
  left: -15%;
  filter: blur(80px);
}

.ambient-bg::after {
  content: '';
  position: absolute;
  width: 55vw;
  height: 55vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(247, 188, 107, 0.3) 0%, transparent 65%);
  bottom: 5%;
  right: -10%;
  filter: blur(100px);
}

/* --------------------------------------------------------------------------
   Animations
   -------------------------------------------------------------------------- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUpCentered {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 24px));
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

@keyframes fadeInUpCenteredRotated {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 24px)) rotate(-2deg);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(-2deg);
  }
}

.fade-in-up {
  animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.fade-in-up--delay-1 { animation-delay: 120ms; }
.fade-in-up--delay-2 { animation-delay: 250ms; }
.fade-in-up--delay-3 { animation-delay: 380ms; }

.scroll-reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

.scroll-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

:focus:not(:focus-visible) {
  outline: none;
}
