/* ══════════════════════════════════════════
   Unit detail page
   ══════════════════════════════════════════ */

/* Wider layout on this page */
.unit-hero .container,
.unit-content .container {
  max-width: 1360px;
}

/* ── Hero ── */
.unit-hero {
  position: relative;
  padding: 90px 0 56px;
  overflow: hidden;
}

.unit-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(31, 28, 53, 0.88) 0%,
    rgba(58, 104, 155, 0.75) 45%,
    rgba(0, 191, 173, 0.55) 100%
  );
  z-index: 0;
}

.unit-hero .container {
  position: relative;
  z-index: 1;
}

.unit-hero__main {
  text-align: left;
}

.unit-hero__eyebrow {
  display: inline-block;
  padding: 6px 14px;
  margin-bottom: 16px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.95);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  backdrop-filter: blur(4px);
}

.unit-hero__eyebrow--link {
  text-decoration: none;
  color: rgba(255, 255, 255, 0.95);
}

.unit-hero__eyebrow--link:hover,
.unit-hero__eyebrow--link:focus-visible {
  text-decoration: none;
  color: var(--ep-white-color);
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.2);
}

.unit-blocks__header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.unit-blocks__clear-filters {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  position: relative;
  opacity: 1;
  border: 1px solid var(--block-accent-border);
  background: var(--ep-white-color);
  color: var(--ep-title-color);
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(31, 28, 53, 0.08);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.unit-blocks__clear-filters i {
  font-size: 16px;
  color: var(--block-accent);
}

.unit-blocks__clear-filters:hover,
.unit-blocks__clear-filters:focus-visible {
  color: var(--block-accent);
  text-decoration: none;
  background: var(--block-accent-light);
  border-color: var(--block-accent);
  transform: translateY(-1px);
}

.unit-hero__title {
  margin: 0 0 20px;
  font-size: clamp(28px, 5vw, 46px);
  font-weight: 700;
  line-height: 1.15;
  color: var(--ep-white-color);
  letter-spacing: -0.02em;
}

.unit-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.unit-hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  backdrop-filter: blur(6px);
}

.unit-hero__badge i {
  font-size: 14px;
  opacity: 0.9;
}

.unit-hero__badge--subject {
  background: rgba(0, 191, 173, 0.25);
  border: 1px solid rgba(0, 191, 173, 0.45);
  color: #e8fffc;
}

.unit-hero__badge--grade {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: var(--ep-white-color);
}

.unit-hero__badge--link {
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.unit-hero__badge--link:hover,
.unit-hero__badge--link:focus-visible {
  text-decoration: none;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(87, 242, 208, 0.18);
}

.unit-hero__badge--subject.unit-hero__badge--link:hover,
.unit-hero__badge--subject.unit-hero__badge--link:focus-visible {
  background: rgba(0, 191, 173, 0.35);
  border-color: rgba(87, 242, 208, 0.68);
}

.unit-hero__badge--grade.unit-hero__badge--link:hover,
.unit-hero__badge--grade.unit-hero__badge--link:focus-visible {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.55);
}

/* Related units */
.unit-hero__related {
  margin-top: 24px;
}

.unit-hero__related-head {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}

.unit-hero__related-head i {
  font-size: 14px;
  color: rgba(87, 242, 208, 0.9);
}

.unit-hero__related-panel {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 14px;
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.unit-hero__related-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.unit-hero__related-item {
  margin: 0;
  padding: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.unit-hero__related-item:last-child {
  border-bottom: none;
}

.unit-hero__related-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.9);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  transition: background 0.22s ease, color 0.22s ease, padding-left 0.22s ease;
}

.unit-hero__related-link:hover {
  background: rgba(0, 191, 173, 0.18);
  color: var(--ep-white-color);
  padding-left: 24px;
}

.unit-hero__related-name {
  flex: 1;
  min-width: 0;
}

