/* responsive.css - Responsive design and media queries */

/* Tablet View (768px - 1024px) */
@media screen and (max-width: 1024px) {
    .container {
        max-width: 95%;
        padding: var(--spacing-lg);
    }

    .hexagram-container {
        gap: var(--spacing-lg);
    }

    .trigram-info {
        gap: var(--spacing-md);
    }
}

/* Small Tablet / Large Mobile (600px - 768px) */
@media screen and (max-width: 768px) {
    :root {
        --font-size-base: 15px;
    }

    h1 {
        font-size: 2.5em;
    }

    .container {
        padding: var(--spacing-md);
        border-radius: 15px;
    }

    .hexagram-container {
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .line {
        width: 180px;
    }

    button {
        padding: 12px 30px;
        font-size: 1.1em;
    }

    .language-selector {
        position: static;
        margin-bottom: var(--spacing-md);
        justify-content: center;
    }
}

/* Mobile View (max-width: 600px) */
@media screen and (max-width: 600px) {
    :root {
        --font-size-base: 14px;
        --spacing-xs: 3px;
        --spacing-sm: 8px;
        --spacing-md: 15px;
        --spacing-lg: 20px;
        --spacing-xl: 30px;
    }

    body {
        padding: var(--spacing-sm);
    }

    .container {
        padding: var(--spacing-md);
        border-radius: 10px;
    }

    h1 {
        font-size: 2em;
        margin-bottom: var(--spacing-lg);
        letter-spacing: 1px;
    }

    h1::after {
        font-size: 0.6em;
    }

    h3 {
        font-size: 1.2em;
    }

    h4 {
        font-size: 1.1em;
    }

    /* Form Elements */
    label {
        font-size: 1em;
    }

    input[type="text"],
    textarea {
        padding: 12px 15px;
        font-size: 1em;
    }

    /* Hexagram Display */
    .hexagram-display {
        min-height: 250px;
        margin: var(--spacing-lg) 0;
    }

    .hexagram {
        padding: var(--spacing-md);
        gap: 6px;
    }

    .line {
        width: 150px;
        height: 10px;
    }

    .line.moving .changing-indicator {
        right: -25px;
        font-size: 16px;
    }

    /* Hexagram Info */
    .hexagram-name {
        font-size: 1.5em;
    }

    .changing-name {
        font-size: 1.2em;
    }

    .trigram-info {
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    .trigram-box {
        padding: 10px 20px;
    }

    .trigram-label {
        font-size: 0.85em;
    }

    .trigram-name {
        font-size: 1.1em;
    }

    /* Buttons */
    button {
        padding: 10px 25px;
        font-size: 1em;
        margin: var(--spacing-xs);
    }

    .button-container {
        margin: var(--spacing-md) 0;
    }

    /* Language Selector */
    .language-btn {
        padding: 6px 12px;
        font-size: 13px;
    }

    /* Coin Animation */
    .coin {
        width: 60px;
        height: 60px;
    }

    .coin:nth-child(1) {
        left: -80px;
    }

    .coin:nth-child(2) {
        left: 0;
    }

    .coin:nth-child(3) {
        left: 80px;
    }

    /* Interpretation */
    .interpretation {
        padding: var(--spacing-md);
        font-size: 1em;
        line-height: 1.7;
    }

    /* Plum Blossom Info */
    .plum-blossom-info {
        padding: var(--spacing-sm);
    }

    .time-calculation {
        font-size: 0.85em;
    }

    .ti-yong-info {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
}

/* Small Mobile (max-width: 400px) */
@media screen and (max-width: 400px) {
    h1 {
        font-size: 1.8em;
    }

    .line {
        width: 120px;
        height: 8px;
    }

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

    .coin {
        width: 50px;
        height: 50px;
    }

    .coin:nth-child(1) {
        left: -60px;
    }

    .coin:nth-child(3) {
        left: 60px;
    }
}

/* Landscape Mobile */
@media screen and (max-height: 600px) and (orientation: landscape) {
    .container {
        max-height: 90vh;
        overflow-y: auto;
    }

    h1 {
        font-size: 2em;
        margin-bottom: var(--spacing-md);
    }

    .hexagram-display {
        min-height: 200px;
    }

    .hexagram-container {
        flex-direction: row;
    }
}

/* High Resolution Displays */
@media screen and (-webkit-min-device-pixel-ratio: 2),
screen and (min-resolution: 192dpi) {

    /* Sharper borders and shadows */
    .container {
        border-width: 0.5px;
    }

    .line {
        box-shadow: 0 1px 5px rgba(255, 215, 0, 0.5);
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        color: black;
    }

    .container {
        box-shadow: none;
        border: 1px solid #ccc;
        background: white;
    }

    .language-selector,
    button,
    .coins-animation {
        display: none !important;
    }

    h1,
    h3,
    h4 {
        color: black;
    }

    .hexagram-name,
    .trigram-name {
        color: #333;
    }

    .line.yang {
        background: black;
        box-shadow: none;
    }

    .line.yin .yin-left,
    .line.yin .yin-right {
        background: black;
        box-shadow: none;
    }
}

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

    h1::after {
        animation: none;
    }

    .line {
        opacity: 1;
        animation: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    /* Already dark by default, but can add overrides here */
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    button {
        min-height: 44px;
        min-width: 44px;
    }

    input[type="text"],
    textarea {
        min-height: 44px;
        font-size: 16px;
        /* Prevents zoom on iOS */
    }

    .language-btn {
        min-height: 36px;
        padding: 8px 16px;
    }
}