/* Shared responsive shell and conversion primitives.
 * Loaded after each page's local styles so legacy pages keep their visual
 * identity while sharing one predictable navigation and mobile baseline. */

html { overflow-x: hidden; scroll-behavior: smooth; }
body { overflow-wrap: anywhere; }
body > header {
    gap: clamp(0.75rem, 1.8vw, 1.5rem);
    padding-inline: clamp(1rem, 3vw, 3.5rem) !important;
}
body > header .logo { flex: 0 0 auto; white-space: nowrap; }
body > header nav {
    min-width: 0;
    flex: 1 1 auto;
    align-items: center;
    justify-content: center;
    gap: clamp(0.65rem, 1.25vw, 1.5rem) !important;
}
body > header nav a {
    white-space: nowrap;
    position: relative;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}
body > header nav a:hover {
    color: var(--primary, #00f2fe) !important;
    background: rgba(255, 255, 255, 0.04);
}
body > header nav a.active {
    color: var(--primary, #00f2fe) !important;
    background: rgba(0, 242, 254, 0.1);
    border: 1px solid rgba(0, 242, 254, 0.28);
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.15);
    font-weight: 700;
}
body > header nav a.active::after {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    background: #00f2fe;
    border-radius: 50%;
    margin-left: 6px;
    vertical-align: middle;
    box-shadow: 0 0 6px #00f2fe;
}
body > header > .btn { flex: 0 0 auto; white-space: nowrap; }

/* Code, JSON, and Sandbox Response Wrapping & Scrolling */
pre, code, .code-block, .code-editor, .response-viewer, textarea.response-viewer, .response-box, .json-box {
    max-width: 100%;
    box-sizing: border-box;
}
.code-block, pre, .response-viewer, textarea.response-viewer {
    overflow-x: auto;
    white-space: pre-wrap !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    scrollbar-width: thin;
    scrollbar-color: var(--primary, #00f2fe) rgba(255,255,255,0.05);
}
.code-block pre {
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    white-space: pre-wrap !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
}
.code-block pre code {
    white-space: pre-wrap !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
}

.nav-toggle {
    display: none;
    width: 2.75rem;
    height: 2.75rem;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--glass-border, var(--border, rgba(255,255,255,0.12)));
    border-radius: 10px;
    background: rgba(255,255,255,0.05);
    color: var(--text-main, var(--text, #fff));
    font: inherit;
    font-size: 1.25rem;
    cursor: pointer;
}
.nav-toggle:focus-visible,
body > header nav a:focus-visible,
.btn:focus-visible,
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--primary, var(--accent, #00f2fe));
    outline-offset: 3px;
}

.conversion-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-top: 1rem;
}
.conversion-actions[hidden] { display: none; }
.conversion-actions .btn,
.conversion-actions .action-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    padding: 0.68rem 1rem;
    font-weight: 700;
}
.conversion-actions .action-link {
    color: var(--primary, var(--accent, #00f2fe));
    border: 1px solid var(--glass-border, var(--border, rgba(255,255,255,0.12)));
    background: rgba(255,255,255,0.035);
}

img, svg, video { max-width: 100%; height: auto; }
pre, code, .mono, .metric-value, .metric-val, .keyout { overflow-wrap: normal; }
table { max-width: 100%; }

@media (max-width: 1280px) and (min-width: 721px) {
    body > header { flex-wrap: wrap; }
    body > header nav {
        order: 3;
        flex: 1 0 100%;
        justify-content: flex-start;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        scrollbar-width: thin;
        padding: 0.15rem 0 0.1rem;
    }
}

@media (max-width: 720px) {
    body > header {
        flex-wrap: wrap;
        min-height: 4.5rem;
        padding-block: 0.8rem !important;
    }
    body > header .logo { font-size: 1.28rem; margin-right: auto; }
    html.nav-ready .nav-toggle { display: inline-flex; order: 2; }
    body > header > .btn { display: none; }
    html.nav-ready body > header nav {
        display: none;
        order: 4;
        flex: 1 0 100%;
        width: 100%;
        max-height: calc(100vh - 5rem);
        overflow-y: auto;
        align-items: stretch;
        justify-content: flex-start;
        flex-direction: column;
        gap: 0 !important;
        padding: 0.65rem 0 0.25rem;
        border-top: 1px solid var(--glass-border, var(--border, rgba(255,255,255,0.12)));
    }
    html.nav-ready body > header.nav-open nav { display: flex; }
    body > header nav a {
        width: 100%;
        min-height: 44px;
        display: flex;
        align-items: center;
        padding: 0.55rem 0.35rem;
    }
    body > header nav a.active,
    body > header nav a[aria-current="page"] {
        padding-left: 0.75rem;
        border-left: 2px solid var(--primary, var(--accent, #00f2fe));
        background: rgba(0,242,254,0.05);
    }

    .container,
    .main-container,
    main { padding-inline: 1rem !important; }
    main { grid-template-columns: minmax(0, 1fr) !important; }
    main > *,
    .glass-panel,
    .code-block,
    .sandbox-area { min-width: 0; max-width: 100%; }
    pre { max-width: 100%; }
    .container,
    .main-container { padding-top: 2rem !important; }
    .hero, .header-title { margin-bottom: 2rem !important; }
    .hero h1,
    .header-title h1 { font-size: clamp(2rem, 10vw, 2.6rem) !important; }
    .header-text h1 { font-size: clamp(1.9rem, 9vw, 2.4rem) !important; }
    h1 { overflow-wrap: normal; }
    .glass-panel,
    .pricing-card,
    .crypto-box,
    .results-card,
    .integration-card { padding: 1.25rem !important; }
    .search-box { flex-direction: column; }
    .search-box input,
    .search-box button,
    .search-box .btn { width: 100%; min-width: 0; }
    .metrics-grid { grid-template-columns: 1fr !important; }
    .score-banner { align-items: flex-start !important; gap: 0.75rem; flex-wrap: wrap; }
    .code-header { gap: 0.75rem; flex-wrap: wrap; }
    .code-tabs,
    .lang-tabs { max-width: 100%; overflow-x: auto; }
    .kv { grid-template-columns: 1fr !important; gap: 0.25rem !important; }
    .kv div:nth-child(even) { margin-bottom: 0.65rem; }
    .row > .btn,
    .row > button,
    .row > a { min-height: 44px; }
    .modal-content { max-height: calc(100vh - 2rem); overflow-y: auto; padding: 1.25rem !important; }
    footer p { line-height: 2; }
}

@media (max-width: 480px) {
    .glass-panel,
    .pricing-card,
    .crypto-box,
    .results-card,
    .integration-card { padding: 1rem !important; border-radius: 14px !important; }
    .pricing-grid,
    .integration-grid { grid-template-columns: minmax(0, 1fr) !important; }
    .price-amount { font-size: 2.4rem !important; }
    .conversion-actions > * { width: 100%; }
    .row { align-items: stretch !important; }
    .row > .btn,
    .row > button,
    .row > a { width: 100%; text-align: center; justify-content: center; }
    table.rate,
    .glass-panel > table { display: block; overflow-x: auto; white-space: nowrap; }
    th, td { padding-inline: 0.65rem !important; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
