/* =========================================================================
   GKYC auth pages for Forgejo 17 — sign in, sign up, forgot/reset password,
   2FA, account activation. Matches geekyco.de and the custom landing page.

   Loaded on every page via templates/custom/header.tmpl, but every rule is
   scoped to the auth pages, so the rest of Forgejo is untouched.
   ========================================================================= */

@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-latin-wght.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

/* ---- 1. Recolour Forgejo's theme variables on auth pages (dark) --------- */
:root:has(.page-content.user:is(.signin, .signup, .forgot, .reset, .activate, .link-account)) {
  --gkyc-cyan: #24c5ff;
  --gkyc-green: #24ff9c;
  --gkyc-red: #ff3d5d;
  --gkyc-yellow: #fff238;
  --gkyc-link: #24c5ff;

  --fonts-override: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --fonts-monospace: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --color-primary: #24c5ff;
  --color-primary-contrast: #0c0e12;
  --color-primary-hover: #22d3ee;
  --color-primary-active: #0ea5e9;
  --color-primary-dark-1: #1fb3eb;
  --color-primary-dark-2: #1aa1d6;
  --color-primary-dark-3: #158fc2;
  --color-primary-dark-4: #107dad;
  --color-primary-light-1: #47cfff;
  --color-primary-light-2: #6ad8ff;
  --color-primary-light-3: #8de2ff;
  --color-primary-light-4: #b0ebff;
  --color-primary-alpha-10: rgba(36, 197, 255, .10);
  --color-primary-alpha-20: rgba(36, 197, 255, .20);
  --color-primary-alpha-30: rgba(36, 197, 255, .30);
  --color-primary-alpha-40: rgba(36, 197, 255, .40);
  --color-primary-alpha-50: rgba(36, 197, 255, .50);

  --color-body: #0c0e12;
  --color-box-body: #1c2026;
  --color-box-header: #1c2026;
  --color-card: #1c2026;
  --color-button: #1c2026;
  --color-nav-bg: #0c0e12;
  --color-footer: #0c0e12;
  --color-secondary: #2b3038;
  --color-light-border: #2b3038;
  --color-hover: rgba(255, 255, 255, .04);
  --color-active: rgba(255, 255, 255, .07);
  --color-text: #d4d8dd;
  --color-text-dark: #ffffff;
  --color-text-light: #aeb6bf;
  --color-text-light-1: #9aa3ad;
  --color-text-light-2: #828d9a;
  --color-text-light-3: #64707e;
  --color-input-background: #0c0e12;
  --color-input-border: #2b3038;
  --color-input-border-hover: #414953;
  --color-input-text: #ffffff;
  --color-placeholder-text: #64707e;
  --color-caret: #24c5ff;
  --color-selection-bg: rgba(36, 197, 255, .3);
  --color-selection-fg: #ffffff;

  --gkyc-heading: #ffffff;
  --gkyc-border: #2b3038;
  color-scheme: dark;
}

/* ---- 1b. Light-mode visitors ------------------------------------------- */
@media (prefers-color-scheme: light) {
  :root:has(.page-content.user:is(.signin, .signup, .forgot, .reset, .activate, .link-account)) {
    --gkyc-link: #0284c7;
    --color-body: #ffffff;
    --color-box-body: #ffffff;
    --color-box-header: #ffffff;
    --color-card: #ffffff;
    --color-button: #f3f4f6;
    --color-nav-bg: #ffffff;
    --color-footer: #f6f7f9;
    --color-secondary: #e3e6ea;
    --color-light-border: #e3e6ea;
    --color-hover: rgba(12, 14, 18, .04);
    --color-active: rgba(12, 14, 18, .07);
    --color-text: #3a414b;
    --color-text-dark: #0c0e12;
    --color-text-light: #4b5563;
    --color-text-light-1: #5b6471;
    --color-text-light-2: #6b7480;
    --color-text-light-3: #8a939e;
    --color-input-background: #ffffff;
    --color-input-border: #c9ced5;
    --color-input-border-hover: #9aa3ad;
    --color-input-text: #0c0e12;
    --color-placeholder-text: #8a939e;
    --color-caret: #0284c7;
    --color-selection-fg: #0c0e12;
    --gkyc-heading: #0c0e12;
    --gkyc-border: #e3e6ea;
    color-scheme: light;
  }
}

