/* ===========================================================================
   Sacred Taste CRM — Basis und Bausteine
   ---------------------------------------------------------------------------
   Nutzt ausschliesslich die Tokens aus tokens.css. Hier steht kein fester
   Farbwert und kein fester Radius.
   =========================================================================== */

/* --- Schrift laden --------------------------------------------------------
   Quincy vom Shop-CDN, wie auf sacredtaste.ch. font-display: swap zeigt den
   Text sofort in der Ersatzschrift, statt ihn bis zum Laden zu verstecken. */
@font-face {
  font-family: "Quincy";
  src: url("https://cdn.shopify.com/s/files/1/0250/9956/7140/files/Quincy-Black.woff2?v=1741951504") format("woff2"),
       url("https://cdn.shopify.com/s/files/1/0250/9956/7140/files/Quincy-Black.woff?v=1741951504") format("woff");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Quincy";
  src: url("https://cdn.shopify.com/s/files/1/0250/9956/7140/files/Quincy-Bold.woff2?v=1741950572") format("woff2"),
       url("https://cdn.shopify.com/s/files/1/0250/9956/7140/files/Quincy-Bold.woff?v=1741950572") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Quincy";
  src: url("https://cdn.shopify.com/s/files/1/0250/9956/7140/files/Quincy-Medium.woff2?v=1741947310") format("woff2"),
       url("https://cdn.shopify.com/s/files/1/0250/9956/7140/files/Quincy-Medium.woff?v=1741947310") format("woff");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* --- Grundlagen ----------------------------------------------------------- */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  line-height: var(--leading-tight);
  letter-spacing: -0.01em;
  margin: 0;
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }

p { margin: 0; }

a {
  color: inherit;
  text-decoration-color: var(--color-border-strong);
  text-underline-offset: 0.2em;
  transition: text-decoration-color var(--duration-fast) var(--ease);
}
a:hover { text-decoration-color: currentColor; }

:focus-visible {
  outline: 2px solid var(--color-border-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* --- Hilfsklassen --------------------------------------------------------- */

.stack > * + * { margin-top: var(--space-4); }
.stack-sm > * + * { margin-top: var(--space-2); }
.stack-lg > * + * { margin-top: var(--space-5); }

.muted { color: var(--color-text-muted); }
.faint { color: var(--color-text-faint); }
.text-sm { font-size: var(--text-sm); }
.text-center { text-align: center; }

.eyebrow {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-text-faint);
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* --- Karte ---------------------------------------------------------------- */

.card {
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-7) var(--space-6);
}

/* --- Formularfelder -------------------------------------------------------
   Leicht abgerundet, feine Linie. Der Rahmen wird beim Fokus nicht dicker
   (das würde das Layout verschieben), sondern dunkler — dazu kommt der Ring. */

.field { display: block; }

.field__label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.input {
  display: block;
  width: 100%;
  height: var(--field-height);
  padding: 0 var(--space-4);
  font-family: inherit;
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-bg);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-md);
  transition:
    border-color var(--duration-fast) var(--ease),
    box-shadow var(--duration-fast) var(--ease),
    background-color var(--duration-fast) var(--ease);
}

.input::placeholder { color: var(--color-text-faint); }

.input:hover:not(:disabled) { border-color: var(--color-border-strong); }

.input:focus {
  outline: none;
  background: var(--color-surface);
  border-color: var(--color-border-focus);
  box-shadow: var(--focus-ring);
}

.input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.input[aria-invalid="true"] {
  border-color: var(--color-danger);
}

/* Code-Eingabe: gross, gesperrt, mittig — der Code ist hier der Inhalt. */
.input--code {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  letter-spacing: 0.32em;
  text-align: center;
  text-indent: 0.32em; /* gleicht das Tracking nach dem letzten Zeichen aus */
  height: calc(var(--field-height) * 1.35);
  padding: 0;
}

.field__hint {
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-faint);
}

