/* Main CSS file - deferred loading */

/* Additional styles beyond the critical CSS */

/* LCP optimization: Set content-visibility for non-critical content */
.historical-data,
.key-levels,
article > p:not(:first-of-type),
article > h3:not(:first-of-type),
.footer-content {
  content-visibility: auto;
  contain-intrinsic-size: auto 500px;
}

/* Chart-specific styles */
.chart-tab {
  transition: all 0.2s;
}
.chart-tab:hover {
  background: var(--secondary);
}
.chart-tab-content {
  display: none;
  margin-bottom: 2rem;
}
.chart-tab-content.active {
  display: block;
}
.secondary-chart-container {
  width: 100%;
  height: 400px;
  background: var(--background-alt);
  border-radius: 8px;
  margin: 1rem 0;
  position: relative;
  overflow: hidden;
}
.chart-description {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

/* Additional chart styles */
.additional-charts {
  margin-top: 3rem;
}
.chart-tabs {
  display: flex;
  gap: 0.5rem;
  margin: 1.5rem 0 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

/* Key levels and historical data styles */
.key-levels {
  background: var(--background-alt);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 2rem 0;
}
.level-item {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.level-item:last-child {
  border-bottom: none;
}
.level-label {
  font-weight: 600;
}
.level-value {
  font-family: monospace;
  font-size: 1.1rem;
}

/* Historical data table styles */
.historical-data {
  width: 100%;
  overflow-x: auto;
}
.historical-data table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 2rem;
}
.historical-data th, .historical-data td {
  padding: 0.75rem;
  border: 1px solid var(--border);
  text-align: right;
}
.historical-data th {
  background: var(--background-alt);
  font-weight: 600;
  text-align: center;
}
.historical-data tr:nth-child(even) {
  background: var(--background-alt);
}
.historical-data td:first-child {
  text-align: left;
}

/* Mobile responsiveness for charts */
@media (max-width: 768px) {
  .secondary-chart-container {
    height: 300px;
  }
  .chart-tabs {
    flex-wrap: wrap;
  }
  .chart-tab {
    flex: 1 0 auto;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.9rem;
  }
}

/* Typography enhancements */
p {
  margin-bottom: 1rem;
}

ul, ol {
  margin-bottom: 1.5rem;
  margin-left: 1.5rem;
}

blockquote {
  border-left: 4px solid var(--primary);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: var(--text-light);
  font-style: italic;
}

code {
  font-family: monospace;
  background: var(--background-alt);
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-size: 0.9em;
}

/* Links */
a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}

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

/* Form elements */
input, select, textarea, button {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--background);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 79, 140, 0.1);
}

button {
  background: var(--primary);
  color: white;
  border: none;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

button:hover {
  background: var(--primary-light);
}

/* Spacing utilities */
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 2rem; }

.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }
.p-5 { padding: 2rem; }

/* Alert components */
.alert {
  padding: 1rem;
  border-radius: 4px;
  margin: 1rem 0;
}

.alert-info {
  background-color: #e3f2fd;
  border: 1px solid #90caf9;
  color: #0d47a1;
}

.alert-warning {
  background-color: #fff3e0;
  border: 1px solid #ffcc80;
  color: #e65100;
}

.alert-success {
  background-color: #e8f5e9;
  border: 1px solid #a5d6a7;
  color: #1b5e20;
}

.alert-danger {
  background-color: #ffebee;
  border: 1px solid #ef9a9a;
  color: #b71c1c;
}

/* Badge */
.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-primary {
  background: var(--primary);
  color: white;
}

.badge-success {
  background: var(--success);
  color: white;
}

.badge-danger {
  background: var(--danger);
  color: white;
}

/* Card */
.card {
  background: var(--background);
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.card-header {
  padding: 1rem 1.5rem;
  background: var(--background-alt);
  border-bottom: 1px solid var(--border);
}

.card-body {
  padding: 1.5rem;
}

.card-footer {
  padding: 1rem 1.5rem;
  background: var(--background-alt);
  border-top: 1px solid var(--border);
}

/* Accessibility */
.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;
}

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

/* Enhanced hamburger menu for mobile */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.hamburger span {
  display: block;
  width: 25px;
  height: 3px;
  background: white;
  margin: 5px 0;
  border-radius: 3px;
  transition: all 0.3s;
}

@media (max-width: 768px) {
  .hamburger {
    display: block;
  }
  
  .mobile-menu-open nav ul {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--primary);
    padding: 1rem;
    z-index: 100;
  }
  
  .mobile-menu-open nav ul li {
    margin: 0.5rem 0;
  }
}

/* Print styles */
@media print {
  .no-print {
    display: none;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.5;
    color: #000;
    background: #fff;
  }
  
  a {
    color: #000;
    text-decoration: underline;
  }
  
  header, footer, .mobile-cta, .cta-buttons {
    display: none;
  }
  
  .container {
    width: 100%;
    max-width: none;
    padding: 0;
    margin: 0;
  }
  
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
    page-break-inside: avoid;
  }
  
  img {
    max-width: 100% !important;
    page-break-inside: avoid;
  }
  
  blockquote, table, pre {
    page-break-inside: avoid;
  }
  
  ul, ol, dl {
    page-break-before: avoid;
  }
}

/* Dark mode - activated via user preference */
@media (prefers-color-scheme: dark) {
  :root {
    --text: #e1e1e1;
    --text-light: #aaa;
    --background: #121212;
    --background-alt: #1e1e1e;
    --border: #333;
  }
  
  .card,
  .toc,
  .price-widget,
  .disclaimer,
  input, select, textarea {
    background: #1e1e1e;
  }
  
  img {
    opacity: 0.8;
  }
}

/* Animation utilities */
.fade-in {
  animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

.slide-in {
  animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
  0% { transform: translateY(20px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* Loading indicator */
.loader {
  display: inline-block;
  width: 30px;
  height: 30px;
  border: 3px solid rgba(13, 79, 140, 0.2);
  border-radius: 50%;
  border-top-color: var(--primary);
  animation: spin 1s ease-in-out infinite;
}

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