/* CLP Region single (single-clp_region.php): state permit steps per position. */

.clp-region {
  --clp-color-navy: #0b2265;
  --clp-color-muted: #4b5870;
  --clp-color-surface: #f5f7f9;
  --clp-color-line: #d1d9e5;
  --clp-color-white: #fff;
  --clp-color-chip: #ffc72c;
  --clp-color-tint: rgba(11, 34, 101, 0.04);
  --clp-color-tint-line: rgba(11, 34, 101, 0.12);
  --clp-font-family: "Barlow", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  --clp-font-regular: 400;
  --clp-font-semibold: 600;
  --clp-font-bold: 700;
  --clp-content-width: 960px;
  --clp-gutter: 24px;
  --clp-section-gap: 48px;
  --clp-marker-size: 32px;
  --clp-step-inset: 16px;

  color: var(--clp-color-navy);
  font-family: var(--clp-font-family);
  font-size: 18px;
  font-weight: var(--clp-font-regular);
  line-height: 27px;
}

.clp-region .container {
  box-sizing: content-box;
  width: auto;
  max-width: var(--clp-content-width);
  margin: 0 auto;
  padding-inline: var(--clp-gutter);
}

/* !important: the global heading rule sets color with !important, and the global mobile
   (max-width: 767px) heading rule does the same for font-size, so heading sizes below use it too. */
.clp-region h1,
.clp-region h2,
.clp-region h3 {
  margin: 0;
  color: var(--clp-color-navy) !important;
  font-family: var(--clp-font-family);
  font-weight: var(--clp-font-semibold);
  text-transform: none;
}

/* The global p rule sets 300 weight at 20px/28px. */
.clp-region p {
  margin: 0;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
}

.clp-region strong {
  font-weight: var(--clp-font-semibold);
}

/* !important: the global "#content a:not(...)" link rule outranks these selectors and forces its own
   color, line-height, and inline-block display on every link. */
/* CLP Page editor content keeps the site's link colors. :where() adds no specificity, so the overrides below still win. */
.clp-region a:not(.button):not(:where(.clp-page__content a)) {
  display: inline !important;
  color: var(--clp-color-navy) !important;
  font-size: inherit;
  line-height: inherit !important;
  text-decoration: underline !important;
}

.clp-region a:not(.button):hover {
  text-decoration-thickness: 2px !important;
}

/* The rule above forces inline, which drops vertical margin; same specificity, so this must stay after it. */
.clp-region a.clp-virtual-class__support {
  display: inline-block !important;
}

/* [clp_virtual_class register_link_1 register_link_2] split register buttons. flex-start so they don't stretch full width. */
.clp-region .clp-virtual-class__register {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
}

.clp-region a:focus-visible,
.clp-region summary:focus-visible {
  outline: 2px solid var(--clp-color-navy);
  outline-offset: 2px;
}

/* Intro: back link, title, position selector */
.clp-region__intro {
  padding-block: var(--clp-section-gap);
  border-bottom: 1px solid var(--clp-color-line);
}

.clp-region__intro .container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.clp-region a.clp-region__back {
  display: inline-flex !important;
  align-items: center;
  min-height: 44px;
  font-weight: var(--clp-font-regular);
}

.clp-region__title {
  font-size: 40px !important;
  line-height: 48px;
}

.clp-selector {
  display: flex;
  align-self: stretch;
  flex-direction: column;
  gap: 8px;
  padding-top: 40px;
}

.clp-selector__heading {
  font-size: 28px !important;
  line-height: 40px;
}

.clp-selector__list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.clp-selector__list li {
  display: flex;
  margin: 0;
}

.clp-region a.clp-selector__button {
  display: block !important;
  flex: 1;
  padding: 14px 24px;
  border: 1px solid var(--clp-color-navy);
  border-radius: 4px;
  background: var(--clp-color-white);
  color: var(--clp-color-navy) !important;
  font-weight: var(--clp-font-semibold);
  line-height: 20px !important;
  text-align: center;
  text-decoration: none !important;
  white-space: nowrap;
}

.clp-region a.clp-selector__button:hover {
  background: var(--clp-color-surface);
}

.clp-region a.clp-selector__button[aria-current="true"] {
  background: var(--clp-color-navy);
  color: var(--clp-color-white) !important;
}

/* Body: one panel per position */
.clp-region__body {
  padding-top: var(--clp-section-gap);
  padding-bottom: 120px;
}

.clp-region__panel {
  display: flex;
  flex-direction: column;
  gap: var(--clp-section-gap);
}

/* CLP Page (page-clp-page.php): editor content, then the help box */
.clp-page .clp-region__body {
  display: flex;
  flex-direction: column;
  gap: var(--clp-section-gap);
}

/* The p and heading resets above zero editor margins, so content (and group blocks) space with gap. */
.clp-page__content,
.clp-page__content .wp-block-group__inner-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.clp-page__content p:empty {
  display: none;
}

