/* OpenThings Keycloak login theme — mirrors apps/portal/app/(auth)/login/page.tsx.
   Values are lifted from the portal's globals.css tokens + Tailwind utilities so
   the hosted Keycloak page matches the in-app login. */
@import url("https://api.fontshare.com/v2/css?f[]=space-grotesk@300,400,500,600,700&display=swap");

:root {
  --background: #F5F4F0;
  --surface: #FFFFFF;
  --surface-2: #F5F4F0;
  --ink: #1A1A1A;
  --ink-2: #3A3D44;
  --muted: #5E626B;
  --placeholder: #AAAAAA;
  --line: rgba(10, 10, 10, 0.10);
  --line-soft: rgba(10, 10, 10, 0.06);
  --accent: #00C9A0;
  --accent-hover: #00A884;
  --accent-glow: rgba(0, 201, 160, 0.15);
  --sidebar: #0A0A0A;
}

* { box-sizing: border-box; }

html {
  font-family: "Space Grotesk", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  padding: 0;
  background: var(--background);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.ot-root {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  overflow: hidden;
  background: var(--background);
}

/* Teal radial gradient blobs (top-left, bottom-right). */
.ot-blob {
  position: absolute;
  pointer-events: none;
  width: 460px;
  height: 460px;
  border-radius: 9999px;
  z-index: 0;
}
.ot-blob-1 {
  top: -128px;
  left: -96px;
  background: radial-gradient(circle, rgba(0, 201, 160, 0.14), transparent 70%);
}
.ot-blob-2 {
  bottom: -160px;
  right: 18%;
  background: radial-gradient(circle, rgba(0, 201, 160, 0.08), transparent 70%);
}

/* Bouncing, slowly spinning faint ring (positioned by JS). */
.ot-ring {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  opacity: 0.13;
  pointer-events: none;
  will-change: transform;
}
.ot-ring-spin {
  animation: ot-spin-slow 26s linear infinite;
  transform-origin: center;
}
@keyframes ot-spin-slow { to { transform: rotate(360deg); } }

/* Left brand panel — hidden below 1280px (the original xl: breakpoint). */
.ot-aside {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 10;
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 440px;
  padding: 48px;
}
@media (min-width: 1280px) {
  .ot-aside { display: flex; }
}

.ot-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
.ot-logo-text {
  font-family: "Space Grotesk", system-ui, sans-serif;
  letter-spacing: -0.03em;
  white-space: nowrap;
  font-size: 22px;
}
.ot-logo-text strong { font-weight: 700; color: var(--ink); }
.ot-logo-things { font-weight: 300; color: var(--muted); }

.ot-tagline {
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.6;
  max-width: 280px;
  margin: 0;
}
.ot-tagline strong { font-weight: 600; color: var(--ink); }

.ot-version {
  margin-top: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ot-version span:last-child { font-size: 12px; color: var(--muted); }
.ot-dot {
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: var(--accent);
  animation: ot-pulse 2s ease-in-out infinite;
}
@keyframes ot-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Right card column. */
.ot-main {
  position: relative;
  z-index: 10;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}
.ot-card {
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 24px 60px -20px rgba(10, 10, 10, 0.25);
  padding: 44px;
}
@media (max-width: 640px) {
  .ot-card { padding: 32px; }
}

.ot-logo-sm { display: flex; justify-content: center; margin-bottom: 32px; }
@media (min-width: 1280px) {
  .ot-logo-sm { display: none; }
}

.ot-head { margin-bottom: 32px; }
.ot-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--ink);
  margin: 0;
}
.ot-subtitle { font-size: 14px; color: var(--ink-2); margin: 8px 0 0; }

.ot-form { display: flex; flex-direction: column; gap: 16px; }
.ot-field { display: flex; flex-direction: column; gap: 6px; }
.ot-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.ot-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  transition: all 0.15s ease;
}
.ot-input::placeholder { color: var(--placeholder); }
.ot-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.ot-error {
  font-size: 13px;
  color: #DC2626;
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  padding: 10px 16px;
  margin: 0;
}

.ot-button {
  width: 100%;
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--sidebar);
  background: var(--accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.ot-button:hover { background: var(--accent-hover); }
.ot-button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Tenant logo swap (variant themes render an <img> here instead of the
   inline OpenThings ring + wordmark; see login.ftl). Sized to read clearly
   as the primary brand mark in the aside - up from 56px, kept proportional
   at the mobile breakpoint. */
.ot-logo-img { height: 72px; width: auto; display: block; }
@media (max-width: 720px) { .ot-logo-img { height: 56px; } }
.ot-logo-img-sm { height: 28px; width: auto; display: block; }

/* Context selector - quiet row of links at the bottom of the card (DEMO-008).
   Shared by every theme; the active entry picks up the theme's own --accent. */
.ot-context-switch {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 6px;
}
.ot-context-link {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--muted);
  text-decoration: none;
  padding: 5px 8px;
  border-radius: 6px;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.ot-context-link:hover { color: var(--ink-2); background: var(--surface-2); }
.ot-context-link.is-active {
  color: var(--ink);
  font-weight: 600;
  background: var(--surface-2);
}
.ot-context-link.is-active::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 6px;
  border-radius: 999px;
  background: var(--accent);
  vertical-align: middle;
}

/* Locale switcher - a quiet EN/PL row under the context selector. Shares
   the context-switch spacing rhythm but stays visually secondary (smaller,
   no top border of its own) so it doesn't compete with it. */
