/* #ow-table is for all table styles, 
  .optus-plans-table is for shared styles between tables, 
  use tab panel ID for table specific. e.g. #GiftCardPlans */
:root {
  --optus-jadeLight: #267993;
  --optus-teal: #00a3ad;
  --optus-yellow: #fdcc08;
  --optus-blueLight: #c2f4f6;
}

.text-enlarge-inator {
  font-size: max(1.666666em, 20px);
}

.availability-specifier {
  display: block;
  text-wrap: balance;
}

#ow-table.optus-plans-table {
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-black: 800;
  display: table;
  table-layout: fixed;
  margin: 0;
  border-collapse: collapse;
  /* border-style: hidden overrides the border from inner cells */
  border-style: hidden;
  font-size: 1rem;

  /* Optus Colors - place on tr/th/td */
  .optus-teal :is(th, td),
  :is(th, td).optus-teal {
    background: var(--optus-teal);
    color: var(--white, #fff);
  }

  .optus-jadeLight :is(th, td),
  :is(th, td).optus-jadeLight {
    background: var(--optus-jadeLight);
    color: var(--white, #fff);
  }

  .optus-yellow :is(th, td),
  :is(th, td).optus-yellow {
    background: var(--optus-yellow);
    color: var(--brand-primary-500, #001080);
  }

  .optus-blueLight :is(th, td),
  :is(th, td).optus-blueLight {
    background: var(--optus-blueLight);
  }

  /* END Optus Colors */

  /* Columns */
  .ow-table__column--heading,
  .ow-table__column--gift-card {
    width: 162px;
    width: 17.6%;
    min-width: 121px;

    #DataPlans & {
      width: 20%;
    }
  }

  #GiftCardPlans & .ow-table__column--heading {
    width: 30%;
  }

  #GiftCardPlans & .ow-table__column--gift-card {
    width: 16%;
  }

  #DataPlans & .ow-table__column--desc {
    min-width: 210px;
  }

  /* Table */
  tr {
    display: table-row;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
  }

  :is(th, td) {
    position: relative;
    display: table-cell;
    padding: var(--spacing-200, 16px);
    font-family: "Inter", sans-serif;
    font-size: max(1.2em, 10px);
    font-weight: var(--font-weight-medium);
    vertical-align: top;
    word-wrap: break-word;
    border-radius: 0 !important;

    &::before {
      content: none;
      display: none;
    }

    :where(h1, h2, h3, h4, h5, p, ul, ol) {
      font-family: inherit;
      font-size: inherit;
      font-weight: inherit;
      color: inherit;
    }
  }

  :where(.permonth-row, .months-row) :is(th, td) {
    padding: var(--spacing-100, 8px) var(--spacing-200, 16px);
  }

  :is(thead, tbody, tfoot) :is(th, td) {
    border: 1px solid;
    border-color: var(--white, #fff);
  }

  tbody tr:last-child :is(th, td) {
    border-bottom-width: 3px;
  }

  :where(h1, h2, h3, h4, h5, .h1, .h2, .h3, .h4, .h5) {
    margin-bottom: 0;
    /* font-family: inherit !important; */
    font-weight: var(--font-weight-black) !important;
    /* color: inherit !important; */
  }

  :where(h1, .h1) {
    font-size: 3em !important;
    font-size: max(3em, 32px) !important;
  }

  :where(h2, .h2) {
    font-size: 2.166666em !important;
    font-size: max(2.166666em, 20px) !important;
  }

  :where(h3, .h3) {
    font-size: 1.666666em !important;
    font-size: max(1.666666em, 18px) !important;
  }

  :where(h4, .h4) {
    font-size: 1.5em !important;
    font-size: max(1.5em, 16px) !important;
  }

  :where(h5, .h5) {
    font-size: 1.166666em !important;
    font-size: max(1.166666em, 12px) !important;
  }

  b {
    font-weight: var(--font-weight-black);
  }

  .body-row .h5 {
    font-size: 1.166666em !important;
    font-size: max(1.166666em, 14px) !important;
    line-height: 1.1 !important;
    margin-bottom: 0.333333em !important;
  }

  /* THEAD */
  thead {
    position: static;
    top: auto;
    left: auto;
    border-bottom: unset;
  }

  thead th {
    background: var(--optus-teal);
    color: var(--white, #fff);
    font-weight: var(--font-weight-medium);
  }

  thead :is(h2, h3) {
    font-family: inherit;
    font-weight: var(--font-weight-black);
    color: inherit;
  }

  sup {
    font-size: 0.58em;
    font-size: max(0.58em, 10px);
  }

  sub {
    bottom: 0;
    font-size: 0.65em;
    font-size: max(0.65em, 10px);
  }

  .logo-row th {
    padding: 0;
    padding: 0 0 0 var(--spacing-400, 32px);
    background: var(--brand-primary-500, #001080);
  }

  .logo-row__content {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .officeworks-cross-optus {
    position: sticky;
    left: var(--spacing-400, 32px);
  }

  .officeworks-two-dashes {
    position: sticky;
    right: 0;
  }

  #DataPlans & .bonus-gift-card-row th:first-child {
    position: sticky;
    /* top: 0; */
    left: -211px;
    z-index: 1;
    vertical-align: middle;
  }

  .heading-row th {
    vertical-align: top;
  }

  .table-heading {
    align-items: center;
    font-size: clamp(0.8rem, 1.639vw - 0.825rem, 1.2rem);
  }

  .table-heading__copy-container {
    white-space: nowrap;
  }

  #GiftCardPlans & .connect-spend {
    display: block;
    margin-bottom: 10%;
    color: inherit;
    font-family: inherit;
    font-size: 2.166666em !important;
    font-size: max(2.166666em, 18px) !important;
  }

  .table-title {
    font-size: 3.5em !important;
    font-size: max(3.5em, 32px) !important;
    line-height: 1.1 !important;

    #GiftCardPlans & {
      font-size: 4em !important;
      font-size: max(4em, 36px) !important;
      margin-bottom: 10%;
      color: var(--optus-yellow);
    }
  }

  .table-subheading {
    font-size: 2.666666em !important;
    font-size: max(2.666666em, 24px) !important;

    #GiftCardPlans & {
      margin-bottom: 10%;
      font-size: 1.666666em !important;
      font-size: max(1.666666em, 16px) !important;
      line-height: 1.1 !important;
    }
  }

  .table-copy {
    color: var(--brand-primary-500, #001080) !important;
    font-size: 1.33333em !important;
    font-size: max(1.33333em, 16px) !important;
    white-space: normal;
  }

  .plus-spend {
    color: var(--optus-yellow);
  }

  .bgcr__cell__container {
    display: flex;
    gap: var(--spacing-300, 24px);
    flex-direction: column;
    height: 100%;
    justify-content: space-between;
  }

  .bgcr__cell__upper {
    text-wrap: pretty;
  }

  .bgcr__cell__lower {
    text-wrap: balance;
  }

  .bgcr__cell__lower::before {
    content: "";
    display: block;
    border-bottom: 1px solid var(--white, #fff);
    margin-bottom: var(--spacing-100, 8px);
  }

  .bgcr__cell {
    /* Height shouldn't actually be set but allows using 100% height within table, miserable */
    height: 1px;

    @-moz-document url-prefix() {
      height: unset;
    }
  }

  /* TBODY */
  tbody {
    display: table-row-group;
    border-bottom: 3px solid var(--white, #fff);
  }

  :is(tbody, tfoot) :is(th, td) {
    text-align: center;
    vertical-align: middle;
    background: var(--optus-blueLight);
    color: var(--brand-primary-500, #001080);
  }

  #GiftCardPlans & :is(.bonus-gift-card-row, .data-row, .permonth-row) :is(th, td) {
    text-align: left;
  }

  & .permonth-row h4 {
    font-size: 1.666666em !important;
    margin-bottom: var(--spacing-50, 4px);
  }

  #DataPlans & tbody th:first-child {
    position: sticky;
    left: -1px;
    z-index: 2;
    text-wrap: balance;
    font-weight: var(--font-weight-black);
  }

  tbody td:first-of-type {
    text-wrap: pretty;
  }

  tbody a[target="_blank"]:not(.btn):has(svg) {
    padding-right: 15px;
  }

  /* TFOOT */
  .table-disclaimer {
    display: block;
    font-size: max(0.833333em, 10px);
    font-weight: var(--font-weight-normal);
    text-wrap: pretty;
  }

  .table-disclaimer a[target="_blank"]:not(.btn):has(svg) {
    padding-right: 13px;
    white-space: nowrap;
  }

  .table-disclaimer a[target="_blank"]:not(.btn) svg {
    bottom: 2px;
  }
}

@media screen and (max-width: 989px) {
  #ow-table.optus-plans-table {
    display: block;
    overflow: scroll hidden;
  }

  /* This pseudo-border !MUST! match its based cell borders otherwise they will explode! and there will also be rendering issues */
  #DataPlans #ow-table.optus-plans-table .bonus-gift-card-row th:first-child::before {
    content: "";
    display: block;
    background: transparent;
    width: calc(100% + 2px);
    height: calc(100% + 2px);
    position: absolute;
    left: -1px;
    top: -1px;
    border: var(--table-border--default);
    border-color: var(--white, #fff);
    pointer-events: none;
  }

  #DataPlans #ow-table.optus-plans-table tbody th:first-child::after {
    content: "";
    display: block;
    background: transparent;
    width: calc(100% + 2px);
    height: 100%;
    position: absolute;
    left: -1px;
    top: 0;
    border-left: var(--table-border--default);
    border-right: var(--table-border--default);
    border-color: var(--white, #fff);
    pointer-events: none;
  }
}
