﻿/* custom-content-shared.css, lessons.css and login.css are linked from
   index.html, not @imported here: an @import URL doesn't carry app.css's ?v=
   cache-buster, so production kept serving stale copies after deploys. */

:root {
    --primary-color: #4d7cfe;
    --primary-dark: #001e57;
    --primary-light: #4d7cfe3f;
    --red: #dd1717;
    --green: #34c759;
    --orange: #ff9500;
    --text-dark: #001e57;
    --text-light: #001e5782;
    --bg-light: #f7f7f7;
    --bg-dark: #f2f2f2;
    --bg-white: #ffffff;
    --border-color: #dedede;
    --shadow-color: hsla(0, 0%, 0%, 0.014);
    --shadow: 0 2px 8px var(--shadow-color), 0 4px 8px var(--shadow-color), 0 8px 6px var(--shadow-color), 0 0 18px var(--shadow-color);
    --radius-s: 20px;
    --radius: 40px;
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --spacing-xs: 5px;
    --spacing-s: 10px;
    --spacing-m: 15px;
    --spacing-l: 20px;
    --spacing-xl: 30px;
    --spacing-xxl: 50px;
    --text-xs: 14px;
    --text-s: 18px;
    --text-m: 22px;
    --text-l: 24px;
    --text-xl: 35px;
    --text-xxl: 50px;
    --icon-s: 20px;
    --icon-m: 40px;
    --icon-l: 80px;
    --icon-xl: 100px;
    --icon-xxl: 175px;
}

@media (max-width: 1024px) {
    :root {
        --text-xs: 12px;
        --text-s: 16px;
        --text-m: 18px;
        --text-l: 20px;
        --text-xl: 22px;
        --text-xxl: 30px;
        --icon-s: 20px;
        --icon-m: 30px;
        --icon-l: 60px;
        --icon-xxl: 175px;
    }
}

html {
    overflow-y: auto;
    scrollbar-gutter: stable;
}

html, body {
    font-family: 'Montserrat', sans-serif;
    background-color: white;
    margin: 0;
    padding: 0;
    color: #333;
}

/* =====================================================
   Focus-zoom guard

   Mobile Safari zooms the whole page in when a text field is
   focused and its computed font-size is below 16px, and it stays
   zoomed after the keyboard closes - so the user ends up pinching
   back out and scrolling sideways after every bit of typing.
   Keeping every text-entry control at 16px is what actually
   prevents it; pinch-to-zoom stays fully available.

   The base rule below is the broadly-compatible version. The
   :is()/:not() rule that follows says the same thing at a much
   higher specificity, so a per-component
   `font-size: <14px> !important` in a scoped stylesheet cannot
   quietly bring the zoom back. js/ios-zoom-guard.js is the runtime
   backstop for anything neither rule can reach.
   ===================================================== */
input,
textarea,
select {
    font-size: 16px !important;
}

/* Types that never open a keyboard are excluded, so component styling
   of file pickers, buttons and the like is left alone. */
:is(input, textarea, select):not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="hidden"]) {
    font-size: 16px !important;
}

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="search"],
    input[type="url"],
    textarea {
        -webkit-user-select: text;
        user-select: text;
    }

/* =====================================================
   Shared Loading Spinner (logo + circular progress)
   Drawn by App.razor while LoadingService.IsLoading. index.html's start
   spinner (#app-loading) is the same drawing, styled inline there.
   ===================================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100lvh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #fff;
    z-index: 9999;
}

/* A thin black arc turning on a light track, the logo inside: the ring of index.html's start spinner (which fills
   instead of turning, since it has a download to show). */
.loading-container {
    position: relative;
    width: 136px;
    height: 136px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loading-progress {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    animation: loading-spin 1s linear infinite;
}

    .loading-progress circle {
        fill: none;
        stroke-width: 2.5;
    }

.loading-track {
    stroke: #eceef3;
}

/* r=46 in a 100-unit box: 87 of the SVG's percentage unit is 30% of the ring */
.loading-arc {
    stroke: #1a1a1a;
    stroke-linecap: round;
    stroke-dasharray: 87% 500%;
}

.loading-logo {
    position: relative;
    width: 72px;
    height: auto;
}

@keyframes loading-spin {
    from {
        transform: rotate(-90deg);
    }

    to {
        transform: rotate(270deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .loading-progress {
        animation-duration: 3s;
    }
}

h1:focus {
    outline: none;
}

/* "New version available" banner, shown by js/app-update.js */
.app-update-banner {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    width: fit-content;
    max-width: 480px;
    margin: 0 auto;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 8px;
    box-sizing: border-box;
    padding: 8px 8px 8px 20px;
    background: var(--primary-dark);
    color: #fff;
    border-radius: 100px;
    box-shadow: 0 6px 24px hsla(0, 0%, 0%, 0.18);
    font-size: 14px;
    font-weight: 500;
    animation: app-update-in var(--transition-normal);
}

.app-update-text {
    line-height: 1.3;
}

.app-update-button {
    flex-shrink: 0;
    min-height: 36px;
    padding: 0 16px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 100px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.app-update-button:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* The update banner and the mistake navigator float over the bottom of the
   page; give the footer room so its toggle and links can scroll clear of them. */
body:has(.app-update-banner) .footer-section,
body:has(.mistake-nav) .footer-section {
    padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
}

/* The matching lesson fills the screen on phones and tablets (its buttons just
   above the footer): <main> becomes a column so the lesson's layout can take
   all of its height (MatchingLayout.razor.css). */
@media (max-width: 1023px) {
    main:has(> .matching-layout) {
        display: flex;
        flex-direction: column;
    }
}

@keyframes app-update-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
}