/* --- Knöpfe --------------------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  height: var(--field-height);
  padding: 0 var(--space-5);
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--color-text-oncolor);
  background: var(--brand-ink);
  border: var(--border-width) solid var(--brand-ink);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition:
    background-color var(--duration-fast) var(--ease),
    border-color var(--duration-fast) var(--ease),
    transform var(--duration-fast) var(--ease),
    box-shadow var(--duration-fast) var(--ease);
}

.button:hover:not(:disabled) {
  background: var(--brand-cacao);
  border-color: var(--brand-cacao);
}

.button:active:not(:disabled) { transform: translateY(1px); }

.button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.button--quiet {
  color: var(--color-text-muted);
  background: transparent;
  border-color: transparent;
  width: auto;
  height: auto;
  padding: var(--space-2);
  font-size: var(--text-sm);
  text-decoration: underline;
  text-decoration-color: var(--color-border-strong);
  text-underline-offset: 0.2em;
}
.button--quiet:hover:not(:disabled) {
  color: var(--color-text);
  background: transparent;
  border-color: transparent;
  text-decoration-color: currentColor;
}

/* Ladezustand: Beschriftung bleibt stehen, damit der Knopf nicht springt. */
.button[data-busy="true"] { pointer-events: none; opacity: 0.65; }
.button[data-busy="true"] .button__label::after {
  content: "";
  display: inline-block;
  width: 0.75em; height: 0.75em;
  margin-left: 0.5em;
  vertical-align: -0.05em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: var(--radius-full);
  animation: spin 700ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* --- Meldungen ------------------------------------------------------------ */

.notice {
  padding: var(--space-3) var(--space-4);
  border: var(--border-width) solid transparent;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
}

.notice--error {
  color: var(--color-danger);
  background: var(--color-danger-bg);
  border-color: color-mix(in srgb, var(--color-danger) 26%, transparent);
}

.notice--success {
  color: var(--color-success);
  background: var(--color-success-bg);
  border-color: color-mix(in srgb, var(--color-success) 26%, transparent);
}

/* --- Trenner mit Text ----------------------------------------------------- */

.divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--color-text-faint);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: var(--border-width);
  background: var(--color-border);
}

/* --- Bewegung zurückhaltend ----------------------------------------------- */

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

/* --- Sprachumschalter ------------------------------------------------------
   Bis zu fünf Sprachen stehen nebeneinander als Kürzel — kein Aufklappen,
   auf einen Blick erfassbar. Die aktive Sprache trägt einen feinen Strich
   statt einer Fläche: sie soll sich abheben, ohne zu dominieren. */

.langswitch {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.langswitch__item {
  position: relative;
  padding: var(--space-2) var(--space-3);
  font-family: inherit;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-faint);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    color var(--duration-fast) var(--ease),
    background-color var(--duration-fast) var(--ease);
}

/* Feiner Trennstrich zwischen den Kürzeln, nicht vor dem ersten. */
.langswitch__item + .langswitch__item::before {
  content: "";
  position: absolute;
  left: calc(var(--space-1) * -0.5 - 0.5px);
  top: 50%;
  transform: translateY(-50%);
  width: var(--border-width);
  height: 0.9em;
  background: var(--color-border);
}

.langswitch__item:hover {
  color: var(--color-text);
  background: color-mix(in srgb, var(--brand-ink) 5%, transparent);
}

.langswitch__item:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.langswitch__item[aria-pressed="true"] {
  color: var(--color-text);
}

.langswitch__item[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  left: var(--space-3);
  right: var(--space-3);
  bottom: calc(var(--space-2) - 3px);
  height: var(--border-width);
  background: var(--brand-accent);
}

/* Ab sechs Sprachen: Auswahlliste statt Reihe. */
.langselect {
  appearance: none;
  padding: var(--space-2) var(--space-6) var(--space-2) var(--space-3);
  font-family: inherit;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  background-color: transparent;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 16px) center, calc(100% - 11px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease),
              color var(--duration-fast) var(--ease);
}

.langselect:hover { border-color: var(--color-border-strong); color: var(--color-text); }

.langselect:focus-visible {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: var(--focus-ring);
}

/* --- Verstecktes bleibt versteckt ------------------------------------------
   Die Voreinstellung des Browsers fuer [hidden] ist `display: none`, aber sie
   kommt aus dem Browser-Stylesheet und verliert deshalb gegen JEDE eigene
   `display`-Regel — auch gegen `.field { display: flex }`. Ein Feld, das
   JavaScript auf `hidden` setzt, bliebe ohne diese Zeile sichtbar.

   Das `!important` ist hier richtig und nicht faul: `hidden` ist eine Aussage
   ueber den Zustand des Elements, keine Frage der Gestaltung. */
[hidden] { display: none !important; }
