/* cloudstack — Login-Page Styling
   Block 1: @font-face (self-hosted)
   Block 2: Splash Hero (MobileHero-animation + hero-h1)
   Block 3: NC Login-Form Overrides */

/* ── Block 1: @font-face ──────────────────────────────────────────── */

@font-face {
  font-family: 'Inter Variable';
  src: url('/themes/cloudstack/core/fonts/inter-variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter Variable';
  src: url('/themes/cloudstack/core/fonts/inter-variable-italic.woff2') format('woff2');
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'JetBrains Mono Variable';
  src: url('/themes/cloudstack/core/fonts/jetbrains-mono-variable.woff2') format('woff2');
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'JetBrains Mono Variable';
  src: url('/themes/cloudstack/core/fonts/jetbrains-mono-variable-italic.woff2') format('woff2');
  font-weight: 100 800;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'Instrument Serif';
  src: url('/themes/cloudstack/core/fonts/instrument-serif.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Instrument Serif';
  src: url('/themes/cloudstack/core/fonts/instrument-serif-italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  --ss-ink:        #0F0F10;
  --ss-surface:    #1A1A1C;
  --ss-surface-2:  #222225;
  --ss-cream:      #EDEAE3;
  --ss-muted:      #8A8680;
  --ss-amber:      #D4A574;
  --ss-amber-soft: #E8C493;
  --ss-success:    #7FB069;
  --ss-border:     #26262A;
  --ss-font-sans:  'Inter Variable', 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --ss-font-mono:  'JetBrains Mono Variable', 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

/* ── Block 2: Splash Hero ─────────────────────────────────────────── */

/* Hero container — fliesst nahtlos in body-background (embers vom body). */
.ss-splash {
  position: relative;
  width: 100%;
  padding: 48px 24px 12px;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  box-sizing: border-box;
  z-index: 2;
  user-select: none;
  -webkit-user-select: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Forged Steel background layer — viewport-fixed */
.ss-splash__bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

/* Heat: wobbling radial glow ueber die gesamte breite */
.ss-steel__heat {
  position: absolute;
  inset: -20%;
  background: radial-gradient(ellipse 140% 45% at 50% 100%, rgba(212, 165, 116, 0.35) 0%, transparent 65%);
  animation: ss-steel-heat 9s ease-in-out infinite;
  filter: blur(20px);
}
@keyframes ss-steel-heat {
  0%, 100% { transform: translate(0, 0) scale(1);        opacity: 0.8; }
  50%      { transform: translate(-20px, -8px) scale(1.08); opacity: 1;   }
}

/* Subtle blueprint grid, center-masked */
.ss-steel__grid {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(237, 234, 227, 0.025) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(90deg, rgba(237, 234, 227, 0.025) 1px, transparent 1px) 0 0 / 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 50%, black 30%, transparent 80%);
          mask-image: radial-gradient(ellipse at 50% 50%, black 30%, transparent 80%);
}

/* Concentric rings — right side, like workpieces */
.ss-steel__ring {
  position: absolute;
  left: 80%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
}
.ss-steel__ring--r1 { width: 360px; height: 360px; border: 1px solid rgba(237, 234, 227, 0.08); }
.ss-steel__ring--r2 { width: 260px; height: 260px; border: 1px solid rgba(212, 165, 116, 0.15); }
.ss-steel__ring--r3 { width: 480px; height: 480px; border: 1px solid rgba(237, 234, 227, 0.04); }

/* Sparks — aus der esse */
.ss-steel__spark {
  position: absolute;
  bottom: 0;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: var(--ss-amber-soft);
  box-shadow: 0 0 6px var(--ss-amber), 0 0 12px rgba(212, 165, 116, 0.8);
  animation: ss-steel-spark 6s linear infinite;
}
@keyframes ss-steel-spark {
  0%   { transform: translate(0, 0) scale(0.6); opacity: 0; }
  10%  { opacity: 1; }
  100% { transform: translate(calc(var(--d, 0) * 1px), -480px) scale(0.2); opacity: 0; }
}

/* Corner monospace marks */
.ss-steel__corner {
  position: absolute;
  font-family: var(--ss-font-mono);
  font-size: 10px;
  color: rgba(237, 234, 227, 0.3);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  z-index: 2;
}
.ss-steel__corner--tl { top: 18px; left: 20px; }
.ss-steel__corner--tr { top: 18px; right: 20px; }
.ss-steel__corner--br { bottom: 18px; right: 20px; color: var(--ss-amber); }

/* Logo + wordmark ueber den bg-layern */
.ss-splash > .ss-splash__logo,
.ss-splash > .ss-splash__wordmark {
  position: relative;
  z-index: 2;
}

/* Logo container: hosts svg + tokens + pill */
.ss-splash__logo {
  position: relative;
  cursor: pointer;
  user-select: none;
  overflow: visible;
  flex-shrink: 0;
}

/* Wordmark "cloudstack" unter dem logo mit typewriter
   ziel: optische breite ~ logo-breite (260px). Bei 10 chars Inter 640
   entspricht das ~52px font-size. */
.ss-splash__wordmark {
  font-family: var(--ss-font-sans);
  font-feature-settings: 'ss01', 'cv11';
  font-weight: 640;
  letter-spacing: -0.03em;
  line-height: 1;
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  color: var(--ss-cream);
  text-align: center;
  margin: 0;
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  white-space: nowrap;
}
.ss-splash__wordmark-prefix {
  display: inline-block;
  min-height: 1em;
}
.ss-splash__wordmark-caret {
  display: inline-block;
  width: 3px;
  height: 0.85em;
  background: var(--ss-amber);
  margin-left: 3px;
  vertical-align: -0.08em;
  animation: ss-caret 700ms steps(1) infinite;
  opacity: 0;
}
.ss-splash__wordmark.is-typing .ss-splash__wordmark-caret {
  opacity: 1;
}
.ss-splash__wordmark-accent {
  color: var(--ss-amber);
  display: inline-block;
  min-height: 1em;
  text-shadow:
    0 0 14px rgba(232, 196, 147, 0.28),
    0 0 28px rgba(212, 165, 116, 0.18);
}
@keyframes ss-caret {
  50% { opacity: 0; }
}

/* Hero-H1 unter der wordmark */
.ss-splash__h1 {
  font-family: var(--ss-font-sans);
  font-feature-settings: 'ss01', 'cv11';
  font-weight: 640;
  letter-spacing: -0.02em;
  line-height: 1.06;
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  color: var(--ss-cream);
  text-align: center;
  margin: 0;
  max-width: 18ch;
  text-wrap: balance;
}
.ss-splash__h1 > span {
  display: block;
}
.ss-splash__accent {
  color: var(--ss-amber);
}

/* Halo behind logo */
.mhl-halo {
  position: absolute;
  pointer-events: none;
  background: radial-gradient(circle at center, rgba(212, 165, 116, 0.08) 0%, rgba(212, 165, 116, 0) 60%);
  transition: background 600ms cubic-bezier(.4, 0, .2, 1);
}
.ss-splash[data-phase="ring"] .mhl-halo {
  background: radial-gradient(circle at center, rgba(212, 165, 116, 0.22) 0%, rgba(212, 165, 116, 0) 60%);
}

/* Floating tokens */
.mhl-tokens {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.mhl-token {
  position: absolute;
  font-family: var(--ss-font-mono);
  white-space: nowrap;
  pointer-events: none;
  transform-origin: center;
  will-change: transform, opacity;
  transform: translate(calc(-50% + var(--ex)), calc(-50% + var(--ey))) rotate(var(--rot));
}
.mhl-token.appear {
  animation: mhl-tok-appear 520ms cubic-bezier(.2, .8, .2, 1) both;
}
.mhl-token.collapse {
  animation: mhl-tok-collapse 720ms cubic-bezier(.5, 0, .2, 1) forwards;
}

@keyframes mhl-tok-appear {
  0%   { transform: translate(calc(-50% + var(--ex)), calc(-50% + var(--ey))) rotate(var(--rot)) scale(0.4); opacity: 0; filter: blur(4px); }
  60%  { opacity: 1; filter: blur(0); }
  100% { transform: translate(calc(-50% + var(--ex)), calc(-50% + var(--ey))) rotate(var(--rot)) scale(1); opacity: 1; filter: blur(0); }
}
@keyframes mhl-tok-collapse {
  0%   { transform: translate(calc(-50% + var(--ex)), calc(-50% + var(--ey))) rotate(var(--rot)) scale(1); opacity: 1; }
  60%  { opacity: 0.8; }
  100% { transform: translate(-50%, -50%) rotate(0deg) scale(0.2); opacity: 0; filter: blur(3px); }
}

/* Tick-ring (60 lines rotating) — opacity in phases ring+rest */
.mhl-tick-ring {
  opacity: 0;
  transition: opacity 500ms ease 200ms;
}
.ss-splash[data-phase="ring"] .mhl-tick-ring,
.ss-splash[data-phase="rest"] .mhl-tick-ring {
  opacity: 1;
  animation: mhl-spin 22s linear infinite;
}

/* Main white ring */
.mhl-main-ring {
  transform: rotate(-90deg);
  transition: stroke-dashoffset 900ms cubic-bezier(.2, .8, .2, 1);
  filter: drop-shadow(0 0 3px rgba(237, 234, 227, .15));
}
.ss-splash[data-phase="ring"] .mhl-main-ring {
  filter: drop-shadow(0 0 8px rgba(237, 234, 227, .55)) drop-shadow(0 0 18px rgba(237, 234, 227, .25));
}

/* Amber dashed inner ring */
.mhl-inner-ring {
  opacity: 0;
  transition: opacity 600ms ease 400ms;
}
.ss-splash[data-phase="ring"] .mhl-inner-ring,
.ss-splash[data-phase="rest"] .mhl-inner-ring {
  opacity: 0.35;
  animation: mhl-spin-reverse 30s linear infinite;
}

/* Corner brackets */
.mhl-brackets {
  opacity: 0;
  transition: opacity 400ms ease 700ms;
}
.ss-splash[data-phase="ring"] .mhl-brackets,
.ss-splash[data-phase="rest"] .mhl-brackets {
  opacity: 0.5;
}

/* Orbit sparks */
.mhl-orbit-spark {
  animation: mhl-orbit 2.4s cubic-bezier(.4, 0, .2, 1) both;
  filter: drop-shadow(0 0 6px rgba(232, 196, 147, .9));
}

/* Cube: facets appear from translated positions */
.mhl-facet {
  transform-origin: 32px 32px;
  opacity: 0;
  transition: transform 620ms cubic-bezier(.2, .8, .2, 1), opacity 380ms ease;
}
.mhl-facet-top    { transform: translate(0, -24px); }
.mhl-facet-left   { transform: translate(-28px, 16px); transition-delay: 80ms, 80ms; transition-duration: 680ms, 380ms; }
.mhl-facet-right  { transform: translate(28px, 16px);  transition-delay: 160ms, 160ms; transition-duration: 680ms, 380ms; }

.ss-splash[data-phase="assemble"] .mhl-facet,
.ss-splash[data-phase="ring"] .mhl-facet,
.ss-splash[data-phase="rest"] .mhl-facet {
  transform: translate(0, 0);
  opacity: 1;
}

/* Amber Y-joint draws in via stroke-dashoffset */
.mhl-yjoint {
  stroke-dasharray: 70;
  stroke-dashoffset: 70;
  transition: stroke-dashoffset 720ms cubic-bezier(.4, 0, .2, 1) 420ms;
}
.ss-splash[data-phase="ring"] .mhl-yjoint,
.ss-splash[data-phase="rest"] .mhl-yjoint {
  stroke-dashoffset: 0;
}
.ss-splash[data-phase="ring"] .mhl-yjoint {
  filter: drop-shadow(0 0 6px rgba(232, 196, 147, .85));
}

/* Pulse core during ring-phase */
.ss-splash[data-phase="ring"] .mhl-pulse-core {
  animation: mhl-pulse 1.4s cubic-bezier(.4, 0, .2, 1) 0.3s both;
}
@keyframes mhl-pulse {
  0%   { r: 2;   opacity: 0.9; }
  100% { r: 12;  opacity: 0;   }
}

/* forge.ts pill */
.mhl-pill {
  position: absolute;
  left: 50%;
  bottom: -2px;
  transform: translateX(-50%);
  font-family: var(--ss-font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ss-muted);
  background: var(--ss-ink);
  padding: 3px 9px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 400ms ease 700ms;
}
.ss-splash[data-phase="ring"] .mhl-pill,
.ss-splash[data-phase="rest"] .mhl-pill {
  opacity: 1;
}
.mhl-pill-arrow { color: var(--ss-amber); margin-right: 6px; }
.mhl-pill-ok    { color: var(--ss-success); margin-left: 6px; }

@keyframes mhl-spin         { to { transform: rotate(360deg); } }
@keyframes mhl-spin-reverse { to { transform: rotate(-360deg); } }
@keyframes mhl-orbit {
  0%   { transform: rotate(0deg);   opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: rotate(360deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .ss-splash *,
  .mhl-token {
    animation: none !important;
    transition: none !important;
  }
  .mhl-token { display: none; }
  .mhl-facet  { opacity: 1; transform: translate(0, 0); }
  .mhl-yjoint { stroke-dashoffset: 0; }
  .mhl-main-ring { stroke-dashoffset: 0; }
  .mhl-tick-ring, .mhl-inner-ring, .mhl-brackets, .mhl-pill { opacity: 1; }
}

/* Mobile: compact hero */
@media (max-width: 768px) {
  .ss-splash {
    padding: 32px 16px 40px;
    gap: 24px;
  }
  .ss-splash__h1 {
    font-size: clamp(2rem, 8vw, 3rem);
  }
}

/* ── Block 3: NC Login-Form Overrides ─────────────────────────────── */

#body-login {
  /* NC-CSS-variablen ueberschreiben, damit Vue-checkbox + andere components
     die amber-brand-farbe nutzen statt NC-default-primary (das in /apps/theming
     teils als ci-gruen kommt). */
  --color-primary: #D4A574 !important;
  --color-primary-text: #0F0F10 !important;
  --color-primary-element: #D4A574 !important;
  --color-primary-element-hover: #E8C493 !important;
  --color-primary-element-text: #0F0F10 !important;
  --color-primary-element-text-dark: #0F0F10 !important;
  --color-primary-light: rgba(212, 165, 116, 0.15) !important;
  --color-primary-light-text: #D4A574 !important;
  --color-primary-light-hover: rgba(212, 165, 116, 0.22) !important;
  --color-checkbox-checked-background: #D4A574 !important;
  --color-checkbox-checkmark: #0F0F10 !important;

  /* Forged Steel bg — ruhiger base-gradient + subtiler sage-akzent oben links.
     Der amber-glow kommt ausschliesslich aus .ss-steel__heat. */
  background:
    radial-gradient(ellipse 45% 40% at 20% 0%, rgba(107, 142, 127, 0.10) 0%, transparent 50%),
    linear-gradient(160deg, #111113 0%, #0a0a0b 100%) !important;
  background-attachment: fixed !important;
  color: var(--ss-cream);
  font-family: var(--ss-font-sans);
  font-feature-settings: 'ss01', 'cv11';
  /* Einspaltiger flow, kinder default-zentriert */
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
  align-items: center !important;
  min-height: 100vh !important;
  position: relative;
}

#body-login > .ss-splash {
  align-self: stretch !important;
  flex-shrink: 0;
}

/* Form-wrapper: ~30px abstand unter der wordmark, horizontal zentriert */
#body-login > .wrapper {
  margin-block: 30px 0 !important;
  margin-inline: auto !important;
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 700px;
}
#body-login > .wrapper .v-align {
  display: flex;
  justify-content: center;
}

/* NC-Header (header.header-guest mit .logo) — das ist das kleine quadrat oben.
   Wir setzen es unsichtbar weil unser hero-logo die rolle uebernimmt. */
#body-login #header.header-guest {
  display: none !important;
}

/* NC-default-Footer (slogan-pill) ausgeblendet — unser eigener footer ersetzt ihn. */
#body-login > footer.guest-box {
  display: none !important;
}

/* Eigener Footer: am bildschirm-bottom, dezent mono, amber-link */
.ss-footer {
  margin-top: auto;
  align-self: stretch;
  width: 100%;
  padding: 24px 16px 28px;
  text-align: center;
  font-family: var(--ss-font-mono);
  font-size: 12px;
  color: var(--ss-muted);
  letter-spacing: 0.06em;
  position: relative;
  z-index: 2;
}
.ss-footer a {
  color: var(--ss-amber) !important;
  text-decoration: none;
}
.ss-footer a:hover {
  color: var(--ss-amber-soft) !important;
}

/* Inputs — text zentriert */
#body-login input[type="text"],
#body-login input[type="password"],
#body-login input[type="email"],
#body-login input[type="tel"] {
  background: var(--ss-surface) !important;
  border: 1px solid var(--ss-border) !important;
  color: var(--ss-cream) !important;
  border-radius: 10px !important;
  font-family: var(--ss-font-sans);
  text-align: center !important;
}
#body-login input[type="text"]::placeholder,
#body-login input[type="password"]::placeholder,
#body-login input[type="email"]::placeholder {
  text-align: center;
  color: var(--ss-muted);
}

