/* ================================================
   Claude Code Spire - Responsive Styles
   ================================================ */

/* ================================================
   Large Tablets (1024px and below)
   ================================================ */
@media (max-width: 1024px) {
    .spire-header {
        flex-wrap: wrap;
        gap: var(--spacing-md);
        padding: var(--spacing-md);
    }

    .global-progress {
        order: 3;
        width: 100%;
        max-width: none;
        margin: 0;
    }

    .floor-nav {
        flex-wrap: wrap;
    }

    .floor-tab {
        flex: 1;
        min-width: 110px;
        justify-content: center;
    }

    .map-container {
        height: calc(100vh - 180px);
    }

    .map-wrapper {
        min-width: 800px;
    }
}

/* ================================================
   Tablets (768px and below)
   ================================================ */
@media (max-width: 768px) {
    :root {
        --spacing-xl: 24px;
        --spacing-lg: 16px;
    }

    .spire-header {
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .logo h1 {
        font-size: 1.1rem;
    }

    .logo-icon {
        font-size: 1.5rem;
    }

    .floor-nav {
        padding: var(--spacing-sm);
        gap: var(--spacing-xs);
    }

    .floor-tab {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 0.85rem;
    }

    .floor-name {
        display: none;
    }

    .floor-tab .floor-icon {
        font-size: 1.3rem;
    }

    .floor-tab .floor-progress {
        font-size: 0.7rem;
        padding: 2px 6px;
    }

    .map-container {
        height: calc(100vh - 150px);
        padding: var(--spacing-md);
    }

    .map-wrapper {
        min-width: 700px;
        min-height: 500px;
    }

    .floor-info {
        font-size: 0.75rem;
        padding: var(--spacing-xs) var(--spacing-md);
    }

    /* Modal adjustments */
    .modal {
        max-height: 90vh;
        border-radius: var(--radius-lg);
    }

    .modal-header {
        padding: var(--spacing-lg);
        padding-right: 50px;
    }

    .feature-icon {
        font-size: 2rem;
    }

    .feature-title {
        font-size: 1.25rem;
    }

    .modal-body {
        padding: var(--spacing-lg);
    }

    .modal-footer {
        padding: var(--spacing-md);
        flex-direction: column;
        align-items: stretch;
    }

    .docs-link {
        justify-content: center;
        padding: var(--spacing-sm) 0;
    }

    .modal-actions {
        justify-content: stretch;
    }

    .modal-actions .btn {
        flex: 1;
        justify-content: center;
    }

    /* Achievements modal */
    .achievements-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ================================================
   Mobile (480px and below)
   ================================================ */
@media (max-width: 480px) {
    .spire-header {
        padding: var(--spacing-xs) var(--spacing-sm);
    }

    .logo h1 {
        font-size: 0.95rem;
    }

    .logo-icon {
        font-size: 1.3rem;
    }

    .header-actions {
        gap: var(--spacing-xs);
    }

    .btn-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .floor-nav {
        padding: var(--spacing-xs);
        gap: 4px;
    }

    .floor-tab {
        padding: var(--spacing-xs) var(--spacing-sm);
        min-width: 0;
        flex: 1;
    }

    .floor-tab .floor-icon {
        font-size: 1.1rem;
    }

    .floor-tab .floor-progress {
        display: none;
    }

    .lock-indicator {
        font-size: 0.7rem;
        top: -5px;
        right: -5px;
    }

    .map-container {
        padding: var(--spacing-sm);
        height: calc(100vh - 130px);
    }

    .map-wrapper {
        min-width: 600px;
        min-height: 450px;
    }

    .floor-info {
        display: none;
    }

    /* Full-screen modal on mobile */
    .modal-overlay {
        padding: 0;
    }

    .modal {
        max-width: none;
        max-height: none;
        height: 100%;
        border-radius: 0;
    }

    .modal-close {
        top: var(--spacing-sm);
        right: var(--spacing-sm);
    }

    .modal-header {
        padding: var(--spacing-md);
        padding-right: 45px;
    }

    .feature-icon {
        font-size: 1.8rem;
    }

    .feature-title {
        font-size: 1.1rem;
    }

    .feature-difficulty,
    .feature-category {
        font-size: 0.65rem;
        padding: 2px 8px;
    }

    .modal-body {
        padding: var(--spacing-md);
    }

    .feature-section h3 {
        font-size: 0.95rem;
    }

    .task-card {
        padding: var(--spacing-md);
        font-size: 0.9rem;
    }

    .steps-list li {
        font-size: 0.9rem;
    }

    .steps-list li::before {
        width: 24px;
        height: 24px;
        font-size: 0.75rem;
    }

    .code-block {
        font-size: 0.75rem;
        padding: var(--spacing-sm);
    }

    .tips-list li {
        font-size: 0.85rem;
    }

    /* Achievements */
    .achievements-modal h2 {
        padding: var(--spacing-lg);
        font-size: 1.3rem;
    }

    .achievements-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 0 var(--spacing-md);
        gap: var(--spacing-sm);
    }

    .achievement-card {
        padding: var(--spacing-sm);
    }

    .achievement-card-icon {
        font-size: 1.5rem;
    }

    .achievement-card-title {
        font-size: 0.8rem;
    }

    .achievement-card-desc {
        font-size: 0.65rem;
    }

    /* Toast */
    .achievement-toast {
        left: var(--spacing-md);
        right: var(--spacing-md);
        bottom: var(--spacing-md);
    }
}

/* ================================================
   Touch Device Optimizations
   ================================================ */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch */
    .feature-node:hover {
        transform: none;
    }

    .feature-node:active {
        transform: scale(0.95);
    }

    /* Always show node labels on touch */
    .node-label {
        opacity: 0.8;
    }

    /* Larger touch targets */
    .btn {
        min-height: 44px;
    }

    .floor-tab {
        min-height: 44px;
    }

    .btn-icon {
        min-width: 44px;
        min-height: 44px;
    }

    /* No hover glow on touch */
    .feature-node.available .node-circle {
        animation: none;
    }
}

/* ================================================
   Reduced Motion
   ================================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .progress-fill::after {
        animation: none;
    }

    .path-line.available {
        animation: none;
    }

    .feature-node.available {
        animation: none;
    }
}

/* ================================================
   Print Styles
   ================================================ */
@media print {
    .spire-header,
    .floor-nav,
    .floor-info,
    .modal-overlay,
    .achievement-toast,
    .particles-container {
        display: none !important;
    }

    .map-container {
        height: auto;
        overflow: visible;
    }

    body {
        background: white;
        color: black;
    }
}

/* ================================================
   High Contrast Mode
   ================================================ */
@media (prefers-contrast: high) {
    :root {
        --bg-primary: #000;
        --bg-secondary: #111;
        --bg-tertiary: #222;
        --text-primary: #fff;
        --text-secondary: #ddd;
        --border-color: #666;
    }

    .node-circle {
        stroke-width: 4;
    }

    .path-line {
        stroke-width: 4;
    }
}