.ot-locale-switch {
  margin-top: 10px;
  display: flex;
  justify-content: center;
  gap: 12px;
}
.ot-locale-link {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-decoration: none;
  padding: 3px 5px;
  border-radius: 5px;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.ot-locale-link:hover { color: var(--ink-2); background: var(--surface-2); }
.ot-locale-link.is-active { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  .ot-ring-spin, .ot-dot { animation: none; }
}

/* ============================================================
   Tenant split login layout (P10A / DEMO-008 follow-up).
   Two columns: a light form panel (left, ~41%) and full-height
   tenant hero photography (right, ~59%). Entirely scoped under
   .ot-split, which only tenant contexts get (see login.ftl) - the
   base openthings theme never has this class, so its markup/CSS
   above is untouched.

   The form panel deliberately keeps the shared :root light tokens
   (--background/--surface/--ink/--muted from the top of this file)
   rather than adopting a tenant's dark brand.css palette: near-black
   ink on a near-white surface is what gets WCAG AA text contrast
   "for free" (house rule: no washed-out grey). Each variant.css only
   overrides --accent/--accent-hover/--accent-glow/--sidebar (for
   the button + focus ring) and a very light background tint, so the
   three panels stay visually distinct without sacrificing contrast.
   ============================================================ */
.ot-split {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  background: var(--background);
}

.ot-split-form {
  flex: 0 0 41%;
  max-width: 41%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 40px;
  position: relative;
  z-index: 1;
}

.ot-split-form-inner {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.ot-split-logo { margin-bottom: 32px; }
.ot-split-logo-mark { margin: 0; line-height: 0; }
.ot-split-logo .ot-logo-img { height: 82px; width: auto; display: block; }
.ot-split-logo .ot-subtitle { margin: 14px 0 0; }

.ot-split-hero {
  flex: 1 1 59%;
  position: relative;
  overflow: hidden;
  background: #05070C;
}
.ot-split-hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 60% 50%; /* overridden per tenant in variant.css */
  display: block;
}
/* Legibility + brand-tint wash over the photo; each variant.css supplies
   its own gradient colours so the wash reads as part of that tenant's
   palette rather than one generic dark vignette. */
.ot-split-hero-veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ot-poweredby {
  margin: 28px 0 0;
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* Hero accent widgets - small frosted-glass chips/pills over the
   photography (goal: 2-3 quiet live-status elements per tenant, not a
   full-bleed treatment). Solid fallback background is declared first;
   backdrop-filter is a progressive enhancement behind @supports so the
   chip stays legible without any experimental feature. */
.ot-hero-accent {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 56px);
  padding: 9px 13px;
  border-radius: 999px;
  background: rgba(6, 9, 16, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #F2F4F8;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  z-index: 2;
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .ot-hero-accent {
    background: rgba(6, 9, 16, 0.42);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
}
.ot-hero-accent-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ot-hero-accent-primary { top: 28px; left: 28px; }

.ot-hero-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
  flex: 0 0 auto;
  animation: ot-hero-pulse 6s ease-in-out infinite;
}
@keyframes ot-hero-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.ot-hero-spark {
  width: 52px;
  height: 16px;
  overflow: visible;
  flex: 0 0 auto;
}
.ot-hero-spark polyline {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ot-hero-hairline {
  position: relative;
  width: 64px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  overflow: hidden;
  flex: 0 0 auto;
}
.ot-hero-hairline-fill {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  transform: scaleX(0);
  background: var(--accent);
  animation: ot-hero-fill 8s ease-in-out infinite;
}
@keyframes ot-hero-fill {
  0% { transform: scaleX(0); }
  45%, 55% { transform: scaleX(1); }
  100% { transform: scaleX(0); }
}

.ot-hero-node-pulse {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid var(--accent);
  z-index: 2;
  animation: ot-hero-node 7s ease-in-out infinite;
}
@keyframes ot-hero-node {
  0%, 100% { transform: scale(1); opacity: 0.55; }
  50% { transform: scale(1.8); opacity: 0; }
}

.ot-hero-trace {
  position: absolute;
  width: 220px;
  height: 40px;
  overflow: visible;
  z-index: 2;
}
.ot-hero-trace-base {
  fill: none;
  stroke: rgba(255, 255, 255, 0.22);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ot-hero-trace-pulse {
  fill: none;
  stroke: var(--hero-highlight, var(--accent));
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 24 400;
  animation: ot-hero-trace 9s linear infinite;
}
@keyframes ot-hero-trace { to { stroke-dashoffset: -424; } }

.ot-hero-live {
  position: absolute;
  top: 28px;
  right: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(6, 9, 16, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #F2F4F8;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  z-index: 2;
}

/* Responsive collapse: single column, form first (already first in the
   DOM - see login.ftl), compact hero banner beneath it. */
@media (max-width: 1023px) {
  .ot-split { flex-direction: column; min-height: 0; }
  .ot-split-form { flex: 1 1 auto; max-width: 100%; padding: 40px 24px 36px; }
  .ot-split-logo .ot-logo-img { height: 50px; }
  .ot-split-hero { flex: 0 0 200px; height: 200px; }
  .ot-hero-trace { width: 160px; height: 32px; }
}
@media (max-width: 480px) {
  .ot-split-form { padding: 32px 18px 28px; }
  .ot-split-hero { flex-basis: 180px; height: 180px; }
}

@media (prefers-reduced-motion: reduce) {
  .ot-hero-dot,
  .ot-hero-hairline-fill,
  .ot-hero-node-pulse,
  .ot-hero-trace-pulse {
    animation: none;
  }
  .ot-hero-hairline-fill { transform: scaleX(0.55); }
}
