/* Public standalone IMPA catalog — embed / iframe friendly */
html.store-public-mode,
html:has(.store-public-body) {
    height: 100%;
}

.store-public-body {
    margin: 0;
    min-height: 100%;
    background: linear-gradient(180deg, #edf2f7 0%, #e2e8f0 100%);
    color: #1a202c;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

.store-public-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    margin: 0 auto;
}

.store-public-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    padding: 16px 20px;
    background: #1a365d;
    color: #fff;
    box-shadow: 0 2px 8px rgba(26, 54, 93, 0.25);
}

.store-public-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.store-public-brand img {
    border-radius: 8px;
    background: #fff;
    flex-shrink: 0;
}

.store-public-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.25;
}

.store-public-subtitle {
    margin: 4px 0 0;
    font-size: 0.8125rem;
    color: #bee3f8;
    line-height: 1.35;
}

.store-public-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.btn-header-contact {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border: 1px solid rgba(144, 205, 244, 0.65);
    border-radius: 999px;
    background: transparent;
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-header-contact:hover,
.btn-header-contact:focus-visible {
    background: rgba(255, 255, 255, 0.12);
    border-color: #90cdf4;
    color: #fff;
    outline: none;
}

.store-public-site-link {
    color: #90cdf4;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.store-public-site-link:hover,
.store-public-site-link:focus-visible {
    color: #fff;
    text-decoration: underline;
}

.seo-quick-index {
    margin: 0 16px 12px;
    padding: 14px 16px;
    border: 1px solid #bfd0ea;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.82);
}

.seo-quick-index-label {
    margin: 0 0 10px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #0b3d91;
}

.seo-quick-index-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.seo-quick-chip {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #0b3d91;
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.seo-quick-chip:hover,
.seo-quick-chip:focus-visible {
    background: #e8f1ff;
    border-color: #93b4e4;
}

.store-public-toolkit {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid #cbd5e0;
    position: sticky;
    top: 0;
    z-index: 30;
    backdrop-filter: blur(8px);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.store-public-toolkit::-webkit-scrollbar {
    height: 6px;
}

.store-public-toolkit::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 999px;
}

.store-tool-chip {
    border: 1px solid #cbd5e0;
    background: #fff;
    color: #2d3748;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.store-tool-chip:hover,
.store-tool-chip:focus-visible {
    border-color: #2b6cb0;
    color: #1a365d;
    outline: none;
}

.store-tool-chip.active {
    background: #1a365d;
    border-color: #1a365d;
    color: #fff;
}

.store-public-panels {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.store-public-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    animation: toolkit-panel-in 0.22s ease;
}

@keyframes toolkit-panel-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.store-public-panel.hidden {
    display: none;
}

.store-category-filter {
    min-width: 140px;
    padding: 10px 12px;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    background: #fff;
    color: #2d3748;
    font-size: 0.875rem;
}

.store-public-footer-tag {
    font-size: 0.75rem;
    color: #718096;
}

/* Mobile pull-to-refresh */
.store-public-shell {
    position: relative;
}

.store-pull-refresh {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 30;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 8px;
    padding-bottom: 8px;
    height: 0;
    overflow: hidden;
    color: #cbd5e1;
    font-size: 0.8125rem;
    font-weight: 600;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s ease;
}

.store-pull-refresh-icon {
    display: inline-flex;
    width: 1.25rem;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
}

.store-pull-refresh-ready .store-pull-refresh-icon {
    color: #90cdf4;
}

.store-pull-refresh-active .store-pull-refresh-icon {
    animation: store-pull-spin 0.8s linear infinite;
}

@keyframes store-pull-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

body.store-pull-active .store-public-panel {
    transition: transform 0.08s ease-out;
}

body.store-pull-active.store-pull-refreshing .store-public-panel {
    transition: transform 0.2s ease;
}

.maritime-bunker-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    text-align: center;
}

.maritime-bunker-metrics span {
    display: block;
    font-size: 0.75rem;
    color: #2c5282;
    margin-bottom: 4px;
}

.maritime-bunker-metrics strong {
    font-size: 1.125rem;
    color: #1a365d;
}

.maritime-bunker-metrics strong:first-of-type {
    font-size: 1.5rem;
}

#storeToolBunker,
#storeToolLube,
#storeToolPaint,
#storeToolEngineering {
    padding-top: 16px;
    padding-bottom: 8px;
    overflow-y: auto;
}

.maritime-panel-head {
    margin: 0 16px 12px;
}

.maritime-panel-title {
    margin: 0;
    font-size: 1.125rem;
    color: #1a365d;
}

.maritime-panel-sub {
    margin: 6px 0 0;
    font-size: 0.875rem;
    color: #4a5568;
    line-height: 1.45;
}

.maritime-flange-controls,
.maritime-bunker-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 0 16px 16px;
}

.maritime-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 140px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #4a5568;
}

