/**
 * Responsive Styles for Saju Website
 */

/* ===================================
   Tablet Styles (768px - 1024px)
   =================================== */

@media (max-width: 1024px) {
  /* Header adjustments */
  .header-container {
    padding: var(--spacing-md) var(--spacing-lg);
  }
  
  /* Hero adjustments */
  .hero-title .brush-stroke {
    font-size: var(--text-4xl);
  }
  
  /* Form adjustments */
  .time-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  /* Results adjustments */
  .interpretation {
    grid-template-columns: 1fr;
  }
  
  /* Info grid adjustments */
  .info-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===================================
   Mobile Styles (640px - 768px)
   =================================== */

@media (max-width: 768px) {
  /* Navigation */
  .main-nav {
    gap: var(--spacing-md);
  }
  
  .main-nav a {
    font-size: var(--text-sm);
  }
  
  /* Hero section */
  #hero-section {
    min-height: 60vh;
  }
  
  .hero-title .brush-stroke {
    font-size: var(--text-3xl);
  }
  
  .hero-title .subtitle {
    font-size: var(--text-lg);
  }
  
  /* Form layout */
  .date-input-group {
    grid-template-columns: 1fr;
  }
  
  .time-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .gender-select {
    flex-direction: column;
    align-items: center;
  }
  
  .gender-card {
    width: 100%;
    max-width: 300px;
  }
  
  /* Saju table */
  .saju-table {
    grid-template-columns: repeat(2, 1fr);
    max-width: 400px;
  }
  
  /* Elements chart */
  .chart-container {
    height: 250px;
  }
  
  /* Info grid */
  .info-grid {
    grid-template-columns: 1fr;
  }
  
  /* Footer */
  .footer-content {
    flex-direction: column;
    text-align: center;
  }
  
  .footer-links {
    flex-direction: column;
    gap: var(--spacing-sm);
  }
}

/* ===================================
   Small Mobile Styles (< 640px)
   =================================== */

@media (max-width: 640px) {
  /* Base typography */
  :root {
    --text-base: 0.875rem;
    --text-lg: 1rem;
    --text-xl: 1.125rem;
    --text-2xl: 1.25rem;
    --text-3xl: 1.5rem;
    --text-4xl: 1.875rem;
    --text-5xl: 2.25rem;
  }
  
  /* Header */
  #site-header {
    position: relative;
  }
  
  .header-container {
    flex-direction: column;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
  }
  
  .logo-area {
    margin-bottom: var(--spacing-sm);
  }
  
  .main-nav {
    width: 100%;
    justify-content: center;
  }
  
  /* Hero section */
  #hero-section {
    min-height: 50vh;
    padding: var(--spacing-xl) var(--spacing-md);
  }
  
  .hero-content {
    padding: var(--spacing-lg);
  }
  
  .hero-title .brush-stroke {
    font-size: var(--text-2xl);
  }
  
  .hero-title .subtitle {
    font-size: var(--text-base);
  }
  
  /* Luopan Compass - Mobile */
  .bagua-compass {
    width: 200px;
    height: 200px;
  }
  
  .mountain {
    font-size: 9px;
    width: 16px;
    height: 16px;
    line-height: 16px;
  }
  
  .trigram {
    font-size: 16px;
    width: 24px;
    height: 24px;
    line-height: 24px;
  }
  
  .branch {
    font-size: 11px;
    width: 20px;
    height: 20px;
    line-height: 20px;
  }
  
  .compass-center {
    width: 45px;
    height: 45px;
  }
  
  .needle-pointer {
    width: 3px;
  }
  
  .center-dot {
    width: 10px;
    height: 10px;
  }
  
  .cta-button {
    font-size: var(--text-base);
    padding: var(--spacing-sm) var(--spacing-md);
  }
  
  /* Section containers */
  .section-container {
    padding: var(--spacing-2xl) var(--spacing-md);
  }
  
  .section-title {
    font-size: var(--text-2xl);
    margin-bottom: var(--spacing-lg);
  }
  
  /* Form elements */
  #saju-form {
    padding: 0 var(--spacing-sm);
  }
  
  .calendar-type {
    flex-direction: column;
    gap: var(--spacing-sm);
  }
  
  .radio-card {
    width: 100%;
  }
  
  .input-field select {
    font-size: var(--text-sm);
  }
  
  .time-grid {
    gap: var(--spacing-xs);
  }
  
  .time-grid button {
    padding: var(--spacing-xs);
  }
  
  .hour-name {
    font-size: var(--text-sm);
  }
  
  .hour-time {
    font-size: 10px;
  }
  
  /* Results section */
  .saju-table {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
    max-width: 300px;
  }
  
  .pillar {
    display: grid;
    grid-template-columns: auto 1fr 1fr;
    align-items: center;
    gap: var(--spacing-md);
    text-align: left;
  }
  
  .pillar-title {
    font-weight: var(--font-bold);
  }
  
  /* Elements analysis */
  .elements-analysis {
    padding: var(--spacing-lg);
  }
  
  .chart-container {
    height: 200px;
  }
  
  .elements-legend {
    grid-template-columns: 1fr;
  }
  
  /* Interpretation cards */
  .interpretation-card {
    padding: var(--spacing-lg);
  }
  
  .interpretation-card h3 {
    font-size: var(--text-base);
  }
  
  .interpretation-card p {
    font-size: var(--text-sm);
  }
  
  /* Share buttons */
  .share-buttons {
    flex-direction: column;
    width: 100%;
  }
  
  .share-btn {
    width: 100%;
    justify-content: center;
  }
  
  /* Info cards */
  .info-card {
    padding: var(--spacing-lg);
  }
  
  .info-card h3 {
    font-size: var(--text-lg);
  }
  
  .info-card p {
    font-size: var(--text-sm);
  }
  
  /* Advertisement containers */
  #adsense-top-banner {
    min-height: 60px;
  }
  
  #adsense-infeed,
  #adsense-display,
  #adsense-matched {
    margin: var(--spacing-lg) 0;
  }
}

/* ===================================
   Dark Mode Support
   =================================== */

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg-primary: #1A1A1A;
    --color-bg-secondary: #2A2A2A;
    --color-bg-tertiary: #3A3A3A;
    --color-text-primary: #E0E0E0;
    --color-text-secondary: #A0A0A0;
    --color-text-tertiary: #808080;
    --color-text-inverse: #1A1A1A;
    --color-border: #404040;
    --color-border-light: #303030;
    --color-border-dark: #505050;
    --color-shadow: rgba(0, 0, 0, 0.3);
    --color-shadow-dark: rgba(0, 0, 0, 0.5);
  }
  
  .ink-wash-pattern {
    opacity: 0.3;
  }
  
  .hero-background {
    background: linear-gradient(135deg, #1A1A1A 0%, #2A2A2A 100%);
  }
  
  .ad-container {
    background: #2A2A2A;
    border-color: #404040;
  }
  
  .ad-container::before {
    color: #808080;
  }
}