:root {
    --navy: #0f1b3e;
    --navy-deep: #0a1330;
    --green: #22c55e;
    --green-dark: #16a34a;
    --blue: #60a5fa;
    --ink: #111827;
    --ink-soft: #4b5563;
    --line: #e5e7eb;
    --bg: #f8fafc;
    --card: #ffffff;
    --radius: 14px;
    --shadow-card: 0 20px 40px -20px rgba(15, 27, 62, 0.25), 0 8px 16px -10px rgba(15, 27, 62, 0.12);
    --shadow-chip: 0 1px 2px rgba(15, 27, 62, 0.08);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: clip;
}

body {
    font-family: 'Commissioner', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Flex children default to min-width: auto, which refuses to shrink below
   their widest content (long URLs in <pre>, etc.) and blows out the viewport
   on narrow screens. Force them to shrink. */
body > * {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

/* Defensive: long Greek text and URLs should always be allowed to break
   rather than push parents wider than their constrained width. */
p, li, h1, h2, h3, h4, h5 {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

main {
    flex: 1;
}

/* ---- Header ---- */

.site-header {
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 40px;
    border-bottom: 1px solid var(--line);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--navy);
    font-weight: 700;
    font-size: 18px;
}

.brand-icon {
    width: 28px;
    height: 28px;
}

.brand-text {
    letter-spacing: -0.01em;
}

.nav-actions {
    display: flex;
    gap: 10px;
}

.api-button,
.about-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.api-button {
    background: var(--navy);
    color: #fff;
    border: 1.5px solid var(--navy);
}

.api-button:hover {
    background: var(--navy-deep);
    border-color: var(--navy-deep);
}

.about-button {
    background: #fff;
    color: var(--navy);
    border: 1.5px solid var(--navy);
}

.about-button:hover {
    background: var(--navy);
    color: #fff;
}

/* ---- Hero ---- */

.hero {
    background: var(--navy);
    color: #fff;
    padding: 36px 40px 90px;
    position: relative;
    text-align: center;
}

.hero-title {
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 700;
    margin: 0 0 40px;
    letter-spacing: -0.02em;
}

.controls {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 1100px;
    margin: 0 auto;
    position: relative;
    z-index: 5;
}

.control {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
    text-align: left;
    flex: 1 1 220px;
    min-width: 0;
}

.control-label {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.75);
}

.control-input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 15px;
    font-family: inherit;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='white'><path d='M5 8l5 5 5-5H5z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
    padding-right: 38px;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.control-input:hover {
    background-color: rgba(255, 255, 255, 0.12);
}

.control-input:focus {
    outline: none;
    border-color: var(--green);
    background-color: rgba(255, 255, 255, 0.12);
}

.control-input option {
    background: var(--navy);
    color: #fff;
}

/* Multi-select dropdown */
.multi-select {
    position: relative;
    width: 100%;
}

.multi-select-trigger {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    transition: border-color 0.15s ease, background-color 0.15s ease;
    text-align: left;
}

.multi-select-trigger:hover {
    background: rgba(255, 255, 255, 0.12);
}

.multi-select.is-open .multi-select-trigger,
.multi-select-trigger:focus {
    outline: none;
    border-color: var(--green);
    background: rgba(255, 255, 255, 0.12);
}

.trigger-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trigger-caret {
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.multi-select.is-open .trigger-caret {
    transform: rotate(180deg);
}

.multi-select-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 10;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 12px 24px -12px rgba(15, 27, 62, 0.35);
    max-height: 280px;
    overflow-y: auto;
    padding: 6px;
}

.multi-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 7px;
    cursor: pointer;
    color: var(--ink);
    font-size: 14px;
    user-select: none;
}

.multi-option:hover {
    background: var(--bg);
}

.multi-option input[type="checkbox"] {
    margin: 0;
    width: 16px;
    height: 16px;
    accent-color: var(--green);
    cursor: pointer;
}

.multi-option.is-selected {
    color: var(--navy);
    font-weight: 500;
}

.range-chips {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 4px;
    width: 100%;
}

.chip {
    flex: 1;
    padding: 9px 8px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.75);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.chip:hover {
    color: #fff;
}

.chip.is-active {
    background: var(--green);
    color: #fff;
    box-shadow: var(--shadow-chip);
}

/* ---- Chart card ---- */

.chart-card {
    background: var(--card);
    max-width: 1100px;
    margin: -40px auto 40px;
    padding: 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    position: relative;
    z-index: 2;
}

.chart-wrap {
    position: relative;
    height: 420px;
}

.chart-status {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.85);
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 500;
    z-index: 3;
    border-radius: var(--radius);
    pointer-events: none;
}

.chart-status[hidden] {
    display: none;
}

.chart-status[data-kind="error"] {
    color: #b91c1c;
}

/* ---- Latest prices section ---- */

.latest-section {
    max-width: 1100px;
    margin: 0 auto 32px;
    padding: 0;
    text-align: center;
    position: relative;
    z-index: 5;
}

.latest-title {
    font-size: 20px;
    font-weight: 600;
    color: #fff;
    margin: 0 0 4px;
    letter-spacing: -0.01em;
}

.latest-subtitle {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    margin: 0 0 16px;
}

.latest-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.latest-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px;
    text-align: left;
    box-shadow: 0 1px 2px rgba(15, 27, 62, 0.04);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.latest-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px -8px rgba(15, 27, 62, 0.18);
}

.latest-card-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-soft);
    margin-bottom: 10px;
}

.latest-card-price {
    font-size: 26px;
    font-weight: 700;
    color: var(--navy);
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.latest-card-unit {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-soft);
    margin-left: 4px;
}

