/* ==========================================================================
   fitb - Custom CSS
   Modern Athletic Design System
   ========================================================================== */

/* --- Design Tokens (CSS Custom Properties) -------------------------------- */

:root {
  /* Base palette */
  --base-1: #333333;
  --base-2: #525C69;
  --base-4: #A8ADB4;
  --base-6: #DFE0E3;
  --base-7: #EDEEF0;
  --base-8: #FFFFFF;
  --base-black-fixed: #000000;
  --base-white-fixed: #FFFFFF;

  /* Accent palette */
  --accent-primary: #0075FF;
  --accent-link: #0154C8;
  --accent-primary-alt: #1F86FF;
  --accent-primary-alt-2: #58B1FF;
  --accent-success: #1BCE7B;
  --accent-success-alt: #10B769;
  --accent-success-alt-2: #00A659;
  --accent-warning: #FAA72C;
  --accent-alert: #FF5752;

  /* Background surfaces */
  --bg-primary: #FFFFFF;
  --bg-secondary: #F6FAFB;
  --bg-tertiary: #EEF2F4;
  --bg-vibrant-default: rgba(250, 251, 252, 0.92);
  --bg-vibrant-less: rgba(250, 251, 252, 0.86);

  /* Interactive state overlays */
  --bg-state-hover: rgba(0, 0, 0, 0.03);
  --bg-state-click: rgba(0, 0, 0, 0.06);
  --bg-state-hover-alt: rgba(255, 255, 255, 0.07);
  --bg-state-click-alt: rgba(255, 255, 255, 0.14);
  --bg-state-hover-overlay: rgba(0, 0, 0, 0.20);
  --bg-state-click-overlay: rgba(0, 0, 0, 0.32);
  --bg-state-hover-alt-overlay: rgba(255, 255, 255, 0.35);
  --bg-state-click-alt-overlay: rgba(255, 255, 255, 0.50);

  /* Layout */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08), 0 4px 8px rgba(0, 0, 0, 0.04);
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --------------------------------------------------------- */

*, *::before, *::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  padding: 0;
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--base-1);
  background-color: var(--bg-secondary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Links ---------------------------------------------------------------- */

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

a:hover {
  color: var(--accent-primary);
  text-decoration: underline;
}

a:active {
  color: var(--accent-primary-alt);
}

/* --- Glass Morphism ------------------------------------------------------- */

.glass {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.glass-subtle {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* --- HTMX Transition / Animation Classes ---------------------------------- */

/* Fade in */
.htmx-added,
.fade-in {
  animation: fadeIn var(--transition-normal) cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Fade out (applied by HTMX on swap-out) */
.htmx-swapping {
  animation: fadeOut var(--transition-fast) cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* Slide down (for new feed items, notifications) */
.slide-down {
  animation: slideDown var(--transition-normal) cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Slide up (modal entrance) */
.slide-up {
  animation: slideUp var(--transition-normal) cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Scale pop (likes, reactions) */
.pop {
  animation: pop var(--transition-fast) cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Spinner (loading indicator) */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--base-6);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* HTMX request indicator */
.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: inline-block;
}

/* Skeleton / placeholder */
.skeleton {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

/* --- Focus Rings ---------------------------------------------------------- */

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--accent-primary) !important;
  box-shadow: 0 0 0 3px rgba(0, 117, 255, 0.12);
}

/* --- Scrollbar Styling ---------------------------------------------------- */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--base-6);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--base-4);
}

/* Hide scrollbar for carousel */
.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* --- Card Effects --------------------------------------------------------- */

.card-hover {
  transition: transform 150ms cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* --- Button Effects ------------------------------------------------------- */

.btn-press:active {
  transform: scale(0.98);
}

/* --- Utility Classes ------------------------------------------------------ */

.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;
}

.text-muted {
  color: var(--base-4);
}

.text-success {
  color: var(--accent-success);
}

.text-warning {
  color: var(--accent-warning);
}

.text-alert {
  color: var(--accent-alert);
}
