/*
  Paporwerk pre-authentication login page.

  Self-contained on purpose (see ../templating.py): no tenant theme
  variables, no shell component classes. Every color, size and spacing value
  used by this page is defined here as a custom property so nothing here
  silently depends on another stylesheet loading first.
*/

:root {
  /* -- Paporwerk core palette (brand direction: deep ink + warm ivory) -- */
  --pw-ink-950: #0a0d12;
  --pw-ink-900: #0e131a;
  --pw-ivory: #f4eee1;
  --pw-ivory-dim: rgb(244 238 225 / 78%);
  --pw-ivory-faint: rgb(244 238 225 / 52%);
  --pw-ivory-ghost: rgb(244 238 225 / 40%);
  --pw-hairline: rgb(244 238 225 / 14%);
  --pw-hairline-strong: rgb(244 238 225 / 26%);
  --pw-focus: #9db8ff;
  --pw-focus-glow: rgb(157 184 255 / 35%);
  --pw-danger-bg: rgb(255 116 108 / 12%);
  --pw-danger-border: rgb(255 148 140 / 45%);
  --pw-danger-text: #ffb4ac;

  --pw-radius-lg: 22px;
  --pw-radius-sm: 8px;
  --pw-font: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --pw-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--pw-ink-950);
}

body {
  min-height: 100vh;
  font-family: var(--pw-font);
  color: var(--pw-ivory);
  -webkit-font-smoothing: antialiased;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--pw-ivory);
  color: var(--pw-ink-950);
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  z-index: 100;
  font-weight: 600;
}
.skip-link:focus {
  left: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- stage */

.stage {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(340px, 1fr);
  background: var(--pw-ink-950);
  position: relative;
}

/* The production environment plate (walls, portal, floor reflection, haze,
   cool ambient light, the far-right seam -- all baked in, derived from the
   approved reference's own canvas). Full-bleed behind BOTH columns, not a
   small crop sized/positioned inside the brand zone: the plate already
   composes the portal and the far-right seam at the correct relative
   positions for this page's proportions, because it shares the approved
   reference's aspect ratio. `cover` + `center` crops symmetrically at
   narrower viewports without needing per-breakpoint repositioning. */
.stage__scene {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: var(--scene-url);
  background-size: cover;
  background-position: center;
}

/* ------------------------------------------------------------ brand zone */

.brand-zone {
  position: relative;
  z-index: 1;
  overflow: hidden;
  padding: clamp(28px, 5vw, 64px);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  isolation: isolate;
}

/* A light legibility scrim behind the text column only (left ~55% of this
   zone) -- the plate is a real photograph, not a flat fill, so unlike the
   old CSS-approximated wash this is a small, deliberately restrained
   assist for contrast, not the thing doing the environmental work. */
.brand-zone::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    /* the footer sits over real floor reflection at full width -- without
       this it can wash out against a bright streak passing under it */
    linear-gradient(0deg, rgb(10 13 18 / 60%) 0%, transparent 14%),
    linear-gradient(100deg, rgb(10 13 18 / 46%) 0%, rgb(10 13 18 / 20%) 34%, transparent 58%);
  pointer-events: none;
}

.brand-kicker {
  margin: 0 0 28px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--pw-ivory-faint);
  line-height: 1.7;
}

/* A thinner, more editorial hand than the rest of the page's UI sans --
   the approved reference's headline is a light serif, not a bold display
   sans. System serif stack only (no external font request). */
.brand-headline {
  margin: 0;
  font-family: Georgia, "Times New Roman", "Noto Serif", serif;
  font-size: clamp(34px, 4.6vw, 58px);
  line-height: 1.12;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--pw-ivory);
  max-width: 11ch;
}

/* Positioned to sit beside the portal, in the same vertical band as its
   lower half -- not pushed down below it into a separate row, which read
   as the headline and the portal stacked rather than composed together.
   Still well above the footer -- the footer's own `margin-top: auto`
   below is what pins it to the bottom regardless of this block's height. */
.brand-headline-block {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin-top: clamp(70px, 15vh, 190px);
  position: relative;
  z-index: 1;
}

.brand-rule {
  width: 46px;
  height: 1px;
  background: var(--pw-hairline-strong);
  border: 0;
  margin: 0;
}

