/* ============================================
   RideLog — Main Stylesheet
   Reset, Typography, Layout, Components, Responsive
   ============================================ */

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

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

body {
  font-family: var(--font-main);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--accent-green-light);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--accent-orange);
}

ul, ol {
  list-style: none;
}

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

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid var(--glass-border);
}

/* --- Inline SVG Icons --- */
.icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 { font-size: var(--font-size-hero); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }

p {
  color: var(--text-secondary);
  line-height: 1.7;
}

.text-gradient {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }

/* --- Layout --- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.container--narrow {
  max-width: 800px;
}

.container--wide {
  max-width: 1400px;
}

section {
  padding: var(--space-xl) 0;
  position: relative;
}

section.bg-alt {
  background-color: var(--bg-secondary);
}

/* --- Flexbox Utilities --- */
.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-col {
  flex-direction: column;
}

.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* --- Grid --- */
.grid {
  display: grid;
  gap: var(--space-md);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: 0.875rem 2rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--font-size-base);
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
  text-decoration: none;
  line-height: 1;
}

.btn--primary {
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: 0 4px 20px rgba(139, 154, 70, 0.3);
}

.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(139, 154, 70, 0.5);
  color: #fff;
}

.btn--secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
}

.btn--secondary:hover {
  border-color: var(--accent-green);
  color: var(--accent-green-light);
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
}

.btn--ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.btn--sm {
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
}

.btn--lg {
  padding: 1.125rem 2.5rem;
  font-size: var(--font-size-lg);
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  transition: all 0.3s ease;
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(139, 154, 70, 0.3);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

/* --- Badge --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 1rem;
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 600;
  background: rgba(139, 154, 70, 0.15);
  color: var(--accent-green-light);
  border: 1px solid rgba(139, 154, 70, 0.3);
}

/* --- Section Header --- */
.section-header {
  text-align: center;
  max-width: 700px;
  margin: 0 auto var(--space-lg);
}

.section-header h2 {
  margin-bottom: var(--space-sm);
}

.section-header p {
  font-size: var(--font-size-lg);
}

/* --- Navbar --- */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 1rem 0;
  transition: all 0.3s ease;
}

.site-nav.scrolled {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  padding: 0.75rem 0;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.nav-logo img {
  height: 40px;
  width: auto;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.nav-links a {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9375rem;
  transition: color 0.3s ease;
  position: relative;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gradient-brand);
  transition: width 0.3s ease;
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.lang-switcher {
  display: flex;
  gap: 0.25rem;
}

.lang-switcher a {
  padding: 0.25rem 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: all 0.3s ease;
  text-transform: uppercase;
}

.lang-switcher a:hover,
.lang-switcher a.current-lang {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

/* Hamburger */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 0.5rem;
  cursor: pointer;
  z-index: 1001;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  transition: all 0.3s ease;
}

.nav-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Nav Overlay */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 26, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.nav-overlay.active {
  display: flex;
  opacity: 1;
}

.nav-overlay a {
  font-size: var(--font-size-2xl);
  font-weight: 600;
  color: var(--text-primary);
}

.nav-overlay a:hover {
  color: var(--accent-green-light);
}

/* --- Footer --- */
.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--glass-border);
  padding: var(--space-xl) 0 var(--space-md);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.footer-brand {
  text-align: left;
}

.footer-brand .footer-logo img {
  height: 36px;
  width: auto;
  margin-bottom: var(--space-sm);
}

.footer-brand p {
  font-size: 0.9375rem;
  margin-bottom: var(--space-md);
}

.footer-col h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
}

.footer-col ul {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.footer-col a {
  color: var(--text-muted);
  font-size: 0.9375rem;
  transition: color 0.3s ease;
}

.footer-col a:hover {
  color: var(--accent-green-light);
}

.footer-bottom {
  border-top: 1px solid var(--glass-border);
  padding-top: var(--space-md);
  text-align: center;
}

.footer-bottom p {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.app-store-badge {
  display: inline-block;
  transition: transform 0.3s ease;
}

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

.app-store-badge img {
  height: 44px;
}

/* --- Noise Texture Overlay --- */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  section {
    padding: var(--space-lg) 0;
  }

  h2 {
    font-size: var(--font-size-2xl);
  }

  .container {
    padding: 0 var(--space-sm);
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .nav-links,
  .nav-right .btn {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .section-header {
    margin-bottom: var(--space-md);
  }
}

@media (max-width: 480px) {
  .btn--lg {
    padding: 1rem 1.75rem;
    font-size: var(--font-size-base);
  }
}
