/* ============================================
   Julius Bjerrekaer - Main Stylesheet
   4px spacing system: 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48...
   ============================================ */

/* ============================================
   CSS CUSTOM PROPERTIES / VARIABLES
   ============================================ */
:root {
  /* Light Mode Colors */
  --bg-primary: #FFFFFF;
  --bg-secondary: #F8F9FB;
  --text-primary: #1d1d1f;
  --text-secondary: #86868b;
  --accent-blue: #007AFF;
  --border-color: #E5E7EB;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
  
  /* 4px Spacing System */
  --spacing-4: 4px;
  --spacing-8: 8px;
  --spacing-12: 12px;
  --spacing-16: 16px;
  --spacing-20: 20px;
  --spacing-24: 24px;
  --spacing-28: 28px;
  --spacing-32: 32px;
  --spacing-36: 36px;
  --spacing-40: 40px;
  --spacing-44: 44px;
  --spacing-48: 48px;
  --spacing-56: 56px;
  --spacing-64: 64px;
  --spacing-72: 72px;
  --spacing-80: 80px;
  
  /* Typography */
  --font-size-base: 16px;
  --line-height-base: 1.6;
}

/* ============================================
   THEME VARIATIONS
   ============================================ */

/* Dark Mode */
html[data-theme="dark"] {
  --bg-primary: #000000;
  --bg-secondary: #1d1d1f;
  --text-primary: #f5f5f7;
  --text-secondary: #a1a1a6;
  --accent-blue: #0A84FF;
  --border-color: #38383a;
}

/* High Contrast Mode */
html[data-contrast="high"] {
  --text-primary: #000000;
  --text-secondary: #000000;
  --accent-blue: #0000FF;
  --border-color: #000000;
}

html[data-theme="dark"][data-contrast="high"] {
  --text-primary: #FFFFFF;
  --text-secondary: #FFFFFF;
  --accent-blue: #00BFFF;
  --border-color: #FFFFFF;
}

/* Text Size Adjustments */
html[data-text-size="small"] {
  --font-size-base: 14px;
}

html[data-text-size="large"] {
  --font-size-base: 18px;
}

html[data-text-size="extra-large"] {
  --font-size-base: 20px;
}

/* Reduce Motion */
html[data-reduce-motion="true"] * {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

/* ============================================
   BASE STYLES / RESET
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: var(--font-size-base);
  scroll-behavior: smooth;
}

html[data-reduce-motion="true"] {
  scroll-behavior: auto;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  line-height: var(--line-height-base);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
}

html[data-reduce-motion="true"] body {
  transition: none;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--accent-blue);
  color: white;
  padding: var(--spacing-8) var(--spacing-16);
  text-decoration: none;
  z-index: 100;
  border-radius: var(--spacing-4);
}

.skip-link:focus {
  top: var(--spacing-8);
}

/* ============================================
   LAYOUT COMPONENTS
   ============================================ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-20);
}

/* ============================================
   HEADER & NAVIGATION
   ============================================ */
header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  padding: var(--spacing-16) 0;
  position: sticky;
  top: 0;
  z-index: 50;
  transition: all 0.3s ease;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-32);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--spacing-12);
  text-decoration: none;
}

.logo img {
  height: 40px;
  width: 40px;
  border-radius: var(--spacing-8);
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent-blue);
  text-decoration: none;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: var(--spacing-32);
  align-items: center;
}

.nav-links a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  padding: var(--spacing-8) var(--spacing-4);
  transition: color 0.2s ease;
  position: relative;
}

.nav-links a:hover,
.nav-links a:focus {
  color: var(--accent-blue);
  outline: none;
}

.nav-links a:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
  border-radius: var(--spacing-4);
}

.nav-links a[aria-current="page"] {
  color: var(--accent-blue);
}

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: var(--spacing-8);
  color: var(--text-primary);
}

/* ============================================
   SETTINGS PANEL
   ============================================ */

/* Settings Button - Bottom Right */
.settings-btn {
  position: fixed;
  bottom: var(--spacing-24);
  right: var(--spacing-24);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-blue);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  transition: transform 0.2s ease;
}

.settings-btn svg {
  width: 24px;
  height: 24px;
}

.settings-btn:hover {
  transform: scale(1.1);
}

.settings-btn:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

/* Settings Panel */
.settings-panel {
  position: fixed;
  bottom: var(--spacing-80);
  right: var(--spacing-24);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--spacing-12);
  padding: var(--spacing-24);
  min-width: 300px;
  max-width: 340px;
  box-shadow: var(--shadow-lg);
  z-index: 99;
  display: none;
}

.settings-panel.active {
  display: block;
}

.settings-panel h3 {
  font-size: 1.25rem;
  margin-bottom: var(--spacing-20);
  color: var(--accent-blue);
  font-weight: 600;
}

.setting-group {
  margin-bottom: var(--spacing-20);
}

.setting-group:last-child {
  margin-bottom: 0;
}

