/* ==========================================================================
   Piotr Sochnacki — Recruitment AI Agent (Soft-Neumorphic TryLume DNA)
   ========================================================================== */

:root {
  --bg-light: #ffffff;
  --surface-warm: #f6f6f4;
  --surface-inset: #f1f1ee;
  --ink: #172033;
  --ink-muted: rgba(23, 32, 51, 0.58);
  --ink-subtle: rgba(23, 32, 51, 0.42);
  --border-light: rgba(17, 17, 17, 0.06);
  --border-strong: rgba(17, 17, 17, 0.14);
  --danger: #b42318;
  --ok: #067647;
  --nav-height: 76px;
  --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-light);
  color: var(--ink);
  line-height: 1.5;
  letter-spacing: -0.015em;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: var(--surface-inset);
  padding: 2px 6px;
  border-radius: 6px;
}

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

/* ==================== TOP HEADER ==================== */
.site-header {
  height: var(--nav-height);
  width: 100%;
  border-bottom: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.site-header__inner {
  max-width: 1120px;
  height: 100%;
  margin: 0 auto;
  padding: 0 clamp(16px, 3vw, 36px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand__mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #111111;
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.03em;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
}

.brand__sub {
  font-size: 12px;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.status-pill {
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-light);
  background: var(--surface-inset);
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow:
    inset 3px 3px 7px rgba(188, 188, 182, 0.35),
    inset -3px -3px 7px rgba(255, 255, 255, 0.92);
}

.status-pill[hidden] {
  display: none;
}

.status-pill--quota {
  color: var(--ok);
  font-variant-numeric: tabular-nums;
}

.status-pill--btn {
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.status-pill--btn:hover {
  border-color: var(--border-strong);
  box-shadow:
    inset 4px 4px 9px rgba(182, 182, 176, 0.48),
    inset -4px -4px 9px rgba(255, 255, 255, 1);
}

.status-pill--danger {
  color: var(--danger);
}

.lang-switch {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-inset);
  border: 1px solid var(--border-light);
  box-shadow:
    inset 3px 3px 6px rgba(188, 188, 182, 0.35),
    inset -3px -3px 6px rgba(255, 255, 255, 0.9);
}

.lang-switch__btn {
  border: 0;
  background: transparent;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  cursor: pointer;
}

.lang-switch__btn.is-active {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(17, 17, 17, 0.1);
}

/* ==================== MAIN STAGE ==================== */
.stage {
  flex: 1;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 clamp(16px, 3vw, 36px);
  display: flex;
  flex-direction: column;
}

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  color: var(--ink-muted);
  margin-bottom: 12px;
}

/* ==================== AUTH GATE ==================== */
.auth-gate {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 0 48px;
}

.auth-gate[hidden] {
  display: none;
}

.auth-gate__card {
  width: 100%;
  max-width: 680px;
  padding: clamp(24px, 4vw, 40px);
  border-radius: 28px;
  background: var(--surface-warm);
  box-shadow:
    12px 12px 28px rgba(188, 188, 182, 0.34),
    -12px -12px 28px rgba(255, 255, 255, 0.96);
}

.auth-gate__heading {
  font-size: clamp(1.75rem, 3vw, 2.35rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.14;
  color: var(--ink);
  margin-bottom: 12px;
}

.auth-gate__desc {
  font-size: 1rem;
  line-height: 1.58;
  color: rgba(23, 32, 51, 0.76);
  margin-bottom: 24px;
}

.auth-gate__form {
  min-height: 74px !important;
  padding: 12px 14px 12px 22px !important;
}

.auth-gate__error {
  margin-top: 14px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--danger);
}

.auth-gate__error[hidden] {
  display: none;
}

.auth-gate__meta {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
  font-size: 13px;
  color: var(--ink-muted);
}

.auth-gate__meta a {
  text-decoration: none;
}

.auth-gate__meta a:hover code {
  text-decoration: underline;
}

/* ==================== SOFT-NEUMORPHIC AI CHAT ==================== */
.ai-chat {
  width: 100%;
  min-height: max(460px, calc(100svh - var(--nav-height) - 24px));
  height: max(460px, calc(100svh - var(--nav-height) - 24px));
  padding: 8px 0 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.ai-chat[hidden] {
  display: none;
}

.ai-chat.is-active {
  justify-content: flex-start;
}

.ai-chat__top {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  min-height: 0;
}

.ai-chat:not(.is-active) .ai-chat__top {
  display: none;
}

.ai-chat.is-active .ai-chat__top {
  min-height: 34px;
  margin-bottom: 4px;
}

.ai-chat__reset {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: rgba(23, 32, 51, 0.45);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.25s ease;
}

.ai-chat__reset[hidden] {
  display: none;
}

.ai-chat__reset:hover {
  color: var(--ink);
  transform: rotate(-45deg);
}

.ai-chat__messages {
  flex: 0 0 auto;
  width: 100%;
  min-height: 0;
  overflow-y: visible;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 4px 18px;
  scrollbar-width: thin;
  scrollbar-color: rgba(23, 32, 51, 0.16) transparent;
}

.ai-chat.is-active .ai-chat__messages {
  flex: 1 1 0%;
  overflow-y: auto;
  padding: 6px 8px 24px 0;
  margin-bottom: 10px;
}

.ai-chat.is-active .ai-chat__messages > :first-child {
  margin-top: auto;
}

.ai-chat__heading {
  font-size: clamp(2rem, 3vw, 2.75rem);
  font-weight: 500;
  letter-spacing: -0.034em;
  line-height: 1.14;
  color: var(--ink);
}

.ai-chat__intro {
  font-size: clamp(1.04rem, 1.3vw, 1.2rem);
  line-height: 1.56;
  letter-spacing: -0.012em;
  color: rgba(23, 32, 51, 0.78);
  max-width: 70ch;
}

.ai-chat__caret {
  display: inline-block;
  width: 1.5px;
  height: 1.05em;
  background: var(--ink);
  margin-left: 2px;
  vertical-align: -0.14em;
  animation: chatCaretBlink 0.9s steps(2, start) infinite;
}

@keyframes chatCaretBlink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.ai-chat__msg {
  flex: 0 0 auto;
  font-size: clamp(1rem, 1.15vw, 1.1rem);
  line-height: 1.58;
  letter-spacing: -0.01em;
  animation: chatFadeIn 0.25s ease both;
}

@keyframes chatFadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.ai-chat__msg--user {
  align-self: flex-end;
  max-width: 74%;
  padding: 13px 22px;
  border-radius: 18px;
  background: var(--surface-inset);
  border: 1px solid rgba(17, 17, 17, 0.045);
  color: var(--ink);
  box-shadow:
    inset 5px 5px 12px rgba(188, 188, 182, 0.44),
    inset -5px -5px 12px rgba(255, 255, 255, 0.95);
}

.ai-chat__msg--ai {
  align-self: flex-start;
  max-width: min(76ch, 100%);
  color: var(--ink);
  white-space: pre-line;
}

.ai-chat__msg--error {
  color: var(--danger);
  background: #fef3f2;
  border: 1px solid #fecdca;
  padding: 12px 16px;
  border-radius: 14px;
}

.ai-chat__msg-meta {
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--ink-subtle);
  letter-spacing: 0;
}

.ai-chat__thinking {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.96rem;
  color: rgba(23, 32, 51, 0.52);
}

.ai-chat__spinner {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1.75px solid rgba(23, 32, 51, 0.16);
  border-top-color: rgba(23, 32, 51, 0.58);
  animation: chatSpin 0.85s linear infinite;
}

@keyframes chatSpin {
  to { transform: rotate(360deg); }
}

.ai-chat__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-self: flex-start;
  max-width: min(76ch, 100%);
  margin-top: 2px;
  animation: chatFadeIn 0.25s ease both;
}