#body-login input[type="text"]:focus,
#body-login input[type="password"]:focus,
#body-login input[type="email"]:focus {
  border-color: var(--ss-amber) !important;
  box-shadow: 0 0 0 2px rgba(212, 165, 116, 0.25) !important;
  outline: none !important;
}

/* Primary button */
#body-login input[type="submit"],
#body-login button[type="submit"],
#body-login .primary {
  background: var(--ss-amber) !important;
  color: var(--ss-ink) !important;
  border: none !important;
  border-radius: 10px !important;
  font-weight: 600 !important;
  font-family: var(--ss-font-sans);
  transition: background 150ms ease;
}
#body-login input[type="submit"]:hover,
#body-login button[type="submit"]:hover,
#body-login .primary:hover {
  background: var(--ss-amber-soft) !important;
}

/* Links */
#body-login a { color: var(--ss-amber); }
#body-login a:hover { color: var(--ss-amber-soft); }

#body-login :focus-visible {
  outline: 2px solid var(--ss-amber) !important;
  outline-offset: 3px !important;
}

/* Login-Box card */
#body-login .login-box,
#body-login .guest-box {
  background: var(--ss-surface);
  border: 1px solid var(--ss-border);
  border-radius: 16px;
}

/* Checkbox amber — multi-layer override fuer NC (legacy + Vue + NC25+ variants) */
#body-login input[type="checkbox"] {
  accent-color: var(--ss-amber) !important;
}
/* Legacy (label::before pseudo) */
#body-login input[type="checkbox"].checkbox + label:before,
#body-login input[type=checkbox].checkbox--white + label:before {
  border-color: var(--ss-amber) !important;
}
#body-login input[type="checkbox"].checkbox:checked + label:before,
#body-login input[type=checkbox].checkbox--white:checked + label:before {
  background-color: var(--ss-amber) !important;
  border-color: var(--ss-amber) !important;
}
/* NC Vue CheckboxRadioSwitch — alle varianten bis NC33 */
#body-login .checkbox-radio-switch,
#body-login .checkbox-radio-switch__label,
#body-login .checkbox-content {
  color: var(--ss-cream) !important;
}
#body-login .checkbox-content--checked .checkbox-content-checkmark,
#body-login .checkbox-radio-switch__icon,
#body-login .checkbox-content__icon {
  color: var(--ss-amber) !important;
  fill: var(--ss-amber) !important;
}
/* Rahmen der Vue-checkbox (oft via box-shadow oder border auf wrapper) */
#body-login .checkbox-content,
#body-login .checkbox-radio-switch__content {
  --color-primary-element: var(--ss-amber) !important;
  --color-success: var(--ss-amber) !important;
  border-color: var(--ss-amber) !important;
}
/* Checkbox SVG-paths direkt faerben (stroke + fill) */
#body-login .checkbox-radio-switch svg,
#body-login .checkbox-content svg,
#body-login label[for*="remember"] svg {
  color: var(--ss-amber) !important;
  fill: var(--ss-amber) !important;
  stroke: var(--ss-amber) !important;
}
/* Falls NC die checkbox mit .material-design-icon / mdi rendert */
#body-login .mdi-check-bold,
#body-login .mdi-checkbox-marked {
  color: var(--ss-amber) !important;
}

/* "An mich erinnern" — checkbox + label mittig zentrieren */
#body-login #remember_login,
#body-login [id^="remember"],
#body-login label[for*="remember"] {
  margin-inline: auto !important;
}
#body-login form > div:has(input[type="checkbox"]),
#body-login form > p:has(input[type="checkbox"]),
#body-login form .login-additional,
#body-login form .remember-login-container {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  text-align: center !important;
}
#body-login .checkbox-radio-switch {
  justify-content: center !important;
}
