/* The free Swiss VAT calculator (frontend/vat-calculator). Layout only: colours, elevation, fields, the segmented
   toggle and the accordion come from tokens.css and ui.css.

   One card under the title, as wide as a reading column allows (1040 px): the questions on the left and the result
   beside them from 860 px, the result under the questions on a phone. The offer is one line at the card's foot. The
   questions people search for are folded below the card. */

.vcal-page .visually-hidden {
    position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.vcal-page { --vcal-gutter: 24px; --vcal-error: var(--red-text, #b42318); padding-bottom: 8px; }
:root[data-theme="dark"] .vcal-page { --vcal-error: #ff8a8a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .vcal-page { --vcal-error: #ff8a8a; } }

.vcal { box-sizing: border-box; width: min(1040px, calc(100% - 2 * var(--vcal-gutter))); margin: 0 auto; padding-top: 36px; }

/* ---------- the title ---------- */
.vcal-head { max-width: 760px; margin-bottom: 22px; }
.vcal-page .vcal-head h1 { margin: 0 0 10px; font-size: clamp(28px, 3.1vw, 40px); font-weight: 700; line-height: 1.12; letter-spacing: -.025em; color: var(--ink); }
.vcal-page .vcal-lead { margin: 0; font-size: 17px; line-height: 1.5; color: var(--muted); }

.vcal-page .vcal-unavailable, .vcal-page .vcal-noscript {
    margin: 0 0 24px; padding: 18px 20px; border-radius: 14px; background: var(--amber-tint); color: var(--ink); font-size: 16px;
}

/* ---------- the card ---------- */
.vcal-card {
    box-sizing: border-box; padding: 22px 28px 0; border: 1px solid var(--line); border-radius: 20px;
    background: var(--surface); box-shadow: var(--elev-md);
}
.vcal-tabs { display: inline-grid; margin-bottom: 20px; }
.vcal-tabs button { min-width: 150px; min-height: 40px; font-size: 15px; }

.vcal-body { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); gap: 28px; align-items: start; }
.vcal-inputs { min-width: 0; margin: 0; }
.vcal-panel { display: grid; gap: 18px; }
.vcal-panel[hidden] { display: none; }

.vcal-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; margin: 0; padding: 0; border: 0; }
.vcal-field[hidden] { display: none; }
.vcal-page .vcal-label { padding: 0; font-size: 14.5px; font-weight: 650; line-height: 1.35; color: var(--ink); }
.vcal-page .vcal-intro { margin: 0; font-size: 15px; line-height: 1.5; color: var(--muted); }
.vcal-hint { font-size: 13.5px; line-height: 1.45; color: var(--muted); }
.vcal-error { font-size: 14px; line-height: 1.45; font-weight: 600; color: var(--vcal-error); }
.vcal-error:empty { display: none; }
.vcal-page [aria-invalid="true"] { border-color: var(--red, #d92d20) !important; }

/* The amount: big, as on a till */
.vcal-page .vcal-amount {
    width: 100%; min-height: 58px; padding: 10px 16px; border-radius: 12px;
    font-size: 26px; font-weight: 650; letter-spacing: -.01em; font-variant-numeric: tabular-nums;
}
.vcal-basis { display: grid; grid-template-columns: 1fr 1fr; width: 100%; max-width: 360px; }
.vcal-basis button { min-width: 0; min-height: 40px; font-size: 15px; }

/* The rates: three choices, the figure first, then what the chosen one covers */
.vcal-rates__list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.vcal-rate {
    position: relative; display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 12px 14px;
    border: 1px solid var(--control-border, var(--line-strong)); border-radius: 12px; background: var(--control-bg, var(--surface));
    cursor: pointer; transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.vcal-rate:hover { border-color: var(--control-border-hover, var(--line-strong)); }
.vcal-rate input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.vcal-rate:has(input:checked) { border-color: var(--accent-text); background: var(--accent-tint); box-shadow: inset 0 0 0 1px var(--accent-text); }
.vcal-rate:has(input:focus-visible) { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.vcal-rate__figure { font-size: 20px; font-weight: 700; line-height: 1.2; color: var(--ink); font-variant-numeric: tabular-nums; }
.vcal-rate__name { font-size: 13.5px; font-weight: 600; line-height: 1.3; color: var(--muted); overflow-wrap: break-word; hyphens: auto; }
.vcal-page .vcal-rate__covers { margin: 2px 0 0; font-size: 14px; line-height: 1.45; color: var(--muted); }

/* The activity: a search in the list */
.vcal-combo { position: relative; }
.vcal-combo__icon { position: absolute; left: 14px; top: 50%; translate: 0 -50%; color: var(--muted); pointer-events: none; }
.vcal-combo input { width: 100%; padding-left: 42px; }
.vcal-combo__list {
    position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0; max-height: 320px; overflow-y: auto;
    margin: 0; padding: 6px; list-style: none; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--elev-lg);
}
.vcal-combo__list[hidden] { display: none; }
.vcal-combo__option { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 10px 12px; border-radius: 8px; cursor: pointer; }
.vcal-combo__option[aria-selected="true"], .vcal-combo__option:hover { background: var(--surface-2); }
.vcal-combo__name { min-width: 0; font-size: 15px; line-height: 1.35; color: var(--ink); }
.vcal-combo__matched { font-size: 14px; color: var(--muted); }
.vcal-combo__rate { flex: none; font-size: 15px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.vcal-combo__none { padding: 10px 12px 4px; font-size: 14.5px; color: var(--muted); }
.vcal-combo .vcal-combo__own { color: var(--accent-text); font-size: 15px; font-weight: 650; text-decoration: underline; text-underline-offset: 3px; }
.vcal-page .vcal-chosen { margin: 0; font-size: 15px; font-weight: 650; color: var(--ink); }
.vcal-page .vcal-chosen::before { content: "\2713"; display: inline-block; margin-right: 6px; color: var(--accent-text); }
.vcal-own__input { width: 8em; }
.vcal-linkish {
    align-self: flex-start; min-height: 32px; margin: 0; padding: 0; border: 0; background: none; cursor: pointer;
    color: var(--accent-text); font: inherit; font-size: 14.5px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px;
}
.vcal-linkish:hover { color: var(--ink); }

/* ---------- the result ---------- */
.vcal-result { min-width: 0; padding: 20px 22px; border-radius: 16px; background: var(--surface-2); }
.vcal-result [hidden] { display: none !important; }
.vcal-page .vcal-empty { margin: 0; padding: 18px 0; font-size: 15.5px; line-height: 1.5; color: var(--muted); }
.vcal-figures { display: grid; gap: 0; margin: 0; transition: opacity .12s ease; }
.vcal-result.is-waiting .vcal-figures, .vcal-result.is-waiting .vcal-sentence { opacity: .55; }
.vcal-figures > div { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 9px 0; border-top: 1px solid var(--line); }
.vcal-figures > div:first-child { border-top: 0; padding-top: 0; }
.vcal-figures dt { min-width: 0; font-size: 15px; line-height: 1.35; color: var(--ink-2); }
.vcal-figures dd { flex: none; margin: 0; font-size: 18px; font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.vcal-cur { font-size: .78em; font-weight: 600; color: var(--muted); }
.vcal-figures .vcal-figures__main { padding: 12px 0; }
.vcal-figures .vcal-figures__main dt { font-weight: 700; color: var(--ink); }
.vcal-figures .vcal-figures__main dd { font-size: 30px; font-weight: 750; letter-spacing: -.02em; }
.vcal-figures .vcal-figures__cash dt, .vcal-figures .vcal-figures__cash dd { font-size: 14.5px; font-weight: 600; color: var(--muted); }
.vcal-page .vcal-sentence { margin: 12px 0 0; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.vcal-page .vcal-source { margin: 12px 0 0; font-size: 13px; line-height: 1.45; color: var(--muted); }
.vcal-source a { color: inherit; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.vcal-source a:hover { color: var(--ink); }
.vcal-page .vcal-offline { margin: 0; padding: 14px 16px; border-radius: 12px; background: var(--amber-tint); color: var(--ink); font-size: 15px; line-height: 1.45; }

/* ---------- the foot: the offer, the QR invoice, nothing stored ---------- */
.vcal-foot { margin: 22px -28px 0; padding: 16px 28px 18px; border-top: 1px solid var(--line); }
.vcal-page .vcal-cta { margin: 0; font-size: 15.5px; line-height: 1.5; color: var(--ink-2); }
.vcal-cta a { color: var(--accent-text); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.vcal-cta a:hover { color: var(--ink); }
.vcal-page .vcal-more { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 22px; margin: 8px 0 0; font-size: 14px; line-height: 1.45; color: var(--muted); }
.vcal-qr { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-text); font-weight: 600; text-decoration: none; }
.vcal-qr:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- the questions ---------- */
.vcal-faq { box-sizing: border-box; width: min(1040px, calc(100% - 2 * var(--vcal-gutter))); margin: 48px auto 64px; }
.vcal-page .vcal-faq h2 { margin: 0 0 16px; font-size: 24px; font-weight: 700; letter-spacing: -.015em; color: var(--ink); }
.vcal-faq .accordion { max-width: 820px; margin: 0; }
.vcal-faq .accordion p { margin: 0; padding: 0 20px 18px; font-size: 15.5px; line-height: 1.6; color: var(--ink-2); }

/* ---------- smaller screens ----------
   One column, and the result where the eyes are while typing: right under the amount and its "incl. / excl.", before
   the rates (whose change it shows above them). The form and its panels let their blocks into the column
   (display: contents) so the result can stand between them; the DOM order, and so the reading order of a screen
   reader, stays questions first. */
@media (max-width: 860px) {
    .vcal-body { display: flex; flex-direction: column; align-items: stretch; gap: 18px; }
    .vcal-inputs, .vcal-panel { display: contents; }
    .vcal-panel[hidden] { display: none; }
    .vcal-panel > * { order: 1; }
    .vcal-result { order: 3; }
    .vcal-panel > .vcal-rates { order: 4; }
}
@media (max-width: 560px) {
    .vcal-page { --vcal-gutter: 16px; }
    .vcal { padding-top: 22px; }
    .vcal-page .vcal-lead { font-size: 15.5px; }
    .vcal-card { padding: 16px 16px 0; border-radius: 16px; }
    .vcal-tabs { display: grid; grid-template-columns: 1fr 1fr; width: 100%; margin-bottom: 16px; }
    .vcal-tabs button { min-width: 0; padding: 0 8px; font-size: 14.5px; }
    .vcal-basis { max-width: none; }
    .vcal-rates__list { gap: 8px; }
    .vcal-rate { padding: 10px 8px; }
    .vcal-rate__figure { font-size: 18px; }
    .vcal-rate__name { font-size: 12px; letter-spacing: -.005em; }
    .vcal-result { padding: 16px; }
    .vcal-figures .vcal-figures__main dd { font-size: 26px; }
    .vcal-foot { margin: 18px -16px 0; padding: 14px 16px 16px; }
    .vcal-faq { margin-top: 36px; }
}
@media (prefers-reduced-motion: reduce) {
    .vcal-rate, .vcal-figures { transition: none; }
}