/* ---- 2. Shared styling for every auth page ---------------------------- */
.page-content.user:is(.signin, .signup, .forgot, .reset, .activate, .link-account) {
  -webkit-font-smoothing: antialiased;
}
.page-content.user:is(.signin, .signup, .forgot, .reset, .activate, .link-account) a:not(.button) {
  color: var(--gkyc-link);
}

/* Card header ("Sign in", "Forgot password", "Two-factor authentication"...) */
.page-content.user:is(.signin, .signup, .forgot, .reset, .activate, .link-account) .ui.top.attached.header {
  background: transparent;
  border: 0;
  padding: 0 0 20px;
  text-align: left;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--gkyc-heading);
}
.page-content.user:is(.signin, .signup, .forgot, .reset, .activate, .link-account) .ui.attached.segment {
  background: var(--color-box-body);
  border: 1px solid var(--gkyc-border) !important;
  border-radius: 12px !important;
  padding: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, .25);
}

/* Fields */
.page-content.user:is(.signin, .signup, .forgot, .reset, .activate, .link-account) .ui.form .field > label {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 6px;
}
.page-content.user:is(.signin, .signup, .forgot, .reset, .activate, .link-account) .ui.form .required.field > label::after {
  color: var(--gkyc-red);
}
.page-content.user:is(.signin, .signup, .forgot, .reset, .activate, .link-account) .ui.form input:not([type="checkbox"]):not([type="radio"]) {
  min-height: 44px;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 15px;
  transition: border-color .15s, box-shadow .15s;
}
.page-content.user:is(.signin, .signup, .forgot, .reset, .activate, .link-account) .ui.form input:not([type="checkbox"]):not([type="radio"]):focus {
  border-color: var(--gkyc-cyan);
  box-shadow: 0 0 0 3px rgba(36, 197, 255, .25);
}
.page-content.user:is(.signin, .signup, .forgot, .reset, .activate, .link-account) .ui.form .field.error input {
  border-color: var(--gkyc-red);
}

/* Buttons */
.page-content.user:is(.signin, .signup, .forgot, .reset, .activate, .link-account) .ui.button {
  border-radius: 8px;
  min-height: 44px;
  font-size: 15px;
  font-weight: 600;
}
.page-content.user:is(.signin, .signup, .forgot, .reset, .activate, .link-account) .ui.primary.button {
  background: var(--gkyc-cyan);
  color: #0c0e12;
}
.page-content.user:is(.signin, .signup, .forgot, .reset, .activate, .link-account) .ui.primary.button:hover {
  background: #22d3ee;
}
.page-content.user:is(.signin, .signup, .forgot, .reset, .activate, .link-account) .ui.button:focus-visible,
.page-content.user:is(.signin, .signup, .forgot, .reset, .activate, .link-account) a:focus-visible {
  outline: 2px solid var(--gkyc-cyan);
  outline-offset: 2px;
}
.page-content.user:is(.signin, .signup, .forgot, .reset, .activate, .link-account) .oauth-login-link {
  border: 1px solid var(--gkyc-border);
}

/* Error / info banners */
.page-content.user:is(.signin, .signup, .forgot, .reset, .activate, .link-account) .ui.message {
  border-radius: 8px;
}

/* The "Forgot password? / Register" box under the card: plain text, not a second card */
.page-content.user:is(.signin, .signup, .forgot, .reset, .activate, .link-account) .ui.attached.segment.header.top {
  background: transparent;
  border: 0 !important;
  box-shadow: none;
  padding: 8px 0 0;
  font-size: 14px;
  font-weight: 500;
}

/* Subtle grid behind the auth pages that don't have the brand panel */
.page-content.user:is(.signup, .forgot, .reset, .activate, .link-account),
.page-content.user.signin:not(.gkyc-auth) {
  position: relative;
  padding-top: 48px;
  padding-bottom: 48px;
}

/* ---- 3. Split-screen sign-in page (templates/user/auth/signin.tmpl) ---- */
:root:has(.gkyc-auth) #navbar { display: none; }
/* Forgejo pads the page wrapper (80px bottom) and spaces the first child (16px top) */
:root:has(.gkyc-auth) .full.height { padding-bottom: 0; }
.page-content.gkyc-auth > .gkyc-auth-panel { margin-top: 0; }

