/* ============================================================
   Cooper Base — Theme CSS
   Layout and component styles for .cb-* classes, block styles,
   and inline utility classes. All color / spacing / type values
   reference tokens from design-system.css.
   ============================================================ */

/* ---------------------------------------------------------------
   1. SHELL — outermost page wrapper
   --------------------------------------------------------------- */
/* Light-gray page canvas so the white content reads as a centered card. */
body {
  background: var(--navy-50);
}

.cb-shell {
  max-width: var(--container-max);
  margin: 0 auto;
  background: #fff;
  box-shadow: var(--shadow-lg);
}

/* ---------------------------------------------------------------
   2. IDENTITY BAR (header: logo + wordmark)
   --------------------------------------------------------------- */
.cb-identity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 26px 48px;
  background: linear-gradient(180deg, #fbfbfd, #f4f5fa);
}

.cb-wordmark {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: clamp(22px, 2.4vw, 30px);
  letter-spacing: -0.02em;
  color: var(--cooper-red);
}

.cb-identity .custom-logo,
.cb-identity .cb-logo-default img {
  height: 52px;
  width: auto;
  display: block;
}

/* ---------------------------------------------------------------
   3. PRIMARY NAVIGATION
   --------------------------------------------------------------- */
.cb-nav {
  background: var(--navy-500);
  padding: 0 48px;
  display: flex;
  align-items: center;
}

/* Menu list */
.cb-nav__menu {
  display: inline-flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 28px;
}

.cb-nav__menu a {
  display: block;
  color: #fff;
  text-decoration: none;
  padding: 20px 4px;
  border-bottom: 3px solid transparent;
  font-size: 15px;
  font-weight: 600;
  transition:
    border-color var(--dur-base) var(--ease-out),
    background var(--dur-base) var(--ease-out);
}

.cb-nav__menu a:hover {
  color: #fff;
  border-bottom-color: rgba(255, 255, 255, 0.4);
}

.cb-nav__menu .current-menu-item a {
  border-bottom-color: var(--cooper-red);
}

/* Dropdown submenus (used by grouped nav + the "More ▾" overflow item) */
.cb-nav__menu li {
  position: relative;
}

.cb-nav__menu .menu-item-has-children > a {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cb-nav__menu .menu-item-has-children > a::after {
  content: "";
  width: 7px;
  height: 7px;
  flex: none;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform var(--dur-base) var(--ease-out);
}

.cb-nav__menu .menu-item-has-children:hover > a::after,
.cb-nav__menu .menu-item-has-children.is-open > a::after {
  transform: translateY(1px) rotate(-135deg);
}

.cb-nav__menu .sub-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 210px;
  margin: 0;
  padding: 6px 0;
  list-style: none;
  background: var(--navy-800);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition:
    opacity var(--dur-base) var(--ease-out),
    transform var(--dur-base) var(--ease-out),
    visibility var(--dur-base);
  z-index: 50;
}

.cb-nav__menu .menu-item-has-children:hover > .sub-menu,
.cb-nav__menu .menu-item-has-children:focus-within > .sub-menu,
.cb-nav__menu .menu-item-has-children.is-open > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.cb-nav__menu .sub-menu a {
  padding: 10px 18px;
  border-bottom: none;
  white-space: nowrap;
  font-weight: 500;
}

.cb-nav__menu .sub-menu a:hover {
  background: rgba(255, 255, 255, 0.08);
  border-bottom-color: transparent;
}

/* CTA button — pushed to far right */
.cb-nav__cta {
  margin-left: auto;
  list-style: none;
  padding: 0;
  margin-top: 0;
  margin-bottom: 0;
}

.cb-nav__cta a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  color: var(--cooper-red);
  font-weight: 700;
  font-size: var(--fs-14);
  text-decoration: none;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  transition: opacity var(--dur-base) var(--ease-out);
}

/* Log-in icon before the nav CTA label (masked so it inherits the red text) */
.cb-nav__cta a::before {
  content: "";
  width: 16px;
  height: 16px;
  flex: none;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4'/%3E%3Cpolyline points='10 17 15 12 10 7'/%3E%3Cline x1='15' y1='12' x2='3' y2='12'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4'/%3E%3Cpolyline points='10 17 15 12 10 7'/%3E%3Cline x1='15' y1='12' x2='3' y2='12'/%3E%3C/svg%3E") no-repeat center / contain;
}

.cb-nav__cta a:hover {
  opacity: 0.9;
}

