/*
 * Scipio Commerce
 * Copyright (C) Ilscipio GmbH
 *
 * This file is part of Scipio Commerce. Scipio Commerce is free software: you
 * can redistribute it and modify it under the terms of the GNU Affero General
 * Public License, version 3, as published by the Free Software Foundation.
 * Scipio Commerce is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
 * for more details. You should have received a copy of the license with this
 * work (file LICENSE). If not, see <https://www.gnu.org/licenses/agpl-3.0.html>.
 * A commercial license is available from Ilscipio GmbH.
 *
 * SPDX-License-Identifier: AGPL-3.0-only
 */
/* ==========================================================================
   Aurora - base
   Reset, typography, form controls and the helper classes the widget engine
   emits. Every rule here is written for this theme; no CSS framework is loaded.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--au-ground);
    color: var(--au-ink);
    font-family: var(--au-font);
    font-size: var(--au-fs-ui);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-variant-numeric: tabular-nums;
}

img, svg, video, canvas { max-width: 100%; height: auto; vertical-align: middle; }
canvas { max-height: 100%; }

hr {
    height: 1px;
    margin: 1.25rem 0;
    border: 0;
    background: var(--au-rule);
}

/* ---- Type ---------------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
    margin: 0 0 .5rem;
    color: var(--au-ink);
    font-weight: 600;
    line-height: 1.25;
}
h1, h2, h3 { font-family: var(--au-font-serif); }
h1 { font-size: var(--au-fs-h1); }
h2 { font-size: var(--au-fs-h2); }
h3 { font-size: var(--au-fs-h3); }
h4 { font-size: var(--au-fs-h4); }
h5, h6 {
    font-size: var(--au-fs-small);
    color: var(--au-ink-2);
    font-weight: 600;
}

p { margin: 0 0 .75rem; }
p:last-child { margin-bottom: 0; }

strong, b { font-weight: 600; color: var(--au-ink); }
small, .is-small-text { font-size: var(--au-fs-small); }

a {
    color: var(--au-accent);
    text-decoration: none;
    transition: color var(--au-speed) ease;
}
/* A visited link keeps the accent. The browser default turns it purple, which
   in a backend reads as a second, meaningless colour. */
a:visited { color: var(--au-accent); }
a:hover, a:visited:hover { color: var(--au-accent); text-decoration: underline; text-underline-offset: 2px; }
/* The focus ring is brass, the one other place brass appears. */
a:focus-visible,
button:focus-visible,
input[type="submit"]:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--au-focus);
    outline-offset: 2px;
    border-radius: 3px;
}

ul, ol { margin: 0 0 .75rem; padding-left: 1.25rem; }
ul.inline-list, ul.no-bullet { list-style: none; padding-left: 0; }
ul.inline-list > li { display: inline-block; margin-right: .5rem; }

code, kbd, samp, pre, .price, .au-figure {
    font-family: var(--au-font-mono);
    font-size: .9375em;
}
code {
    padding: .1em .35em;
    border-radius: 4px;
    background: var(--au-surface-2);
    color: var(--au-accent);
    border: 1px solid var(--au-rule-soft);
}
pre {
    margin: 0 0 .75rem;
    padding: .875rem 1rem;
    overflow: auto;
    background: var(--au-surface-2);
    border: 1px solid var(--au-rule);
    border-radius: var(--au-r-panel);
    color: var(--au-ink-2);
    line-height: 1.5;
}
pre code { padding: 0; border: 0; background: none; color: inherit; }

blockquote {
    margin: 0 0 .75rem;
    padding: .5rem 0 .5rem 1rem;
    border-left: 3px solid var(--au-accent-line);
    color: var(--au-ink-2);
}

/* ---- Form controls ------------------------------------------------------- */

label, .label, .field-label label {
    display: inline-block;
    color: var(--au-ink-2);
    font-size: var(--au-fs-small);
    font-weight: 600;
}
.label { margin-bottom: .3125rem; }

.input, .textarea, .select select,
input[type="text"], input[type="password"], input[type="email"], input[type="url"],
input[type="search"], input[type="tel"], input[type="number"], input[type="date"],
input[type="time"], input[type="datetime-local"], input[type="month"], input[type="week"],
select, textarea {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    width: 100%;
    max-width: 100%;
    min-height: var(--au-control-h);
    padding: .3125rem .625rem;
    background: var(--au-surface);
    color: var(--au-ink);
    font-family: inherit;
    font-size: var(--au-fs-ui);
    line-height: 1.4;
    border: 1px solid var(--au-rule);
    border-radius: var(--au-r-control);
    box-shadow: var(--au-bezel);
    transition: border-color var(--au-speed) ease, box-shadow var(--au-speed) ease;
}
textarea, .textarea { min-height: 6rem; line-height: 1.5; resize: vertical; }