.brand-pillars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--pw-ivory-faint);
}

.brand-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pw-ivory-ghost);
  text-shadow: 0 1px 3px rgb(0 0 0 / 70%), 0 1px 8px rgb(0 0 0 / 50%);
  flex-wrap: wrap;
}

/* ------------------------------------------------------------- auth zone */

/* Transparent on purpose -- the real environment plate (`.stage__scene`)
   shows through here now. The old synthetic warm/cool gradient bleed and
   the two fake far-right seam pseudo-elements are gone: the plate already
   has a real, photographed far-right light seam baked in at the position
   its own aspect ratio (matching the approved reference's) puts it, which
   lands in this zone without any per-element positioning from here. */
.auth-zone {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 4vw, 48px);
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 408px;
  padding: clamp(36px, 4.6vw, 48px) clamp(26px, 3.6vw, 38px) 38px;
  border-radius: var(--pw-radius-lg);
  /* Materially more translucent than the first pass, which read as a
     solid opaque rectangle -- lower fill alpha, a brighter hairline, and a
     softer top-edge highlight so the glass/blur treatment is actually
     visible against the warm bleed above. */
  background: linear-gradient(165deg, rgb(23 31 43 / 50%), rgb(14 19 26 / 56%));
  border: 1px solid rgb(244 238 225 / 24%);
  box-shadow:
    /* separation from the background: soft, not harsh */
    0 34px 90px -22px rgb(0 0 0 / 62%),
    /* cool outer glow */
    0 0 70px -4px rgb(96 132 190 / 26%),
    /* warm outer glow -- the card sits in the same lit room as the portal */
    0 0 52px -8px rgb(232 218 182 / 22%),
    /* beveled top/left rim highlight */
    0 1px 0 0 rgb(244 238 225 / 20%) inset,
    1px 0 0 0 rgb(244 238 225 / 10%) inset;
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
}

/* The distinct bright vertical strip down the card's own right edge --
   rim light, not a border -- the approved reference shows on the glass
   panel itself, separate from the far-right environmental light strip. */
.auth-card::after {
  content: "";
  position: absolute;
  top: 8%;
  bottom: 8%;
  right: -1px;
  width: 2.5px;
  border-radius: 2px;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgb(244 238 225 / 70%) 30%,
    rgb(244 238 225 / 92%) 55%,
    rgb(244 238 225 / 50%) 80%,
    transparent 100%
  );
  box-shadow: 0 0 8px 1px rgb(244 238 225 / 35%);
  filter: blur(0.3px);
  pointer-events: none;
}

.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin: 0 auto 32px;
}

.auth-logo__mark {
  display: block;
  width: 46px;
  height: auto;
}

.auth-logo__wordmark {
  display: block;
  width: min(196px, 58%);
  height: auto;
}

.auth-title {
  margin: 0 0 28px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--pw-ivory-faint);
}

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--pw-radius-sm);
  font-size: 13px;
  line-height: 1.4;
  margin: 0 0 18px;
}

.notice--error {
  background: var(--pw-danger-bg);
  border: 1px solid var(--pw-danger-border);
  color: var(--pw-danger-text);
}

.field {
  margin-bottom: 22px;
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--pw-ivory-dim);
  margin-bottom: 7px;
}

.field-control {
  position: relative;
}

.field-control svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--pw-ivory-faint);
  pointer-events: none;
}

.field input[type="email"],
.field input[type="password"] {
  width: 100%;
  padding: 12px 14px 12px 38px;
  border-radius: var(--pw-radius-sm);
  border: 1px solid var(--pw-hairline-strong);
  background: rgb(8 11 15 / 55%);
  color: var(--pw-ivory);
  font-size: 14.5px;
  font-family: inherit;
  transition: border-color 160ms var(--pw-ease), box-shadow 160ms var(--pw-ease);
}

.field input[type="email"]::placeholder,
.field input[type="password"]::placeholder {
  color: var(--pw-ivory-ghost);
}

.field input[type="email"]:hover,
.field input[type="password"]:hover {
  border-color: var(--pw-ivory-ghost);
}

.field input[type="email"]:focus-visible,
.field input[type="password"]:focus-visible {
  outline: none;
  border-color: var(--pw-focus);
  box-shadow: 0 0 0 4px var(--pw-focus-glow);
}