/* Hamburger — hidden on desktop, shown at mobile breakpoint */
.cb-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 10px;
  margin-left: auto;
}

/* Nav search bar (opt-in via cb_show_search filter; used by cooper-news) */
.cb-search {
  margin-left: auto;
  display: flex;
  align-items: center;
}

.cb-search__field {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-pill);
  padding: 7px 14px;
  transition: background var(--dur-base) var(--ease-out);
}

.cb-search__field:focus-within {
  background: #fff;
}

.cb-search__icon {
  display: inline-flex;
  color: rgba(255, 255, 255, 0.8);
}

.cb-search__field:focus-within .cb-search__icon {
  color: var(--navy-500);
}

.cb-search input {
  width: 150px;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: var(--font-sans);
  font-size: var(--fs-14);
}

.cb-search input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.cb-search__field:focus-within input {
  color: var(--navy-800);
}

.cb-search__field:focus-within input::placeholder {
  color: var(--neutral-400);
}

/* ---------------------------------------------------------------
   4. MAIN CONTENT AREA
   --------------------------------------------------------------- */
.cb-main {
  display: block;
}

/* Full-bleed main: hero + footer span edge-to-edge; body content is centered
   by .cb-body below. */
.cb-main--full {
  display: block;
}

/* Content column between the hero and footer. Left edge matches the nav /
   identity band (48px) so body copy lines up with the navigation. */
.cb-body {
  padding: 0 48px 72px;
}

/* Intro copy sits in a slightly narrower measure than the wider sections. */
.cb-intro {
  max-width: 820px;
  padding: 64px 0 8px;
}

.cb-intro > .eyebrow + p {
  font-size: var(--fs-18);
  color: var(--navy-800);
  margin-top: 16px;
}

/* Inner (non-home) pages align to the nav's left edge, like the home body. */
.cb-main--article {
  padding: 24px 48px 72px;
}

.cb-page-title {
  /* Match the home hero headline size (.cb-hero__inner h1). */
  font-size: clamp(var(--fs-36), 5vw, 52px);
  padding: 40px 0 4px;
}

/* ---------------------------------------------------------------
   5. HERO PATTERN BLOCK  (core/cover carrying .cb-hero)
   --------------------------------------------------------------- */
.cb-hero.wp-block-cover {
  min-height: 460px;
  /* Left-align the inner column instead of core/cover's centering. */
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0;
}

/* Directional editorial scrim over the hero image — dark on the left,
   fading to near-transparent on the right (replaces core's flat dim). */
.cb-hero > .wp-block-cover__background {
  background: linear-gradient(
    90deg,
    rgba(18, 26, 48, 0.92) 0%,
    rgba(18, 26, 48, 0.72) 42%,
    rgba(18, 26, 48, 0.15) 100%
  );
  opacity: 1;
}

.cb-hero__inner {
  max-width: 640px;
  width: 100%;
  padding: 0 56px;
}

.cb-hero .eyebrow {
  color: #ffb3c2;
  margin-bottom: 14px;
}

.cb-hero__inner h1 {
  color: #fff;
  font-size: clamp(var(--fs-36), 5vw, 52px);
  line-height: 1.05;
  margin-bottom: 18px;
}

.cb-hero .lede {
  color: rgba(255, 255, 255, 0.92);
  font-size: 19px;
  line-height: 1.55;
  max-width: 520px;
}

.cb-hero .wp-block-buttons {
  gap: 14px;
  margin-top: 30px;
}

/* ---------------------------------------------------------------
   6. HELP ROWS
   --------------------------------------------------------------- */
.cb-help {
  padding: 44px 0 8px;
}

/* Divider above the first help row (below the "Get help" label). */
.cb-help__row:first-of-type {
  border-top: 1px solid var(--border-subtle);
}

.cb-help__row {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 20px 4px;
  border-bottom: 1px solid var(--border-subtle);
}

.cb-help__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  background: var(--red-50);
  color: var(--cooper-red);
  border-radius: var(--radius-sm);
}

/* ---------------------------------------------------------------
   7. CTA BANNER BLOCK
   --------------------------------------------------------------- */
.cb-cta {
  background: var(--cooper-red);
  color: #fff;
  border-radius: var(--radius-md);
  margin: 56px 0 0;
  padding: 44px 48px;
  display: flex;
  gap: 32px;
  justify-content: space-between;
  align-items: center;
}

.cb-cta h2,
.cb-cta h3 {
  color: #fff;
  font-size: clamp(28px, 3.4vw, 40px);
  margin-bottom: 8px;
}

