/* ===== RESPONSIVE DESIGN ===== */
/* Mobile-first responsive design patterns */

/* ===== BASE MOBILE STYLES ===== */
/* All styles above are mobile-first, these are overrides */

/* ===== SMALL MOBILE (up to 480px) ===== */
@media (max-width: 480px) {
  /* Ultra-small mobile adjustments */
  .container {
    padding: 0 var(--space-sm);
  }
  
  /* Typography scaling for small screens */
  .text-5xl { font-size: 2rem; }
  .text-4xl { font-size: 1.75rem; }
  .text-3xl { font-size: 1.5rem; }
  
  /* Hero adjustments */
  .hero {
    min-height: 100vh;
    padding: var(--space-lg) 0;
  }
  
  /* Button full width on small mobile */
  .btn {
    width: 100%;
    justify-content: center;
  }
  
  /* Modal adjustments */
  .modal__content {
    margin: var(--space-sm);
    max-height: calc(100vh - 1rem);
  }
  
  /* Card padding reduction */
  .card {
    padding: var(--space-lg);
  }
  
  .card--feature {
    padding: var(--space-lg);
  }
  
  /* Stats grid for very small screens */
  .stats {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
  
  /* Reduce spacing */
  .section {
    padding: var(--space-xl) 0;
  }
}

/* ===== MOBILE (481px to 767px) ===== */
@media (min-width: 481px) and (max-width: 767px) {
  /* Medium mobile adjustments */
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* Hero actions can be row on larger mobile */
  .hero__actions {
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
  }
}

/* ===== TABLET (769px to 1023px) ===== */
@media (min-width: 769px) and (max-width: 1023px) {
  /* Navigation adjustments - Only show desktop nav on tablet+ */
  .nav__menu {
    display: flex;
  }
  
  .nav__toggle {
    display: none;
  }
  
  /* Grid adjustments for tablet */
  .grid--3 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* Stats grid for tablet */
  .stats {
    grid-template-columns: repeat(3, 1fr);
  }
  
  /* Features grid adjustment */
  .grid--features {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* Modal content width */
  .modal__content {
    max-width: 90%;
  }
}

/* ===== DESKTOP (1024px and up) ===== */
@media (min-width: 1024px) {
  /* Full desktop navigation */
  .nav__menu {
    display: flex;
  }
  
  .nav__toggle {
    display: none;
  }
  
  /* Grid systems work as intended */
  .grid--3 {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .grid--4 {
    grid-template-columns: repeat(4, 1fr);
  }
  
  /* Stats full grid */
  .stats {
    grid-template-columns: repeat(4, 1fr);
  }
  
  /* Larger spacing for desktop */
  .section {
    padding: var(--space-4xl) 0;
  }
  
  /* Hover effects only on desktop */
  .card:hover {
    transform: translateY(-2px);
  }
  
  .btn:hover {
    transform: translateY(-1px);
  }
  
  /* Larger hero text */
  .hero h1 {
    font-size: var(--font-5xl);
  }
}

/* ===== LARGE DESKTOP (1280px and up) ===== */
@media (min-width: 1280px) {
  /* Even more spacing for large screens */
  .section--lg {
    padding: var(--space-4xl) 0 var(--space-4xl);
  }
  
  /* Larger modal on big screens */
  .modal__content {
    max-width: 800px;
  }
  
  /* More comfortable padding */
  .container {
    padding: 0 var(--space-lg);
  }
}

/* ===== MOBILE NAVIGATION OVERRIDES ===== */
@media (max-width: 768px) {
  /* Mobile menu styles */
  .nav__toggle {
    display: flex;
    position: relative;
    width: 35px;
    height: 35px;
    background: transparent;
    border: var(--border-dark);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 0;
    z-index: calc(var(--z-modal) + 2);
  }
  
  .nav__toggle::before {
    content: "☰";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    color: var(--color-text-primary);
    line-height: 1;
  }
  
  .nav__toggle.active::before {
    content: "✕";
    font-size: 18px;
  }
  
  /* Mobile menu positioning - HIDE BY DEFAULT */
  .nav__menu {
    display: none !important; /* Hide by default */
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 300px;
    height: 100vh;
    background: var(--color-dark-tertiary);
    border-left: var(--border-purple-subtle);
    transition: right var(--transition-base);
    z-index: var(--z-modal);
    padding: 80px 30px 30px;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
  }
  
  /* Show menu when active/open state is triggered */
  .nav-open .nav__menu,
  .menu-open .nav__menu,
  .nav__menu.active {
    display: block !important;
    right: 0;
  }
  
  /* Mobile menu list */
  .nav__list {
    flex-direction: column;
    gap: 0;
  }
  
  .nav__item {
    border-bottom: var(--border-dark-subtle);
  }
  
  .nav__item:last-child {
    border-bottom: none;
  }
  
  .nav__link {
    display: block;
    padding: var(--space-md) 0;
    color: var(--color-text-primary);
    font-size: var(--font-base);
    font-weight: var(--font-weight-medium);
    transition: color var(--transition-base);
  }
  
  .nav__link:hover,
  .nav__link--active {
    color: var(--color-primary);
  }
  
  /* Mobile menu overlay */
  .mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: calc(100% - 300px);
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: calc(var(--z-modal) - 1);
  }
  
  .mobile-menu-overlay.active {
    display: block;
  }
  
  /* Prevent body scroll when menu is open */
  body.menu-open {
    overflow: hidden;
  }
  
  /* ===== MOBILE "READY TO DISAPPEAR" SECTION ALIGNMENT FIX ===== */
  /* Fix alignment for "Discover our story", "verify our commitment", "transparency reports" links */
  .about-section {
    text-align: center;
  }
  
  .about-section .hero-section__description {
    text-align: center;
    line-height: 1.6;
  }
  
  .about-section .hero-section__description a,
  .about-section .text-purple {
    display: inline;
    text-align: center;
    white-space: normal;
    word-wrap: break-word;
    line-height: inherit;
  }
  
  .about-section .hero-section__redacted {
    text-align: center;
    line-height: 1.6;
  }
  
  .about-section .hero-section__redacted a {
    display: inline;
    text-align: center;
    white-space: normal;
    word-wrap: break-word;
  }
}

/* ===== TOUCH DEVICE OPTIMIZATIONS ===== */
@media (hover: none) and (pointer: coarse) {
  /* Remove hover effects on touch devices */
  .card:hover,
  .btn:hover,
  .hover-lift:hover,
  .hover-scale:hover {
    transform: none;
  }
  
  /* Larger touch targets */
  .btn {
    min-height: var(--touch-target);
  }
  
  .nav__link {
    padding: var(--space-md) var(--space-sm);
  }
  
  /* Better form inputs for touch */
  .form-input {
    min-height: var(--touch-target);
    font-size: 16px; /* Prevent zoom on iOS */
  }
}

/* ===== HIGH DPI / RETINA DISPLAYS ===== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* Optimizations for high DPI displays */
  /* Use crisp-edges for small text */
  .font-mono,
  .terminal,
  code {
    -webkit-font-smoothing: auto;
    -moz-osx-font-smoothing: auto;
  }
}

/* ===== LANDSCAPE MOBILE ADJUSTMENTS ===== */
@media (max-width: 767px) and (orientation: landscape) {
  /* Landscape mobile specific styles */
  .hero {
    min-height: auto;
    padding: var(--space-lg) 0;
  }
  
  .hero h1 {
    font-size: var(--font-3xl);
  }
  
  .section {
    padding: var(--space-lg) 0;
  }
  
  /* Reduce vertical spacing in landscape */
  .my-xl,
  .py-xl {
    margin-top: var(--space-md);
    margin-bottom: var(--space-md);
    padding-top: var(--space-md);
    padding-bottom: var(--space-md);
  }
}

/* ===== PRINT STYLES ===== */
@media print {
  /* Basic print optimizations */
  * {
    background: transparent !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  
  a,
  a:visited {
    text-decoration: underline;
  }
  
  .nav,
  .btn,
  .modal,
  .hero {
    display: none;
  }
  
  .container {
    max-width: none;
    margin: 0;
    padding: 0;
  }
  
  h1, h2, h3 {
    page-break-after: avoid;
  }
  
  p {
    orphans: 3;
    widows: 3;
  }
}

/* ===== ACCESSIBILITY: REDUCE MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  /* Disable animations for users who prefer reduced motion */
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  /* Keep essential animations but make them much faster */
  .animate-pulse,
  .animate-bounce,
  .animate-fadeIn,
  .animate-slideUp {
    animation-duration: 0.01ms !important;
  }
}

/* ===== ACCESSIBILITY: HIGH CONTRAST ===== */
@media (prefers-contrast: high) {
  /* High contrast mode adjustments */
  :root {
    --color-text-primary: #ffffff;
    --color-text-secondary: #ffffff;
    --border-dark: 2px solid #ffffff;
    --border-purple: 2px solid var(--color-primary);
  }
  
  .card,
  .terminal,
  .modal__content {
    background: #000000;
    color: #ffffff;
    border-color: #ffffff;
  }
  
  .btn {
    border-width: 2px;
  }
}

/* ===== ACCESSIBILITY: FOCUS VISIBILITY ===== */
@media (prefers-reduced-motion: no-preference) {
  /* Enhanced focus indicators when motion is allowed */
  *:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    transition: outline-offset var(--transition-fast);
  }
  
  .btn:focus-visible {
    outline-offset: 4px;
  }
}

