:root {
    --canvas: #eef1f8;
    --surface: #ffffff;
    --surface-soft: #f7f8fc;
    --ink: #101a32;
    --muted: #68728a;
    --line: #d9deea;
    --blue: #3154f5;
    --blue-dark: #1e39bd;
    --mint: #c9f5da;
    --gold: #f4b83f;
    --success: #17764d;
    --warning: #986000;
    --error: #bd3434;
    --display: "Arial Black", "Helvetica Neue", Arial, sans-serif;
    --body: "Avenir Next", "Segoe UI", Arial, sans-serif;
    --data: Consolas, "SFMono-Regular", "Roboto Mono", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    overflow-x: clip;
    color: var(--ink);
    background: var(--canvas);
    font-family: var(--body);
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.site-shell {
    width: min(calc(100% - 40px), 1080px);
    margin: 0 auto;
}

.site-header {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 1px solid rgba(16, 26, 50, 0.12);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: var(--ink);
    font-family: var(--display);
    font-size: 16px;
    letter-spacing: -0.04em;
    text-decoration: none;
}

.brand-mark {
    width: 46px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: #fff;
    background: var(--blue);
    font-family: var(--data);
    font-size: 17px;
    font-weight: 900;
    letter-spacing: -0.08em;
    box-shadow: inset -9px 0 0 rgba(255, 255, 255, 0.11);
}

.market-indicator {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.76);
    font-family: var(--data);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 4px rgba(23, 118, 77, 0.12);
}

.hero {
    min-height: calc(100svh - 76px);
    display: grid;
    align-content: center;
    gap: 24px;
    padding: 42px 0 56px;
}

.hero-copy { width: 100%; }

h1 {
    margin: 0;
    font-family: var(--display);
    font-size: clamp(48px, 6.7vw, 76px);
    font-weight: 900;
    line-height: 0.94;
    letter-spacing: -0.065em;
}

h1 span { color: var(--blue); }

