/*!
 * Helio Stitch
 * Copyright (c) 2026 Helio Stitch. All rights reserved.
 *
 * This software is proprietary and confidential. It is licensed for use through
 * the Helio Stitch service only, and is not sold. You may not copy, modify,
 * redistribute, sell, resell, sublicense, reverse engineer or create derivative
 * works from it, in whole or in part, without prior written permission.
 *
 * Designs and machine files you make with Helio Stitch are yours.
 * Third-party components keep their own licences:
 * https://heliostitch.com/attribution
 *
 * For extended usage, licensing or partnership: sam@cityembroidery.com
 */
/*
 * Signed-out surfaces — sign in, register, verification, password reset,
 * complete profile, attribution.
 *
 * Restyled 2026-09 to the `Helio Stitch Auth v4` comp: the same dark
 * (`#0C0D0F`) / lime (`#B6D84A`) system the lander (`web/static/lander/`)
 * already ports, rather than the old warm-paper "Hoop Template" identity —
 * DESIGN.md's split between the app's cool acrylic chrome and a warm public
 * face no longer holds now the public face itself is this dark system.
 * Nothing in `frontend/src` reads these tokens and nothing here reads the
 * app's; the two remain separate on purpose.
 *
 * Hand-written, no build step. Bricolage Grotesque + IBM Plex Mono load from
 * Google Fonts, matching the lander's own choice (see its `index.html`) —
 * once that dependency exists for the public site, duplicating it as a
 * self-hosted subset here bought nothing.
 */

:root {
  /* Ground */
  --bg: #0c0d0f; /* page background, everywhere */
  --panel: #131417; /* fields, the art card, note boxes */
  --field: #131417;

  /* Text */
  --ink: #eceae4;
  --ink-2: #9a9ea6; /* sub-copy, secondary nav */
  --ink-3: #7c8088; /* footer, meta */
  --placeholder: #6c7078;

  /* Lines */
  --line: #25272c; /* field borders */
  --line-2: #33363c; /* pill / secondary-button borders */
  --line-3: #2a2c31; /* strength meter track */
  --header-line: #1e2024;

  /* Brand: lime accent on near-black */
  --accent: #b6d84a;
  --accent-hover: #c6e36a;
  --accent-ink: #15170e; /* text on a lime fill */
  --accent-tint-bg: rgba(141, 176, 42, 0.14);
  --accent-tint-border: rgba(182, 216, 74, 0.5);
  --accent-tint-ink: #ddf28c;
  --focus-ring: rgba(182, 216, 74, 0.18);

  --danger: #f2877d;

  /* Local-dev demo notice — deliberately a different hue, because it means
     authentication is switched off. */
  --warn-border: rgba(232, 184, 74, 0.55);
  --warn-bg: rgba(232, 184, 74, 0.12);
  --warn-ink: #e8c97a;

  --font-ui: 'Bricolage Grotesque', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
}

