
/* Mobile native-style UI. Desktop CSS is unchanged. */

.mobile-native-nav {
    display: none;
}

@media screen and (max-width: 767px) {

    :root {
        --mobile-green: #28684d;
        --mobile-ink: #233129;
        --mobile-muted: #69756d;
        --mobile-border: #e3e8e2;
        --mobile-bg: #f5f7f3;
    }

    *, *::before, *::after {
        box-sizing: border-box;
    }

    html {
        -webkit-text-size-adjust: 100%;
        scroll-padding-top: 75px;
    }

    body {
        min-width: 0;
        margin: 0;
        padding-bottom: calc(85px + env(safe-area-inset-bottom, 0px));
        background: var(--mobile-bg);
        color: var(--mobile-ink);
        font-family: -apple-system, BlinkMacSystemFont,
                     "Segoe UI", sans-serif;
        overflow-x: clip;
        -webkit-tap-highlight-color: transparent;
    }

    /* Mobile app header */

    .site-header {
        position: sticky;
        top: 0;
        z-index: 100;
        background: rgba(255,255,255,.96);
        border-bottom: 1px solid var(--mobile-border);
        box-shadow: 0 2px 12px rgba(0,0,0,.035);
        -webkit-backdrop-filter: blur(16px);
        backdrop-filter: blur(16px);
    }

    .header-row {
        height: 60px;
        min-height: 60px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 16px;
        margin: 0;
    }

    .site-header .brand {
        display: block;
        color: var(--mobile-ink);
        font-size: 19px;
        font-weight: 750;
        text-decoration: none;
        letter-spacing: -.5px;
        white-space: nowrap;
    }

    .primary-nav {
        display: none !important;
    }

    /* Page layout */

    .shell {
        width: 100%;
        max-width: 100%;
        padding-left: 16px;
        padding-right: 16px;
    }

    main {
        min-width: 0;
        padding-top: 14px;
    }

    h1 {
        font-size: clamp(25px, 7vw, 32px);
        line-height: 1.17;
        letter-spacing: -.6px;
    }

    h2 {
        font-size: 21px;
        line-height: 1.25;
    }

    .home-columns,
    .article-layout,
    .bible-testaments {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
    }

    .home-sidebar {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }

    /* Native-style search */

    .hero-search {
        width: 100%;
        max-width: none;
        margin-top: 18px;
    }

    .search-box {
        position: relative;
        display: flex;
        width: 100%;
        overflow: visible;
    }

    .search-box input {
        min-width: 0;
        flex: 1;
        height: 52px;
        padding: 0 15px;
        border: 1px solid var(--mobile-border);
        border-right: 0;
        border-radius: 15px 0 0 15px;
        background: #fff;
        font-size: 16px;
    }

    .search-box button {
        flex: 0 0 86px;
        width: 86px;
        height: 52px;
        border: 0;
        border-radius: 0 15px 15px 0;
        background: var(--mobile-green);
        color: #fff;
        font-size: 14px;
        font-weight: 700;
    }

    .search-suggestions {
        top: 54px;
        width: 100%;
        border-radius: 14px;
        background: white;
        box-shadow: 0 12px 35px rgba(0,0,0,.12);
        overflow: hidden;
    }

    /* Animal and fish listing cards */

    .lookup-row,
    .result-row,
    .food-result-row,
    .selected-food-row {
        max-width: 100%;
        margin-bottom: 11px;
        padding: 13px;
        background: #fff;
        border: 1px solid var(--mobile-border);
        border-radius: 17px;
        box-shadow: 0 3px 12px rgba(25,45,30,.035);
        overflow: hidden;
        text-decoration: none;
    }

    .lookup-row {
        display: grid;
        grid-template-columns: 74px minmax(0, 1fr);
        gap: 12px;
        align-items: center;
    }

    .result-row {
        display: grid;
        grid-template-columns: 74px minmax(0, 1fr);
        gap: 12px;
    }

    .result-meta {
        grid-column: 2;
        text-align: left;
        align-items: flex-start;
    }

    .food-result-row {
        grid-template-columns: minmax(0, 1fr) 105px;
        gap: 9px;
    }

    .food-result-link {
        grid-template-columns: 65px minmax(0, 1fr);
        gap: 10px;
    }

    .selected-food-row {
        grid-template-columns: 65px minmax(0, 1fr);
        gap: 10px;
    }

    .lookup-row img,
    .result-row img,
    .food-result-link img,
    .selected-food-row img {
        max-width: 100%;
        border-radius: 11px;
        object-fit: cover;
    }

    /* Filters */

    .filters {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: end;
        gap: 11px;
        padding: 12px 0 16px;
    }

    .filters > div {
        min-width: 0;
    }

    .filters .filter-search {
        grid-column: 1 / -1;
        min-width: 0;
    }

    .filters input,
    .filters select {
        width: 100%;
        height: 46px;
        min-width: 0;
        padding: 0 12px;
        border: 1px solid var(--mobile-border);
        border-radius: 12px;
        background: white;
        font-size: 16px;
    }

    .filters button {
        min-height: 46px;
        height: auto;
        border: 0;
        border-radius: 12px;
        background: var(--mobile-green);
        color: white;
        font-weight: 700;
    }

    .clear-filter {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        margin: 0;
    }

    /* Detail and Bible pages */

    .animal-header {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }

    .animal-header img {
        max-width: 100%;
        height: auto;
        border-radius: 17px;
    }

    .trait-list div {
        grid-template-columns: 85px minmax(0, 1fr);
        gap: 12px;
        padding: 11px 0;
    }

    .document-header h1,
    .bible-header h1 {
        font-size: 28px;
    }

    .bible-verse {
        grid-template-columns: 25px minmax(0, 1fr);
        font-size: 16px;
        line-height: 1.7;
        padding: 8px 0;
    }

    .chapter-nav {
        flex-wrap: wrap;
        gap: 12px;
        white-space: normal;
    }

    .pagination {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    /* Native bottom tab bar */

    .mobile-native-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 9999;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        height: calc(70px + env(safe-area-inset-bottom, 0px));
        padding: 6px 7px env(safe-area-inset-bottom, 0px);
        background: rgba(255,255,255,.97);
        border-top: 1px solid var(--mobile-border);
        box-shadow: 0 -5px 24px rgba(0,0,0,.045);
        -webkit-backdrop-filter: blur(20px);
        backdrop-filter: blur(20px);
    }

    .mobile-native-nav a {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        min-width: 0;
        min-height: 54px;
        padding: 5px 2px;
        border-radius: 12px;
        color: #78847c;
        font-size: 10px;
        font-weight: 650;
        line-height: 1.2;
        text-decoration: none;
        text-align: center;
        touch-action: manipulation;
    }

    .mobile-native-nav svg {
        width: 23px;
        height: 23px;
        flex-shrink: 0;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .mobile-native-nav a.is-current {
        background: #eaf4ed;
        color: var(--mobile-green);
    }

    .mobile-native-nav a:active {
        background: #e9efe9;
    }

    .site-footer {
        margin-bottom: 10px;
    }

    button, a, select {
        touch-action: manipulation;
    }

    input, textarea {
        font-size: 16px;
    }
}