.cb-cta p {
  color: rgba(255, 255, 255, 0.9);
}

/* White button inside the red CTA banner */
.cb-cta .wp-block-button__link,
.cb-cta__btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  color: var(--cooper-red);
  border-radius: var(--radius-sm);
  padding: 16px 30px;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
}

/* Arrow after the CTA button label (masked so it inherits the red text) */
.cb-cta .wp-block-button__link::after {
  content: "";
  width: 18px;
  height: 18px;
  flex: none;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='5' y1='12' x2='19' y2='12'/%3E%3Cpolyline points='12 5 19 12 12 19'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='5' y1='12' x2='19' y2='12'/%3E%3Cpolyline points='12 5 19 12 12 19'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* ---------------------------------------------------------------
   7b. LINK CARDS (hub / landing grids)
   --------------------------------------------------------------- */
.cb-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  margin: 8px 0;
}

.cb-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 28px 28px 26px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--dur-base) var(--ease-out);
}

.cb-card:hover {
  box-shadow: var(--shadow-md);
}

.cb-card h2,
.cb-card h3 {
  font-size: var(--fs-24);
  margin-bottom: 10px;
}

.cb-card :is(h2, h3) a {
  color: var(--navy-800);
  text-decoration: none;
}

.cb-card :is(h2, h3) a:hover {
  color: var(--cooper-red);
}

.cb-card p {
  color: var(--neutral-600);
  margin-bottom: 20px;
}

.cb-card__link {
  margin-top: auto;
  align-self: flex-start;
  color: var(--cooper-red);
  font-weight: 700;
  text-decoration: none;
}

.cb-card__link:hover {
  text-decoration: underline;
}

/* ---------------------------------------------------------------
   8. FAQ ACCORDION BLOCK
   --------------------------------------------------------------- */
.cb-faq {
  padding: 64px 0 20px;
}

.cb-faq details {
  border-bottom: 1px solid var(--border-subtle);
}

.cb-faq summary {
  display: flex;
  gap: 16px;
  padding: 20px 0;
  font-weight: 600;
  color: var(--navy-800);
  cursor: pointer;
  list-style: none;
}

/* Remove default disclosure marker across browsers */
.cb-faq summary::-webkit-details-marker {
  display: none;
}

.cb-faq__chev {
  color: var(--cooper-red);
  transition: transform var(--dur-base) var(--ease-out);
  flex-shrink: 0;
}

.cb-faq details[open] .cb-faq__chev {
  transform: rotate(90deg);
}

.cb-faq details > p,
.cb-faq__answer {
  padding: 0 0 22px 34px;
  color: var(--neutral-600);
}

/* The chevron sits at a fixed size so the answer's 34px indent lines up. */
.cb-faq__chev {
  flex: none;
  display: inline-flex;
  width: 18px;
}

/* ---------------------------------------------------------------
   9. FOOTER
   --------------------------------------------------------------- */
.cb-footer {
  background: var(--navy-700);
  color: var(--navy-100);
  padding: 44px 56px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cb-footer__logo img {
  height: 46px;
  width: auto;
  display: block;
  /* Recolor any Customizer logo to white on the dark navy footer */
  filter: brightness(0) invert(1);
}

.cb-footer__wordmark {
  color: #fff;
  font-weight: 700;
}

.cb-footer__meta {
  font-size: var(--fs-14);
  color: var(--navy-100);
}

.cb-footer__note {
  font-size: var(--fs-12);
  opacity: 0.7;
}

/* Footer resource columns — optional widget band above the footer strip */
.cb-footer-widgets {
  background: var(--navy-800);
  color: rgba(255, 255, 255, 0.85);
}

.cb-footer-widgets__inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 36px 48px;
  padding-top: 52px;
  padding-bottom: 52px;
}

