/* ============================================
   JR Royal Services LLC - 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: #1F2937;
  --text-secondary: #6B7280;
  --royal-blue: #181D4D;
  --gold: #E3AD42;
  --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.5;
}

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

/* Dark Mode */
html[data-theme="dark"] {
  --bg-primary: #1A1F3A;
  --bg-secondary: #242B48;
  --text-primary: #F3F4F6;
  --text-secondary: #B8BCC8;
  --royal-blue: #4B5BA0;
  --gold: #D4A644;
  --border-color: #374151;
}

/* High Contrast Mode */
html[data-contrast="high"] {
  --text-primary: #000000;
  --text-secondary: #000000;
  --royal-blue: #000080;
  --gold: #FFD700;
  --border-color: #000000;
}

html[data-theme="dark"][data-contrast="high"] {
  --text-primary: #FFFFFF;
  --text-secondary: #FFFFFF;
  --royal-blue: #4169E1;
  --gold: #FFD700;
  --border-color: #FFFFFF;
}

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

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

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

/* Reduce Motion */
[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;
}

[data-reduce-motion="true"] html {
  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;
}

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

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Skip Link - FIXED */
.skip-link {
  position: absolute;
  top: -100px;  /* Fixed: Increased from -40px to fully hide the element */
  left: 0;
  background: var(--royal-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 */
.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);
}

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

.logo-text {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--royal-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(--royal-blue);
  outline: none;
}

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

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

.nav-links a[aria-current="page"]::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gold);
}

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

.mobile-menu-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: var(--spacing-4);
}

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