.section-label,
.card-index {
    margin: 0;
    font-family: var(--data);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.section-label { color: var(--blue); }

.converter {
    width: 100%;
    position: relative;
    padding: clamp(24px, 3.5vw, 38px);
    overflow: hidden;
    border: 1px solid rgba(16, 26, 50, 0.1);
    border-radius: 26px;
    background: var(--surface);
    box-shadow: 0 26px 70px rgba(45, 61, 103, 0.15);
}

.converter::before {
    content: "";
    height: 7px;
    position: absolute;
    inset: 0 0 auto;
    background: linear-gradient(90deg, var(--blue) 0 78%, var(--gold) 78% 88%, var(--mint) 88% 100%);
}

.converter-topline {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.converter h2 {
    margin: 7px 0 0;
    font-family: var(--display);
    font-size: clamp(25px, 3vw, 34px);
    line-height: 1;
    letter-spacing: -0.045em;
}

.edition {
    padding: 8px 11px;
    border-radius: 999px;
    color: var(--blue-dark);
    background: #e9edff;
    font-family: var(--data);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}

.rate-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    padding: 19px 22px;
    margin-bottom: 24px;
    border-radius: 17px;
    color: #fff;
    background: var(--blue);
}

.rate-label {
    margin: 0 0 5px;
    color: rgba(255, 255, 255, 0.72);
    font-family: var(--data);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.rate-value {
    margin: 0;
    font-family: var(--data);
    font-size: clamp(20px, 3vw, 28px);
    font-weight: 900;
    letter-spacing: -0.05em;
}

.rate-status {
    flex: 0 0 auto;
    padding: 7px 10px;
    border-radius: 999px;
    color: var(--ink);
    background: var(--mint);
    font-family: var(--data);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.rate-status.is-error { color: #fff; background: var(--error); }
.rate-status.is-stale { color: var(--ink); background: #ffe29d; }

.converter-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 52px minmax(0, 1fr);
    gap: 18px;
    align-items: end;
}

.input-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 8px;
    color: var(--muted);
    font-family: var(--data);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.input-heading label { color: var(--ink); }
.input-shell { position: relative; }

.input-shell input {
    width: 100%;
    min-height: 72px;
    padding: 14px 112px 14px 17px;
    border: 1px solid var(--line);
    border-radius: 14px;
    outline: none;
    color: var(--ink);
    background: var(--surface-soft);
    font-family: var(--data);
    font-size: clamp(20px, 2.5vw, 27px);
    font-weight: 800;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.input-shell input::placeholder { color: #9ca6ba; }

.input-shell input:focus {
    border-color: var(--blue);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(49, 84, 245, 0.12);
}

.currency-chip {
    min-width: 86px;
    height: 38px;
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 11px;
    border-radius: 10px;
    color: var(--ink);
    background: #e8ecf4;
    font-family: var(--data);
    font-size: 11px;
    font-weight: 900;
}

.currency-chip span { color: var(--blue); font-size: 16px; }

.swap-row {
    height: 72px;
    display: grid;
    place-items: center;
}

.swap-row > span { display: none; }

.swap-button {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 13px;
    color: #fff;
    background: var(--ink);
    cursor: pointer;
    transition: transform 180ms ease, color 180ms ease, background 180ms ease;
}

.swap-button:hover { color: var(--ink); background: var(--gold); transform: rotate(180deg); }

.swap-button svg,
.refresh-button svg,
.card-icon svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.swap-button svg { width: 20px; height: 20px; }

.refresh-button {
    min-height: 54px;
    grid-column: 1 / -1;
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 18px;
    border: 0;
    border-radius: 13px;
    color: #fff;
    background: var(--ink);
    cursor: pointer;
    font-family: var(--data);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    transition: background 160ms ease, transform 160ms ease;
}

.refresh-button:hover { background: var(--blue); transform: translateY(-1px); }
.refresh-button:active { transform: translateY(0); }
.refresh-button:disabled { cursor: wait; opacity: 0.66; }
.refresh-button svg { width: 19px; height: 19px; }

.brand:focus-visible,
.swap-button:focus-visible,
.refresh-button:focus-visible,
.footer-links a:focus-visible,
.prose a:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 3px;
}

.message {
    min-height: 18px;
    margin-top: 12px;
    color: var(--muted);
    font-family: var(--data);
    font-size: 9px;
    font-weight: 700;
    line-height: 1.45;
}

.message.is-error { color: var(--error); }
.message.is-warning { color: var(--warning); }

.info-section {
    display: grid;
    grid-template-columns: 0.9fr 1.1fr;
    gap: clamp(40px, 8vw, 100px);
    align-items: end;
    padding: clamp(50px, 7vw, 76px);
    margin: 90px 0 22px;
    border-radius: 30px;
    color: #fff;
    background: var(--ink);
}

.info-section .section-label { color: var(--mint); }

.info-heading h2 {
    margin: 14px 0 0;
    font-family: var(--display);
    font-size: clamp(38px, 5.2vw, 58px);
    line-height: 0.98;
    letter-spacing: -0.055em;
}

.info-copy {
    margin: 0;
    color: #cbd2e3;
    font-size: clamp(17px, 2vw, 21px);
    line-height: 1.7;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
    padding: 0 0 100px;
}

.feature-card {
    min-height: 320px;
    display: flex;
    flex-direction: column;
    padding: 30px;
    border: 1px solid rgba(16, 26, 50, 0.1);
    border-radius: 24px;
    background: var(--surface);
}

.feature-card--mint { background: var(--mint); }
.feature-card--dark { color: #fff; background: var(--blue); }
.card-index { color: var(--muted); }
.feature-card--dark .card-index { color: rgba(255, 255, 255, 0.7); }

.card-icon {
    width: 50px;
    height: 50px;
    display: grid;
    place-items: center;
    margin: 38px 0 34px;
    border-radius: 15px;
    color: #fff;
    background: var(--blue);
}

.feature-card--dark .card-icon { color: var(--ink); background: var(--mint); }
.card-icon svg { width: 27px; height: 27px; }

.feature-card h3 {
    margin: auto 0 12px;
    font-family: var(--display);
    font-size: clamp(24px, 2.6vw, 31px);
    line-height: 1.04;
    letter-spacing: -0.045em;
}

.feature-card p:last-child {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.feature-card--dark p:last-child { color: rgba(255, 255, 255, 0.78); }

.site-footer {
    min-height: 176px;
    display: grid;
    grid-template-columns: 1fr auto 1.2fr 0.8fr;
    gap: clamp(24px, 4vw, 46px);
    align-items: center;
    padding: 40px 0;
    border-top: 1px solid rgba(16, 26, 50, 0.14);
}

.footer-brand { display: flex; align-items: center; gap: 11px; }
.brand-mark--small { width: 39px; height: 30px; border-radius: 9px; font-size: 14px; }
.footer-brand div { display: grid; gap: 3px; }
.footer-brand strong { font-family: var(--display); font-size: 12px; }

.footer-brand div span,
.copyright,
.disclaimer {
    color: var(--muted);
    font-family: var(--data);
    font-size: 9px;
    line-height: 1.55;
}

.footer-brand div span,
.copyright { letter-spacing: 0.04em; text-transform: uppercase; }

.footer-links { display: flex; gap: 20px; }

.footer-links a {
    color: var(--ink);
    font-family: var(--data);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
    text-transform: uppercase;
}

.footer-links a:hover { color: var(--blue); }
.disclaimer, .copyright { margin: 0; }
.copyright { text-align: right; }
#about, #privacy-policy { scroll-margin-top: 22px; }

/* Lightweight text and policy pages */
.text-page .site-shell {
    width: min(calc(100% - 40px), 1080px);
}

.article-page {
    margin-top: 34px;
    overflow: hidden;
    border: 1px solid rgba(16, 26, 50, 0.1);
    border-radius: 26px;
    background: var(--surface);
}

.article-content {
    width: min(calc(100% - 48px), 730px);
    margin: 0 auto;
    padding: clamp(60px, 8vw, 92px) 0 clamp(76px, 10vw, 116px);
}

.article-header {
    padding-bottom: clamp(38px, 6vw, 56px);
    border-bottom: 1px solid var(--line);
}

.article-kicker,
.article-meta {
    font-family: var(--data);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.article-kicker {
    margin: 0 0 22px;
    color: var(--blue);
}

.article-page h1 {
    max-width: 660px;
    font-size: clamp(54px, 7vw, 76px);
    line-height: 0.95;
}

.article-lead {
    max-width: 660px;
    margin: 28px 0 0;
    color: #364158;
    font-size: clamp(19px, 2.2vw, 22px);
    line-height: 1.58;
}

.article-meta {
    margin: 26px 0 0;
    color: var(--muted);
}

.prose {
    padding-top: clamp(38px, 6vw, 56px);
    color: #354057;
    font-size: 17px;
    line-height: 1.78;
}

.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }

.prose p {
    margin: 0 0 22px;
}

.prose h2 {
    margin: 56px 0 19px;
    color: var(--ink);
    font-family: var(--display);
    font-size: clamp(30px, 4vw, 39px);
    line-height: 1.08;
    letter-spacing: -0.045em;
}

.prose h3 {
    margin: 34px 0 13px;
    color: var(--ink);
    font-size: 19px;
    line-height: 1.35;
    letter-spacing: -0.015em;
}

.prose ul,
.prose ol {
    margin: 0 0 26px;
    padding-left: 25px;
}

.prose li {
    margin-bottom: 9px;
    padding-left: 5px;
}

.prose li::marker {
    color: var(--blue);
    font-weight: 900;
}

.prose a {
    color: var(--blue-dark);
    font-weight: 700;
    text-decoration-color: rgba(49, 84, 245, 0.42);
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
}

.prose a:hover {
    color: var(--blue);
    text-decoration-color: currentColor;
}

.brand:focus-visible,
.footer-links a:focus-visible,
.prose a:focus-visible {
    outline: 3px solid rgba(49, 84, 245, 0.32);
    outline-offset: 4px;
}

@media (max-width: 900px) {
    .info-section { grid-template-columns: 1fr; gap: 26px; }
    .feature-grid { grid-template-columns: 1fr; }
    .feature-card { min-height: 270px; }
    .site-footer { grid-template-columns: 1fr 1fr; }
    .footer-links { justify-content: flex-end; }
    .disclaimer, .copyright { grid-column: 1 / -1; }
    .copyright { text-align: left; }
}

@media (max-width: 720px) {
    .converter-form { grid-template-columns: 1fr; gap: 0; }
    .swap-row {
        height: auto;
        grid-template-columns: 1fr auto 1fr;
        gap: 10px;
        margin: 10px 0;
    }
    .swap-row > span { display: block; width: 100%; height: 1px; background: var(--line); }
    .refresh-button { grid-column: auto; margin-top: 16px; }
}

@media (max-width: 600px) {
    .site-shell { width: min(calc(100% - 24px), 1080px); }
    .site-header { min-height: 64px; }
    .brand { gap: 8px; font-size: 14px; }
    .brand-mark { width: 39px; height: 30px; border-radius: 9px; font-size: 14px; }
    .market-indicator { gap: 6px; padding: 7px 8px; font-size: 8px; }
    .hero { min-height: calc(100svh - 64px); gap: 16px; padding: 22px 0 34px; }
    h1 { font-size: clamp(38px, 12vw, 50px); line-height: 0.98; }
    .converter { padding: 20px 17px 17px; border-radius: 20px; }
    .converter-topline { margin-bottom: 16px; }
    .converter h2 { font-size: 25px; }
    .edition { padding: 7px 9px; }
    .rate-panel { align-items: flex-start; flex-direction: column; gap: 9px; padding: 14px 15px; margin-bottom: 16px; border-radius: 14px; }
    .rate-value { font-size: 20px; }
    .rate-status { padding: 5px 8px; }
    .input-heading { margin-bottom: 6px; }
    .input-shell input { min-height: 58px; padding: 10px 100px 10px 13px; font-size: 19px; border-radius: 12px; }
    .currency-chip { min-width: 78px; height: 34px; right: 9px; }
    .swap-row { margin: 7px 0; }
    .swap-button { width: 34px; height: 34px; border-radius: 11px; }
    .refresh-button { min-height: 48px; margin-top: 13px; border-radius: 12px; }
    .message { min-height: 15px; margin-top: 8px; font-size: 8px; }
    .info-section { padding: 38px 25px; margin: 68px 0 18px; border-radius: 24px; }
    .info-heading h2 { font-size: 38px; }
    .info-copy { font-size: 16px; }
    .feature-grid { gap: 16px; padding-bottom: 72px; }
    .feature-card { min-height: 280px; padding: 26px; border-radius: 20px; }
    .site-footer { grid-template-columns: 1fr; gap: 22px; }
    .footer-links { justify-content: flex-start; }
    .disclaimer, .copyright { grid-column: auto; }
    .text-page .site-shell { width: min(calc(100% - 24px), 1080px); }
    .article-page { margin-top: 18px; border-radius: 20px; }
    .article-content { width: 100%; padding: 48px 20px 68px; }
    .article-kicker { margin-bottom: 18px; }
    .article-page h1 { font-size: clamp(42px, 14vw, 56px); }
    .article-lead { margin-top: 22px; font-size: 18px; }
    .article-meta { margin-top: 22px; }
    .prose { padding-top: 38px; font-size: 16px; line-height: 1.72; }
    .prose h2 { margin-top: 45px; font-size: 29px; }
    .prose h3 { margin-top: 30px; font-size: 18px; }
}

@media (max-width: 360px), (max-width: 600px) and (max-height: 700px) {
    .site-shell { width: min(calc(100% - 16px), 1080px); }
    .site-header { min-height: 58px; }
    .market-indicator { font-size: 7px; }
    .hero { min-height: calc(100svh - 58px); gap: 10px; align-content: start; padding: 10px 0 18px; }
    h1 { font-size: 36px; }
    .converter { padding: 16px 12px 12px; border-radius: 17px; }
    .converter-topline { margin-bottom: 11px; }
    .converter h2 { font-size: 22px; }
    .rate-panel { gap: 6px; padding: 10px 12px; margin-bottom: 11px; }
    .rate-value { font-size: 17px; }
    .input-shell input { min-height: 50px; font-size: 17px; }
    .currency-chip { height: 31px; }
    .swap-row { margin: 5px 0; }
    .swap-button { width: 30px; height: 30px; }
    .refresh-button { min-height: 43px; margin-top: 10px; }
    .message { min-height: 13px; margin-top: 6px; }
    .text-page .site-shell { width: min(calc(100% - 16px), 1080px); }
    .article-content { padding: 40px 16px 58px; }
    .article-page h1 { font-size: 40px; }
}

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