/* ==========================================================================
   Level of Engagement — Plugin Stylesheet
   High-contrast, 508-compliant theme
   ========================================================================== */

:root {
  --loe-ink:        #0d1b2a;   /* near-black text — 18:1 on white */
  --loe-blue-dark:  #003f7f;   /* dark blue for heading, borders */
  --loe-blue-mid:   #1a5fa8;   /* interactive elements */
  --loe-blue-light: #ddeeff;   /* section highlight background */
  --loe-blue-xlt:   #eef5ff;   /* alternating row tint */
  --loe-border:     #7bafd4;   /* visible border — 3:1+ on white */
  --loe-bg:         #f4f8fd;   /* input backgrounds */
  --loe-white:      #ffffff;
  --loe-slate:      #2d3748;   /* secondary text — 10:1 on white */
  --loe-radius:     5px;
  --loe-font:       Georgia, 'Times New Roman', serif;
  --loe-sans:       -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;

  /* Level radio accent colours — all 4.5:1+ on white when used as text */
  --loe-core:        #003f7f;
  --loe-involved:    #1a5fa8;
  --loe-supportive:  #1a6b45;
  --loe-interested:  #7b3f00;

  /* Focus ring — high-visibility gold, 3:1 on both light and dark */
  --loe-focus:      #b45309;
}

/* ── Wrapper ──────────────────────────────────────────────────────── */
.loe-wrap {
  max-width: 980px;
  margin: 0 auto 48px;
  background: var(--loe-white);
  border: 2px solid var(--loe-blue-dark);
  border-radius: var(--loe-radius);
  box-shadow: 0 2px 16px rgba(0,63,127,.10);
  overflow: hidden;
  font-family: var(--loe-sans);
  color: var(--loe-ink);
  font-size: 16px;
}

/* ── Header — light blue, dark text ──────────────────────────────── */
.loe-header {
  background: var(--loe-blue-light);
  padding: 28px 36px 22px;
  border-bottom: 3px solid var(--loe-blue-dark);
}
.loe-title {
  font-family: var(--loe-font);
  font-size: 28px;
  font-weight: 700;
  color: var(--loe-blue-dark);   /* 12:1 on --loe-blue-light */
  margin: 0 0 6px;
  letter-spacing: .01em;
}
.loe-subtitle {
  color: var(--loe-slate);       /* 10:1 on --loe-blue-light */
  font-size: 15px;
  margin: 0;
}

/* ── Meta grid (Org / Project / Date) ─────────────────────────────── */
.loe-meta-grid,
.loe-contact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  padding: 24px 36px 0;
}
.loe-contact-grid {
  padding-top: 0;
  padding-bottom: 4px;
}
.loe-meta-field--full {
  grid-column: 1 / -1;
}

.loe-meta-field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--loe-ink);
  margin-bottom: 6px;
}
.field-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  color: var(--loe-slate);
}
.loe-meta-field input[type="text"],
.loe-meta-field input[type="email"],
.loe-meta-field input[type="date"] {
  width: 100%;
  padding: 10px 13px;
  border: 2px solid var(--loe-border);
  border-radius: var(--loe-radius);
  font-size: 16px;
  color: var(--loe-ink);
  background: var(--loe-white);
  box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s;
}
.loe-meta-field input:focus {
  outline: 3px solid var(--loe-focus);
  outline-offset: 2px;
  border-color: var(--loe-blue-mid);
  box-shadow: none;
}

/* ── Table ────────────────────────────────────────────────────────── */
.loe-table-wrap {
  padding: 24px 36px;
  overflow-x: auto;
}
.loe-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}

/* Column widths */
.loe-table .col-timeframe { width: 14%;  min-width: 130px; }
.loe-table .col-action    { width: 46%;  min-width: 260px; }
.loe-table .col-level     { width: 40%;  min-width: 290px; }

/* Header row — light blue background, dark text */
.loe-table thead tr {
  background: var(--loe-blue-light);
  border-bottom: 2px solid var(--loe-blue-dark);
}
.loe-table thead th {
  padding: 13px 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--loe-blue-dark);   /* 12:1 on --loe-blue-light */
  text-align: left;
  border: 1px solid var(--loe-border);
}

