/* TI-30XIIS Calculator - iPad & Touch Optimizations */

/* Prevent all zoom behaviors */
* {
    touch-action: manipulation;
}

/* Prevent iOS text adjustments */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Ensure minimum touch target sizes */
.calc-btn {
    min-width: 44px;
    min-height: 44px;
}

/* Prevent callouts on long press */
.calc-btn {
    -webkit-touch-callout: none;
}

/* Safe area adjustments for notched devices */
@supports (padding-top: env(safe-area-inset-top)) {
    .calculator {
        padding-top: max(12px, env(safe-area-inset-top));
        padding-bottom: max(8px, env(safe-area-inset-bottom));
        padding-left: max(8px, env(safe-area-inset-left));
        padding-right: max(8px, env(safe-area-inset-right));
    }
}

/* Standalone/PWA mode adjustments */
@media (display-mode: standalone) {
    body {
        /* Extra padding at top for status bar in standalone mode */
        padding-top: 0;
    }
}

/* iPad specific sizes */
@media screen and (min-width: 768px) {
    .calculator {
        max-width: 500px;
    }

    .calc-btn {
        font-size: 16px;
        min-height: 52px;
    }

    .btn-operator {
        font-size: 22px;
    }

    .btn-enter {
        font-size: 24px;
    }

    .result-line {
        font-size: 38px;
        height: 48px;
        line-height: 48px;
    }

    .entry-line {
        font-size: 20px;
        height: 28px;
        line-height: 28px;
    }

    .calc-btn[data-second]::before {
        font-size: 10px;
        top: -16px;
    }

    .indicators {
        font-size: 11px;
    }
}

/* Landscape orientation (discouraged but handled) */
@media screen and (orientation: landscape) and (max-height: 500px) {
    .display-area {
        margin: 8px;
        padding: 6px 10px;
    }

    .result-line {
        font-size: 24px;
        height: 30px;
        line-height: 30px;
    }

    .entry-line {
        font-size: 14px;
        height: 18px;
        line-height: 18px;
    }

    .button-grid {
        gap: 4px;
        padding: 4px;
    }

    .calc-btn {
        min-height: 36px;
        font-size: 12px;
    }

    .calc-btn[data-second]::before {
        display: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --display-bg: #ffffff;
        --display-text: #000000;
        --btn-number-bg: #ffffff;
        --btn-function-bg: #ffff00;
    }

    .calc-btn {
        border: 2px solid #000000;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .calc-btn {
        transition: none;
    }
}
