﻿/* =========================================================================
 * router-info.css — styles for the curated route overview page (router-info.php)
 *
 * Scope: every rule is prefixed with `.router-info-page` (the <body> class)
 * so this file never restyles the legacy route-detail.php page, which reuses
 * the same .route-* class names. New, page-specific components use the .ri-
 * prefix.
 *
 * Breakpoints (explicit, self-verified):
 *   - desktop  : > 1024px   -> two-column grid, left wide / right 360px rail
 *   - tablet   : 768–1024px  -> single column, sidebar stacks below main
 *   - mobile   : < 768px     -> full width, tightened padding, smaller hero
 * ========================================================================= */

/* ------------------------------------------------------------------ base */
.router-info-page .route-content {
    max-width: 1280px;
}

/* Info bar — simplified three-up strip (Duration / Best for / Getting there) */
.router-info-page .ri-info-strip {
    background: #ffffff;
    border-radius: var(--rd-radius-lg, 16px);
    box-shadow: var(--rd-shadow-lg, 0 10px 30px rgba(15, 35, 60, 0.08));
    margin: -36px auto 40px;
    max-width: 1280px;
    padding: 22px 28px;
    position: relative;
    z-index: 5;
}
.router-info-page .ri-info-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}
.router-info-page .ri-info-cell .ri-info-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--rd-text-secondary, #64748b);
    font-weight: 600;
    margin-bottom: 6px;
}
.router-info-page .ri-info-cell .ri-info-value {
    font-size: 1.08rem;
    font-weight: 700;
    color: var(--rd-text-primary, #0f233c);
    line-height: 1.4;
}

/* ------------------------------------------------------------- two-column */
/* Desktop (>1024px): wide left column, fixed 360px right rail */
.router-info-page .route-main-content {
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 36px;
    align-items: start;
}

/* Left-column body text readability */
.router-info-page .route-left .route-section p {
    color: var(--rd-text-secondary, #475569);
    line-height: 1.85;
    margin: 0 0 14px;
    font-size: 1.05rem;
}
.router-info-page .route-left .route-section p:last-child { margin-bottom: 0; }

/* Top things / Eat this card grids: desktop 2 columns */
.router-info-page .ri-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}
.router-info-page .ri-card {
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    border: 1px solid var(--rd-border, #e6ebf2);
    border-radius: 12px;
    padding: 18px 18px 16px;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.router-info-page .ri-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--rd-shadow-md, 0 6px 18px rgba(15, 35, 60, 0.08));
}
.router-info-page .ri-card-title {
    display: block;
    font-weight: 700;
    color: var(--rd-text-primary, #0f233c);
    font-size: 1.02rem;
    margin-bottom: 8px;
}
.router-info-page .ri-card-body {
    color: var(--rd-text-secondary, #475569);
    line-height: 1.7;
    font-size: 0.98rem;
}

/* Sidebar: sticky like route-detail.php — stays fixed below the header while
   the main column scrolls; returns to static on ≤1024px (single column). */
.router-info-page .route-sidebar {
    position: sticky;
    top: 90px;
    height: fit-content;
}
.router-info-page .route-sidebar .route-section { margin-bottom: 20px; }

/* Section header image (above "Top things to see") */
.router-info-page .ri-section-img img {
    width: 100%;
    height: 320px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 22px;
}

/* Food strip (above "Eat this") */
.router-info-page .ri-food-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}
.router-info-page .ri-food-strip img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 10px;
}

/* Learn More / Plan the Complete Trip CTA card */
.router-info-page .ri-learn-card {
    background: linear-gradient(160deg, var(--rd-primary, #0f766e) 0%, var(--rd-secondary, #0e7490) 100%);
    color: #ffffff;
    border: none;
}
.router-info-page .ri-learn-card h3 { color: #ffffff; }
.router-info-page .ri-learn-card p {
    color: rgba(255, 255, 255, 0.92);
    line-height: 1.7;
    margin: 0 0 16px;
    font-size: 0.98rem;
}
.router-info-page .ri-learn-btn {
    display: inline-block;
    background: #ffffff;
    color: var(--rd-primary, #0f766e);
    font-weight: 700;
    padding: 12px 20px;
    border-radius: 10px;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.router-info-page .ri-learn-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}
.router-info-page .ri-ai-btn {
    display: inline-block;
    width: 100%;
    background: #22c55e;
    color: #ffffff;
    font-weight: 700;
    font-size: 1rem;
    padding: 13px 20px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.router-info-page .ri-ai-btn-standalone {
    margin: 0 0 20px;
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.35);
}
.router-info-page .ri-ai-btn:hover {
    background: #16a34a;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

/* AI Plan Trip modal */
.router-info-page .ri-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
}
.router-info-page .ri-modal.open { display: block; }
.router-info-page .ri-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 22, 40, 0.6);
}
.router-info-page .ri-modal-panel {
    position: relative;
    margin: 4vh auto 0;
    width: min(960px, 94vw);
    height: 88vh;
    background: #f5f7fa;
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.router-info-page .ri-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
}
.router-info-page .ri-modal-head h2 {
    font-size: 1.05rem;
    margin: 0;
    color: #0a1628;
}
.router-info-page .ri-modal-close {
    background: transparent;
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    color: #4b5563;
    cursor: pointer;
    padding: 4px 10px;
}
.router-info-page .ri-modal-close:hover { color: #0a1628; }
.router-info-page .ri-modal-body { flex: 1; min-height: 0; }
.router-info-page .ri-modal-body iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}
@media (max-width: 640px) {
    .router-info-page .ri-modal-panel {
        width: 100vw;
        height: 100vh;
        margin: 0;
        border-radius: 0;
    }
}

/* ------------------------------------------------------------ tablet 768-1024 */
@media (min-width: 768px) and (max-width: 1024px) {
    .router-info-page .route-main-content {
        grid-template-columns: minmax(0, 1fr);   /* stack sidebar below main */
        gap: 24px;
    }
    .router-info-page .route-right { height: auto; }
    .router-info-page .route-sidebar { position: static; }
    .router-info-page .ri-info-grid {
        grid-template-columns: 1fr;              /* stack the three facts */
        gap: 14px;
    }
    .router-info-page .ri-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* --------------------------------------------------------------- mobile <768 */
@media (max-width: 767px) {
    .router-info-page .route-main-content {
        grid-template-columns: minmax(0, 1fr);   /* single column */
        gap: 8px;                                 /* was 20px — tighten vertical gap */
    }
    .router-info-page .route-right { height: auto; }
    .router-info-page .route-sidebar { position: static; }

    .router-info-page .ri-info-strip {
        margin: -24px 12px 12px;                  /* was 28px bottom */
        padding: 18px 16px;
    }
    .router-info-page .ri-info-grid {
        grid-template-columns: 1fr;              /* full-width facts */
        gap: 12px;
    }
    .router-info-page .route-content { padding: 0 12px; }

    .router-info-page .route-left .route-section { padding: 12px 16px; }  /* was 20px top/bottom */
    .router-info-page .route-left .route-section h2 { font-size: 1.3rem; }

    .router-info-page .ri-card-grid {
        grid-template-columns: minmax(0, 1fr);   /* cards stack, 1 column */
        gap: 12px;
    }
    .router-info-page .ri-section-img img { height: 200px; }
    .router-info-page .ri-food-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
    .router-info-page .ri-food-strip img { height: 120px; }
}

/* ------------------------------------------- extra-narrow <480px: hero fix */
/* At 375px the route-hero h1 (28.8px from style.css) is wider than the       */
/* viewport and overflows. Shrink title + add side padding on very small phones */
@media (max-width: 480px) {
    .router-info-page .route-hero {
        padding-left: 16px;
        padding-right: 16px;
    }
    .router-info-page .route-hero h1 {
        font-size: 1.8rem !important;
        line-height: 1.25;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    .router-info-page .route-hero .hero-subtitle,
    .router-info-page .route-hero p {
        font-size: 0.95rem;
        padding: 0 8px;
    }
}

/* =========================================================================
 * Getting-there transport picker — departure city tabs + travel-time panel
 *
 * Markup contract (both router-info.php and the static router-info/<id>/index.html
 * exports must produce it):
 *   .ri-transport
 *     .ri-transport-tabs > .ri-transport-tab[data-city]
 *     .ri-transport-panels > .ri-transport-panel[data-city]
 *
 * The first tab/panel pair ships with .is-active in the HTML, so the block is
 * readable with JS disabled. js/router-info.js only toggles .is-active.
 * ========================================================================= */
.router-info-page .ri-transport {
    margin-top: 18px;
}
.router-info-page .ri-transport-caption {
    color: var(--rd-text-secondary, #64748b);
    font-size: 0.95rem;
    margin-bottom: 12px;
}

/* --- tabs --- */
.router-info-page .ri-transport-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}
.router-info-page .ri-transport-tab {
    appearance: none;
    background: #ffffff;
    border: 1px solid var(--rd-border, #e2e8f0);
    border-radius: 999px;
    color: var(--rd-text-primary, #1e293b);
    cursor: pointer;
    font: inherit;
    font-size: 0.92rem;
    line-height: 1.2;
    padding: 8px 16px;
    transition: background-color 0.2s ease, border-color 0.2s ease,
                color 0.2s ease, box-shadow 0.2s ease;
}
.router-info-page .ri-transport-tab:hover {
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.45);
    color: var(--rd-primary-dark, #16a34a);
}
.router-info-page .ri-transport-tab:focus-visible {
    outline: 2px solid var(--rd-secondary, #06b6d4);
    outline-offset: 2px;
}
.router-info-page .ri-transport-tab.is-active,
.router-info-page .ri-transport-tab.is-active:hover {
    background: linear-gradient(135deg,
                var(--rd-primary, #22c55e) 0%,
                var(--rd-secondary, #06b6d4) 100%);
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.25);
    color: #ffffff;
    font-weight: 600;
}

/* --- panel --- */
.router-info-page .ri-transport-panel {
    display: none;
}
.router-info-page .ri-transport-panel.is-active {
    animation: ri-transport-fade 0.32s ease both;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    border: 1px solid var(--rd-border, #e6ebf2);
    border-left: 3px solid var(--rd-secondary, #06b6d4);
    border-radius: 12px;
    display: block;
    padding: 16px 18px;
}
@keyframes ri-transport-fade {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.router-info-page .ri-transport-route {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.router-info-page .ri-transport-to {
    color: var(--rd-text-primary, #1e293b);
    font-size: 1.06rem;
    font-weight: 700;
}
.router-info-page .ri-transport-arrow {
    color: var(--rd-secondary, #06b6d4);
    font-size: 1.1rem;
}
.router-info-page .ri-transport-from {
    color: var(--rd-text-secondary, #64748b);
    font-size: 1rem;
}

.router-info-page .ri-transport-modes {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.router-info-page .ri-transport-mode-row {
    align-items: center;
    display: flex;
    flex: 1 1 220px;
    flex-wrap: wrap;
    gap: 8px 10px;
    padding: 2px 0;
}
.router-info-page .ri-transport-icon {
    color: var(--rd-secondary, #06b6d4);
    display: inline-flex;
    flex-shrink: 0;
}
.router-info-page .ri-transport-icon svg {
    display: block;
    height: 17px;
    width: 17px;
}
.router-info-page .ri-transport-mode {
    color: var(--rd-text-primary, #1e293b);
    font-size: 0.97rem;
}
.router-info-page .ri-transport-time {
    background: rgba(6, 182, 212, 0.1);
    border-radius: 999px;
    color: var(--rd-primary-dark, #16a34a);
    font-size: 0.88rem;
    font-weight: 600;
    padding: 2px 10px;
}
.router-info-page .ri-transport-detail {
    color: var(--rd-text-secondary, #475569);
    flex-basis: 100%;
    font-size: 0.9rem;
    line-height: 1.4;
    margin-top: 4px;
    min-width: 0;
}

@media (max-width: 768px) {
    .router-info-page .ri-transport-tabs { gap: 6px; }
    .router-info-page .ri-transport-tab {
        flex: 1 1 auto;
        font-size: 0.88rem;
        padding: 7px 12px;
        text-align: center;
    }
}