.cb-fcol__title {
  font-size: var(--fs-14);
  font-weight: 700;
  color: #fff;
  margin: 0 0 16px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cb-footer-widgets a {
  color: #fff;
  text-decoration: none;
}

.cb-footer-widgets a:hover {
  text-decoration: underline;
}

.cb-fcol p {
  margin: 0 0 12px;
  font-size: var(--fs-14);
  line-height: 1.55;
}

.cb-fcol ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cb-fcol li {
  margin-bottom: 11px;
  font-size: var(--fs-14);
  line-height: 1.4;
}

/* Generic form styling so plugin subscribe/search forms fit the dark band */
.cb-footer-widgets input[type="email"],
.cb-footer-widgets input[type="text"],
.cb-footer-widgets input[type="search"] {
  width: 100%;
  max-width: 320px;
  padding: 10px 12px;
  margin-bottom: 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-family: var(--font-sans);
  font-size: var(--fs-14);
}

.cb-footer-widgets input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.cb-footer-widgets input[type="submit"],
.cb-footer-widgets button[type="submit"] {
  background: var(--cooper-red);
  color: #fff;
  border: none;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: var(--fs-14);
  cursor: pointer;
  transition: opacity var(--dur-base) var(--ease-out);
}

.cb-footer-widgets input[type="submit"]:hover,
.cb-footer-widgets button[type="submit"]:hover {
  opacity: 0.9;
}

/* ---------------------------------------------------------------
   10. GUTENBERG BLOCK STYLES
   --------------------------------------------------------------- */

/* Primary — solid red fill */
.wp-block-button.is-style-cooper-primary .wp-block-button__link {
  background: var(--cooper-red);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 15px 28px;
  font-weight: 700;
}

/* Secondary — transparent / outlined (for use on dark backgrounds) */
.wp-block-button.is-style-cooper-secondary .wp-block-button__link {
  background: transparent;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-sm);
  padding: 13px 26px;
  font-weight: 700;
}

/* Inline link component */
.cc-link {
  color: var(--cooper-red);
  text-decoration: none;
  border-bottom: 1px solid rgba(191, 13, 62, 0.35);
  transition: border-bottom-color var(--dur-base) var(--ease-out);
}

.cc-link:hover {
  border-bottom-color: var(--cooper-red);
}

/* ---------------------------------------------------------------
   11. RESPONSIVE — mobile breakpoint (≤ 781px, WP canonical)
   --------------------------------------------------------------- */
@media (max-width: 781px) {

  /* Identity + nav get tighter horizontal padding */
  .cb-identity,
  .cb-nav {
    padding-left: 22px;
    padding-right: 22px;
  }

  /* Nav becomes a vertical stack, hidden until .is-open toggled */
  .cb-nav {
    flex-wrap: wrap;
    padding-top: 10px;
    padding-bottom: 12px;
  }

  .cb-nav__menu {
    display: none;
    flex-direction: column;
    width: 100%;
  }

  .cb-nav.is-open .cb-nav__menu {
    display: flex;
  }

  .cb-nav__menu a {
    padding: 14px 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  }

  /* Submenus become inline accordions in the drawer (tap parent to expand) */
  .cb-nav__menu .sub-menu {
    position: static;
    display: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    min-width: 0;
    padding: 0 0 0 16px;
    background: rgba(0, 0, 0, 0.18);
    box-shadow: none;
    border-radius: 0;
  }

  .cb-nav__menu .menu-item-has-children.is-open > .sub-menu {
    display: block;
  }

  .cb-nav__menu .sub-menu a {
    white-space: normal;
    padding: 12px 4px;
  }

  .cb-footer-widgets__inner {
    padding-top: 36px;
    padding-bottom: 36px;
    gap: 28px;
  }

  .cb-nav__cta {
    margin-left: auto;
  }

  /* Hamburger visible on mobile */
  .cb-hamburger {
    display: inline-flex;
  }

  /* Search drops to its own full-width row so it isn't jammed in the bar */
  .cb-search {
    flex-basis: 100%;
    margin-left: 0;
    margin-top: 10px;
  }

  .cb-search__field {
    width: 100%;
  }

  .cb-search input {
    flex: 1;
    width: auto;
    min-width: 0;
  }

  /* Hero compresses */
  .cb-hero.wp-block-cover {
    min-height: 380px;
  }

  .cb-hero__inner {
    padding: 0 22px;
  }

  /* Tighter body gutters on mobile */
  .cb-body {
    padding-left: 22px;
    padding-right: 22px;
  }

  /* Keep help rows icon-beside-text on mobile (WP stacks columns by default) */
  .cb-help__row.wp-block-columns {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 14px;
    align-items: flex-start;
  }

  .cb-help__row .cb-help__icon {
    flex: 0 0 44px;
    width: 44px;
  }

  .cb-help__row .wp-block-column {
    margin-left: 0;
  }

  /* CTA banner stacks vertically */
  .cb-cta {
    flex-direction: column;
    text-align: center;
    gap: 20px;
    padding: 28px 24px;
  }

  /* Footer stacks vertically */
  .cb-footer {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .cb-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) and (min-width: 782px) {
  .cb-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}