/* Level sub-headers */
.level-header-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  text-align: center;
}
.lh-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0 4px;
}
.lh-cell strong {
  font-size: 12px;
  color: var(--loe-blue-dark);
}
.lh-cell em {
  font-size: 11px;
  font-style: normal;
  color: var(--loe-slate);
  line-height: 1.3;
}

/* Body rows */
.loe-row {
  border-bottom: 1px solid var(--loe-border);
  transition: background .1s;
}
.loe-row:last-child { border-bottom: none; }
.loe-row:nth-child(even) { background: var(--loe-blue-xlt); }
.loe-row:hover { background: var(--loe-blue-light); }

.loe-row td {
  padding: 14px;
  vertical-align: top;
}

/* Timeframe cell */
.col-timeframe {
  border-right: 2px solid var(--loe-border);
}
.tf-label {
  display: block;
  font-weight: 700;
  font-size: 15px;
  color: var(--loe-ink);
}
.tf-sub {
  display: block;
  font-size: 13px;
  color: var(--loe-slate);
  margin-top: 4px;
  font-style: italic;
}

/* Action cell */
.col-action {
  border-right: 1px solid var(--loe-border);
}
.action-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.action-num-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.num-prefix {
  font-weight: 700;
  color: var(--loe-blue-dark);
  font-size: 16px;
}
.action-num-input {
  width: 72px;
  padding: 7px 8px;
  border: 2px solid var(--loe-border);
  border-radius: 4px;
  font-size: 15px;
  text-align: center;
  color: var(--loe-ink);
  background: var(--loe-white);
  font-weight: 600;
  transition: border-color .15s;
}
.action-num-input:focus {
  outline: 3px solid var(--loe-focus);
  outline-offset: 2px;
  border-color: var(--loe-blue-mid);
}
.action-txt-input {
  width: 100%;
  padding: 9px 11px;
  border: 2px solid var(--loe-border);
  border-radius: 4px;
  font-size: 15px;
  color: var(--loe-ink);
  background: var(--loe-white);
  resize: vertical;
  min-height: 72px;
  font-family: var(--loe-sans);
  line-height: 1.6;
  box-sizing: border-box;
  transition: border-color .15s;
}
.action-txt-input:focus {
  outline: 3px solid var(--loe-focus);
  outline-offset: 2px;
  border-color: var(--loe-blue-mid);
}

/* Level radio grid */
.level-radio-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  align-items: center;
  height: 100%;
}
.level-option {
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  /* 44×44 minimum touch target per WCAG 2.5.5 */
  min-width: 44px;
  min-height: 44px;
  border-radius: 4px;
  transition: background .12s;
}
.level-option:hover {
  background: var(--loe-blue-light);
}
.level-radio {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.radio-ring {
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2.5px solid var(--loe-border);
  background: var(--loe-white);
  transition: border-color .15s, background .15s, transform .12s;
  position: relative;
}
.radio-ring::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--loe-white);
  transition: transform .15s ease;
}

/* Selected states — filled circle, white dot inside */
.level-core       .level-radio:checked ~ .radio-ring { border-color: var(--loe-core);        background: var(--loe-core); }
.level-involved   .level-radio:checked ~ .radio-ring { border-color: var(--loe-involved);    background: var(--loe-involved); }
.level-supportive .level-radio:checked ~ .radio-ring { border-color: var(--loe-supportive);  background: var(--loe-supportive); }
.level-interested .level-radio:checked ~ .radio-ring { border-color: var(--loe-interested);  background: var(--loe-interested); }

.level-core       .level-radio:checked ~ .radio-ring::after,
.level-involved   .level-radio:checked ~ .radio-ring::after,
.level-supportive .level-radio:checked ~ .radio-ring::after,
.level-interested .level-radio:checked ~ .radio-ring::after {
  transform: translate(-50%, -50%) scale(1);
}