.input:hover, .textarea:hover, select:hover, input:hover, textarea:hover { border-color: var(--au-rule-strong); }

.input:focus, .textarea:focus, .select select:focus,
input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--au-focus);
    outline-offset: -1px;
    border-color: var(--au-focus);
    box-shadow: none;
}

.input::placeholder, textarea::placeholder, input::placeholder { color: var(--au-ink-4); }

.input[disabled], .textarea[disabled], select[disabled], input[disabled], textarea[disabled],
.input[readonly], input[readonly], textarea[readonly] {
    background: var(--au-surface-2);
    color: var(--au-ink-3);
    cursor: not-allowed;
    box-shadow: none;
}

/* A select needs its own arrow, since the native one is removed. */
.select { position: relative; display: inline-block; width: 100%; vertical-align: top; }
.select select { padding-right: 1.875rem; cursor: pointer; }
.select::after,
.au-select-wrap::after {
    content: "";
    position: absolute;
    top: 50%;
    right: .6875rem;
    width: .4375rem;
    height: .4375rem;
    margin-top: -.3125rem;
    border-right: 1.5px solid var(--au-ink-3);
    border-bottom: 1.5px solid var(--au-ink-3);
    transform: rotate(45deg);
    pointer-events: none;
}
.select.is-multiple::after { display: none; }
/* The field macro also puts "select" on the element itself; only the wrapper draws the arrow. */
select.select::after { content: none; display: none; }
.select select[multiple], select[multiple] { height: auto; padding: .25rem; }
.select.is-fullwidth, .select.is-fullwidth select { width: 100%; }

/* A plain checkbox/radio draws its own flat box, so it reads as one of this
   theme's inputs rather than the browser's native control in either scheme. */
input[type="checkbox"], input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    accent-color: var(--au-accent);
    position: relative;
    flex: none;
    width: .9375rem;
    height: .9375rem;
    margin: 0 .375rem 0 0;
    vertical-align: -2px;
    background: var(--au-surface-2);
    border: 1px solid var(--au-rule-strong);
    border-radius: 3px;
    cursor: pointer;
}
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]:hover, input[type="radio"]:hover { border-color: var(--au-accent-line); }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible {
    outline: 2px solid var(--au-accent);
    outline-offset: 1px;
}
input[type="checkbox"]:disabled, input[type="radio"]:disabled { opacity: .55; cursor: not-allowed; }
input[type="checkbox"]:checked:not(.switch), input[type="radio"]:checked {
    background: var(--au-accent);
    border-color: var(--au-accent);
}
input[type="checkbox"]:checked:not(.switch)::after {
    content: "";
    position: absolute;
    left: 2px;
    top: -1px;
    width: 4px;
    height: 8px;
    border: solid var(--au-on-accent);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
input[type="radio"]:checked::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 3px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--au-on-accent);
}
input[type="range"] { accent-color: var(--au-accent); width: 100%; }
input[type="color"] {
    width: 2.5rem;
    min-height: var(--au-control-h);
    padding: .1875rem;
    border: 1px solid var(--au-rule);
    border-radius: var(--au-r-control);
    background: var(--au-surface);
}

.checkbox, .radio {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    color: var(--au-ink-2);
    font-weight: 400;
    cursor: pointer;
}
.checkbox:hover, .radio:hover { color: var(--au-ink); }
.checkbox + .checkbox, .radio + .radio { margin-left: .75rem; }
.checkbox[disabled], .radio[disabled] { color: var(--au-ink-4); cursor: not-allowed; }

/* The switch: a checkbox the widget engine styles as checkbox-type-switch. */
.switch input[type="checkbox"],
input[type="checkbox"].switch {
    position: relative;
    width: 2.125rem;
    height: 1.1875rem;
    border-radius: var(--au-r-pill);
    background: var(--au-surface-3);
    border: 1px solid var(--au-rule);
    appearance: none;
    -webkit-appearance: none;
    transition: background var(--au-speed) ease, border-color var(--au-speed) ease;
    vertical-align: -5px;
}
.switch input[type="checkbox"]::after,
input[type="checkbox"].switch::after {
    content: "";
    position: absolute;
    top: 1px;
    left: 1px;
    width: .9375rem;
    height: .9375rem;
    border-radius: 50%;
    background: var(--au-surface);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .28);
    transition: transform var(--au-speed) ease;
}
.switch input[type="checkbox"]:checked,
input[type="checkbox"].switch:checked {
    background: var(--au-accent);
    border-color: var(--au-accent);
}
.switch input[type="checkbox"]:checked::after,
input[type="checkbox"].switch:checked::after { transform: translateX(.9375rem); }