/* Help box */
.clp-help-box {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  border-radius: 4px;
  background: var(--clp-color-surface);
}

.clp-help-box > :not(.clp-help-box__actions) {
  max-width: 760px;
}

.clp-help-box__title {
  font-size: 20px !important;
  line-height: 27px;
}

.clp-help-box__call {
  font-weight: var(--clp-font-semibold)!important;
}

.clp-help-box__actions {
  display: none;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.clp-help-box__actions li {
  display: flex;
  flex: 1;
  margin: 0;
}

/* Bulleted lists: help box list and lists in editor content */
.clp-help-box__list,
.clp-steps__content ul,
.clp-accordion__content ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.clp-help-box__list li,
.clp-steps__content ul li,
.clp-accordion__content ul li {
  display: flex;
  gap: 8px;
  margin: 0;
  font-size: inherit;
}

.clp-help-box__list li::before,
.clp-steps__content ul li::before,
.clp-accordion__content ul li::before {
  content: "\2022";
  flex: 0 0 12px;
  color: var(--clp-color-muted);
}

/* Steps timeline: numbered markers joined by a vertical line */
.clp-steps {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 32px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: clp-step;
}

.clp-steps::before {
  content: "";
  position: absolute;
  top: 20px;
  bottom: 0;
  left: calc(var(--clp-step-inset) + var(--clp-marker-size) / 2 - 0.5px);
  width: 1px;
  background: var(--clp-color-line);
}

.clp-steps__step {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding-left: calc(var(--clp-step-inset) + var(--clp-marker-size) + 16px);
  padding-right: 32px;
  counter-increment: clp-step;
}

.clp-steps__step::before {
  content: counter(clp-step);
  position: absolute;
  top: 4px;
  left: var(--clp-step-inset);
  box-sizing: border-box;
  width: var(--clp-marker-size);
  height: var(--clp-marker-size);
  border: 1px solid var(--clp-color-line);
  border-radius: 50%;
  background: var(--clp-color-surface);
  font-weight: var(--clp-font-semibold);
  line-height: 30px;
  text-align: center;
}

.clp-steps__title {
  font-size: 28px !important;
  line-height: 40px;
}

.clp-intro,
.clp-steps__content,
.clp-accordion__content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.clp-intro > *,
.clp-steps__content > *,
.clp-accordion__content > * {
  margin: 0;
}

.clp-steps__content + .clp-accordion {
  padding-top: 12px;
}

/* Accordions */
.clp-accordion {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.clp-accordion__item {
  position: relative;
  margin: 0;
  padding: 0 20px;
  border: 1px solid var(--clp-color-line);
  background: var(--clp-color-white);
}

.clp-accordion__item--highlighted {
  border-color: var(--clp-color-navy);
}

.clp-accordion__summary,
.clp-disclosure__summary {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 44px;
  padding: 16px 0;
  cursor: pointer;
  list-style: none;
}

.clp-accordion__summary::-webkit-details-marker,
.clp-disclosure__summary::-webkit-details-marker {
  display: none;
}

.clp-accordion__title {
  flex: 1;
  font-size: 20px;
  font-weight: var(--clp-font-semibold);
  line-height: 27px;
}

.clp-accordion--full-width .clp-accordion__title {
  font-size: 18px;
}

.clp-accordion__chip {
  position: absolute;
  top: -14px;
  right: 27px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--clp-color-chip);
  font-size: 13px;
  font-weight: var(--clp-font-bold);
  line-height: 16px;
  letter-spacing: 0.78px;
  text-transform: uppercase;
}

/* +/- drawn with two lines; the vertical one hides when open. */
.clp-accordion__icon {
  position: relative;
  flex: 0 0 40px;
  height: 40px;
}

.clp-accordion__icon::before,
.clp-accordion__icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10.5px;
  height: 1.5px;
  border-radius: 1px;
  background: var(--clp-color-navy);
  transform: translate(-50%, -50%);
}

.clp-accordion__icon::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

details[open] > summary > .clp-accordion__icon::after {
  display: none;
}

.clp-accordion__content {
  padding-bottom: 16px;
}

/* Disclosure: an accordion item's collapsible PDF list (template-parts/clp-disclosure.php) */
.clp-disclosure {
  border-top: 1px solid var(--clp-color-line);
  border-bottom: 1px solid var(--clp-color-line);
}

.clp-disclosure__title {
  flex: 1;
  font-size: 16px;
  line-height: 24px;
}

.clp-disclosure__content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 16px;
}

.clp-disclosure__content > * {
  margin: 0;
}

/* Document (PDF) cards: 2-up, a lone card spans the row */
.clp-region .clp-documents {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.clp-region .clp-document {
  display: flex;
  flex: 0 1 calc(50% - 4px);
  margin: 0;
}

.clp-region .clp-document::before {
  content: none;
}

.clp-region .clp-document:only-child {
  flex-basis: 100%;
}

.clp-region a.clp-document__link {
  display: flex !important;
  flex: 1;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--clp-color-tint);
  text-decoration: none !important;
}