.unit-hero__related-go {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.45);
  font-size: 12px;
  transition: background 0.22s ease, color 0.22s ease, transform 0.22s ease;
}

.unit-hero__related-link:hover .unit-hero__related-go {
  background: rgba(0, 191, 173, 0.35);
  color: var(--ep-white-color);
  transform: translate(2px, -2px);
}

/* ── Content area ── */
.unit-content {
  padding-top: 32px;
  padding-bottom: 56px;
  background: var(--ep-offwhite-color);
}

.unit-content.section-gap {
  padding-top: 32px;
  padding-bottom: 56px;
}

.unit-blocks {
  width: 100%;
}

/* Tab menu — all tabs always visible (wrap, no scroll hide) */
.unit-blocks__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  padding: 8px;
  background: var(--ep-white-color);
  border-radius: 14px;
  border: 1px solid var(--ep-border-color);
  box-shadow: 0 2px 12px rgba(31, 28, 53, 0.05);
}

.unit-blocks__tab {
  flex: 1 1 auto;
  min-width: fit-content;
  padding: 12px 20px;
  border: 1px solid var(--ep-border-color);
  border-radius: 10px;
  background: var(--ep-offwhite-color);
  color: var(--ep-secondary-color);
  font-family: var(--ep-font-family);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.unit-blocks__tab:hover:not(.active) {
  color: var(--block-accent);
  background: var(--block-accent-light);
  border-color: var(--block-accent-border);
}

.unit-blocks__tab.active {
  background: var(--block-accent);
  border-color: var(--block-accent);
  color: var(--ep-white-color);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--block-accent) 35%, transparent);
}

.unit-blocks__tab:focus-visible {
  outline: 2px solid var(--block-accent);
  outline-offset: 2px;
}

.unit-blocks__panels {
  margin-top: 0;
}