.field--error input[type="email"],
.field--error input[type="password"] {
  border-color: var(--pw-danger-border);
}

.field-error {
  margin: 6px 2px 0;
  font-size: 12px;
  color: var(--pw-danger-text);
}
.field-error:empty { display: none; }

.checkbox-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0 28px;
  flex-wrap: wrap;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--pw-ivory-dim);
  cursor: pointer;
  user-select: none;
}

.checkbox input[type="checkbox"] {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid var(--pw-hairline-strong);
  background: rgb(8 11 15 / 55%);
  display: inline-grid;
  place-content: center;
  cursor: pointer;
  flex: none;
}

.checkbox input[type="checkbox"]::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  transform: scale(0);
  transition: transform 120ms var(--pw-ease);
  background: var(--pw-ivory);
}

.checkbox input[type="checkbox"]:checked {
  border-color: var(--pw-ivory-dim);
}
.checkbox input[type="checkbox"]:checked::before {
  transform: scale(1);
}

.checkbox input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--pw-focus-glow);
}

.link-quiet {
  font-size: 13px;
  color: var(--pw-ivory-faint);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.link-quiet:hover,
.link-quiet:focus-visible {
  color: var(--pw-ivory);
  border-bottom-color: var(--pw-ivory-faint);
}

.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 18px;
  border-radius: var(--pw-radius-sm);
  border: none;
  background: var(--pw-ivory);
  color: var(--pw-ink-950);
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms var(--pw-ease), box-shadow 160ms var(--pw-ease), background 160ms var(--pw-ease);
}

.btn-primary svg {
  width: 15px;
  height: 15px;
  transition: transform 160ms var(--pw-ease);
}

.btn-primary:hover {
  background: #ffffff;
  box-shadow: 0 12px 30px -12px rgb(244 238 225 / 45%);
}
.btn-primary:hover svg {
  transform: translateX(3px);
}

.btn-primary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--pw-focus-glow);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-primary[aria-disabled="true"] {
  background: rgb(244 238 225 / 22%);
  color: var(--pw-ivory-dim);
  cursor: not-allowed;
  pointer-events: none;
}

.hint {
  margin: 10px 2px 0;
  font-size: 12.5px;
  color: var(--pw-ivory-faint);
  text-align: center;
  line-height: 1.5;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 30px 0 20px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pw-ivory-ghost);
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--pw-hairline);
}

.reassurance {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0;
  font-size: 12px;
  color: var(--pw-ivory-faint);
}
.reassurance svg {
  width: 13px;
  height: 13px;
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 980px) {
  .stage {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  }
  .brand-headline { max-width: 9ch; }
  .brand-pillars { display: none; }
}

@media (max-width: 720px) {
  .stage {
    grid-template-columns: none;
    grid-template-rows: minmax(220px, 34vh) auto;
  }
  .brand-zone {
    padding: 22px 22px 26px;
    justify-content: flex-end;
  }
  /* Confined to the hero row's own height (matching the grid track's
     effective size) rather than the full stage: at desktop/tablet the
     card sits *beside* the environment, so a full-bleed plate behind both
     columns is correct, but the mobile layout *stacks* card below image --
     letting the plate keep spanning the full page put a bright, busy photo
     directly behind the glass card's backdrop-filter, which washed the
     card's own contents out. The plate is a wide (~16:9) landscape image,
     so `cover` alone would also zoom in hard and could crop the portal out
     entirely; the horizontal focal point is biased to keep it in frame. */
  .stage__scene {
    bottom: auto;
    height: max(220px, 34vh);
    background-position: 32% center;
  }
  .brand-kicker { margin-bottom: 10px; }
  .brand-headline { font-size: clamp(26px, 7vw, 34px); max-width: 14ch; }
  .brand-headline-block,
  .brand-footer { display: none; }
  .auth-zone { padding: 0 18px 28px; background: var(--pw-ink-950); }
  .auth-card { max-width: 460px; border-radius: 18px 18px var(--pw-radius-lg) var(--pw-radius-lg); margin-top: -28px; }
}

@media (max-width: 420px) {
  .auth-card { padding: 26px 18px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.001ms !important; }
}