/* File field */
.file { display: inline-flex; align-items: stretch; }
.file-input { position: absolute; width: .01em; height: .01em; overflow: hidden; opacity: 0; }
.file-label { display: flex; align-items: stretch; cursor: pointer; overflow: hidden; }
.file-cta {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    height: var(--au-control-h);
    padding: 0 .75rem;
    background: var(--au-surface-2);
    border: 1px solid var(--au-rule);
    border-radius: var(--au-r-control) 0 0 var(--au-r-control);
    color: var(--au-ink-2);
    white-space: nowrap;
}
.file-name {
    display: inline-flex;
    align-items: center;
    max-width: 16rem;
    height: var(--au-control-h);
    padding: 0 .75rem;
    border: 1px solid var(--au-rule);
    border-left: 0;
    border-radius: 0 var(--au-r-control) var(--au-r-control) 0;
    background: var(--au-surface);
    color: var(--au-ink-3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
input[type="file"] {
    font-size: var(--au-fs-small);
    color: var(--au-ink-3);
}
input[type="file"]::file-selector-button {
    margin-right: .625rem;
    padding: .3125rem .75rem;
    border: 1px solid var(--au-rule);
    border-radius: var(--au-r-control);
    background: var(--au-surface-2);
    color: var(--au-ink);
    font: inherit;
    cursor: pointer;
}
input[type="file"]::file-selector-button:hover { background: var(--au-surface-3); }

/* Field container, the shape @field emits */
.field { margin-bottom: .625rem; }
.field:last-child { margin-bottom: 0; }
.field.is-grouped { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-start; }
.field.is-grouped > .control { flex: 0 0 auto; }
.field.is-grouped > .control.is-expanded { flex: 1 1 auto; }
.field.is-horizontal { display: flex; gap: .75rem; align-items: flex-start; }
.field-label { flex: 0 0 auto; padding-top: .375rem; }
.field-body { flex: 1 1 auto; min-width: 0; }
.field-inline, .field.field-inline { display: inline-flex; align-items: center; gap: .5rem; }
.field-extra, .field_extra { color: var(--au-ink-3); font-size: var(--au-fs-small); }
.control { position: relative; }
.control.is-expanded { flex-grow: 1; width: 100%; }
.help { margin-top: .25rem; color: var(--au-ink-3); font-size: var(--au-fs-tiny); }
.help.is-danger { color: var(--au-danger); }

/* An addon group: input plus button, joined into one control */
.has-addons, .input-group {
    display: flex;
    align-items: stretch;
    width: 100%;
}
.has-addons > .control, .input-group > * { margin: 0; }
.has-addons > .control:not(:last-child) > .input,
.has-addons > .control:not(:last-child) > .button,
.has-addons > .control:not(:last-child) > .select select,
.input-group > *:not(:last-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.has-addons > .control:not(:first-child) > .input,
.has-addons > .control:not(:first-child) > .button,
.has-addons > .control:not(:first-child) > .select select,
.input-group > *:not(:first-child) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    margin-left: -1px;
}
.has-addons > .control.is-expanded { flex: 1 1 auto; }
.input-group-addon {
    display: inline-flex;
    align-items: center;
    padding: 0 .625rem;
    background: var(--au-surface-2);
    border: 1px solid var(--au-rule);
    color: var(--au-ink-3);
    white-space: nowrap;
}
.input-group > .input, .input-group > input { flex: 1 1 auto; width: auto; }

/* A required field carries the mark, not a colour. */
.required, .requiredClass, .field .required {
    color: var(--au-danger);
    font-weight: 600;
}
.required::after { content: ""; }

fieldset {
    margin: 0 0 1rem;
    padding: .875rem 1rem 1rem;
    border: 1px solid var(--au-rule);
    border-radius: var(--au-r-panel);
    background: var(--au-surface);
    box-shadow: var(--au-bezel);
}
legend {
    padding: 0 .375rem;
    color: var(--au-ink-2);
    font-size: var(--au-fs-ui);
    font-weight: 600;
}

/* ---- Helper classes ------------------------------------------------------ */

.has-text-left,    .text_left,     .text-left     { text-align: left !important; }
.has-text-right,   .text_right,    .text-right,
.text-align-right                                 { text-align: right !important; }
.has-text-centered, .text_center,  .text-centered { text-align: center !important; }
.has-text-justified, .text_justify                { text-align: justify !important; }

.has-text-primary,   .text_color_primary   { color: var(--au-accent) !important; }
.has-text-secondary, .text_color_secondary { color: var(--au-ink-2) !important; }
/* The record link in a list carries the secondary class. A link keeps the one
   link colour, so a list does not read as two kinds of link. */
a.has-text-secondary, a.text_color_secondary,
a .has-text-secondary, .has-text-secondary > a { color: var(--au-accent) !important; }
.has-text-success,   .text_color_success   { color: var(--au-ok) !important; }
.has-text-warning,   .text_color_warning   { color: var(--au-warn) !important; }
.has-text-danger,    .text_color_error,
.has-text-alert,     .text_color_alert     { color: var(--au-danger) !important; }
.has-text-info,      .text_color_info      { color: var(--au-info) !important; }
.has-text-grey,      .text_color_grey      { color: var(--au-ink-3) !important; }
.has-text-white                            { color: #fff !important; }

.has-background-primary   { background-color: var(--au-accent) !important;   color: var(--au-on-accent) !important; }
.has-background-secondary { background-color: var(--au-accent-2) !important; color: #fff !important; }
.has-background-success   { background-color: var(--au-ok) !important;       color: #fff !important; }
.has-background-warning   { background-color: var(--au-warn) !important;     color: #fff !important; }
.has-background-danger    { background-color: var(--au-danger) !important;   color: #fff !important; }
.has-background-info      { background-color: var(--au-info) !important;     color: #fff !important; }
.has-background-white     { background-color: var(--au-surface) !important; }

.hidden, .hide, .is-hidden, [hidden] { display: none !important; }
.is-sr-only, .sr-only, .show-for-sr {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.is-invisible { visibility: hidden !important; }
.float_left, .float-left, .pull-left   { float: left; }
.float_right, .float-right, .pull-right { float: right; }
.clearfix::after, .float_clearfix::after { content: ""; display: table; clear: both; }
.is-flex { display: flex !important; }
.is-flex-direction-column { flex-direction: column !important; }
.is-justify-content-space-between { justify-content: space-between !important; }
.is-vcentered, .has-content-centered { align-items: center !important; }
.is-fullwidth, .elem-fullwidth { width: 100% !important; }
.is-narrow { flex: none !important; }
.is-fullheight { min-height: 100%; }
.is-fullheight-100v { min-height: 100vh; }
.is-clipped { overflow: hidden !important; }
.is-uppercase { text-transform: uppercase; letter-spacing: .04em; }
.is-monospace, .price, .au-figure { font-family: var(--au-font-mono); }

.mt-1 { margin-top: .25rem; }   .mb-1 { margin-bottom: .25rem; }
.mt-2 { margin-top: .5rem; }    .mb-2 { margin-bottom: .5rem; }
.mt-3 { margin-top: .75rem; }   .mb-3 { margin-bottom: .75rem; }
.mt-4 { margin-top: 1rem; }     .mb-4 { margin-bottom: 1rem; }
.ml-1 { margin-left: .25rem; }  .mr-1 { margin-right: .25rem; }
.ml-2 { margin-left: .5rem; }   .mr-2 { margin-right: .5rem; }
.pb-0 { padding-bottom: 0; }

@media (max-width: 1023px) { .is-hidden-touch { display: none !important; } }
@media (min-width: 1024px) { .is-hidden-desktop { display: none !important; } }
@media (max-width: 768px)  { .hide-for-small { display: none !important; } }
@media (max-width: 480px)  { .is-narrow-mobile { flex: none !important; } }

/* Motion is a hint, not a requirement. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}

/* A scrollbar that belongs to the theme rather than to the operating system. */
* { scrollbar-color: var(--au-rule-strong) transparent; scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--au-rule-strong);
    border: 3px solid transparent;
    background-clip: content-box;
    border-radius: var(--au-r-pill);
}
::-webkit-scrollbar-thumb:hover { background: var(--au-ink-4); background-clip: content-box; }

::selection { background: var(--au-accent-soft); color: var(--au-ink); }