/* Keyboard focus — visible 3px ring in high-contrast amber */
.level-radio:focus ~ .radio-ring {
  outline: 3px solid var(--loe-focus);
  outline-offset: 3px;
}

/* ── Separator before contact section ────────────────────────────── */
.loe-section-sep {
  border: none;
  border-top: 2px solid var(--loe-blue-light);
  margin: 8px 36px 24px;
}

/* ── Disclaimer ───────────────────────────────────────────────────── */
.loe-disclaimer {
  font-size: 14px;
  color: var(--loe-slate);
  font-style: italic;
  text-align: center;
  padding: 0 36px 10px;
  margin: 0;
}

/* ── Actions / submit ─────────────────────────────────────────────── */
.loe-actions {
  padding: 16px 36px 28px;
  display: flex;
  justify-content: flex-end;
}
.loe-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 30px;
  border: 2px solid transparent;
  border-radius: var(--loe-radius);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, transform .1s, box-shadow .15s;
  letter-spacing: .02em;
  min-height: 44px;  /* 508 touch target */
}
.loe-btn--primary {
  background: var(--loe-blue-dark);
  color: var(--loe-white);     /* 12:1 contrast */
  border-color: var(--loe-blue-dark);
}
.loe-btn--primary:hover {
  background: var(--loe-blue-mid);
  border-color: var(--loe-blue-mid);
  box-shadow: 0 4px 12px rgba(0,63,127,.25);
  transform: translateY(-1px);
}
.loe-btn--primary:focus {
  outline: 3px solid var(--loe-focus);
  outline-offset: 3px;
}
.loe-btn--primary:active {
  transform: translateY(0);
}
.loe-btn:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
}

/* Spinner */
.btn-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2.5px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: loe-spin .7s linear infinite;
}
.loe-btn.is-loading .btn-spinner { display: block; }
.loe-btn.is-loading .btn-label   { opacity: .8; }

@keyframes loe-spin {
  to { transform: rotate(360deg); }
}

/* ── Notice ───────────────────────────────────────────────────────── */
.loe-notice {
  margin: 0 36px 24px;
  padding: 13px 18px;
  border-radius: var(--loe-radius);
  font-size: 16px;
  font-weight: 600;
  display: none;
  border-left-width: 5px;
  border-left-style: solid;
}
.loe-notice.is-success {
  display: block;
  background: #edfaf3;
  color: #0d4a2a;           /* 9:1 on background */
  border: 1px solid #4caf82;
  border-left-color: #1a6b45;
}
.loe-notice.is-error {
  display: block;
  background: #fff0f0;
  color: #7b1a1a;           /* 9:1 on background */
  border: 1px solid #e08080;
  border-left-color: #b91c1c;
}

/* ── Screen-reader only ───────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ── Skip link (508) ──────────────────────────────────────────────── */
.loe-skip-link {
  position: absolute;
  top: -999px;
  left: 0;
  background: var(--loe-blue-dark);
  color: var(--loe-white);
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 700;
  z-index: 9999;
  border-radius: 0 0 4px 0;
  text-decoration: none;
}
.loe-skip-link:focus {
  top: 0;
}

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 680px) {
  .loe-wrap           { font-size: 15px; }
  .loe-header         { padding: 20px; }
  .loe-meta-grid,
  .loe-contact-grid   { grid-template-columns: 1fr; padding: 16px 20px 0; }
  .loe-table-wrap     { padding: 16px 8px; }
  .loe-actions        { padding: 16px 20px 24px; }
  .loe-notice         { margin: 0 20px 20px; }
  .loe-disclaimer     { padding: 0 20px 8px; }
  .loe-section-sep    { margin: 8px 20px 20px; }

  .level-header-grid,
  .level-radio-grid   { grid-template-columns: repeat(2, 1fr); }
}

/* ── Reduced motion ───────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .loe-btn,
  .radio-ring,
  .radio-ring::after,
  .level-option,
  .loe-meta-field input,
  .action-num-input,
  .action-txt-input {
    transition: none;
  }
  .btn-spinner {
    animation: none;
    border-top-color: #fff;
    opacity: .8;
  }
}