/* ---- utilities the page scripts toggle at runtime ---- */
.hidden {
  display: none !important;
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.gap-2 {
  gap: 0.5rem;
}

.h-4 {
  height: 1rem;
}

.w-4 {
  width: 1rem;
}

.animate-spin {
  animation: auth-spin 0.9s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .animate-spin {
    animation-duration: 3s;
  }
}

/* ---- shell -------------------------------------------------------------
   Header (logo + nav), main (form column + art panel), footer — the same
   three-band layout as the comp, edge to edge rather than in a centred
   container: this is a utility page, not a marketing one. */
.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* ---- header -------------------------------------------------------------- */
.auth-header {
  position: relative;
  z-index: 2;
  border-bottom: 1px solid var(--header-line);
  background: rgba(12, 13, 15, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.auth-header-inner {
  height: 68px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  flex: none;
  min-width: 0;
}

.auth-logo img {
  width: 32px;
  height: 32px;
  flex: none;
}

.auth-wordmark {
  font-size: 19px;
  letter-spacing: -0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.auth-wordmark b {
  font-weight: 800;
}

.auth-wordmark span {
  font-weight: 400;
}

.auth-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 15px;
  flex: none;
}

.auth-nav-back {
  color: var(--ink-2);
  white-space: nowrap;
}

.auth-nav-back:hover {
  color: var(--ink);
}

/* The pill: "Create account" / "Sign in" / "Back to sign in", depending on
   which form is on screen. */
.auth-pill {
  height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  display: flex;
  align-items: center;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 600;
  transition:
    border-color 0.12s ease,
    color 0.12s ease;
}

.auth-pill:hover {
  border-color: var(--accent);
  color: var(--ink);
}

@media (max-width: 639px) {
  .auth-nav-back {
    display: none;
  }
}

@media (max-width: 479px) {
  .auth-header-inner {
    padding: 0 16px;
    gap: 10px;
  }

  .auth-nav {
    gap: 12px;
    font-size: 13.5px;
  }

  .auth-pill {
    height: 36px;
    padding: 0 13px;
  }

  .auth-wordmark {
    font-size: 16px;
  }
}

/* ---- main: form column + art panel -------------------------------------- */
.auth-main {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
}

@media (min-width: 980px) {
  .auth-main {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  }
}

.auth-formzone {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 56px 24px 72px;
  min-width: 0;
}

@media (max-width: 479px) {
  .auth-formzone {
    padding: 32px 16px 48px;
  }
}

.auth-formcol {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ---- art panel ------------------------------------------------------------
   Hidden below 980px, same threshold the comp ties to `showArt`: the hoop
   card is the first thing to go, never the form. */
.auth-artzone {
  display: none;
}

@media (min-width: 980px) {
  .auth-artzone {
    display: flex;
    padding: 24px 24px 24px 0;
  }
}

.auth-art {
  position: relative;
  flex: 1;
  border-radius: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 48px;
}

.auth-art-glow {
  position: absolute;
  left: 50%;
  top: 45%;
  width: 760px;
  height: 760px;
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(182, 216, 74, 0.12), transparent);
  pointer-events: none;
}

/* The hoop bezel: a metal ring around the dark "fabric" the sun stitches
   onto. Built from CSS, not an image, so it stays crisp at any size. */
.auth-hoop {
  position: relative;
  width: min(420px, 80%);
  aspect-ratio: 1;
  border-radius: 50%;
  padding: 18px;
  background: linear-gradient(145deg, #5a5e66, #3b3e44);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 30px 50px -24px rgba(0, 0, 0, 0.8);
}

.auth-hoop-well {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #1a1b1e;
  box-shadow: inset 0 3px 14px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 13%;
}

.auth-hoop-well > div {
  width: 100%;
}

.auth-art-caption {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.auth-art-kicker {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.auth-art-line {
  max-width: 360px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

/* SunStitch mounts (sunstitch.js fills these with canvases). */
.sun-stitch {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
}

.sun-stitch-cv,
.sun-stitch-ov {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}

/* ---- footer --------------------------------------------------------------- */
.auth-footer {
  border-top: 1px solid var(--header-line);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px 24px;
  padding: 22px 24px;
  font-size: 13.5px;
  color: var(--ink-3);
}

.auth-footer a {
  color: var(--ink-2);
}

.auth-footer a:hover {
  color: var(--ink);
}

.auth-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
}

/* ---- form ------------------------------------------------------------- */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.auth-form-tight {
  gap: 22px;
}

.auth-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  text-align: left;
}

.auth-h1 {
  margin: 0;
  font-size: clamp(40px, 6vw, 60px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.045em;
}

.auth-sub {
  margin: 0;
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink-2);
}

.auth-sub strong {
  color: var(--ink);
  font-weight: 600;
}

.auth-fields {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.auth-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.auth-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.auth-label-row a {
  font-size: 13.5px;
  font-weight: 500;
}

.auth-optional {
  margin-left: 0.35rem;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--ink-3);
}

.auth-input {
  width: 100%;
  height: 54px;
  padding: 0 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--field);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  outline: none;
  transition:
    border-color 0.12s ease,
    box-shadow 0.12s ease;
}

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

.auth-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

select.auth-input {
  appearance: none;
  padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6.5L8 10.5L12 6.5' stroke='%239A9EA6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 16px;
}

/* Two fields on one line where they are a pair, collapsing to one when the
   column is too narrow for both to stay usable. */
.auth-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.auth-row .auth-input {
  min-width: 0;
}

/* ---- password ---------------------------------------------------------- */
.auth-pw {
  position: relative;
  display: block;
}

.auth-pw .auth-input {
  padding-right: 70px;
}

.auth-pw-toggle {
  position: absolute;
  right: 9px;
  top: 9px;
  height: 36px;
  padding: 0 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
}

.auth-pw-toggle:hover {
  background: var(--header-line);
}

.auth-strength {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 2px;
}

.auth-strength-track {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.auth-strength-seg {
  height: 4px;
  border-radius: 2px;
  background: var(--line-3);
  transition: background-color 0.15s ease;
}

.auth-strength-label {
  min-width: 54px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-2);
}

/* ---- checkbox row (e.g. "Show passwords" on the reset screen) ---------- */
.auth-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--ink-2);
  cursor: pointer;
  padding: 2px;
}

.auth-check input {
  width: 17px;
  height: 17px;
  margin: 2px 0 0;
  flex: none;
  accent-color: var(--accent);
}

/* ---- buttons ----------------------------------------------------------- */
.auth-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 56px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.auth-submit:hover:not(:disabled) {
  background: var(--accent-hover);
  color: var(--accent-ink);
}

.auth-submit:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.auth-secondary {
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--ink);
}

.auth-secondary:hover:not(:disabled) {
  border-color: var(--accent);
  background: transparent;
  color: var(--ink);
}

.auth-inline-link {
  align-self: center;
  font-size: 14.5px;
  font-weight: 500;
  padding-top: 4px;
}

.auth-links-row {
  display: flex;
  justify-content: space-between;
  font-size: 14.5px;
  padding: 4px 2px 0;
}

.auth-below {
  text-align: center;
  font-size: 14.5px;
  color: var(--ink-2);
  padding-top: 4px;
}

.auth-below strong,
.auth-below a {
  font-weight: 600;
}

/* ---- federated sign-in -------------------------------------------------- */
.auth-sso {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  height: 50px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--field);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 0.12s ease,
    border-color 0.12s ease;
}