.page-content.gkyc-auth {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  min-height: calc(100vh - 37px);   /* fills the screen above Forgejo's footer */
  min-height: calc(100dvh - 37px);
  padding: 0;
  margin: 0;
}
@media (min-width: 1024px) {
  .page-content.gkyc-auth {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    grid-template-rows: 1fr;
  }
}

/* Brand panel: always dark, like the terminal on geekyco.de */
.gkyc-auth-panel {
  position: relative;
  overflow: hidden;
  background: #0c0e12;
  color: #d4d8dd;
  border-bottom: 1px solid #2b3038;
}
@media (min-width: 1024px) {
  .gkyc-auth-panel { border-bottom: 0; border-right: 1px solid #2b3038; }
}
.gkyc-auth-grid {
  position: absolute; inset: 0; pointer-events: none; opacity: .07;
  background-image:
    linear-gradient(#d4d8dd 1px, transparent 1px),
    linear-gradient(90deg, #d4d8dd 1px, transparent 1px);
  background-size: 48px 48px;
}
.gkyc-auth-panel-inner {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 48px;
  padding: 16px;
}
@media (min-width: 1024px) {
  .gkyc-auth-panel-inner { padding: 40px clamp(32px, 4vw, 64px); }
}

.gkyc-auth .gkyc-brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: #ffffff !important;
  font-weight: 700; font-size: 18px; letter-spacing: -0.01em;
  text-decoration: none;
}
.gkyc-auth .gkyc-brand img { height: 32px; width: auto; }

/* On phones and tablets the panel shrinks to a brand bar */
.gkyc-auth-copy, .gkyc-auth-meta { display: none; }
@media (min-width: 1024px) {
  .gkyc-auth-copy { display: block; max-width: 40rem; }
  .gkyc-auth-meta { display: block; }
}

.gkyc-kicker {
  margin: 0;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px; font-weight: 500;
  letter-spacing: .2em; text-transform: uppercase;
  color: #24c5ff;
}
.gkyc-auth-copy h1 {
  margin: 16px 0 0;
  font-size: clamp(40px, 3.6vw, 56px); font-weight: 800; line-height: 1.05; letter-spacing: -0.025em;
  color: #ffffff;
}
.gkyc-auth-copy h1 span { color: #24c5ff; }
.gkyc-lede {
  margin: 24px 0 0;
  font-size: 18px; line-height: 1.6; color: #aeb6bf;
}
.gkyc-auth .gkyc-lede a { color: #24c5ff !important; }

.gkyc-terminal {
  margin-top: 40px;
  max-width: 30rem;
  background: #0c0e12;
  border: 1px solid #2b3038;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, .4);
}
.gkyc-terminal-bar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid #2b3038; }
.gkyc-terminal .dot { width: 12px; height: 12px; border-radius: 50%; }
.gkyc-terminal .dot.red { background: #ff3d5d; }
.gkyc-terminal .dot.yellow { background: #fff238; }
.gkyc-terminal .dot.green { background: #24ff9c; }
.gkyc-terminal .title { margin-left: 8px; font-family: "JetBrains Mono", monospace; font-size: 12px; color: #828d9a; }
.gkyc-terminal-body {
  padding: 18px 20px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 13px; line-height: 1.7;
  white-space: nowrap; overflow-x: auto;
}
.gkyc-terminal-body .line { display: flex; }
.gkyc-terminal-body .sym { width: 2ch; flex-shrink: 0; }
.gkyc-terminal-body .lbl { width: 26ch; flex-shrink: 0; color: #d4d8dd; }
.gkyc-terminal-body .muted { color: #64707e; }
.gkyc-terminal-body .cyan { color: #24c5ff; }
.gkyc-terminal-body .green { color: #24ff9c; }

.gkyc-auth-meta { margin: 0; font-size: 13px; color: #64707e; }
.gkyc-auth .gkyc-auth-meta a { color: #828d9a !important; }
.gkyc-auth .gkyc-auth-meta a:hover { color: #24c5ff !important; }

/* Form side */
.gkyc-auth-form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px 56px;
  background: var(--color-body);
}
.gkyc-auth-form-inner {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.gkyc-auth-form-inner > .ui.container { width: 100%; margin: 0 !important; }

/* Forgejo footer on the sign-in page: quieter */
:root:has(.gkyc-auth) .page-footer {
  border-top: 1px solid var(--gkyc-border);
  font-size: 13px;
}