@media (max-width: 768px) {
    .latest-section {
        margin: 0 0 24px;
        padding: 0;
    }

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

    .latest-card {
        padding: 14px 16px;
    }

    .latest-card-price {
        font-size: 22px;
    }
}

/* ---- About page ---- */

.about-content {
    max-width: 880px;
    margin: 0 auto;
    padding: 48px 40px 60px;
}

.about-logos {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 48px;
    align-items: stretch;
}

.about-logos a {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    min-height: 130px;
}

.about-logos a:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px -8px rgba(15, 27, 62, 0.18);
    border-color: var(--navy);
}

.about-logos img {
    max-width: 100%;
    max-height: 90px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.about-text {
    line-height: 1.7;
    color: var(--ink);
    font-size: 15px;
}

.about-text p {
    margin: 0 0 14px;
}

.about-text a {
    color: var(--navy);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.15s ease;
}

.about-text a:hover {
    color: var(--green-dark);
}

.about-feedback {
    margin-top: 24px !important;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    text-align: center;
    color: var(--ink-soft);
}

@media (max-width: 768px) {
    .about-content {
        padding: 32px 16px 40px;
    }

    .about-logos {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-bottom: 36px;
    }

    .about-logos a {
        padding: 14px;
        min-height: 100px;
    }

    .about-logos img {
        max-height: 70px;
    }
}

/* ---- Docs page ---- */

.docs-hero {
    background: var(--navy);
    color: #fff;
    padding: 60px 40px 70px;
    text-align: center;
}

.docs-hero-inner {
    max-width: 800px;
    margin: 0 auto;
}

.docs-hero h1 {
    font-size: clamp(28px, 4vw, 38px);
    font-weight: 700;
    margin: 0 0 14px;
    letter-spacing: -0.02em;
}

.docs-hero p {
    margin: 0;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.78);
    line-height: 1.6;
}

.docs-content {
    max-width: 880px;
    margin: 0 auto;
    padding: 40px 40px 60px;
}

.docs-toc {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 40px;
}

.docs-toc a {
    padding: 6px 12px;
    border-radius: 8px;
    color: var(--ink-soft);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}

.docs-toc a:hover {
    background: var(--bg);
    color: var(--navy);
}

.docs-section {
    margin-bottom: 56px;
    scroll-margin-top: 24px;
}

.docs-section h2 {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 16px;
    color: var(--navy);
    letter-spacing: -0.01em;
}

.docs-section p {
    line-height: 1.65;
    color: var(--ink);
    margin: 0 0 14px;
}

.docs-section .hint {
    color: var(--ink-soft);
    font-size: 14px;
}

.bullets {
    margin: 0 0 14px;
    padding-left: 22px;
    line-height: 1.8;
    color: var(--ink);
}

.endpoint {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    scroll-margin-top: 24px;
}

.endpoint header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.endpoint h4 {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-soft);
    margin: 20px 0 8px;
}

.method-badge {
    background: var(--green);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    letter-spacing: 0.05em;
}

.endpoint-path {
    font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    font-size: 15px;
    color: var(--navy);
    font-weight: 600;
    word-break: break-all;
}

code {
    font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    font-size: 0.92em;
    background: #f1f5f9;
    color: var(--navy);
    padding: 2px 6px;
    border-radius: 5px;
}

pre.code {
    background: var(--navy-deep);
    color: #e2e8f0;
    padding: 16px 18px;
    border-radius: 10px;
    overflow-x: auto;
    max-width: 100%;
    box-sizing: border-box;
    font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    font-size: 13.5px;
    line-height: 1.6;
    margin: 0 0 14px;
    -webkit-overflow-scrolling: touch;
}

pre.code code {
    background: transparent;
    color: inherit;
    padding: 0;
}

.code-comment {
    color: #94a3b8;
    font-style: italic;
}

.params-table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0 14px;
    font-size: 14px;
}

.params-table th,
.params-table td {
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
}

.params-table th {
    background: var(--bg);
    color: var(--ink-soft);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

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

@media (max-width: 640px) {
    .docs-hero {
        padding: 40px 20px 50px;
    }

    .docs-hero p {
        font-size: 15px;
    }

    .docs-content {
        padding: 28px 14px 40px;
    }

    .docs-toc {
        padding: 12px;
        gap: 4px;
    }

    .docs-toc a {
        padding: 6px 10px;
        font-size: 13px;
    }

    .endpoint {
        padding: 18px 16px;
    }

    .params-table {
        font-size: 12.5px;
    }

    .params-table th,
    .params-table td {
        padding: 8px 8px;
    }

    .params-table th:first-child,
    .params-table td:first-child {
        white-space: nowrap;
    }

    pre.code {
        font-size: 12.5px;
        padding: 14px;
    }
}

/* ---- Footer ---- */

.site-footer {
    text-align: center;
    padding: 24px 40px 32px;
    color: var(--ink-soft);
    font-size: 13px;
}

.site-footer p {
    margin: 0 0 4px;
}

.site-footer p:last-child {
    margin: 0;
}

.site-footer .heart {
    color: #e11d48;
}

.site-footer a {
    color: var(--navy);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.15s ease;
}

.site-footer a:hover {
    color: var(--green-dark);
}

/* ---- Responsive ---- */

@media (max-width: 640px) {
    .site-header {
        padding: 14px 20px;
    }

    .brand-text {
        font-size: 16px;
    }

    .hero {
        padding: 24px 20px 70px;
    }

    .chart-card {
        margin: -30px 16px 24px;
        padding: 20px;
    }

    .chart-wrap {
        height: 320px;
    }

    .controls {
        gap: 14px;
    }

    .control {
        flex-basis: 100%;
        max-width: none;
    }
}
