/* dangrubb.net skin for the Authelia sign-in pages (auth.grubb.zip).
 *
 * Authelia has no theming hook beyond light/dark, so the VPS nginx that fronts it injects this file into the page
 * (see auth.grubb.zip.nginx.snippet). Everything here is cosmetic and keyed to Authelia's own markup: if a future
 * version changes that markup the page simply falls back to the stock look.
 *
 * Light and dark follow the visitor's system setting through Authelia's `theme: auto`, which marks the page with
 * html[data-theme="light" | "dark"]. Fonts, logos and the grain are served from /dg-theme/ on the same origin,
 * because Authelia's content-security-policy only allows 'self'.
 */

@font-face { font-family: 'Instrument Sans'; font-weight: 400; font-display: swap; src: url('/dg-theme/instrument-sans-400.woff2') format('woff2'); }
@font-face { font-family: 'Instrument Sans'; font-weight: 500; font-display: swap; src: url('/dg-theme/instrument-sans-500.woff2') format('woff2'); }
@font-face { font-family: 'Geist Mono'; font-weight: 500; font-display: swap; src: url('/dg-theme/geist-mono-500.woff2') format('woff2'); }

html[data-theme] {
  --dg-ink: 14 12 40;
  --dg-accent: #4a30d8;
  --dg-card: #ffffff;
  --dg-logo: url('/dg-theme/logo-dark.svg');
  --dg-grad: linear-gradient(90deg, #6344d5, #7ba5e6, #bab8e4);
  --dg-btn-bg: rgb(14 12 40);
  --dg-btn-fg: #fff;
  --dg-field-bg: #fff;
  --dg-shadow: 0 40px 90px -40px rgb(20 15 70 / 0.55);

  /* retint Authelia's own palette */
  --primary: #4a30d8;
  --ring: #4a30d8;
  --input: rgb(14 12 40 / 0.3);
  --foreground: rgb(14 12 40);
  --muted-foreground: rgb(14 12 40 / 0.62);
  --card: #ffffff;
  --custom-icon: rgb(14 12 40);
}
html[data-theme='dark'] {
  --dg-card: #15133a;
  --dg-logo: url('/dg-theme/logo-white.svg');
  --dg-btn-bg: #ffffff;
  --dg-btn-fg: rgb(14 12 40);
  --dg-field-bg: rgb(255 255 255 / 0.06);
  --dg-shadow: 0 40px 90px -40px rgb(0 0 0 / 0.8);
  --primary: #a99bff;
  --ring: #a99bff;
  --input: rgb(255 255 255 / 0.28);
  --foreground: #f3f2ff;
  --muted-foreground: rgb(243 242 255 / 0.66);
  --card: #15133a;
  --custom-icon: #fff;
}

/* ---------- the page: the same sky as the member site, in two moods ---------- */
html[data-theme], html[data-theme] body {
  min-height: 100%;
  font-family: 'Instrument Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
html[data-theme='light'] body {
  background:
    radial-gradient(62% 52% at 6% 30%, #6a3fd6 0%, rgb(106 63 214 / 0.78) 38%, rgb(106 63 214 / 0) 100%),
    radial-gradient(48% 44% at 100% 74%, #f4f3fd 0%, rgb(244 243 253 / 0.8) 40%, rgb(244 243 253 / 0) 100%),
    radial-gradient(46% 34% at 96% 4%, #9a80e6 0%, rgb(154 128 230 / 0) 100%),
    radial-gradient(60% 34% at 4% 98%, #5da4e8 0%, rgb(93 164 232 / 0) 100%),
    radial-gradient(54% 26% at 62% 104%, #6679e2 0%, rgb(102 121 226 / 0) 100%),
    linear-gradient(180deg, #6f93e8 0%, #8fa4ec 38%, #c5c8f3 62%, #8d9ced 84%, #6d86e6 100%);
  background-attachment: fixed;
}
html[data-theme='dark'] body {
  background:
    radial-gradient(58% 50% at 8% 28%, rgb(88 56 210 / 0.72) 0%, rgb(88 56 210 / 0) 100%),
    radial-gradient(50% 44% at 98% 80%, rgb(96 104 230 / 0.34) 0%, rgb(96 104 230 / 0) 100%),
    radial-gradient(60% 34% at 4% 100%, rgb(40 96 200 / 0.55) 0%, rgb(40 96 200 / 0) 100%),
    linear-gradient(180deg, #0c0b26 0%, #121038 52%, #0a0a22 100%);
  background-attachment: fixed;
}
/* film grain, as on the site */
html[data-theme] body::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: url('/dg-theme/grain.svg') 0 0 / 240px 240px;
  opacity: 0.34; mix-blend-mode: soft-light;
}
html[data-theme='dark'] body::before { opacity: 0.2; mix-blend-mode: overlay; }
#root { position: relative; z-index: 1; }

/* ---------- the card: a folder tab like the member site's service cards ---------- */
[id$='-stage'] { text-align: center; }
[id$='-stage'] > div {
  position: relative;
  max-width: 444px;
  margin-top: 28px;
  background: var(--dg-card);
  padding: 4px 36px 34px;
  box-shadow: var(--dg-shadow);
  color: var(--foreground);
  opacity: 0; transform: translateY(14px);
  animation: dg-in 0.8s cubic-bezier(0.33, 0, 0.2, 1) 0.1s forwards;
}
[id$='-stage'] > div::before,
[id$='-stage'] > div::after { content: ''; position: absolute; top: -26px; height: 26px; background: var(--dg-card); }
[id$='-stage'] > div::before { left: 0; width: calc(100% - 132px); }
[id$='-stage'] > div::after {
  content: 'dangrubb.net'; right: 0; width: 132px; background: transparent;
  display: flex; align-items: center; justify-content: flex-end; padding-right: 2px;
  font: 500 11px/1 'Geist Mono', ui-monospace, monospace; letter-spacing: 0.02em; text-transform: uppercase;
  color: rgb(var(--dg-ink) / 0.85);
}
html[data-theme='dark'] [id$='-stage'] > div::after { color: rgb(243 242 255 / 0.8); }
@keyframes dg-in { to { opacity: 1; transform: none; } }

/* the generic avatar becomes the logo */
div:has(> #UserSvg) {
  height: 76px; margin: 26px 0 4px; padding: 0 !important;
  background: var(--dg-logo) center / contain no-repeat;
}
#UserSvg { display: none; }

h5 {
  font-family: 'Instrument Sans', system-ui, sans-serif; font-weight: 500;
  font-size: 22px !important; letter-spacing: -0.02em; color: var(--foreground);
  margin: 6px 0 4px;
}

/* ---------- controls ---------- */
input[data-slot] {
  border-radius: 0 !important;
  background-color: var(--dg-field-bg);
  border: 1px solid var(--input);
  color: var(--foreground);
  box-shadow: none;
  font-family: 'Instrument Sans', system-ui, sans-serif;
  transition: border-color 0.25s, box-shadow 0.25s;
}
input[data-slot]:focus { border-color: var(--primary) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 24%, transparent); }
input[data-slot]::placeholder { color: transparent; -webkit-text-fill-color: transparent; }   /* the floating label is the placeholder */
input[data-slot]:-webkit-autofill { -webkit-text-fill-color: var(--foreground); box-shadow: inset 0 0 0 100px var(--dg-field-bg); }
label { font-family: 'Instrument Sans', system-ui, sans-serif; }
/* a plain label sitting directly above its field (reset password) */
label[data-slot='label']:has(+ input[data-slot]) {
  display: block; text-align: left; margin-bottom: 8px;
  font: 500 11px/1 'Geist Mono', ui-monospace, monospace; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted-foreground);
}
[data-slot='checkbox'] { border-radius: 0 !important; }

button[data-slot='button'] {
  border-radius: 0 !important; height: 44px;
  font-family: 'Geist Mono', ui-monospace, monospace; font-weight: 500; font-size: 12px; letter-spacing: 0.04em;
  background: var(--dg-btn-bg); color: var(--dg-btn-fg); border: 0;
  transition: background 0.35s, color 0.35s, transform 0.35s;
}
button[data-slot='button']:hover:not(:disabled) {
  background: var(--dg-grad); color: rgb(14 12 40);
}
button[data-slot='button']:active:not(:disabled) { transform: translateY(1px); }
button[data-slot='button'][data-variant='outline'], button[data-slot='button'][data-variant='ghost'] {
  background: transparent; color: var(--foreground); border: 1px solid var(--input);
}

a { color: var(--primary); }
a:hover { text-decoration-thickness: 1px; }
[id$='-stage'] a[class*='9e9e9e'], [id$='-stage'] [class*='text-\[\#9e9e9e\]'] { color: var(--muted-foreground) !important; font-family: 'Geist Mono', ui-monospace, monospace; letter-spacing: 0.02em; }

/* language picker, top right: sits on the sky, so it takes the sky's text colour */
header #language-button { color: rgb(255 255 255 / 0.92); border-radius: 0; }
html[data-theme='light'] header #language-button { color: #fff; }

/* the first-load bars */
span[class*='custom-loading'] { background: var(--dg-card) !important; }

@media (max-width: 520px) {
  [id$='-stage'] > div { padding: 4px 22px 28px; margin-left: 12px; margin-right: 12px; width: auto; }
  [id$='-stage'] > div::before { width: calc(100% - 118px); }
  [id$='-stage'] > div::after { width: 118px; }
}
@media (prefers-reduced-motion: reduce) {
  [id$='-stage'] > div { animation: none; opacity: 1; transform: none; }
  button[data-slot='button'] { transition: none; }
}
