/*
 * BuddhaSquads — pre-auth pages ("Műhely" v4: clean sans, friendly, compact).
 *
 * Standalone stylesheet for login.html + invite.html. The legacy dashboard
 * style.css is intentionally NOT loaded on these pages. Tokens mirror
 * web-app/src/styles/tokens.css — the hexes are brand canon; if they ever
 * change, change them there first and copy here.
 */

/* ---------------------------------------------------------------------------
 * Self-hosted variable fonts (copied from @fontsource-variable, /web/fonts/).
 * Fraunces carries the optical-size axis build (opsz-normal), matching the
 * SPA's `@fontsource-variable/fraunces/opsz.css` import. Fraunces is
 * wordmark-only ("BuddhaSquads" + hanko "BS" — pure latin), so only the
 * latin subset is loaded. Hungarian UI text (ő, ű) needs Schibsted latin-ext.
 * ------------------------------------------------------------------------ */

/* fraunces-latin-opsz-normal */
@font-face {
  font-family: 'Fraunces Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/fonts/fraunces-latin-opsz-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

/* schibsted-grotesk-latin-ext-wght-normal */
@font-face {
  font-family: 'Schibsted Grotesk Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 400 900;
  src: url(/fonts/schibsted-grotesk-latin-ext-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* schibsted-grotesk-latin-wght-normal */
@font-face {
  font-family: 'Schibsted Grotesk Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 400 900;
  src: url(/fonts/schibsted-grotesk-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------------------------------------------------------------------------
 * Sumi tokens (light + dark; flipped via [data-theme] on <html>).
 * ------------------------------------------------------------------------ */
:root,
:root[data-theme='light'] {
  --bs-paper: #f8f7f4;
  --bs-surface: #ffffff;
  --bs-surface-2: #f3f1ec;
  --bs-ink: #0a0a0b;
  --bs-ink-soft: #2a2a2c;
  --bs-muted: #6e6b65;
  --bs-line: #e8e5df;
  --bs-line-strong: #d8d4cc;

  --bs-accent: #c8541a;
  --bs-accent-hover: #ad4815;
  --bs-accent-soft: rgba(200, 84, 26, 0.1);
  --bs-accent-ring: rgba(200, 84, 26, 0.32);
  --bs-on-accent: #ffffff;

  --bs-danger: #a8312e;
  --bs-danger-soft: rgba(168, 49, 46, 0.12);

  --bs-radius-sm: 8px;
  --bs-radius: 10px;
  --bs-radius-lg: 14px;
  --bs-radius-xl: 20px;
  --bs-radius-pill: 999px;

  --bs-shadow-sheet: 0 1px 2px rgba(10, 10, 11, 0.03),
    0 24px 48px -24px rgba(10, 10, 11, 0.18);

  --bs-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --bs-dur: 160ms;
  --bs-dur-slow: 220ms;

  --bs-grain-opacity: 0.035;
  --bs-watermark-opacity: 0.025;

  --bs-font-display: 'Fraunces Variable', 'Fraunces', Georgia, 'Times New Roman', serif;
  --bs-font-sans: 'Schibsted Grotesk Variable', 'Schibsted Grotesk', system-ui,
    -apple-system, 'Segoe UI', sans-serif;
}

:root[data-theme='dark'] {
  --bs-paper: #0b0b0d;
  --bs-surface: #141416;
  --bs-surface-2: #1c1c1f;
  --bs-ink: #f5f4f1;
  --bs-ink-soft: #d9d7d2;
  --bs-muted: #8e8b85;
  --bs-line: #26262a;
  --bs-line-strong: #34343a;

  --bs-accent: #e26a2c;
  --bs-accent-hover: #f07c3d;
  --bs-accent-soft: rgba(226, 106, 44, 0.14);
  --bs-accent-ring: rgba(226, 106, 44, 0.38);
  --bs-on-accent: #0a0a0b;

  --bs-danger: #d04a47;
  --bs-danger-soft: rgba(208, 74, 71, 0.14);

  --bs-grain-opacity: 0.05;
  --bs-watermark-opacity: 0.025;

  --bs-shadow-sheet: 0 1px 2px rgba(0, 0, 0, 0.2),
    0 24px 48px -24px rgba(0, 0, 0, 0.5);
}

/* ---------------------------------------------------------------------------
 * Base: one sheet of textured paper.
 * ------------------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

html {
  font-family: var(--bs-font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  background: var(--bs-paper);
  color: var(--bs-ink);
}

body {
  font-size: 14px;
  line-height: 1.5;
}

/* Paper grain — fixed, non-interactive turbulence layer over everything. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: var(--bs-grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 240px 240px;
  mix-blend-mode: multiply;
}
:root[data-theme='dark'] body::before {
  mix-blend-mode: screen;
}

:focus-visible {
  outline: 2px solid var(--bs-accent);
  outline-offset: 2px;
  border-radius: var(--bs-radius-sm);
}
.auth-btn:focus-visible {
  border-radius: var(--bs-radius);
}

::selection {
  background: var(--bs-accent-soft);
  color: var(--bs-ink);
}

/* ---------------------------------------------------------------------------
 * Editorial primitives (shared with the SPA's design language).
 * ------------------------------------------------------------------------ */

/* Kicker — small uppercase label, used sparingly and kept soft. */
.kicker {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* Page-load reveal: ink rising onto paper. */
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.rise {
  animation: rise var(--bs-dur-slow) var(--bs-ease) both;
}
@media (prefers-reduced-motion: reduce) {
  .rise {
    animation: none;
  }
}

/* ---------------------------------------------------------------------------
 * Auth sheet — a single rounded sheet centered on the paper.
 * Faint hairline border + soft ambient shadow lift it off the page.
 * ------------------------------------------------------------------------ */
.auth-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  z-index: 1; /* above the body::after watermark */
}

/* Full-bleed login/register (two-column split): no centered card, fill the viewport. */
.auth-wrap:has(.auth-split) {
  padding: 0;
  align-items: stretch;
}

.auth-sheet {
  width: 100%;
  max-width: 420px;
  background: var(--bs-surface);
  border: 1px solid var(--bs-line);
  border-radius: var(--bs-radius-xl);
  box-shadow: var(--bs-shadow-sheet);
  padding: 36px 32px 32px;
}

/* Masthead: ensō mark + Fraunces wordmark + hanko, kicker, sans headline.
   Spacing alone separates it from the form — no hairline rule. */
.auth-masthead {
  margin-bottom: 20px;
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 26px;
}

.auth-enso {
  width: 24px;
  height: 24px;
  flex: none;
  color: var(--bs-accent);
}

.auth-wordmark {
  font-family: var(--bs-font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--bs-ink);
}

/* The hanko: a small outlined vermilion seal beside the wordmark. */
.auth-headline {
  font-family: var(--bs-font-sans);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--bs-ink);
  margin: 0;
}

.auth-lede {
  font-size: 13px;
  color: var(--bs-muted);
  margin: 6px 0 20px;
}

/* ---------------------------------------------------------------------------
 * Form.
 * ------------------------------------------------------------------------ */
.auth-field {
  margin-bottom: 16px;
}

.auth-field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--bs-muted);
  margin-bottom: 6px;
}

.auth-field input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--bs-line-strong);
  border-radius: var(--bs-radius);
  background: var(--bs-surface);
  color: var(--bs-ink);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  transition: border-color var(--bs-dur) var(--bs-ease),
    box-shadow var(--bs-dur) var(--bs-ease);
}