/* Block color themes */
.unit-blocks__tab--theme-0,
.unit-blocks__section--theme-0 { --block-accent: #00bfad; --block-accent-light: rgba(0, 191, 173, 0.1); --block-accent-border: rgba(0, 191, 173, 0.28); --block-accent-bg: rgba(0, 191, 173, 0.04); }
.unit-blocks__tab--theme-1,
.unit-blocks__section--theme-1 { --block-accent: #006bff; --block-accent-light: rgba(0, 107, 255, 0.1); --block-accent-border: rgba(0, 107, 255, 0.28); --block-accent-bg: rgba(0, 107, 255, 0.04); }
.unit-blocks__tab--theme-2,
.unit-blocks__section--theme-2 { --block-accent: #ff723a; --block-accent-light: rgba(255, 114, 58, 0.1); --block-accent-border: rgba(255, 114, 58, 0.28); --block-accent-bg: rgba(255, 114, 58, 0.04); }
.unit-blocks__tab--theme-3,
.unit-blocks__section--theme-3 { --block-accent: #c342ff; --block-accent-light: rgba(195, 66, 255, 0.1); --block-accent-border: rgba(195, 66, 255, 0.28); --block-accent-bg: rgba(195, 66, 255, 0.04); }
.unit-blocks__tab--theme-4,
.unit-blocks__section--theme-4 { --block-accent: #3379c9; --block-accent-light: rgba(51, 121, 201, 0.1); --block-accent-border: rgba(51, 121, 201, 0.28); --block-accent-bg: rgba(51, 121, 201, 0.04); }
.unit-blocks__tab--theme-5,
.unit-blocks__section--theme-5 { --block-accent: #bc8410; --block-accent-light: rgba(188, 132, 16, 0.12); --block-accent-border: rgba(188, 132, 16, 0.3); --block-accent-bg: rgba(188, 132, 16, 0.05); }

.unit-blocks__panel {
  background: var(--ep-white-color);
  border-radius: 18px;
  border: 1px solid var(--ep-border-color);
  border-top: 4px solid var(--block-accent);
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(31, 28, 53, 0.06);
}

/* Allow select dropdowns to render outside filter card bounds */
.unit-blocks__panel--filters {
  overflow: visible;
}

.unit-blocks__panel.tab-pane.active {
  animation: unitPanelIn 0.3s ease both;
}

@keyframes unitPanelIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.unit-blocks__header {
  padding: 22px 28px;
  background: linear-gradient(135deg, var(--block-accent-light) 0%, var(--block-accent-bg) 100%);
  border-bottom: 1px solid var(--block-accent-border);
}

.unit-blocks__title {
  margin: 0;
  font-size: clamp(18px, 3vw, 22px);
  font-weight: 700;
  line-height: 1.25;
  color: var(--ep-title-color);
}

/* Fields */
.unit-fields {
  padding: 16px 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.unit-fields__item {
  padding: 14px 0;
  border-bottom: 1px solid var(--ep-border-color);
}

.unit-fields__item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.unit-fields__item:first-child {
  padding-top: 4px;
}

.unit-fields__label {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--block-accent);
}

.unit-fields__value {
  color: var(--ep-paragraph-color);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.7;
}

.unit-fields__text {
  color: var(--ep-title-color);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.unit-fields__text p {
  margin: 0 0 12px;
}

.unit-fields__text p:last-child {
  margin-bottom: 0;
}

.unit-fields__text ul,
.unit-fields__text ol {
  margin: 0 0 12px;
  padding-left: 1.4em;
}

.unit-fields__text a {
  color: var(--block-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.unit-fields__text table {
  width: 100%;
  min-width: 400px;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 14px;
  border: 1px solid var(--ep-border-color);
  border-radius: 8px;
  overflow: hidden;
}

.unit-fields__text table th,
.unit-fields__text table td {
  border: 1px solid var(--ep-border-color);
  padding: 9px 12px;
  text-align: left;
}

.unit-fields__text table th {
  background: var(--block-accent-light);
  font-weight: 600;
  color: var(--ep-title-color);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Tags — inherit block accent */
.unit-fields__tags {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.unit-fields__tags li {
  margin: 0;
  padding: 0;
}

.unit-fields__tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--block-accent-light);
  border: 1px solid var(--block-accent-border);
  border-radius: 999px;
  color: var(--ep-title-color);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
}

.unit-fields__tag i {
  color: var(--block-accent);
  font-size: 12px;
}

/* Inquiry questions table */
.unit-fields__table-wrap {
  border: 1px solid var(--ep-border-color);
  border-radius: 12px;
  background: var(--ep-white-color);
  overflow: hidden;
}

.unit-fields__table {
  margin: 0;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 14px;
  color: var(--ep-title-color);
}

.unit-fields__table thead th:first-child,
.unit-fields__table tbody td:first-child {
  width: 10%;
  text-align: center;
}

.unit-fields__table thead th:last-child,
.unit-fields__table tbody td:last-child {
  width: 90%;
}

.unit-fields__table thead th {
  background: linear-gradient(135deg, var(--block-accent-light) 0%, var(--block-accent-bg) 100%);
  border-bottom: 1px solid var(--ep-border-color);
  border-right: 1px solid var(--ep-border-color);
  color: var(--ep-title-color);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 10px 14px;
}

.unit-fields__table thead th:last-child {
  border-right: none;
}

.unit-fields__table tbody td {
  padding: 12px 14px;
  vertical-align: top;
  border-right: 1px solid var(--ep-border-color);
  border-bottom: 1px solid var(--ep-border-color);
}

.unit-fields__table tbody td:last-child {
  border-right: none;
}

.unit-fields__table tbody tr:last-child td {
  border-bottom: none;
}

.unit-question-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 100px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1.2;
}

/* Factual: light blue/purple */
.unit-question-type--factual {
  color: #4c57b8;
  background: rgba(123, 141, 255, 0.15);
  border-color: rgba(123, 141, 255, 0.35);
}

/* Conceptual: green */
.unit-question-type--conceptual {
  color: #1f7f48;
  background: rgba(53, 173, 99, 0.16);
  border-color: rgba(53, 173, 99, 0.34);
}

/* Debatable: yellow-orange */
.unit-question-type--debatable {
  color: #8e5600;
  background: rgba(236, 167, 53, 0.2);
  border-color: rgba(236, 167, 53, 0.4);
}

.unit-question-type--default {
  color: var(--ep-title-color);
  background: var(--ep-offwhite-color);
  border-color: var(--ep-border-color);
}

.unit-assessment-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1.2;
}

.unit-assessment-type--summative {
  color: #5a3fb6;
  background: rgba(139, 110, 255, 0.16);
  border-color: rgba(139, 110, 255, 0.36);
}

.unit-assessment-type--formative {
  color: #0d7f84;
  background: rgba(0, 191, 173, 0.17);
  border-color: rgba(0, 191, 173, 0.36);
}

.unit-assessment-type--default {
  color: var(--ep-title-color);
  background: var(--ep-offwhite-color);
  border-color: var(--ep-border-color);
}

.unit-fields__table--assessment thead th:first-child,
.unit-fields__table--assessment tbody td:first-child {
  width: 20%;
}

.unit-fields__table--assessment thead th:nth-child(2),
.unit-fields__table--assessment tbody td:nth-child(2) {
  width: 10%;
  text-align: center;
}

.unit-fields__table--assessment thead th:last-child,
.unit-fields__table--assessment tbody td:last-child {
  width: 70%;
}

/* Unit list table (4 columns) */
.unit-list-table {
  table-layout: fixed;
  min-width: 760px;
}

.unit-list-table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.unit-list-table thead th,
.unit-list-table tbody td {
  width: auto !important;
  text-align: center !important;
  vertical-align: middle;
  word-break: break-word;
}

.unit-list-table thead th:nth-child(1),
.unit-list-table tbody td:nth-child(1) {
  width: 16% !important;
}

.unit-list-table thead th:nth-child(2),
.unit-list-table tbody td:nth-child(2) {
  width: 12% !important;
}

.unit-list-table thead th:nth-child(3),
.unit-list-table tbody td:nth-child(3) {
  width: 22% !important;
}

.unit-list-table thead th:nth-child(4),
.unit-list-table tbody td:nth-child(4) {
  width: 50% !important;
}

.unit-list-table__link {
  color: #6f42c1;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.unit-list-table__link:hover,
.unit-list-table__link:focus {
  color: #5b34a3;
}

/* Unit list pagination */
.unit-list-pagination {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.unit-list-pagination__meta {
  color: var(--ep-paragraph-color);
  font-size: 13px;
  line-height: 1.4;
}

.unit-list-pagination__controls {
  margin-left: auto;
}

.unit-list-pagination .pagination {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.unit-list-pagination .page-item {
  margin: 0;
}

.unit-list-pagination .page-link {
  border-radius: 6px;
  border: 1px solid var(--ep-border-color);
  color: var(--ep-title-color);
  background: var(--ep-white-color);
  padding: 6px 10px;
  min-width: 34px;
  text-align: center;
  line-height: 1.2;
  font-size: 13px;
}

.unit-list-pagination .page-item.active .page-link {
  color: var(--ep-white-color);
  border-color: var(--block-accent);
  background: var(--block-accent);
}

.unit-list-pagination .page-item.disabled .page-link {
  color: #8f97ac;
  background: var(--ep-offwhite-color);
}

.unit-list-pagination .page-link:hover,
.unit-list-pagination .page-link:focus {
  color: var(--block-accent);
  background: var(--block-accent-light);
  border-color: var(--block-accent-border);
  box-shadow: none;
}

@media only screen and (max-width: 767px) {
  .unit-list-pagination {
    justify-content: center;
  }

  .unit-list-pagination__meta {
    width: 100%;
    text-align: center;
  }

  .unit-list-pagination__controls {
    margin-left: 0;
  }
}

/* ── Responsive ── */
@media only screen and (max-width: 1199px) {
  .unit-list-table {
    min-width: 700px;
  }

  .unit-list-table thead th:nth-child(1),
  .unit-list-table tbody td:nth-child(1) {
    width: 18% !important;
  }

  .unit-list-table thead th:nth-child(2),
  .unit-list-table tbody td:nth-child(2) {
    width: 14% !important;
  }

  .unit-list-table thead th:nth-child(3),
  .unit-list-table tbody td:nth-child(3) {
    width: 24% !important;
  }

  .unit-list-table thead th:nth-child(4),
  .unit-list-table tbody td:nth-child(4) {
    width: 44% !important;
  }
}

@media only screen and (min-width: 992px) {
  .unit-hero {
    padding: 80px 0 64px;
  }

  .unit-fields {
    padding: 20px 28px 24px;
  }

  .unit-blocks__header {
    padding: 20px 28px;
  }
}

@media only screen and (max-width: 991px) {
  .unit-hero {
    padding: 80px 0 48px;
  }

  .unit-list-table {
    min-width: 660px;
  }

  .unit-list-table thead th,
  .unit-list-table tbody td {
    font-size: 13px;
    padding: 9px 10px !important;
  }

  .unit-list-table thead th:nth-child(1),
  .unit-list-table tbody td:nth-child(1),
  .unit-list-table thead th:nth-child(2),
  .unit-list-table tbody td:nth-child(2),
  .unit-list-table thead th:nth-child(3),
  .unit-list-table tbody td:nth-child(3),
  .unit-list-table thead th:nth-child(4),
  .unit-list-table tbody td:nth-child(4) {
    width: auto !important;
  }
}

@media only screen and (max-width: 767px) {
  .unit-hero {
    padding: 70px 0 40px;
  }

  .unit-hero__related {
    margin-top: 24px;
  }

  .unit-hero__related-link {
    padding: 12px 16px;
    font-size: 14px;
  }

  .unit-hero__related-link:hover {
    padding-left: 20px;
  }

  .unit-content,
  .unit-content.section-gap {
    padding-top: 24px;
    padding-bottom: 48px;
  }

  .unit-blocks__tabs {
    padding: 8px;
    gap: 6px;
    margin-bottom: 18px;
  }

  .unit-blocks__tab {
    flex: 1 1 calc(50% - 6px);
    padding: 11px 14px;
    font-size: 13px;
    min-height: 44px;
  }

  .unit-blocks__panel {
    border-radius: 14px;
  }

  .unit-blocks__header {
    padding: 18px 20px;
  }

  .unit-fields {
    padding: 16px 20px 20px;
  }

  .unit-fields__value {
    font-size: 15px;
  }

  .unit-fields__tag {
    font-size: 13px;
    padding: 6px 12px;
  }

  .unit-fields__table thead th,
  .unit-fields__table tbody td {
    padding: 10px 11px;
  }

  .unit-question-type {
    min-width: 92px;
    font-size: 11px;
  }

  .unit-assessment-type {
    min-width: 82px;
    font-size: 10px;
    padding: 5px 8px;
  }

  .unit-list-table {
    min-width: 600px;
  }

  .unit-list-table thead th,
  .unit-list-table tbody td {
    font-size: 12px;
    padding: 8px 9px !important;
  }

  .unit-list-table__link {
    font-size: 12px;
  }
}

@media only screen and (max-width: 479px) {
  .unit-blocks__header-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .unit-hero__meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .unit-hero__badge {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .unit-hero__related-link,
  .unit-blocks__tab,
  .unit-blocks__panel.tab-pane.active {
    animation: none;
    transition: none;
  }
}
