/* Floating currency calculator (partials/currency_calc.html).
   Colours come from the site's theme tokens (static/site/theme.css), so the
   dark / navy / light palettes work without this file knowing them. Sits in
   the bottom-left corner - the shop's cart button owns the bottom-right. On a
   phone the panel turns into a bottom sheet over a scrim. */

.jz-calc { position: fixed; left: 18px; bottom: 22px; z-index: 1550; font-family: 'Inter', system-ui, sans-serif; }
.jz-calc * { box-sizing: border-box; }
/* The display rules below would otherwise beat the `hidden` attribute. */
.jz-calc [hidden], .jz-calc-alt[hidden] { display: none !important; }

/* ---- the button --------------------------------------------------------- */
/* A pill so the "€ ⇄ ₽" reads as what it does, not just an icon. */
.jz-calc-fab {
    position: relative; z-index: 2;
    display: inline-flex; align-items: center; gap: 10px; height: 50px; padding: 0 18px 0 15px;
    border: none; border-radius: 999px; cursor: pointer;
    background: linear-gradient(135deg, var(--accent-cyan, #00e5ff), var(--accent-blue, #00b8d4));
    color: #06202a; font: inherit; font-weight: 900; font-size: .9rem; letter-spacing: .02em;
    box-shadow: 0 10px 26px rgba(0, 184, 212, .35);
    transition: transform .2s, box-shadow .2s, filter .2s;
}
.jz-calc-fab i { font-size: 1.15rem; }
.jz-calc-fab:hover { transform: translateY(-2px); filter: brightness(1.06); box-shadow: 0 14px 30px rgba(0, 184, 212, .45); }
.jz-calc-fab:focus-visible { outline: 2px solid var(--accent-gold, #ffb800); outline-offset: 3px; }
.jz-calc.is-open .jz-calc-fab { transform: none; filter: brightness(.92); }

/* ---- the panel ---------------------------------------------------------- */
.jz-calc-panel {
    position: absolute; left: 0; bottom: 62px; width: 380px; max-width: calc(100vw - 36px);
    border-radius: 18px; background: var(--card-bg, #141414); color: var(--text-color, #fff);
    border: 1px solid var(--border, rgba(255,255,255,.08));
    box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
    transform-origin: bottom left; animation: jz-calc-pop .18s ease-out;
}
@keyframes jz-calc-pop {
    from { opacity: 0; transform: translateY(8px) scale(.97); }
    to { opacity: 1; transform: none; }
}
.jz-calc-grip { display: none; }
.jz-calc-scrim { display: none; }

.jz-calc-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 14px 12px 14px 16px; border-bottom: 1px solid var(--border, rgba(255,255,255,.08));
}
.jz-calc-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.jz-calc-title-icon {
    flex: 0 0 auto; width: 38px; height: 38px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--accent-cyan, #00e5ff), var(--accent-blue, #00b8d4)); color: #06202a; font-size: 1.05rem;
}
.jz-calc-title-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.jz-calc-title-text b { font-size: .92rem; font-weight: 800; line-height: 1.2; }
.jz-calc-title-text small { font-size: .74rem; font-weight: 700; color: var(--text-dim, #a1a1a1); line-height: 1.2; }
.jz-calc-close {
    flex: 0 0 auto; width: 36px; height: 36px; border: none; border-radius: 10px; background: transparent;
    color: var(--text-dim, #a1a1a1); cursor: pointer; font-size: 1.05rem;
}
.jz-calc-close:hover { background: var(--card-bg2, rgba(255,255,255,.06)); color: var(--text-color, #fff); }

/* ---- what the page is showing, converted ---------------------------------
   Each row is a button: pressing it copies the amount into the converter. */
.jz-calc-live { display: flex; flex-direction: column; gap: 6px; padding: 12px 12px 0; }
.jz-calc-row {
    display: grid; grid-template-columns: auto 1fr auto; column-gap: 12px; align-items: center;
    width: 100%; padding: 10px 12px; border: 1px solid var(--border, rgba(255,255,255,.08)); border-radius: 12px;
    background: var(--card-bg2, rgba(255,255,255,.04)); color: inherit; font: inherit; text-align: left; cursor: pointer;
    transition: border-color .15s, background .15s, transform .15s;
}
.jz-calc-row:hover { border-color: var(--accent-cyan, #00e5ff); transform: translateY(-1px); }
.jz-calc-row-icon {
    width: 32px; height: 32px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--accent-cyan, #00e5ff) 14%, transparent); color: var(--accent-cyan, #00e5ff); font-size: .85rem;
}
.jz-calc-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.jz-calc-row-label { font-size: .7rem; font-weight: 800; color: var(--text-dim, #a1a1a1); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jz-calc-row-eur { font-size: .84rem; font-weight: 700; }
.jz-calc-row-alt { font-size: 1.12rem; font-weight: 900; color: var(--accent-gold, #ffb800); text-align: right; white-space: nowrap; }

/* ---- the converter ------------------------------------------------------- */
.jz-calc-body { padding: 14px 14px 10px; }

/* One pill per currency: the choice sits above the fields where it is seen. */
.jz-calc-cur {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; margin-bottom: 12px;
    border-radius: 12px; background: var(--card-bg2, rgba(255,255,255,.05)); border: 1px solid var(--border, rgba(255,255,255,.08));
}
.jz-calc-cur button {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px;
    border: none; border-radius: 9px; background: transparent; color: var(--text-dim, #a1a1a1);
    font: inherit; font-size: .84rem; font-weight: 800; letter-spacing: .03em; cursor: pointer;
    transition: background .15s, color .15s;
}
.jz-calc-cur button b { font-size: 1.05rem; font-weight: 900; }
.jz-calc-cur button:hover { color: var(--text-color, #fff); }
.jz-calc-cur button[aria-checked="true"] {
    background: linear-gradient(135deg, var(--accent-gold, #ffb800), var(--accent-orange, #ff4500)); color: #1a0f00;
    box-shadow: 0 6px 16px rgba(255, 140, 0, .28);
}

/* Euros on the left, the chosen currency on the right; either side can be
   typed in. The amount is the big thing, the unit sits beside it. */
.jz-calc-form { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 8px; }
.jz-calc-field {
    display: flex; flex-direction: column; gap: 6px; min-width: 0;
}
.jz-calc-field-label { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim, #a1a1a1); padding-left: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jz-calc-field-row {
    display: flex; align-items: center; height: 56px; padding: 0 12px 0 6px;
    border-radius: 14px; border: 1px solid var(--border, rgba(255,255,255,.1)); background: var(--card-bg2, rgba(255,255,255,.04));
    transition: border-color .15s, box-shadow .15s;
}
.jz-calc-field-row:focus-within { border-color: var(--accent-cyan, #00e5ff); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-cyan, #00e5ff) 18%, transparent); }
.jz-calc-field input {
    flex: 1 1 auto; min-width: 0; width: 100%; height: 100%; border: none; background: transparent;
    color: var(--text-color, #fff); font: inherit; font-size: 1.45rem; font-weight: 900; text-align: right; padding: 0 6px; outline: none;
    font-variant-numeric: tabular-nums;
}
.jz-calc-field input::placeholder { color: var(--text-dim, #a1a1a1); opacity: .45; font-weight: 700; }
.jz-calc-unit { flex: 0 0 auto; font-size: 1.1rem; font-weight: 900; color: var(--accent-gold, #ffb800); }
.jz-calc-eq { padding-bottom: 20px; color: var(--text-dim, #a1a1a1); font-size: .85rem; }

.jz-calc-foot { padding: 4px 16px 14px; font-size: .72rem; line-height: 1.45; color: var(--text-dim, #a1a1a1); }
.jz-calc-foot .warn { color: var(--accent-orange, #ff4500); font-weight: 700; }

/* "≈ 1 230 ₽" lines pages place under a price - one shared look. */
.jz-calc-alt { display: block; font-family: 'Inter', system-ui, sans-serif; font-size: .74rem; font-weight: 700; line-height: 1.3; color: var(--text-dim, #a1a1a1); letter-spacing: 0; text-transform: none; }

/* ---- themes -------------------------------------------------------------- */
html[data-theme="light"] .jz-calc-panel { box-shadow: 0 22px 54px rgba(20, 30, 50, .22); }
html[data-theme="light"] .jz-calc-fab,
html[data-theme="light"] .jz-calc-title-icon { color: #ffffff; }
html[data-theme="light"] .jz-calc-fab { box-shadow: 0 10px 26px rgba(0, 152, 199, .35); }
html[data-theme="light"] .jz-calc-cur button[aria-checked="true"] { color: #ffffff; }
html[data-theme="light"] .jz-calc-field-row, html[data-theme="light"] .jz-calc-row, html[data-theme="light"] .jz-calc-cur { background: #f5f7fb; }

/* ---- phones: a bottom sheet ---------------------------------------------- */
@media (max-width: 640px) {
    .jz-calc { left: 12px; bottom: 14px; }
    .jz-calc-fab { height: 46px; padding: 0 15px 0 13px; font-size: .84rem; }
    /* The sheet takes the whole bottom edge; the button hides behind it and
       the header's × (or the scrim) closes it. */
    .jz-calc.is-open .jz-calc-fab { visibility: hidden; }
    .jz-calc-scrim { display: block; position: fixed; inset: 0; z-index: 1; background: rgba(0, 0, 0, .55); animation: jz-calc-fade .18s ease-out; }
    .jz-calc-panel {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 3; width: auto; max-width: none; max-height: 88vh; overflow-y: auto;
        border-radius: 22px 22px 0 0; border-bottom: none;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        transform-origin: bottom center; animation: jz-calc-rise .22s ease-out;
    }
    .jz-calc-grip { display: block; width: 44px; height: 5px; margin: 10px auto 0; border-radius: 3px; background: var(--border, rgba(255,255,255,.14)); }
    .jz-calc-head { padding-top: 10px; }
    .jz-calc-body { padding: 14px 16px 12px; }
    .jz-calc-live { padding: 12px 16px 0; }
    .jz-calc-form { grid-template-columns: 1fr; gap: 6px; }
    .jz-calc-eq { justify-self: center; padding: 0; transform: rotate(90deg); }
    .jz-calc-field-row { height: 60px; }
    .jz-calc-field input { font-size: 1.6rem; }
    .jz-calc-cur button { height: 44px; font-size: .9rem; }
    .jz-calc-foot { padding: 6px 18px 16px; }
}
@keyframes jz-calc-rise {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: none; }
}
@keyframes jz-calc-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .jz-calc-panel, .jz-calc-scrim { animation: none; }
    .jz-calc-fab, .jz-calc-row, .jz-calc-field-row, .jz-calc-cur button { transition: none; }
}