.maritime-field-grow {
    flex: 1;
    min-width: 180px;
}

.maritime-field input,
.maritime-field select {
    padding: 10px 12px;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    font-size: 0.9375rem;
    background: #fff;
    color: #1a202c;
}

.maritime-field input:focus,
.maritime-field select:focus {
    outline: 2px solid #3182ce;
    outline-offset: 1px;
}

.maritime-table-wrap {
    margin: 0 16px 12px;
    overflow: auto;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    max-height: calc(100dvh - 320px);
}

.maritime-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.maritime-table th,
.maritime-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #edf2f7;
    text-align: left;
}

.maritime-table th {
    position: sticky;
    top: 0;
    background: #edf2f7;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #4a5568;
}

.maritime-table tr:last-child td {
    border-bottom: none;
}

.maritime-empty {
    margin: 0 16px;
    color: #718096;
    font-size: 0.9375rem;
}

.maritime-note {
    margin: 8px 16px 20px;
    font-size: 0.75rem;
    color: #718096;
    line-height: 1.45;
}

.maritime-bunker-result {
    margin: 0 16px 12px;
    padding: 16px 18px;
    border-radius: 12px;
    background: linear-gradient(135deg, #ebf8ff 0%, #e6fffa 100%);
    border: 1px solid #90cdf4;
    text-align: center;
}

.maritime-bunker-label {
    display: block;
    font-size: 0.8125rem;
    color: #2c5282;
    margin-bottom: 4px;
}

.maritime-bunker-value {
    font-size: 1.75rem;
    color: #1a365d;
}

.store-public-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px 0 24px;
    min-height: 0;
}

.store-public-main .store-toolbar,
.store-public-main .store-toolbar-public {
    margin-left: 16px;
    margin-right: 16px;
}

.store-public-main .store-vl-wrap {
    margin: 0 16px;
}

.store-public-main .store-cap-note,
.store-public-main .store-empty,
.store-public-main .store-loading,
.store-public-main .store-error {
    margin-left: 16px;
    margin-right: 16px;
}

.store-public-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 12px 20px 16px;
    font-size: 0.8125rem;
    color: #4a5568;
    border-top: 1px solid #cbd5e0;
    background: rgba(255, 255, 255, 0.65);
}

.store-public-footer a {
    color: #2b6cb0;
    font-weight: 600;
    text-decoration: none;
}

.store-public-footer a:hover,
.store-public-footer a:focus-visible {
    text-decoration: underline;
}

.store-public-mode .store-toolbar-public .store-search {
    min-width: 220px;
}

.store-public-mode #catalog-table-wrapper,
.store-public-mode #storeVlWrap {
    flex: 1;
    min-height: 280px;
}