/* ===== INDEX PAGE MOBILE ALIGNMENT ===== */
@media (max-width: 768px) {
  .about-section .container--narrow {
    text-align: center;
  }
  
  .hero-section__description {
    display: block;
    margin: 0 auto;
    padding: 8px 16px;
    max-width: 28rem;
    text-align: center;
  }
  
  .hero-section__redacted {
    display: block;
    margin: 0 auto;
    padding: 8px 16px;
    max-width: 28rem;
    text-align: center;
  }
}

/* ===== CANARY PAGE RESPONSIVE DESIGN ===== */

/* ===== MOBILE CANARY BEACON ALIGNMENT ===== */
@media (max-width: 768px) {
  .canary-title-row {
    display: flex !important;
    flex-direction: row !important;  /* Force horizontal */
    align-items: center;             /* Vertical centering */
    justify-content: center;         /* Horizontal centering */
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: nowrap !important;    /* Prevent wrapping */
  }
  
  .canary-status-indicator {
    flex-shrink: 0;
    display: inline-block;
    vertical-align: middle;
  }
  
  .canary-title {
    display: inline-block;
    vertical-align: middle;
    line-height: 1.2;
  }
}

/* ===== TABLET (768px to 1023px) ===== */
@media (min-width: 768px) and (max-width: 1023px) {
  .status-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
  }
  
  .verification-grid {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }
  
  .hash-display {
    font-size: 0.9rem;
  }
  
  .canary-container {
    max-width: 720px;
    padding: 0 var(--space-lg);
  }
}

/* ===== DESKTOP (1024px and up) ===== */
@media (min-width: 1024px) {
  .status-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-xl);
  }
  
  .verification-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-xl);
  }
  
  .canary-title-row {
    gap: var(--space-lg);
  }
  
  .hash-header {
    justify-content: space-between;
  }
  
  .hash-display {
    font-size: 1rem;
  }
  
  .button-container {
    flex-direction: row;
    justify-content: center;
    gap: var(--space-lg);
  }
  
  .btn {
    flex: 0 1 auto;
    min-width: 150px;
  }
  
  .canary-container {
    max-width: 1200px;
    padding: 0 var(--space-xl);
  }
  
  /* Desktop hover effects */
  .feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(139, 92, 246, 0.2);
  }
  
  .btn:hover {
    transform: translateY(-2px);
  }
  
  .copy-btn:hover,
  .copy-hash-btn:hover,
  .expand-btn:hover {
    background: rgba(139, 92, 246, 0.3);
  }
}

/* ===== LARGE DESKTOP (1440px and up) ===== */
@media (min-width: 1440px) {
  .canary-container {
    max-width: 1400px;
  }
  
  .status-grid {
    gap: var(--space-2xl);
  }
  
  .verification-grid {
    gap: var(--space-2xl);
  }
}