.setting-group label {
  display: flex;
  align-items: center;
  gap: var(--spacing-8);
  margin-bottom: var(--spacing-8);
  font-weight: 500;
  color: var(--text-primary);
}

.setting-group label svg {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
}

.setting-group select {
  width: 100%;
  padding: var(--spacing-8) var(--spacing-12);
  border: 1px solid var(--border-color);
  border-radius: var(--spacing-8);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.setting-group select:hover {
  border-color: var(--accent-blue);
}

.setting-group select:focus {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* Theme Options - 3 Buttons */
.theme-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-8);
}

.theme-options button {
  padding: var(--spacing-12) var(--spacing-8);
  font-size: 0.875rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-4);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--spacing-8);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-options button:hover {
  border-color: var(--accent-blue);
}

.theme-options button svg {
  width: 20px;
  height: 20px;
}

.theme-options button span {
  font-size: 0.75rem;
  font-weight: 500;
}

.theme-options button.active {
  background: var(--accent-blue);
  color: white;
  border-color: var(--accent-blue);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-block;
  padding: var(--spacing-12) var(--spacing-24);
  border-radius: var(--spacing-8);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  border: 2px solid transparent;
  font-size: 1rem;
}

.btn-primary {
  background: var(--accent-blue);
  color: white;
  border-color: var(--accent-blue);
}

.btn-primary:hover {
  background: transparent;
  color: var(--accent-blue);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: transparent;
  color: var(--accent-blue);
  border-color: var(--accent-blue);
}

.btn-secondary:hover {
  background: var(--accent-blue);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

/* Fixed-height buttons for alignment with App Store badge */
.btn-aligned {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 var(--spacing-24);
  border-radius: var(--spacing-8);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  border: 2px solid transparent;
  font-size: 1rem;
  line-height: 1;
}

.btn-aligned:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

/* Hero Action Buttons - Inline row with aligned heights */
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-12);
  justify-content: center;
  align-items: center;
  margin-top: var(--spacing-24);
}

/* ============================================
   APP STORE BADGES
   ============================================ */
.app-badge {
  display: inline-flex;
  align-items: center;
  height: 44px;
  line-height: 0;
}

.app-badge img {
  height: 100%;
  width: auto;
  display: block;
}

/* Dark mode badge swap - uses display toggle, NOT content property */
.app-badge .badge-light {
  display: block;
}

.app-badge .badge-dark {
  display: none;
}

html[data-theme="dark"] .app-badge .badge-light {
  display: none;
}

html[data-theme="dark"] .app-badge .badge-dark {
  display: block;
}

/* ============================================
   THEME-AWARE IMAGES
   ============================================ */
.logo-light {
  display: block;
}

.logo-dark {
  display: none;
}

html[data-theme="dark"] .logo-light {
  display: none;
}

html[data-theme="dark"] .logo-dark {
  display: block;
}

/* Generic theme switching classes */
.theme-light {
  display: block;
}

.theme-dark {
  display: none;
}

html[data-theme="dark"] .theme-light {
  display: none;
}

html[data-theme="dark"] .theme-dark {
  display: block;
}

/* ============================================
   CARDS
   ============================================ */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--spacing-12);
  padding: var(--spacing-32);
  transition: all 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.card h3 {
  color: var(--accent-blue);
  margin-bottom: var(--spacing-16);
}

.card p {
  color: var(--text-secondary);
  margin-bottom: var(--spacing-20);
}

/* ============================================
   GRID LAYOUTS
   ============================================ */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--spacing-24);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--spacing-24);
}

/* ============================================
   SECTIONS
   ============================================ */
.section {
  padding: var(--spacing-64) 0;
}

.section-title {
  font-size: 2rem;
  text-align: center;
  color: var(--text-primary);
  margin-bottom: var(--spacing-12);
}

.section-subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-48);
}

/* ============================================
   FOOTER
   ============================================ */
footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: var(--spacing-40) 0;
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: var(--spacing-32);
  margin-bottom: var(--spacing-20);
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--accent-blue);
}

.footer-copyright {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    flex-direction: column;
    padding: var(--spacing-20);
    gap: var(--spacing-16);
  }
  
  .nav-links.active {
    display: flex;
  }
  
  .mobile-menu-btn {
    display: block;
  }
  
  .settings-panel {
    right: var(--spacing-16);
    left: var(--spacing-16);
    min-width: auto;
    max-width: none;
  }
  
  .settings-btn {
    bottom: var(--spacing-16);
    right: var(--spacing-16);
  }
  
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }
  
  .hero-actions .btn,
  .hero-actions .btn-aligned,
  .hero-actions .app-badge {
    width: 100%;
    justify-content: center;
  }
  
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
  
  .footer-links {
    flex-direction: column;
    gap: var(--spacing-12);
  }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.text-center {
  text-align: center;
}

.mt-32 {
  margin-top: var(--spacing-32);
}

.mb-32 {
  margin-bottom: var(--spacing-32);
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
  .settings-btn,
  .settings-panel,
  .mobile-menu-btn {
    display: none !important;
  }
  
  header {
    position: static;
  }
}