/**
 * backroom.css — The Backroom volunteer enrollment page.
 *
 * Ported from the approved standalone mockup (backroom-mockup.html).
 * Standalone-only bits dropped: html/body/html resets, ::selection, :focus-visible
 * global, .site-header, .site-nav, .kit-theme-toggle, .site-footer, .skip-link.
 * Those all live in the theme's existing frontend.css / global styles.
 *
 * Token map: the Backroom's --c-* palette is DEFINED below on .backroom-page,
 * mapped onto the theme's --wp--preset--color--* variables (set in theme.json
 * for dark and flipped in frontend.css on html[data-theme="light"] body). This
 * makes the whole page (text, hero, roles index, and the custom dropdown)
 * follow the site's light/dark toggle. The gold accent is held per theme
 * because the theme's preset accent is an off-white placeholder in dark mode,
 * while the Backroom design is gold in both themes.
 *
 * @package Kisasa_FC
 */

/* ============================================================
   THEME TOKENS — follow the site's light/dark toggle.
   ============================================================ */
.backroom-page {
  --c-bg:        var(--wp--preset--color--base, #0f0f0e);
  --c-surface2:  var(--wp--preset--color--surface, #1a1a18);
  --c-border:    var(--wp--preset--color--border, #2a2a27);
  --c-text:      var(--wp--preset--color--contrast, #f5f4f0);
  --c-subtle:    var(--wp--preset--color--subtle, #7a7268);
  --c-alert:     var(--wp--preset--color--alert, #C3111B);
  --c-highlight: var(--wp--preset--color--highlight, #a89680);
  --c-accent:    #B7883E; /* Kisasa gold on dark surfaces */

  /* V2 warmth tokens (mirrored from tryouts) used by the dropdown panel */
  --c-warm-2:    #1d1813;
  --c-warm-line: #34302a;
  --radius-md:   14px;
}
html[data-theme="light"] .backroom-page {
  --c-accent:    #9C722E; /* deeper gold for cream surfaces */

  /* V2 warmth tokens flip in light mode, same values as tryouts */
  --c-warm-2:    #F4ECE0;
  --c-warm-line: #E4D9C9;
}

/* ============================================================
   LAYOUT — page wrappers (also used by pitch-in, scoped here
   for the backroom page only)
   ============================================================ */

.backroom-page .page-wrap {
  max-width: var(--content-size, 680px);
  margin-inline: auto;
  padding-inline: var(--sp-40, 1.5rem);
}

.backroom-page .page-wrap--wide {
  max-width: var(--wide-size, 1200px);
  margin-inline: auto;
  padding-inline: var(--sp-40, 1.5rem);
}

/* ============================================================
   HERO SECTION
   ============================================================ */

.backroom-hero {
  padding-top: var(--sp-80, 8rem);
  padding-bottom: var(--sp-70, 6rem);
  background:
    radial-gradient(ellipse at 75% 30%, color-mix(in oklch, var(--c-accent, #B7883E) 10%, transparent) 0%, transparent 55%),
    radial-gradient(ellipse at 15% 80%, color-mix(in oklch, var(--c-highlight, #146F31) 7%, transparent) 0%, transparent 50%);
}

/* Eyebrow label — mirrors .kit-eyebrow already in frontend.css.
   Scoped here in case the theme's global rule gets updated independently. */
.backroom-hero .kit-eyebrow {
  font-family: var(--ff-body);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-subtle, #7a7268);
  margin-bottom: var(--sp-40, 1.5rem);
  display: block;
}

.backroom-hero .kit-eyebrow::before {
  content: '';
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  background-color: var(--c-accent, #B7883E);
  transform: rotate(45deg);
  margin-right: 0.7em;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

/* Display headline: Montserrat, large, tight tracking */
.kit-display {
  font-family: var(--ff-display);
  font-size: clamp(2.75rem, 6vw, 4.5rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--c-text, #F2EDE7);
  margin-bottom: var(--sp-40, 1.5rem);
}

/* Gold italic emphasis — H1 italic em convention from DESIGN.md */
.kit-display em {
  font-style: italic;
  font-weight: 500;
  color: var(--c-accent, #B7883E);
  display: inline-block;
}

/* Hero lede paragraph */
.hero-lede {
  font-size: clamp(1.0625rem, 1.8vw, 1.25rem);
  line-height: 1.65;
  color: var(--c-text, #F2EDE7);
  max-width: 58ch;
  opacity: 0.88;
}

/* ============================================================
   ROLES INDEX SECTION
   ============================================================ */

.roles-section {
  padding-top: var(--sp-70, 6rem);
  padding-bottom: var(--sp-70, 6rem);
}

.section-meta {
  display: flex;
  align-items: baseline;
  gap: var(--sp-40, 1.5rem);
  margin-bottom: var(--sp-60, 4rem);
  flex-wrap: wrap;
}

.section-label {
  font-family: var(--ff-body);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-subtle, #7a7268);
}

.section-count {
  font-family: var(--ff-body);
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--c-subtle, #7a7268);
}

/* Roles list: editorial rows with full-width hairlines.
   3-column grid: number | role name | description.
   NO border-left decoration. */
.roles-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.roles-list li {
  display: grid;
  grid-template-columns: 2.5rem 1fr 1fr;
  column-gap: var(--sp-50, 2.5rem);
  align-items: baseline;
  padding: var(--sp-40, 1.5rem) 0;
  border-top: 1px solid var(--c-border, #2a2a27);
}

.roles-list li:last-child {
  border-bottom: 1px solid var(--c-border, #2a2a27);
}

/* Role number: gold, tabular-nums */
.role-num {
  font-family: var(--ff-display);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--c-accent, #B7883E);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "kern" 1;
  letter-spacing: 0.02em;
  align-self: start;
  padding-top: 0.2em;
}

/* Role name: display family */
.role-name {
  font-family: var(--ff-display);
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--c-text, #F2EDE7);
}

/* Role description: muted body copy */
.role-desc {
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--c-subtle, #7a7268);
}

/* ============================================================
   FORM SECTION — "Offer your trade"
   ============================================================ */

.form-section {
  padding-top: var(--sp-70, 6rem);
  padding-bottom: var(--sp-80, 8rem);
  border-top: 1px solid var(--c-border, #2a2a27);
}

.form-heading {
  font-family: var(--ff-display);
  font-size: clamp(1.875rem, 4vw, 2.75rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--c-text, #F2EDE7);
  margin-bottom: var(--sp-30, 1rem);
  text-wrap: balance;
}

.form-sub {
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--c-subtle, #7a7268);
  margin-bottom: var(--sp-60, 4rem);
  max-width: 52ch;
}

/* Form layout */
.backroom-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-40, 1.5rem);
  max-width: 100%;
  position: relative;
}

/* The flex display above is an author rule, so it beats the UA [hidden] rule.
   This makes the [hidden] attribute win again, so the form actually disappears
   when JS hides it on a successful submit (otherwise the "Sending..." button
   lingers behind the success message). */
.backroom-form[hidden] {
  display: none;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-40, 1.5rem);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-field--full {
  grid-column: 1 / -1;
}

/* Labels */
.form-label {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-subtle, #7a7268);
}

/* Inputs */
.backroom-form input[type="text"],
.backroom-form input[type="email"],
.backroom-form input[type="tel"],
.backroom-form textarea {
  background: transparent;
  color: var(--c-text, #F2EDE7);
  border: 0;
  border-bottom: 1px solid var(--c-border, #2a2a27);
  border-radius: 0;
  padding: 0.65rem 0;
  font-family: var(--ff-body);
  font-size: 1.0625rem;
  line-height: 1.5;
  transition:
    border-color var(--dur-fast, 240ms) var(--ease-out-quart, cubic-bezier(0.25, 1, 0.5, 1)),
    color var(--dur-fast, 240ms) var(--ease-out-quart, cubic-bezier(0.25, 1, 0.5, 1));
  width: 100%;
}

.backroom-form input[type="text"]:focus,
.backroom-form input[type="email"]:focus,
.backroom-form input[type="tel"]:focus,
.backroom-form textarea:focus {
  outline: none;
  border-bottom-color: var(--c-accent, #B7883E);
  border-bottom-width: 2px;
  padding-bottom: calc(0.65rem - 1px);
}

.backroom-form input[type="text"]:focus-visible,
.backroom-form input[type="email"]:focus-visible,
.backroom-form input[type="tel"]:focus-visible,
.backroom-form textarea:focus-visible {
  outline: 2px solid var(--c-accent, #B7883E);
  outline-offset: 2px;
}

.backroom-form textarea {
  resize: vertical;
  min-height: 8rem;
}

/* Placeholder text */
.backroom-form input::placeholder,
.backroom-form textarea::placeholder {
  color: var(--c-subtle, #7a7268);
  opacity: 0.6;
}

/* Error states on inputs */
.backroom-form input.is-invalid,
.backroom-form textarea.is-invalid {
  border-bottom-color: var(--c-alert, #C3111B);
  border-bottom-width: 2px;
}

/* Honeypot — off-screen, hidden from assistive technology */
.kit-form-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Per-field error text */
.form-field-error {
  font-size: 0.8125rem;
  color: var(--c-alert, #C3111B);
  line-height: 1.4;
  min-height: 0;
}

/* ============================================================
   CUSTOM DROPDOWN
   ============================================================ */

.kit-select-wrap {
  position: relative;
}

/* Trigger: styled like the text inputs */
.kit-select-trigger {
  width: 100%;
  background: transparent;
  color: var(--c-text, #F2EDE7);
  border: 0;
  border-bottom: 1px solid var(--c-warm-line);
  border-radius: 0;
  padding: 0.65rem 2rem 0.65rem 0;
  font-family: var(--ff-body);
  font-size: 1.0625rem;
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition:
    border-color var(--dur-fast, 240ms) var(--ease-out-quart, cubic-bezier(0.25, 1, 0.5, 1)),
    color var(--dur-fast, 240ms) var(--ease-out-quart, cubic-bezier(0.25, 1, 0.5, 1));
  position: relative;
}

.kit-select-trigger:focus-visible {
  outline: 2px solid var(--c-accent, #B7883E);
  outline-offset: 3px;
  border-radius: 2px;
}

.kit-select-trigger[aria-expanded="true"] {
  border-bottom-color: var(--c-accent, #B7883E);
  border-bottom-width: 2px;
  padding-bottom: calc(0.65rem - 1px);
}

/* Invalid state on trigger (role not chosen on submit) */
.kit-select-wrap.is-invalid .kit-select-trigger {
  border-bottom-color: var(--c-alert, #C3111B);
}

.kit-select-value {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Placeholder state */
.kit-select-trigger[data-placeholder="true"] .kit-select-value {
  color: var(--c-subtle, #7a7268);
  opacity: 0.8;
}

/* Chevron icon */
.kit-select-chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--c-subtle, #7a7268);
  transition: transform var(--dur-fast, 240ms) var(--ease-out-quart, cubic-bezier(0.25, 1, 0.5, 1));
  pointer-events: none;
  margin-left: 0.5rem;
}

.kit-select-trigger[aria-expanded="true"] .kit-select-chevron {
  transform: rotate(180deg);
  color: var(--c-accent, #B7883E);
}

/* Dropdown panel */
.kit-select-panel {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 200;
  background-color: var(--c-warm-2);
  border: 1px solid var(--c-warm-line);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px -8px rgba(0, 0, 0, 0.45), 0 2px 8px -2px rgba(0, 0, 0, 0.25);
  padding: 0.375rem 0;
  max-height: 280px;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--c-border, #2a2a27) transparent;
}

/* Light mode: lighter shadow */
html[data-theme="light"] .kit-select-panel {
  box-shadow: 0 8px 32px -8px rgba(21, 20, 15, 0.18), 0 2px 8px -2px rgba(21, 20, 15, 0.1);
}

.kit-select-panel[aria-hidden="false"],
.kit-select-panel.is-open {
  display: block;
}

/* Each option */
.kit-select-option {
  padding: 0.65rem var(--sp-40, 1.5rem);
  font-family: var(--ff-body);
  font-size: 0.9375rem;
  line-height: 1.4;
  color: var(--c-text, #F2EDE7);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-30, 1rem);
  transition:
    background-color var(--dur-instant, 100ms) var(--ease-out-quart, cubic-bezier(0.25, 1, 0.5, 1)),
    color var(--dur-instant, 100ms) var(--ease-out-quart, cubic-bezier(0.25, 1, 0.5, 1));
  outline: none;
  user-select: none;
}

/* Hover and keyboard focus on option */
.kit-select-option[aria-selected="true"],
.kit-select-option.is-active {
  color: var(--c-accent, #B7883E);
  background-color: color-mix(in oklch, var(--c-accent, #B7883E) 9%, transparent);
}

/* Selected (persisted) */
.kit-select-option[data-selected="true"] {
  color: var(--c-accent, #B7883E);
  font-weight: 600;
}

/* Checkmark shown next to selected option */
.kit-select-check {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0;
  color: var(--c-accent, #B7883E);
}

.kit-select-option[data-selected="true"] .kit-select-check {
  opacity: 1;
}

/* ============================================================
   FORM FOOTER: button + reassurance copy
   ============================================================ */

.form-foot {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: var(--sp-30, 1rem);
  margin-top: var(--sp-40, 1.5rem);
}

/* Gold pill submit button */
.btn-offer {
  font-family: var(--ff-body);
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--c-accent, #B7883E);
  /* Fixed dark ink: stays legible on gold in BOTH themes (do not use --c-bg,
     which flips to cream in light mode and would wash out on the gold pill). */
  color: #15140F;
  border: 0;
  border-radius: 999px;
  padding: 1rem 1.75rem;
  cursor: pointer;
  transition:
    background-color var(--dur-fast, 240ms) var(--ease-out-quart, cubic-bezier(0.25, 1, 0.5, 1)),
    color var(--dur-fast, 240ms) var(--ease-out-quart, cubic-bezier(0.25, 1, 0.5, 1)),
    transform var(--dur-fast, 240ms) var(--ease-out-quart, cubic-bezier(0.25, 1, 0.5, 1)),
    box-shadow var(--dur-fast, 240ms) var(--ease-out-quart, cubic-bezier(0.25, 1, 0.5, 1));
}

.btn-offer:hover {
  background: color-mix(in oklch, var(--c-accent, #B7883E) 85%, var(--c-text, #F2EDE7) 15%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px color-mix(in oklch, var(--c-accent, #B7883E) 35%, transparent);
}

.btn-offer:active {
  transform: translateY(0);
  transition-duration: var(--dur-instant, 100ms);
}

.btn-offer:focus-visible {
  outline: 2px solid var(--c-accent, #B7883E);
  outline-offset: 3px;
  border-radius: 999px;
}

.btn-offer:disabled,
.btn-offer[aria-busy="true"] {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.form-reassurance {
  font-size: 0.8125rem;
  color: var(--c-subtle, #7a7268);
  letter-spacing: 0.02em;
  line-height: 1.55;
}

/* ============================================================
   FORM ERROR BANNER + SUCCESS STATE
   ============================================================ */

.backroom-form-error {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: color-mix(in oklch, var(--c-alert, #C3111B) 10%, transparent);
  border: 1px solid color-mix(in oklch, var(--c-alert, #C3111B) 45%, transparent);
  border-radius: var(--radius-md, 14px);
  padding: var(--sp-30, 1rem) var(--sp-40, 1.5rem);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--c-text, #f5f4f0);
  margin-top: var(--sp-30, 1rem);
}

.backroom-form-error[hidden] {
  display: none;
}

/* Warning icon via pseudo-element. Uses mask-image so the icon color
   inherits the alert token rather than being baked into the data URI.
   -webkit-mask- prefixes included for Safari and iOS support. */
.backroom-form-error::before {
  content: '';
  flex-shrink: 0;
  width: 1.15em;
  height: 1.15em;
  margin-top: 0.15em;
  background-color: var(--c-alert, #C3111B);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath fill='%23000' fill-rule='evenodd' d='M8.485 2.495a1.75 1.75 0 0 1 3.03 0l6.5 11.25A1.75 1.75 0 0 1 16.5 16.5h-13a1.75 1.75 0 0 1-1.515-2.755l6.5-11.25ZM10 7a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 10 7Zm0 8a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z' clip-rule='evenodd'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  -webkit-mask-position: center;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath fill='%23000' fill-rule='evenodd' d='M8.485 2.495a1.75 1.75 0 0 1 3.03 0l6.5 11.25A1.75 1.75 0 0 1 16.5 16.5h-13a1.75 1.75 0 0 1-1.515-2.755l6.5-11.25ZM10 7a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 10 7Zm0 8a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z' clip-rule='evenodd'/%3E%3C/svg%3E");
  mask-repeat: no-repeat;
  mask-size: contain;
  mask-position: center;
}

.backroom-success {
  padding: var(--sp-60, 4rem) 0;
  text-align: center;
}

.backroom-success-msg {
  font-family: var(--ff-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--c-text, #F2EDE7);
  display: block;
  margin-bottom: var(--sp-30, 1rem);
}

.backroom-success p {
  font-size: 1rem;
  color: var(--c-subtle, #7a7268);
}

/* ============================================================
   RESPONSIVE — mobile-first breakpoints
   ============================================================ */

/* 768px: tablet — single-column form rows */
@media (max-width: 781px) {
  .backroom-hero {
    padding-top: var(--sp-60, 4rem);
    padding-bottom: var(--sp-60, 4rem);
  }

  .roles-section {
    padding-top: var(--sp-60, 4rem);
    padding-bottom: var(--sp-60, 4rem);
  }

  .form-section {
    padding-top: var(--sp-60, 4rem);
    padding-bottom: var(--sp-60, 4rem);
  }

  /* Roles rows collapse to 2-column: num | name, then desc below name */
  .roles-list li {
    grid-template-columns: 2rem 1fr;
    grid-template-rows: auto auto;
    row-gap: 0.25rem;
    column-gap: var(--sp-30, 1rem);
  }

  .role-num {
    grid-row: 1;
    grid-column: 1;
  }

  .role-name {
    grid-row: 1;
    grid-column: 2;
  }

  .role-desc {
    grid-row: 2;
    grid-column: 2;
  }

  /* Form rows collapse to single column */
  .form-row {
    grid-template-columns: 1fr;
  }

  .form-field--full {
    grid-column: 1;
  }
}

/* 480px: phone — tighter headline */
@media (max-width: 480px) {
  .kit-display {
    font-size: clamp(2.5rem, 14vw, 4rem);
    line-height: 1;
  }

  .section-meta {
    flex-direction: column;
    gap: var(--sp-20, 0.5rem);
  }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  .backroom-hero,
  .backroom-form *,
  .kit-select-trigger,
  .kit-select-chevron,
  .kit-select-option,
  .btn-offer {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
