/* ============================================================
   EthosEcho — Global Stylesheet
   Variables, Reset, View Transitions, Typography, Base Layout
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
  /* Brand — Moodlio */
  --color-primary: #10B981;
  --color-primary-light: #34D399;
  --color-primary-dark: #059669;
  --color-bg: #F8FAFC;
  --color-bg-alt: #F1F5F9;
  --color-surface: #FFFFFF;
  --color-text: #0F172A;
  --color-text-secondary: #475569;
  --color-text-muted: #94A3B8;
  --color-border: #E2E8F0;
  --color-btn-text: #FFFFFF;

  /* Mood Scale */
  --mood-1: #EF4444;
  --mood-2: #F97316;
  --mood-3: #EAB308;
  --mood-4: #22C55E;
  --mood-5: #10B981;

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

  /* Typography */
  --font-body: system-ui, sans-serif;
  --font-display: system-ui, sans-serif;
  --font-mono: monospace;

  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.8125rem);
  --text-sm: clamp(0.8125rem, 0.75rem + 0.3125vw, 0.9375rem);
  --text-base: clamp(0.9375rem, 0.875rem + 0.3125vw, 1.0625rem);
  --text-lg: clamp(1.0625rem, 0.975rem + 0.4375vw, 1.25rem);
  --text-xl: clamp(1.25rem, 1.1rem + 0.75vw, 1.5rem);
  --text-2xl: clamp(1.5rem, 1.25rem + 1.25vw, 2rem);
  --text-3xl: clamp(1.875rem, 1.5rem + 1.875vw, 2.5rem);
  --text-4xl: clamp(2.25rem, 1.75rem + 2.5vw, 3.25rem);
  --text-5xl: clamp(2rem, 1.5rem + 3.75vw, 4.5rem);

  /* Layout */
  --max-width: 1200px;
  --max-width-narrow: 720px;
  --max-width-wide: 1440px;
  --nav-height: 64px;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;
}

/* --- Dark Mode --- */
@media (prefers-color-scheme: dark) {
  :root {
    --color-primary: #34D399;
    --color-primary-light: #6EE7B7;
    --color-primary-dark: #10B981;
    --color-bg: #0B1220;
    --color-bg-alt: #111827;
    --color-surface: #1E293B;
    --color-text: #F1F5F9;
    --color-text-secondary: #CBD5E1;
    --color-text-muted: #64748B;
    --color-border: #334155;
    --color-btn-text: #052014;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  }
}

/* --- View Transitions (CSS-only) --- */
@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 200ms;
  animation-timing-function: var(--ease-out);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  hanging-punctuation: first last;
}

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

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

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

p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
  max-width: 65ch;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  text-underline-offset: 0.15em;
}

a:hover {
  text-decoration: underline;
}

ul, ol {
  list-style: none;
}

/* --- Utility Classes --- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--space-lg);
}

.container--narrow {
  max-width: var(--max-width-narrow);
}

.container--wide {
  max-width: var(--max-width-wide);
}

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

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

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

/* --- Typography Utilities --- */
.text-center { text-align: center; }
.text-balance { text-wrap: balance; }

.heading-xl {
  font-family: var(--font-display);
  font-size: var(--text-5xl);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.heading-lg {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  font-weight: 700;
  letter-spacing: -0.015em;
}

.heading-md {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.heading-sm {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 600;
}

.subheading {
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
  max-width: 55ch;
}

/* --- Button Base --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-lg);
  font-weight: 600;
  font-size: var(--text-base);
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
  text-decoration: none;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: translateY(0);
}

.btn--primary {
  background-color: var(--color-primary);
  color: var(--color-btn-text);
}

.btn--primary:hover {
  background-color: var(--color-primary-dark);
}

.btn--outline {
  background-color: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}

.btn--lg {
  padding: 1rem 2rem;
  font-size: var(--text-lg);
  border-radius: var(--radius-xl);
}

/* --- App Store Badge --- */
.app-store-badge {
  display: inline-block;
  height: 54px;
  transition: transform var(--duration-fast) var(--ease-out);
}

.app-store-badge:hover {
  transform: scale(1.05);
}