.clp-document__thumbnail {
  box-sizing: border-box;
  flex: 0 0 64px;
  width: 64px;
  height: 83px;
  border: 1px solid var(--clp-color-tint-line);
  background: var(--clp-color-white);
  object-fit: contain;
}

.clp-document__text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

/* .clp-region prefix and !important: the global "a:not(.button) span" rule sets its own color,
   removes the underline, and forces a 1px thickness with !important. */
.clp-region .clp-document__label {
  color: var(--clp-color-navy);
  text-decoration: underline;
}

.clp-region .clp-document__link:hover .clp-document__label {
  text-decoration-thickness: 2px !important;
}

.clp-region .clp-document__format {
  color: var(--clp-color-muted);
  font-size: 16px;
  line-height: 24px;
}

/* Tables from the editor's table button */
.clp-region table {
  width: 100%;
  border: 1px solid var(--clp-color-line);
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 4px;
  overflow: hidden;
}

/* [clp_virtual_class] schedule table. Two classes so it beats the `.clp-accordion__content > *` margin reset. */
.clp-region .clp-virtual-class__schedule {
  margin: 20px 0 10px;
}

.clp-region th,
.clp-region td {
  padding: 16px 12px;
  border: 0;
  text-align: left;
  vertical-align: top;
}

.clp-region th:first-child,
.clp-region td:first-child {
  padding-left: 16px;
}

.clp-region th:last-child,
.clp-region td:last-child {
  padding-right: 16px;
}

.clp-region thead th,
.clp-region thead td {
  background: var(--clp-color-surface);
  font-size: 16px;
  font-weight: var(--clp-font-semibold);
  line-height: 24px;
}

.clp-region tbody tr + tr td,
.clp-region tbody tr + tr th,
.clp-region thead + tbody tr:first-child td,
.clp-region thead + tbody tr:first-child th {
  border-top: 1px solid var(--clp-color-line);
}

/* !important: the global button margin rule outranks this selector; the flex gaps space buttons here. */
.clp-region .button {
  margin: 0 !important;
}

/* Content areas are flex columns, which would stretch the button to full width. */
.clp-region .button--navy {
  align-self: flex-start;
}

.clp-region .clp-help-box__actions .button {
  flex: 1;
  min-height: 48px;
  padding-inline: 16px !important;
}

@media (max-width: 575px) {
  .clp-region {
    --clp-section-gap: 40px;
    --clp-step-inset: 0px;
  }

  .clp-region__title {
    font-size: 32px !important;
    line-height: 38px;
  }

  .clp-selector {
    padding-top: 32px;
  }

  .clp-selector__heading {
    font-size: 24px !important;
    line-height: 30px;
  }

  .clp-selector__list {
    flex-direction: column;
    gap: 8px;
  }

  .clp-help-box {
    padding: 20px;
  }

  .clp-help-box__title {
    font-size: 18px !important;
    line-height: 24px;
  }

  .clp-help-box p,
  .clp-help-box__list {
    font-size: 16px;
    line-height: 24px;
  }

  .clp-help-box--not-sure p {
    font-size: 18px;
    line-height: 27px;
  }

  .clp-help-box__actions {
    display: flex;
  }

  .clp-steps::before {
    top: 15px;
  }

  .clp-steps__step {
    padding-right: 0;
    padding-left: calc(var(--clp-marker-size) + 12px);
  }

  .clp-steps__step::before {
    top: -1px;
  }

  .clp-steps__title {
    font-size: 24px !important;
    line-height: 30px;
  }

  .clp-accordion__item {
    padding: 0 16px;
  }

  .clp-accordion__title {
    font-size: 18px;
    line-height: 24px;
  }

  .clp-accordion__chip {
    right: 23px;
  }

  .clp-region .clp-document {
    flex-basis: 100%;
  }

  .clp-document__thumbnail {
    flex-basis: 32px;
    width: 32px;
    height: 42px;
  }

  .clp-region .button--navy {
    display: block;
    width: 100%;
  }

  /* Tables stack into one block per row; the header row is dropped. */
  .clp-region thead {
    display: none;
  }

  .clp-region table,
  .clp-region tbody {
    display: block;
  }

  .clp-region tr {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 16px;
  }

  .clp-region tbody tr + tr {
    border-top: 1px solid var(--clp-color-line);
  }

  .clp-region th,
  .clp-region td,
  .clp-region th:first-child,
  .clp-region td:first-child,
  .clp-region th:last-child,
  .clp-region td:last-child {
    padding: 0;
    border: 0 !important;
  }

  .clp-region td:first-child {
    font-weight: var(--clp-font-semibold);
  }
}
