/* =====================================================================
   mobile.css — phone density layer  (phones ONLY; desktop is untouched)
   ---------------------------------------------------------------------
   Loaded after style.css. Everything visual lives inside max-width media
   queries, so >= 992px renders exactly as before.

   Goal: compact. The phone landing page was 16,091px tall at 390px
   (~19 screens) because every card grid collapsed to one column, sections
   kept 64px paddings, buttons were sized for a desktop hero, and the
   featured-research PDF was an <iframe> — which iOS Safari cannot scroll
   (it shows page 1 and stops).

   Rules of the layer:
     * two- and three-up grids instead of one card per row
     * small buttons, tight line-heights, small type
     * no decorative empty space: halved section rhythm, small gaps
     * jump-to-section menu stays available on phones
   ===================================================================== */

/* Desktop/tablet: the tap-through PDF card is phone-only. */
.research-mobile-cta {
    display: none;
}

@media (max-width: 767.98px) {
    /* ---------- vertical rhythm ---------- */
    :root {
        --section-padding: 1.6rem;
    }

    .container {
        padding-left: 0.7rem;
        padding-right: 0.7rem;
        max-width: none;
    }

    .row {
        --bs-gutter-x: 0.55rem;
        --bs-gutter-y: 0.55rem;
    }

    .section-header {
        max-width: none;
        margin-bottom: 1.05rem;
    }

    .section-label {
        font-size: 0.54rem;
        padding: 0.2rem 0.55rem;
        margin-bottom: 0.4rem;
        letter-spacing: 0.09em;
    }

    /* Headlines: keep them from eating a full line on a narrow screen. */
    .section-title {
        font-size: 1.14rem;
        line-height: 1.18;
        margin-bottom: 0.4rem;
    }

    .section-title br {
        display: none;
    }

    .section-subtitle {
        font-size: 0.82rem;
        line-height: 1.42;
    }

    /* ---------- light neumorphism (phone surface treatment) ---------- */
    /* Soft-UI values tuned for the near-white theme: same-color surfaces sit on
       a dual shadow (dark bottom-right, white top-left), no border. Corner
       discipline: 0 seam grids, 6 rows, 8 buttons/icons, 10 panels, 12 capsule.
       Nothing here changes vertical metrics - only how surfaces are lit. */
    :root {
        --nm-dark: rgba(23, 32, 38, 0.07);
        --nm-light: rgba(255, 255, 255, 0.9);
        --nm-raised: 4px 4px 10px var(--nm-dark), -4px -4px 10px var(--nm-light);
        --nm-raised-sm: 2px 2px 6px rgba(23, 32, 38, 0.06), -2px -2px 6px var(--nm-light);
        --nm-pressed: inset 2px 2px 5px rgba(23, 32, 38, 0.08), inset -2px -2px 5px rgba(255, 255, 255, 0.8);
        --nm-dark-raised: 5px 5px 14px rgba(0, 0, 0, 0.4), -3px -3px 10px rgba(255, 255, 255, 0.05);
    }

    .feature-card,
    .strategy-card,
    .risk-card,
    .allocation-chart,
    .perk-card,
    .performance-dashboard,
    .research-mobile-cta {
        border-color: transparent;
        box-shadow: var(--nm-raised);
    }

    /* dark panels need a dark material */
    .cta-content {
        box-shadow: var(--nm-dark-raised);
    }

    /* the floating nav capsule and the section menu button */
    .navbar {
        border-color: transparent;
        box-shadow: 4px 4px 12px rgba(23, 32, 38, 0.1), -4px -4px 12px var(--nm-light);
    }

    .secnav-toggle {
        border-color: transparent;
        box-shadow: var(--nm-raised);
    }

    .secnav-toggle:active {
        box-shadow: var(--nm-pressed);
        transform: scale(0.96);
    }

    /* light buttons read as raised; filled green ones keep their own glow */
    .btn {
        box-shadow: var(--nm-raised-sm);
    }

    .btn:active {
        box-shadow: var(--nm-pressed);
        transform: translateY(1px);
    }

    .btn-hero-primary,
    .btn-cta,
    .btn-success {
        box-shadow: 0 2px 7px rgba(20, 122, 74, 0.3), -1px -1px 5px var(--nm-light);
    }

    .btn-hero-primary:active,
    .btn-cta:active,
    .btn-success:active {
        box-shadow: inset 2px 2px 5px rgba(10, 60, 36, 0.35);
        transform: translateY(1px);
    }

    /* analysis rows: soft chips in the browser-mock card, pressed while tapped */
    .research-pick {
        border-color: transparent;
        box-shadow: var(--nm-raised-sm);
    }

    .research-pick:active {
        box-shadow: var(--nm-pressed);
        transform: scale(0.99);
    }

    /* ---------- generic buttons: small, no giant tap slabs ---------- */
    .btn {
        font-size: 0.76rem;
        padding: 0.3rem 0.6rem;
        border-radius: 8px;
    }

    .btn-sm {
        font-size: 0.7rem;
        padding: 0.22rem 0.5rem;
    }

    /* ---------- hero ---------- */
    .hero-section {
        padding: 0.9rem 0 1.1rem;
    }

    .hero-corporate {
        gap: 0.8rem;
    }

    .hero-title {
        font-size: 1.75rem;
        line-height: 1.02;
    }

    .hero-badge {
        font-size: 0.54rem;
        padding: 0.18rem 0.5rem;
        margin-bottom: 0.4rem;
    }

    .hero-subtitle {
        font-size: 0.82rem;
        line-height: 1.38;
        margin-bottom: 0.6rem;
    }

    /* four stats on one row — they are short numbers */
    .hero-stats-row {
        gap: 0.3rem;
        padding: 0.45rem 0;
        margin: 0.5rem 0;
    }

    .hero-stat-compact {
        flex: 1 1 0;
        min-width: 0;
        text-align: center;
    }

    .hero-stat-compact .value {
        font-size: 1.05rem;
    }

    .hero-stat-compact .label {
        font-size: 0.5rem;
        letter-spacing: 0.03em;
    }

    .hero-cta {
        gap: 0.35rem;
        margin-bottom: 0.4rem;
        /* the base sheet turns the two CTAs into a stacked column below 992px,
           which cost a full row for the small secondary button */
        flex-direction: row;
        align-items: center;
        justify-content: center;
    }

    .btn-hero-primary,
    .btn-hero-secondary {
        max-width: none;
        width: auto;
        padding: 0.45rem 0.75rem;
        font-size: 0.78rem;
        border-radius: 8px;
    }

    .czech-note {
        font-size: 0.68rem;
        line-height: 1.35;
        padding: 0.35rem 0.5rem;
    }

    /* ---------- live performance panel ---------- */
    .performance-dashboard {
        padding: 0.7rem;
        border-radius: 10px;
    }

    .performance-header {
        padding: 0 0 0.5rem;
    }

    .performance-main {
        padding: 0.5rem 0.1rem 0.6rem;
    }

    .performance-main .return-value {
        font-size: 1.8rem;
    }

    .performance-main .return-label {
        font-size: 0.68rem;
    }

    .performance-main .return-meta {
        font-size: 0.62rem;
    }

    /* six risk tiles: 3 across, 2 rows. The panel is a hairline grid (1px gaps on
       a grey background) — adding tile gaps/radii here is what made the tiles look
       like mismatched rounded rectangles, so keep the seams and drop the radius. */
    .risk-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1px;
    }

    .risk-metric {
        padding: 0.45rem 0.3rem;
        border-radius: 0;
    }

    .risk-metric .metric-label {
        font-size: 0.5rem;
        letter-spacing: 0.02em;
        margin-bottom: 0.15rem;
        line-height: 1.15;
    }

    .risk-metric .metric-value {
        font-size: 0.9rem;
    }

    .risk-metric .metric-subtext {
        display: none;
    }

    .benchmark-comparison {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1px;
    }

    .benchmark-item {
        padding: 0.45rem 0.25rem;
        border-radius: 0;
    }

    .benchmark-item .benchmark-name {
        font-size: 0.5rem;
        line-height: 1.15;
        margin-bottom: 0.15rem;
    }

    .benchmark-item .benchmark-value {
        font-size: 0.78rem;
    }

    /* ---------- card grids: two per row, small cards ---------- */
    .feature-grid,
    .strategy-grid,
    .risk-grid,
    .team-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.45rem;
    }

    .feature-card,
    .strategy-card,
    .risk-card {
        padding: 0.6rem 0.55rem;
        border-radius: 10px;
    }

    .feature-icon {
        width: 26px;
        height: 26px;
        font-size: 0.78rem;
        margin-bottom: 0.35rem;
        border-radius: 7px;
    }

    .feature-title {
        font-size: 0.76rem;
        margin-bottom: 0.2rem;
    }

    .feature-text {
        font-size: 0.69rem;
        line-height: 1.38;
    }

    .strategy-card h4 {
        font-size: 0.72rem;
        gap: 0.28rem;
        margin-bottom: 0.2rem;
    }

    .strategy-card h4 i {
        font-size: 0.8rem;
    }

    .strategy-card p {
        font-size: 0.68rem;
        line-height: 1.38;
    }

    .risk-card .risk-header {
        gap: 0.3rem;
        margin-bottom: 0.3rem;
    }

    .risk-card .risk-icon {
        width: 22px;
        height: 22px;
        font-size: 0.66rem;
    }

    .risk-card .risk-title {
        font-size: 0.72rem;
    }

    .risk-card .risk-desc {
        font-size: 0.68rem;
        line-height: 1.38;
    }

    /* A group with an odd number of cards leaves a hole in the last row (three
       cards in a 2-up grid). The orphan card takes the full width and lays out
       sideways, so the space carries content instead of sitting empty. */
    .universe-cards > :last-child:nth-child(odd),
    .perks-cards > :last-child:nth-child(odd) {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .feature-grid > :last-child:nth-child(odd),
    .strategy-grid > :last-child:nth-child(odd),
    .risk-grid > :last-child:nth-child(odd),
    .team-grid > :last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }

    /* the wide orphan: icon beside the text instead of a stretched column */
    .universe-cards > :last-child:nth-child(odd) .feature-card,
    .perks-cards > :last-child:nth-child(odd) .perk-card,
    .feature-grid > :last-child:nth-child(odd) .feature-card {
        display: flex;
        align-items: flex-start;
        gap: 0.55rem;
    }

    .universe-cards > :last-child:nth-child(odd) .feature-icon,
    .perks-cards > :last-child:nth-child(odd) .perk-icon,
    .feature-grid > :last-child:nth-child(odd) .feature-icon {
        margin-bottom: 0;
        flex: 0 0 auto;
    }

    /* ---------- bootstrap scaffolding: two-up instead of one-per-row ---------- */
    /* Bootstrap collapses .col-md-4 / .col-lg-6 to 100% below 768px, which turned
       every three-card row into three full-width cards. Only the two card rows
       that carry an explicit hook are touched: a blanket `[class*=col-]` rule
       also matched the nested rows inside cards (it squeezed the Exclusion
       Criteria column to 35px) and the strategy section's 7/5 chart pair. */
    .universe-cards > [class*="col-"],
    .perks-cards > [class*="col-"] {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .perk-card {
        padding: 0.6rem 0.5rem;
        border-radius: 10px;
    }

    .perk-icon {
        width: 26px;
        height: 26px;
        font-size: 0.78rem;
        margin-bottom: 0.35rem;
        border-radius: 7px;
    }

    .perk-card h4 {
        font-size: 0.74rem;
        margin-bottom: 0.18rem;
    }

    .perk-card p {
        font-size: 0.67rem;
        line-height: 1.36;
        margin: 0;
    }

    /* ---------- investment process: 4 across in one row ---------- */
    .process-flow {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.6rem;
        max-width: none;
    }

    .process-step {
        flex: none;
        text-align: left;
    }

    .process-step .step-number {
        width: 1.6rem;
        height: 1.6rem;
        font-size: 0.68rem;
        margin: 0 0 0.25rem;
        border-width: 1px;
    }

    .process-step .step-title {
        font-size: 0.72rem;
        margin-bottom: 0.15rem;
    }

    .process-step .step-desc {
        font-size: 0.67rem;
        line-height: 1.36;
    }

    /* ---------- stats: one dense strip ---------- */
    .stats-section {
        padding: 0.9rem 0;
    }

    .stats-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 0.3rem;
    }

    .stat-item {
        padding: 0.15rem;
    }

    .stat-number {
        font-size: 1.25rem;
        margin-bottom: 0.05rem;
    }

    .stat-label {
        font-size: 0.5rem;
        letter-spacing: 0.04em;
    }

    /* ---------- team ---------- */
    .team-grid {
        max-width: none;
    }

    .team-image-wrapper {
        height: auto;
        aspect-ratio: 4 / 3;
    }

    .team-content {
        padding: 0.5rem 0.55rem;
    }

    .team-name {
        font-size: 0.8rem;
    }

    .team-role {
        font-size: 0.62rem;
    }

    .team-edu {
        font-size: 0.62rem;
    }

    .team-quote {
        font-size: 0.66rem;
        line-height: 1.36;
        margin: 0.3rem 0;
    }

    .team-photo {
        margin-bottom: 0.7rem;
    }

    .team-photo img {
        height: 130px;
    }

    .team-photo-caption {
        font-size: 0.62rem;
        padding: 0.35rem 0.6rem;
    }

    /* ---------- featured research: no inline PDF on iOS ---------- */
    .research-viewer-frame {
        display: none;
    }

    /* the analysis list: compact full-width rows — two columns cut the titles off
       mid-word ("Google (GOOGL) Stock Analysis - Kl…"), a row fits the whole title */
    .research-picker {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
        max-height: none;
        overflow: visible;
        padding: 0;
    }

    .research-group {
        font-size: 0.58rem;
        letter-spacing: 0.08em;
        margin-top: 0.15rem;
    }

    .research-pick {
        width: 100%;
        gap: 0.45rem;
        align-items: center;
        padding: 0.26rem 0.4rem;
    }

    .research-pick-thumb {
        width: 30px;
        height: 30px;
    }

    .research-pick-title {
        font-size: 0.71rem;
        line-height: 1.22;
        -webkit-line-clamp: 2;
    }

    .research-pick-meta {
        font-size: 0.56rem;
        gap: 0.3rem;
    }

    .research-viewer-bar {
        gap: 0.35rem;
        padding: 0.4rem 0.5rem;
    }

    .research-viewer-title {
        font-size: 0.7rem;
    }

    /* the tap-through card that replaces the iframe */
    .research-mobile-cta {
        display: flex;
        gap: 0.6rem;
        padding: 0.7rem;
    }

    .research-mobile-poster {
        flex: 0 0 58px;
        width: 58px;
        height: 80px;
        border-radius: 8px;
        border: 1px solid var(--color-gray-200);
        background-color: var(--color-gray-100);
        background-size: cover;
        background-position: center;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--primary-green);
        font-size: 1.3rem;
    }

    .research-mobile-body {
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 0.2rem;
    }

    .research-mobile-title {
        font-size: 0.8rem;
        font-weight: 600;
        line-height: 1.2;
        color: var(--color-gray-900);
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .research-mobile-hint {
        margin: 0;
        font-size: 0.64rem;
        line-height: 1.35;
        color: var(--color-gray-400);
    }

    .research-mobile-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 0.3rem;
        margin-top: auto;
    }

    .research-mobile-actions .btn-hero-primary,
    .research-mobile-actions .btn-hero-secondary {
        padding: 0.38rem 0.55rem;
        font-size: 0.72rem;
        border-radius: 8px;
    }

    .research-note {
        font-size: 0.64rem;
        margin-top: 0.5rem;
    }

    /* ---------- about / prose / cards ---------- */
    /* the three "values" cards in About carry an inline one-column style */
    #about .feature-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 0.45rem;
    }

    #about .feature-card.mb-3 {
        margin-bottom: 0 !important;
    }

    #about blockquote {
        padding-left: 0.6rem !important;
        margin-bottom: 0.6rem !important;
    }

    #about blockquote p,
    #about .blockquote-footer {
        font-size: 0.78rem;
        line-height: 1.4;
    }

    /* Bootstrap pulls .blockquote-footer up by half a rem; with the tightened
       line-height above that lands on top of the quote's last line */
    #about .blockquote-footer {
        margin-top: 0 !important;
    }

    #about h3 {
        font-size: 1rem;
        margin-bottom: 0.4rem !important;
    }

    /* the portfolio chart in About is 200px tall in an inline style */
    #about .card-body [style*="height: 200px"] {
        height: 130px !important;
    }

    .section .text-muted,
    .section .lead {
        font-size: 0.78rem;
        line-height: 1.42;
    }

    .section .card-body {
        padding: 0.6rem !important;
    }

    .section h5,
    .section h4.mb-4 {
        font-size: 0.88rem;
    }

    .section .row.mt-3,
    .section .row.mt-4 {
        margin-top: 0.45rem !important;
    }

    /* ---------- CTA ---------- */
    .cta-section {
        padding: 1.4rem 0;
    }

    .cta-content {
        padding: 1rem 0.8rem;
        border-radius: 10px;
    }

    .cta-title {
        font-size: 1.15rem;
        margin-bottom: 0.35rem;
    }

    .cta-text {
        font-size: 0.8rem;
        line-height: 1.4;
    }

    /* ---------- document pages (methodology, terms, privacy) ---------- */
    /* These are Bootstrap utilities + .card prose pages: at phone width they were
       still using the 16px/1.6 desktop scale with 1.5rem card padding, which made
       the methodology page 12 screens tall. */
    body {
        font-size: 0.875rem;
    }

    .container-fluid {
        padding-left: 0.6rem;
        padding-right: 0.6rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1.1rem;
    }

    h4 {
        font-size: 1rem;
    }

    h5 {
        font-size: 0.92rem;
    }

    h6 {
        font-size: 0.85rem;
    }

    p,
    li,
    td,
    th {
        line-height: 1.5;
    }

    .card {
        border-radius: 10px;
    }

    .card-body {
        padding: 0.7rem !important;
        /* a 6-column table cannot shrink below ~500px: scroll it inside the card
           instead of letting it be clipped by the viewport */
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .card-header {
        padding: 0.5rem 0.7rem;
        font-size: 0.85rem;
    }

    .card.mb-4,
    .mb-4 {
        margin-bottom: 0.7rem !important;
    }

    .mb-3 {
        margin-bottom: 0.5rem !important;
    }

    .mt-4 {
        margin-top: 0.7rem !important;
    }

    .mt-3 {
        margin-top: 0.5rem !important;
    }

    .p-3 {
        padding: 0.6rem !important;
    }

    .alert {
        padding: 0.55rem 0.7rem;
        font-size: 0.8rem;
        margin-bottom: 0.6rem !important;
    }

    table.table {
        font-size: 0.7rem;
    }

    table.table th,
    table.table td {
        padding: 0.3rem 0.4rem !important;
    }

    hr {
        margin: 0.7rem 0;
    }

    ul,
    ol {
        padding-left: 1.1rem;
    }

    /* ---------- jump-to-section menu: keep it on phones ---------- */
    .secnav {
        display: flex;
        right: 0.6rem;
        bottom: 0.7rem;
    }

    .secnav-toggle {
        width: 38px;
        height: 38px;
        font-size: 0.92rem;
        border-radius: 10px;
    }

    .secnav-panel {
        min-width: 0;
        width: min(74vw, 260px);
    }

    .secnav-list {
        max-height: 50vh;
    }

    /* ---------- floating dock navbar: a phone needs less capsule ---------- */
    .navbar {
        top: 0.4rem;
        width: calc(100% - 0.8rem);
        padding: 0.3rem 0.4rem;
        border-radius: 12px;
    }

    .navbar.scrolled {
        padding: 0.26rem 0.4rem;
    }

    .navbar-brand {
        font-size: 0.98rem;
        gap: 0.4rem;
    }

    .navbar-brand i {
        font-size: 1.05rem;
    }

    .navbar-toggler {
        padding: 0.15rem 0.35rem;
        font-size: 0.85rem;
        border-radius: 0.6rem;
    }

    .navbar-toggler-icon {
        width: 1.15rem;
        height: 1.15rem;
    }

    /* the closing CTA: a normal button, not a slab */
    .btn-cta {
        padding: 0.6rem 1.1rem;
        font-size: 0.85rem;
        border-radius: 10px;
        box-shadow: 0 3px 14px rgba(26, 156, 94, 0.28);
    }

    /* ---------- footer ---------- */
    .footer,
    .site-footer {
        padding: 1.2rem 0 1.4rem;
    }

    .footer-content,
    .footer-links {
        gap: 0.5rem;
    }

    .footer p,
    .footer a,
    .footer-links a {
        font-size: 0.72rem;
    }
}

/* Phones turned sideways have room for the desktop-ish hero column */
@media (min-width: 576px) and (max-width: 767.98px) {
    .hero-stat-compact {
        flex: 1 1 0;
    }
}