.auth-field input:focus {
  outline: none;
  border-color: var(--bs-accent);
  box-shadow: 0 0 0 3px var(--bs-accent-ring);
}

.auth-field input:read-only {
  background: var(--bs-surface-2);
  color: var(--bs-ink-soft);
}

.auth-hint {
  font-size: 12px;
  color: var(--bs-muted);
  margin-top: 6px;
}

/* The CTA is the seal colour — solid saffron, app-radius (no pill), soft hover. */
.auth-btn {
  width: 100%;
  margin-top: 6px;
  padding: 11px 20px;
  border: none;
  border-radius: var(--bs-radius);
  background: var(--bs-accent);
  color: var(--bs-on-accent);
  font-family: var(--bs-font-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background var(--bs-dur) var(--bs-ease),
    box-shadow var(--bs-dur) var(--bs-ease);
}
.auth-btn:hover {
  background: var(--bs-accent-hover);
  box-shadow: 0 8px 20px -10px var(--bs-accent-ring);
}
.auth-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

/* Status blocks — toggled by JS via element ids; hidden by default. */
.auth-error {
  display: none;
  margin-top: 14px;
  padding: 10px 14px;
  border: 1px solid var(--bs-danger);
  border-radius: var(--bs-radius);
  background: var(--bs-danger-soft);
  color: var(--bs-danger);
  font-size: 13px;
}

.auth-note {
  display: none;
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: var(--bs-radius);
  background: var(--bs-surface-2);
  color: var(--bs-ink-soft);
  font-size: 13px;
}

/* Role badge (invite) — soft tinted pill, sentence case. */
.badge {
  display: inline-block;
  vertical-align: 1px;
  margin-left: 4px;
  padding: 2px 9px;
  border-radius: var(--bs-radius-pill);
  background: var(--bs-accent-soft);
  color: var(--bs-accent);
  font-family: var(--bs-font-sans);
  font-size: 11px;
  font-weight: 500;
}

/* ---------------------------------------------------------------------------
 * Two-column SaaS shell (login + register). A wide split sheet: a vermilion
 * "aside" panel carries the brand + the value proposition; the right column is
 * the form. Reuses the auth-* primitives above for the form itself.
 * ------------------------------------------------------------------------ */
.auth-split {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--bs-surface);
  overflow: hidden;
}