.ai-chat__chips--starter {
  margin-bottom: 14px;
}

.ai-chat__chips:empty {
  display: none;
}

.ai-chat__chip {
  appearance: none;
  border: 1px solid rgba(17, 17, 17, 0.05);
  border-radius: 999px;
  background: var(--surface-inset);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.3;
  padding: 10px 18px;
  cursor: pointer;
  box-shadow:
    inset 4px 4px 10px rgba(188, 188, 182, 0.45),
    inset -4px -4px 10px rgba(255, 255, 255, 0.95);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.ai-chat__chip:hover {
  border-color: rgba(17, 17, 17, 0.12);
  box-shadow:
    inset 6px 6px 13px rgba(182, 182, 176, 0.54),
    inset -6px -6px 13px rgba(255, 255, 255, 1);
}

.ai-chat__chip:active {
  border-color: rgba(17, 17, 17, 0.14);
  box-shadow:
    inset 7px 7px 15px rgba(176, 176, 170, 0.6),
    inset -7px -7px 15px rgba(255, 255, 255, 1);
}

/* Sculpted Soft-Neumorphic Inset Composer */
.ai-chat__form {
  flex: 0 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 88px;
  padding: 16px 18px 16px 26px;
  border-radius: 24px;
  background: var(--surface-inset);
  border: 1px solid rgba(17, 17, 17, 0.05);
  box-shadow:
    inset 6px 6px 14px rgba(188, 188, 182, 0.48),
    inset -6px -6px 14px rgba(255, 255, 255, 0.96);
  transition: box-shadow 0.22s ease, border-color 0.22s ease;
}

.ai-chat__form:focus-within {
  border-color: rgba(17, 17, 17, 0.12);
  box-shadow:
    inset 7px 7px 16px rgba(182, 182, 176, 0.55),
    inset -7px -7px 16px rgba(255, 255, 255, 1);
}

.ai-chat__input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 1.04rem;
  line-height: 1.5;
  color: var(--ink);
  outline: none;
  resize: none;
  padding: 0;
  overflow: hidden;
}