.store-public-mode .store-catalog-hscroll {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.store-public-mode .store-vl-scroll {
    max-height: calc(100dvh - 280px);
    min-height: 240px;
}

.store-tool-flange .store-public-main,
.store-tool-bunker .store-public-main,
.store-tool-lube .store-public-main,
.store-tool-paint .store-public-main,
.store-tool-engineering .store-public-main {
    display: none;
}

@media (max-width: 640px) {
    .store-public-header {
        padding: 12px 14px;
    }

    .store-public-header-actions {
        gap: 8px;
    }

    .btn-header-contact {
        padding: 5px 10px;
        font-size: 0.75rem;
    }

    .store-public-title {
        font-size: 1rem;
    }

    .store-public-subtitle {
        font-size: 0.75rem;
    }

    .maritime-bunker-metrics {
        grid-template-columns: 1fr;
    }

    .store-public-toolkit {
        padding: 10px 12px;
    }

    .store-tool-chip {
        font-size: 0.75rem;
        padding: 7px 10px;
    }

    .store-public-mode .store-vl-scroll {
        max-height: calc(100dvh - 300px);
    }
}

/* Mobile ≤768px — natural scroll, no pull-to-refresh (Maritime Toolkit) */
@media screen and (max-width: 768px) {
    html.store-public-mode,
    html:has(.store-public-body),
    html {
        overscroll-behavior-y: contain;
        background-color: #0f172a;
        min-height: 100dvh;
        overflow-x: hidden;
    }

    body.store-public-body,
    body.mkt-toolkit-page {
        overscroll-behavior-y: contain;
        background-color: #0f172a;
        min-height: 100dvh;
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }

    body.mkt-toolkit-page .mkt-site-wrap,
    .store-public-shell {
        overscroll-behavior-y: contain;
        width: 100%;
        max-width: 100vw;
    }

    .store-public-shell {
        display: flex;
        flex-direction: column;
        min-height: 0;
    }

    .store-public-header,
    .home-toolkit-hero,
    .store-public-toolkit,
    .store-public-footer,
    #marketing-footer {
        flex-shrink: 0;
    }

    .store-public-panels {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    .store-public-panel {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    .store-public-main {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        padding-bottom: 8px;
    }

    .store-public-main .store-toolbar,
    .store-public-main .store-toolbar-public,
    .store-public-main .store-cap-note {
        flex-shrink: 0;
    }

    /* iOS Safari — 16px prevents focus zoom */
    .store-public-body .store-search,
    .store-public-body .store-category-filter,
    .store-public-body .maritime-field input,
    .store-public-body .maritime-field select {
        font-size: 16px !important;
    }

    /* IMPA catalog — header fixed on vertical scroll; shared horizontal scroll */
    #catalog-table-wrapper.store-catalog-wrap {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        margin-bottom: 8px;
        overflow: hidden;
        overscroll-behavior: contain;
    }

    #storeCatalogHScroll.store-catalog-hscroll {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow-x: auto;
        overflow-y: hidden;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    #catalog-table-wrapper.store-catalog-wrap .store-vl-head {
        flex-shrink: 0;
        width: 500px;
        min-width: 500px;
        grid-template-columns: 96px 220px 140px;
    }

    #catalog-table-wrapper.store-catalog-wrap .store-vl-unit,
    #catalog-table-wrapper.store-catalog-wrap .store-vl-unit-head {
        display: none;
    }

    #catalog-table-wrapper.store-catalog-wrap .store-vl-head span,
    #catalog-table-wrapper.store-catalog-wrap .store-vl-cell {
        white-space: nowrap;
    }

    #catalog-table-wrapper.store-catalog-wrap #storeVlScroll.store-vl-scroll {
        flex: 1;
        min-height: 0 !important;
        height: auto !important;
        max-height: none !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        overscroll-behavior: contain;
        touch-action: pan-y;
        -webkit-overflow-scrolling: touch;
    }

    #catalog-table-wrapper.store-catalog-wrap #storeVlScroll .vl-inner,
    #catalog-table-wrapper.store-catalog-wrap #storeVlScroll .store-vl-row {
        width: 500px;
        min-width: 500px;
        grid-template-columns: 96px 220px 140px;
    }

    /* Utility tab panels — own scroll, no body drift */
    #storeToolBunker,
    #storeToolLube,
    #storeToolPaint,
    #storeToolEngineering {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        overflow-x: auto;
        overscroll-behavior: contain;
        touch-action: pan-x pan-y;
        -webkit-overflow-scrolling: touch;
    }

    .maritime-table-wrap {
        overflow-x: auto;
        overflow-y: auto;
        overscroll-behavior: contain;
        touch-action: pan-x pan-y;
        -webkit-overflow-scrolling: touch;
    }

    .maritime-table-wrap .maritime-table {
        min-width: 480px;
    }

    .maritime-table-wrap .maritime-table th,
    .maritime-table-wrap .maritime-table td {
        white-space: nowrap;
    }

    /* IMPA detail modal — stay centered; body scroll lock handled in JS */
    .impa-detail-modal {
        z-index: 99999;
    }
}