/* Left: the persuasion panel — deep accent wash, ink-on-saffron. */
.auth-aside {
  position: relative;
  padding: clamp(40px, 6vw, 72px);
  display: flex;
  flex-direction: column;
  color: var(--bs-on-accent);
  background:
    radial-gradient(120% 120% at 0% 0%, var(--bs-accent-hover) 0%, var(--bs-accent) 58%, var(--bs-accent-hover) 100%);
  isolation: isolate;
}
.auth-aside::after {
  /* faint ensō watermark, bottom-right */
  content: '';
  position: absolute;
  right: -40px;
  bottom: -40px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  border: 22px solid rgba(255, 255, 255, 0.10);
  z-index: -1;
}
.auth-aside-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 40px;
}
.auth-aside-brand img {
  width: 26px;
  height: 26px;
  filter: brightness(0) invert(1);
}
.auth-aside-brand span {
  font-family: var(--bs-font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.auth-aside h2 {
  font-family: var(--bs-font-sans);
  font-size: 26px;
  line-height: 1.18;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
  max-width: 16ch;
}
.auth-aside p {
  font-size: 14px;
  line-height: 1.55;
  opacity: 0.92;
  margin: 0 0 28px;
  max-width: 32ch;
}
.auth-features {
  list-style: none;
  margin: auto 0 0;
  padding: 0;
  display: grid;
  gap: 14px;
}
.auth-features li {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  font-size: 13.5px;
  line-height: 1.45;
  font-weight: 500;
}
.auth-features li::before {
  content: '';
  flex: none;
  margin-top: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  /* check glyph */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

/* Right: the form column. */
.auth-main {
  padding: clamp(32px, 5vw, 56px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
/* Constrain the form column's content so it doesn't stretch across a full-width pane. */
.auth-main > * {
  width: 100%;
  max-width: 380px;
}
.auth-main .auth-headline { font-size: 24px; }

/* Alt-action row under the button ("Nincs még fiókod? Regisztrálj"). */
.auth-alt {
  margin-top: 18px;
  font-size: 13px;
  color: var(--bs-muted);
  text-align: center;
}
.auth-alt a {
  color: var(--bs-accent);
  font-weight: 600;
  text-decoration: none;
}
.auth-alt a:hover { text-decoration: underline; }

.auth-fineprint {
  margin-top: 16px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--bs-muted);
  text-align: center;
}
.auth-fineprint a { color: var(--bs-muted); text-decoration: underline; }

/* ---------------------------------------------------------------------------
 * Mobile: the sheet fills the small screen edge to edge — no border, radius
 * or shadow needed; the language is otherwise unchanged.
 * ------------------------------------------------------------------------ */
@media (max-width: 860px) {
  /* Collapse the split: hide the persuasion panel, the form pane fills the screen. */
  .auth-split {
    grid-template-columns: 1fr;
  }
  .auth-aside { display: none; }
}

@media (max-width: 480px) {
  /* The invite single-sheet goes edge to edge on small screens. */
  .auth-wrap:has(.auth-sheet) {
    padding: 0;
    align-items: stretch;
  }
  .auth-sheet {
    max-width: none;
    min-height: 100vh;
    min-height: 100dvh;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 40px 24px 32px;
  }
}