.ai-chat__input::placeholder {
  color: var(--ink-subtle);
}

.ai-chat__actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ai-chat__send {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 0;
  background: var(--surface-inset);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow:
    5px 5px 12px rgba(188, 188, 182, 0.48),
    -5px -5px 12px rgba(255, 255, 255, 0.95);
  transition: color 0.2s ease, opacity 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.ai-chat__send:disabled {
  color: rgba(54, 54, 50, 0.32);
  cursor: default;
}

.ai-chat__send:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow:
    6px 6px 14px rgba(180, 180, 174, 0.56),
    -6px -6px 14px rgba(255, 255, 255, 1);
}

.ai-chat__send:active:not(:disabled) {
  transform: translateY(0);
  box-shadow:
    inset 3px 3px 8px rgba(180, 180, 174, 0.5),
    inset -3px -3px 8px rgba(255, 255, 255, 0.9);
}

.ai-chat__disclaimer {
  margin-top: 10px;
  text-align: center;
  font-size: 12px;
  line-height: 1.45;
  color: #7d838f;
}

.ai-chat__disclaimer a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ai-chat__disclaimer a:hover {
  color: var(--ink);
}

/* ==================== MODAL ==================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal[hidden] {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 19, 24, 0.42);
  backdrop-filter: blur(4px);
}

.modal__dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  background: var(--surface-warm);
  border-radius: 26px;
  border: 1px solid var(--border-light);
  padding: 28px;
  box-shadow: 0 24px 60px rgba(17, 19, 24, 0.22);
}

.modal__close {
  position: absolute;
  top: 16px;
  right: 18px;
  border: 0;
  background: transparent;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-muted);
}

.modal__title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.modal__desc {
  font-size: 14px;
  color: var(--ink-muted);
  margin-bottom: 16px;
}

.modal__links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.code-block {
  margin-bottom: 14px;
  padding: 16px;
  border-radius: 16px;
  background: #111318;
  color: #e6eaf2;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  overflow-x: auto;
  line-height: 1.55;
}

/* ==================== MOBILE ==================== */
@media (max-width: 640px) {
  .site-header {
    height: auto;
    padding: 10px 0;
  }

  .site-header__inner {
    flex-wrap: wrap;
  }

  .brand__sub {
    display: none;
  }

  .ai-chat {
    min-height: calc(100svh - 110px);
    height: calc(100svh - 110px);
    padding: 12px 0 14px;
  }

  .ai-chat__heading {
    font-size: 1.65rem;
  }

  .ai-chat__intro {
    font-size: 1rem;
  }

  .ai-chat__form {
    min-height: 74px;
    padding: 12px 12px 12px 18px;
    border-radius: 21px;
    gap: 10px;
  }

  .ai-chat__send {
    width: 42px;
    height: 42px;
  }

  .ai-chat__msg--user {
    max-width: 88%;
  }
}