.auth-sso:hover {
  border-color: var(--line-2);
  color: var(--ink);
}

.auth-or {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.auth-or::before,
.auth-or::after {
  content: '';
  flex: 1;
  border-top: 1.5px dashed var(--line);
}

/* ---- messages ----------------------------------------------------------- */
.auth-notice {
  padding: 13px 16px;
  border: 1px dashed var(--accent-tint-border);
  border-radius: 12px;
  background: var(--accent-tint-bg);
  color: var(--accent-tint-ink);
  font-size: 14.5px;
}

.auth-error {
  font-size: 14.5px;
  color: var(--danger);
}

/* ---- result states ------------------------------------------------------ */
.auth-badge {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px dashed var(--accent);
  border-radius: 50%;
}

.auth-badge-inner {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-tint-bg);
  color: var(--accent);
}

.auth-badge-solid .auth-badge-inner {
  background: var(--accent);
  color: var(--accent-ink);
}

.auth-badge-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
}

/* ---- local-dev demo notice (DEMO_LOGIN) --------------------------------- */
.auth-demo-note {
  margin: 0;
  padding: 10px 12px;
  border: 1px dashed var(--warn-border);
  border-radius: 10px;
  background: var(--warn-bg);
  color: var(--warn-ink);
  font-size: 13px;
  line-height: 1.45;
}

.auth-demo-note strong {
  font-weight: 600;
  color: var(--warn-ink);
}

/* ---- attribution page --------------------------------------------------- */
.auth-doc {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px clamp(20px, 5vw, 32px) 72px;
}

.auth-doc h1 {
  margin: 28px 0 10px;
  font-size: clamp(32px, 5vw, 44px);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.auth-doc h2 {
  margin: 40px 0 8px;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.auth-doc p {
  margin: 0 0 14px;
  color: var(--ink-2);
}

.auth-doc-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 8px;
}

.auth-doc-wordmark {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.auth-doc-wordmark span {
  font-weight: 400;
}

/* The line beside every button that creates an account (see agreeLine). */
.auth-agree {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-3);
  margin: 10px 0 0;
  text-align: center;
}
.auth-agree a { color: var(--ink-2); text-decoration: underline; }
