/* ═══════════════════════════════════════════════════════════
   ROLE PANEL — overlay with role detail + inline application
   Opened from a job card; deep-linked via careers.html?role=…
   ═══════════════════════════════════════════════════════════ */

.role-panel {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
  overflow: hidden;
}
/* The hidden attribute must win over display:flex above,
   otherwise an invisible overlay blocks the whole page. */
.role-panel[hidden] {
  display: none;
}
/* Any element inside the panel toggled with [hidden] must actually hide,
   even when its own rule sets display:flex / inline-flex (e.g. the brand
   list or the "Apply" button). This keeps the step transitions clean. */
.role-panel [hidden] {
  display: none !important;
}
.role-panel__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
}
.role-panel__dialog {
  position: relative;
  width: 100%;
  max-width: 1000px;
  max-height: calc(100vh - 96px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #0a0a0a;
  border: 1px solid #333;
  border-radius: 0;
  padding: 0;
  animation: fadeIn 0.15s linear;
}
.role-panel__close-wrapper {
  position: absolute;
  top: 40px;
  right: 40px;
  z-index: 100;
  display: flex;
  gap: 8px;
}
.role-panel__close,
.role-panel__back {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #333;
  border-radius: 0;
  color: #fff;
  background: #111;
  cursor: pointer;
  transition: border-color 0.1s linear, background 0.1s linear, color 0.1s linear;
}
.role-panel__back:hover {
  background: #fff;
  color: #000;
  border-color: #fff;
}
.role-panel__back[hidden] {
  display: none;
}

#role-panel-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
}

.role-panel__close:hover {
  background: #fff;
  color: #000;
  border-color: #fff;
}

.role-panel__sticky-header {
  position: relative;
  background-color: #0a0a0a;
  background-image: radial-gradient(100% 120% at 50% 0%, color-mix(in srgb, var(--brand-color, #142850) 15%, transparent) 0%, transparent 100%);
  z-index: 20;
  padding: 40px 40px 24px;
  border-bottom: 1px solid #333;
  flex-shrink: 0;
}
.role-panel__content-scroll {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding: 24px 40px 40px;
}

/* ── Head ────────────────────────────────────────────────── */
.role-panel__head {
  margin-bottom: 24px;
  padding-right: 48px;
}
.role-panel__title {
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.15;
  margin: 12px 0 8px;
}
.role-panel__meta {
  font-size: 14px;
  color: var(--color-text-muted);
}
.role-panel__mission {
  font-size: var(--text-md);
  line-height: 1.75;
  color: var(--color-text-secondary);
  max-width: 640px;
  margin-bottom: 28px;
}

/* ── Label / About / Columns ─────────────────────────────── */
.role-panel__label {
  display: block;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  margin-bottom: 12px;
}
.role-panel__about {
  background-color: color-mix(in srgb, var(--brand-color, #ffffff) 5%, transparent);
  border: 1px solid color-mix(in srgb, var(--brand-color, #ffffff) 20%, transparent);
  border-radius: 0;
  padding: 20px 24px;
  margin-bottom: 28px;
}
.role-panel__about p {
  font-size: var(--text-md);
  color: var(--color-text-secondary);
}
.role-panel__cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-bottom: 36px;
}
.role-panel__cols ul {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.role-panel__cols li {
  position: relative;
  padding-left: 16px;
  font-size: var(--text-sm);
  line-height: 1.65;
  color: var(--color-text-secondary);
}
.role-panel__cols li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 9px;
  width: 5px;
  height: 5px;
  background: var(--brand-color, #ffffff);
  transform: rotate(45deg);
}

/* ── Application form ────────────────────────────────────── */
.role-form {
  border-top: 1px solid var(--border-default);
  padding-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.role-form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.role-form__field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.role-form__field--full {
  grid-column: 1 / -1;
}
.role-form__field span {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
}
.role-form__field input,
.role-form__field textarea {
  width: 100%;
  padding: 12px 14px;
  background: transparent;
  border: 1px solid #333;
  border-radius: 0;
  color: #fff;
  font-size: 15px;
  outline: none;
  resize: vertical;
  transition: border-color 0.1s linear;
}
.role-form__field input:focus,
.role-form__field textarea:focus {
  border-color: #fff;
}

/* ── Compact dialog — step 1 brand picker ────────────────── */
.role-panel__dialog--compact {
  max-width: 620px;
}
.role-panel__dialog--compact .role-panel__sticky-header {
  padding: 36px 32px 4px;
  border-bottom: none;
  background-image: none;
}
.role-panel__dialog--compact .role-panel__title {
  font-size: clamp(24px, 3vw, 32px);
}
.role-panel__dialog--compact .role-panel__content-scroll {
  padding: 4px 32px 32px;
}
.role-panel__dialog--compact .role-panel__close-wrapper {
  top: 32px;
  right: 32px;
}

/* ── Brand Selector ──────────────────────────────────────── */
.brand-selector-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}
.brand-selector-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  padding: 26px 24px;
  background: #080808;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 17px;
  cursor: pointer;
  transition: border-color 0.1s linear, background 0.1s linear;
}
.brand-selector-btn:hover {
  border-color: rgba(255,255,255,0.2);
  background: #111;
}
.brand-selector-btn > svg:last-child {
  position: absolute;
  right: 24px;
  opacity: 0.5;
}
.role-form__actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
}
.role-form__status {
  font-size: 13px;
  color: rgb(220, 70, 70);
}
.role-form__success {
  text-align: center;
  padding: 40px 0;
}
.role-form__success h3 {
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: 26px;
  margin-bottom: 8px;
}
.role-form__success p {
  color: var(--color-text-secondary);
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 700px) {
  .role-panel {
    padding: 16px 8px;
  }
  .role-panel__dialog {
    max-height: calc(100vh - 32px);
  }
  .role-panel__close-wrapper {
    top: 24px;
    right: 20px;
  }
  .role-panel__sticky-header {
    padding: 24px 20px 20px;
  }
  .role-panel__content-scroll {
    padding: 20px 20px 24px;
  }
  .role-panel__cols,
  .role-form__row {
    grid-template-columns: 1fr;
  }
}