/* Utility — toolkit.html does not load app.css */
.hidden {
    display: none !important;
}

/* Maritime Toolkit public modal — never show legacy plate viewer */
.impa-detail-modal-public #impaDetailPmsLayout,
.impa-detail-modal-public .impa-detail-plate-section,
.impa-detail-modal-public .impa-plate-fullscreen {
    display: none !important;
}

/* Maritime Toolkit — ShipServ-style centered IMPA detail modal */
.impa-detail-modal-public {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(10, 16, 30, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.impa-detail-modal-public .impa-detail-box,
.impa-detail-modal-public .impa-modal-container {
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    max-height: 85dvh;
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}

.impa-detail-modal-public .impa-detail-head {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: #0f172a;
    border-bottom: 1px solid #1e293b;
    color: #f8fafc;
}

.impa-detail-modal-public .impa-detail-head-main {
    min-width: 0;
}

.impa-detail-modal-public .impa-detail-title {
    display: none;
}

.impa-detail-modal-public .impa-detail-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    background: #1e293b;
    color: #e2e8f0;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.impa-detail-modal-public #modalCloseBtn {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    border-radius: 6px;
    background: #1e293b;
    color: #fff;
    border: 1px solid #334155;
    font-size: 18px;
}

.impa-detail-modal-public .modal-body,
.impa-detail-modal-public .impa-detail-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    padding: 20px;
    background: #0f172a;
}

.impa-shipserv-photo {
    max-height: 220px;
    margin: 0 auto 16px;
    border-radius: 8px;
    background: #ffffff;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.impa-shipserv-photo-img {
    display: block;
    max-width: 100%;
    max-height: 200px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.impa-shipserv-photo-fallback,
.impa-shipserv-photo-loading {
    width: 100%;
    text-align: center;
    color: #64748b;
    font-size: 0.8125rem;
}

.impa-shipserv-photo-svg {
    display: block;
    width: 100%;
    max-height: 200px;
}

.impa-shipserv-title {
    margin: 0 0 8px;
    color: #f8fafc;
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.35;
}

.impa-shipserv-dims {
    margin: 0 0 16px;
    color: #94a3b8;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.4;
}

.impa-shipserv-dims.hidden {
    display: none;
}

.impa-shipserv-spec-wrap {
    margin-bottom: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    overflow: hidden;
}

.impa-shipserv-spec-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.impa-shipserv-spec-table th,
.impa-shipserv-spec-table td {
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid #1e293b;
}

.impa-shipserv-spec-table tr:last-child th,
.impa-shipserv-spec-table tr:last-child td {
    border-bottom: none;
}

.impa-shipserv-spec-table th {
    width: 38%;
    color: #94a3b8;
    font-weight: 600;
    background: #131e36;
}

.impa-shipserv-spec-table td {
    color: #e2e8f0;
    background: #0f172a;
}

.impa-shipserv-desc-title {
    margin: 0 0 8px;
    color: #cbd5e1;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.impa-shipserv-desc-text {
    margin: 0;
    padding: 12px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    font-size: 0.875rem;
    line-height: 1.55;
}

@media (max-width: 768px) {
    .impa-detail-modal-public {
        padding: max(16px, env(safe-area-inset-top, 0px)) 16px max(16px, env(safe-area-inset-bottom, 0px));
    }

    .impa-detail-modal-public .impa-detail-box,
    .impa-detail-modal-public .impa-modal-container {
        max-height: 85dvh;
    }
}