/* Settings Button */
.settings-btn {
  position: fixed;
  bottom: var(--spacing-24);
  right: var(--spacing-24);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--royal-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 img {
  filter: brightness(0) invert(1);
  width: 24px;
  height: 24px;
}

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

.settings-btn:focus-visible {
  outline: 2px solid var(--gold);
  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: 280px;
  box-shadow: var(--shadow-lg);
  z-index: 99;
  display: none;
}

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

.settings-panel h3 {
  font-size: 1.125rem;
  margin-bottom: var(--spacing-20);
  color: var(--royal-blue);
}

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

.setting-group label {
  display: block;
  margin-bottom: var(--spacing-8);
  font-weight: 500;
  color: var(--text-primary);
}

.setting-group label img {
  filter: brightness(0);
  vertical-align: text-bottom;
  margin-right: 4px;
}

html[data-theme="dark"] .setting-group label img {
  filter: brightness(0) invert(1);
}

.setting-group select,
.setting-group button {
  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,
.setting-group button:hover {
  border-color: var(--royal-blue);
}

.setting-group select:focus,
.setting-group button:focus {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

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

.theme-options button {
  padding: var(--spacing-8);
  font-size: 0.875rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-4);
}

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

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

/* Theme button icons */
.theme-options button img {
  width: 20px;
  height: 20px;
  opacity: 1;
  transition: all 0.2s ease;
}

.theme-options button:hover img {
  filter: brightness(0.7);
}

.theme-options button.active img {
  filter: brightness(0) invert(1);
  opacity: 1;
}

html[data-theme="dark"] .theme-options button img {
  filter: brightness(0) invert(0.7);
  opacity: 1;
}

html[data-theme="dark"] .theme-options button:hover img {
  filter: brightness(0) invert(0.85);
}

html[data-theme="dark"] .theme-options button.active img {
  filter: brightness(0) invert(1);
  opacity: 1;
}

/* ============================================
   NAVIGATION COMPONENTS
   ============================================ */

/* Breadcrumbs */
.breadcrumb {
  padding: var(--spacing-12) 0;
  font-size: 0.875rem;
}

.breadcrumb ol {
  list-style: none;
  display: flex;
  gap: var(--spacing-8);
  align-items: center;
}

.breadcrumb li::after {
  content: '›';
  margin-left: var(--spacing-8);
  color: var(--text-secondary);
}

.breadcrumb li:last-child::after {
  content: '';
}

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

.breadcrumb a:hover {
  color: var(--royal-blue);
}

.breadcrumb [aria-current="page"] {
  color: var(--text-primary);
  font-weight: 500;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
main {
  min-height: calc(100vh - 200px);
  padding: var(--spacing-40) 0;
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
  text-align: center;
  padding: var(--spacing-80) 0;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

.hero h1 {
  font-size: 3rem;
  font-weight: 700;
  color: var(--royal-blue);
  margin-bottom: var(--spacing-20);
}

.hero-logo {
  width: 120px;
  height: 120px;
  margin: 0 auto var(--spacing-32);
}

.hero-logo img {
  width: 100%;
  height: 100%;
  border-radius: var(--spacing-16);
}

.hero p {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-32);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hero-buttons {
  display: flex;
  gap: var(--spacing-16);
  justify-content: center;
  flex-wrap: wrap;
}

/* Hero Actions - for mixing buttons with App Store badge */
.hero-actions {
  display: flex;
  gap: var(--spacing-16);
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin-top: var(--spacing-24);
}

/* ============================================
   BUTTONS
   ============================================ */

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

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

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

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

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

.btn-gold {
  background: var(--gold);
  color: var(--royal-blue);
  border-color: var(--gold);
}

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

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

/* Aligned Buttons - for use with App Store badge */
.btn-aligned {
  display: inline-flex;
  align-items: center;
  height: 44px;  /* Fixed height matching App Store badge */
  padding: 0 var(--spacing-28);  /* Only horizontal padding */
  border-radius: var(--spacing-8);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  border: 2px solid transparent;
}

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

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

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

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

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

/* ============================================
   APP STORE BADGES
   ============================================ */

/* Base App Store badge - inline with buttons */
.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 */
html[data-theme="dark"] .app-badge img {
  content: url("/assets/apps/AppStoreWhite.svg");
}

/* CTA variant - larger, centered badge */
.app-badge--cta {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: var(--spacing-12) auto 0;
  height: 60px;
}

.app-badge--cta img {
  height: 100%;
  width: auto;
  display: inline-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 h2,
.card h3 {
  color: var(--royal-blue);
  margin-bottom: var(--spacing-16);
}

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

/* App Cards */
.app-card {
  text-align: center;
  padding: var(--spacing-40) var(--spacing-24);
}

.app-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--spacing-20);
  border-radius: var(--spacing-16);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.app-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-card h3 {
  font-size: 1.5rem;
  margin-bottom: var(--spacing-12);
}

/* miniAtlas logo theme swap */
.miniAtlas-logo {
  width: 120px;
  height: 120px;
  display: block;
}

html[data-theme="dark"] .miniAtlas-logo {
  content: url("/assets/apps/miniAtlas/logo-miniAtlas-dark.png");
}

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

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

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

.section-title {
  font-size: 2.5rem;
  text-align: center;
  color: var(--royal-blue);
  margin-bottom: var(--spacing-48);
}

.section-content {
  max-width: 800px;
  margin: 0 auto;
}

.section-content p {
  margin-bottom: var(--spacing-20);
  line-height: 1.8;
}

/* Feature List */
.feature-list {
  list-style: none;
  margin: var(--spacing-32) 0;
}

.feature-list li {
  padding: var(--spacing-16);
  margin-bottom: var(--spacing-16);
  background: var(--bg-secondary);
  border-left: 4px solid var(--gold);
  border-radius: var(--spacing-4);
}

.feature-list li strong {
  color: var(--royal-blue);
}

/* ============================================
   FOOTER
   ============================================ */
footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: var(--spacing-48) 0 var(--spacing-32);
  margin-top: var(--spacing-80);
}

.footer-content {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: var(--spacing-48);
  margin-bottom: var(--spacing-32);
}

.footer-brand h3 {
  color: var(--royal-blue);
  margin-bottom: var(--spacing-12);
}

.footer-brand p {
  color: var(--text-secondary);
  margin-bottom: var(--spacing-16);
}

.footer-section h4 {
  color: var(--text-primary);
  margin-bottom: var(--spacing-16);
}

.footer-section ul {
  list-style: none;
}

.footer-section li {
  margin-bottom: var(--spacing-12);
}

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

.footer-section a:hover {
  color: var(--royal-blue);
}

.footer-bottom {
  text-align: center;
  padding-top: var(--spacing-32);
  border-top: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.footer-bottom p {
  margin-bottom: var(--spacing-8);
}

/* ============================================
   CONTACT SECTION
   ============================================ */
.contact-info {
  background: var(--bg-secondary);
  padding: var(--spacing-32);
  border-radius: var(--spacing-12);
  margin: var(--spacing-32) 0;
}

.contact-info h3 {
  color: var(--royal-blue);
  margin-bottom: var(--spacing-20);
}

.contact-info p {
  margin-bottom: var(--spacing-12);
  color: var(--text-secondary);
}

.contact-info address {
  font-style: normal;
  color: var(--text-primary);
}

/* ============================================
   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;
  }
  
  .hero h1 {
    font-size: 2rem;
  }
  
  .hero p {
    font-size: 1.125rem;
  }
  
  .footer-content {
    grid-template-columns: 1fr;
    text-align: center;
  }
  
  .settings-panel {
    right: var(--spacing-16);
    left: var(--spacing-16);
    min-width: auto;
  }
  
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   LANGUAGE-SPECIFIC ADJUSTMENTS
   ============================================ */
[lang="da"] {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

[lang="fr"] {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Loading state */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

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

/* Text alignment */
.text-center {
  text-align: center;
}

/* Margin utilities */
.mt-32 {
  margin-top: var(--spacing-32);
}

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

/* Color utilities */
.gold-accent {
  color: var(--gold);
}