/* =====================================================================
   Melbourne Discovery Day itinerary — styles for the CMS rich-text block
   Scope: Informa paragraph blocks that contain a table (.table-wrapper).
   Targets only the plain tags the editor keeps (h2, h3, p, table, ul, strong, em, br).
   ===================================================================== */

div[data-testid="informa-paragraph"]:has(> .table-wrapper) {
  --nh-navy: #0b1d45;
  --nh-accent: #2f7de1;
  --nh-accent-soft: #eaf2fd;
  --nh-kicker: #9cc3ff;
  --nh-ink: #1b2333;
  --nh-muted: #5d6779;
  --nh-line: #e2e7f0;
  --nh-soft: #f5f7fb;
  --nh-amber: #8a5a00;
  --nh-amber-soft: #fff3dc;
  color: var(--nh-ink);
  line-height: 1.55;
}

/* ---------- Neutralise CMS heading/paragraph decorations inside this block ---------- */
div[data-testid="informa-paragraph"]:has(> .table-wrapper) > h2::before,
div[data-testid="informa-paragraph"]:has(> .table-wrapper) > h2::after,
div[data-testid="informa-paragraph"]:has(> .table-wrapper) > h3::before,
div[data-testid="informa-paragraph"]:has(> .table-wrapper) > h3::after,
div[data-testid="informa-paragraph"]:has(> .table-wrapper) > p::after {
  content: none !important;
  display: none !important;
}

/* ---------- Delegation Pick Up callout (first h2 + its paragraph) ---------- */
div[data-testid="informa-paragraph"]:has(> .table-wrapper) > h2 {
  margin: 0 !important;
  padding: 18px 22px 4px !important;
  background: var(--nh-accent-soft) !important;
  border: 0 !important;
  border-left: 4px solid var(--nh-accent) !important;
  border-radius: 0 10px 0 0 !important;
  color: var(--nh-navy) !important;
  font-size: 1.125rem !important;
  font-weight: 700;
  line-height: 1.3 !important;
  letter-spacing: normal;
  text-transform: none;
}
div[data-testid="informa-paragraph"]:has(> .table-wrapper) > h2 + p {
  margin: 0 0 32px !important;
  padding: 0 22px 18px !important;
  background: var(--nh-accent-soft) !important;
  border: 0 !important;
  border-left: 4px solid var(--nh-accent) !important;
  border-radius: 0 0 10px 0 !important;
  color: var(--nh-ink);
}

/* ---------- Section header band: "Section N" p + h3 (+ optional time p) ---------- */
div[data-testid="informa-paragraph"]:has(> .table-wrapper) > p:has(+ h3) {
  margin: 28px 0 0 !important;
  padding: 18px 22px 2px !important;
  background: var(--nh-navy) !important;
  border: 0 !important;
  border-radius: 12px 12px 0 0 !important;
  color: var(--nh-kicker) !important;
  font-size: 0.75rem !important;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.4 !important;
  text-transform: uppercase;
}
div[data-testid="informa-paragraph"]:has(> .table-wrapper) > p:has(+ h3) + h3 {
  margin: 0 !important;
  padding: 0 22px 18px !important;
  background: var(--nh-navy) !important;
  border: 0 !important;
  border-radius: 0 !important;
  position: static !important;
  color: #fff !important;
  font-size: 1.25rem !important;
  font-weight: 700;
  line-height: 1.3 !important;
}
div[data-testid="informa-paragraph"]:has(> .table-wrapper) > p:has(+ h3) + h3:has(+ p) {
  padding-bottom: 6px !important;
}
/* time window line, e.g. "02:00pm – 05:00pm" */
div[data-testid="informa-paragraph"]:has(> .table-wrapper) > p:has(+ h3) + h3 + p {
  margin: 0 !important;
  padding: 0 22px 18px !important;
  background: var(--nh-navy) !important;
  border: 0 !important;
  border-radius: 0 !important;
  color: #d6e4ff !important;
  font-size: 0.875rem !important;
  font-weight: 600;
  line-height: 1.55 !important;
}
div[data-testid="informa-paragraph"]:has(> .table-wrapper) > p:has(+ h3) + h3 + p::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 7px;
  vertical-align: -2px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%239cc3ff' stroke-width='1.6'%3E%3Ccircle cx='8' cy='8' r='6.5'/%3E%3Cpath d='M8 4.5V8l2.5 1.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* ---------- Table card ---------- */
div[data-testid="informa-paragraph"]:has(> .table-wrapper) > .table-wrapper {
  margin: 0 0 28px !important;
  padding: 0 !important;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--nh-line);
  border-top: 0;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 1px 2px rgba(11, 29, 69, 0.04), 0 4px 16px rgba(11, 29, 69, 0.05);
}
/* hide empty paragraphs the editor leaves behind (<p><br></p>) */
div[data-testid="informa-paragraph"]:has(> .table-wrapper) > p:has(> br:only-child) {
  display: none;
}

div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper table {
  width: 100%;
  min-width: 0;
  margin: 0;
  border: 0;
  border-collapse: collapse;
  border-spacing: 0;
  background: transparent;
  font-size: 0.9375em;
}
div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper tr {
  background: transparent;
  border: 0;
}
div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper th,
div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper td {
  padding: 14px 18px;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  text-align: left;
  vertical-align: top;
}
div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper th:first-child,
div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper td:first-child {
  width: 130px;
  padding-left: 22px;
}
div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper th:nth-child(2) {
  width: 44%;
}
div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper th:last-child,
div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper td:last-child {
  padding-right: 22px;
}

/* column headings */
div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper thead th {
  padding-top: 10px;
  padding-bottom: 10px;
  background: var(--nh-soft);
  border-bottom: 1px solid var(--nh-line);
  color: var(--nh-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* rows */
div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper tbody tr + tr {
  border-top: 1px solid var(--nh-line);
}
div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper tbody tr:hover {
  background: #fafbfd;
}

/* Time column */
div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper td:first-child {
  color: var(--nh-navy);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
/* "TBC" times in the RMIT table (3rd table, rows 2+) */
div[data-testid="informa-paragraph"]:has(> .table-wrapper) > .table-wrapper:nth-of-type(3) tbody tr:nth-child(n+2) > td:first-child {
  color: var(--nh-amber);
  letter-spacing: 0.04em;
}

/* Item column */
div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper td:nth-child(2) strong {
  color: var(--nh-navy);
  font-weight: 700;
}
div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper td:nth-child(2) em {
  color: var(--nh-muted);
}
div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper td:nth-child(2) br + em {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.875rem;
}

/* Speakers / Notes / Location column */
div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper td:nth-child(3) {
  color: var(--nh-muted);
}
div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper td:nth-child(3) strong {
  color: var(--nh-ink);
}
div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper td ul,
div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper td li {
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
  color: inherit !important;
  font: inherit !important;
  letter-spacing: inherit !important;
}
div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper td li::before {
  content: none;
}
div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper td li + li {
  margin-top: 6px !important;
}

/* Sub-item row (empty time cell, e.g. the Partnership Showcase Panel) */
div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper tbody tr:has(> td:first-child > br:only-child) {
  border-top: 0;
}
div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper tbody tr:has(> td:first-child > br:only-child) > td {
  padding-top: 0;
}
div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper tbody tr:has(> td:first-child > br:only-child) > td:nth-child(2) {
  position: relative;
  padding-left: 34px;
}
div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper tbody tr:has(> td:first-child > br:only-child) > td:nth-child(2)::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 18px;
  width: 8px;
  height: 12px;
  border-left: 2px solid var(--nh-line);
  border-bottom: 2px solid var(--nh-line);
  border-bottom-left-radius: 4px;
}

/* ---------- Group labels (rows 9–12 of the first table) ----------
   The editor ran "Group 1" into the next word ("Group 1Tour"), so the original
   text is hidden and rebuilt as a coloured tag. Depends on row order. */
div[data-testid="informa-paragraph"]:has(> .table-wrapper) > .table-wrapper:first-of-type tbody tr:is(:nth-child(9), :nth-child(10), :nth-child(11), :nth-child(12)) > td:nth-child(2) {
  visibility: hidden;
  line-height: 0;
}
div[data-testid="informa-paragraph"]:has(> .table-wrapper) > .table-wrapper:first-of-type tbody tr:is(:nth-child(9), :nth-child(10), :nth-child(11), :nth-child(12)) > td:nth-child(2) > strong {
  display: block;
  visibility: visible;
  line-height: 1.55;
}
div[data-testid="informa-paragraph"]:has(> .table-wrapper) > .table-wrapper:first-of-type tbody tr:is(:nth-child(9), :nth-child(10), :nth-child(11), :nth-child(12)) > td:nth-child(2)::before {
  display: block;
  width: fit-content;
  margin-bottom: 6px;
  padding: 1px 9px;
  border-radius: 999px;
  visibility: visible;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.6;
}
div[data-testid="informa-paragraph"]:has(> .table-wrapper) > .table-wrapper:first-of-type tbody tr:is(:nth-child(9), :nth-child(11)) > td:nth-child(2)::before {
  content: "Group 1";
  background: var(--nh-accent-soft);
  color: #1c5bb0;
}
div[data-testid="informa-paragraph"]:has(> .table-wrapper) > .table-wrapper:first-of-type tbody tr:is(:nth-child(10), :nth-child(12)) > td:nth-child(2)::before {
  content: "Group 2";
  background: #e3f4f5;
  color: #0e7c86;
}
div[data-testid="informa-paragraph"]:has(> .table-wrapper) > .table-wrapper:first-of-type tbody tr:is(:nth-child(9), :nth-child(12)) > td:nth-child(2) > strong::before {
  content: "Tour ";
  color: var(--nh-ink);
  font-weight: 400;
}
div[data-testid="informa-paragraph"]:has(> .table-wrapper) > .table-wrapper:first-of-type tbody tr:is(:nth-child(10), :nth-child(11)) > td:nth-child(2) > strong::after {
  content: " Tour";
  color: var(--nh-ink);
  font-weight: 400;
}

/* ---------- Evening table: transport note on its own line ---------- */
div[data-testid="informa-paragraph"]:has(> .table-wrapper) > .table-wrapper:last-of-type tbody td:nth-child(2) {
  color: var(--nh-muted);
  font-size: 0.875em;
  font-style: italic;
}
div[data-testid="informa-paragraph"]:has(> .table-wrapper) > .table-wrapper:last-of-type tbody td:nth-child(2) > strong {
  display: block;
  margin-bottom: 4px;
  color: var(--nh-navy);
  font-size: 1.0714em;
  font-style: normal;
}

/* ---------- Mobile: rows become stacked cards ---------- */
@media (max-width: 640px) {
  div[data-testid="informa-paragraph"]:has(> .table-wrapper) > p:has(+ h3),
  div[data-testid="informa-paragraph"]:has(> .table-wrapper) > p:has(+ h3) + h3,
  div[data-testid="informa-paragraph"]:has(> .table-wrapper) > p:has(+ h3) + h3 + p {
    padding-left: 18px;
    padding-right: 18px;
  }
  div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper table,
  div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper tbody,
  div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper tr,
  div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper td {
    display: block;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
  }
  div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper tbody tr {
    padding: 14px 18px;
  }
  div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper td,
  div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper td:first-child,
  div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper td:last-child {
    width: auto;
    padding: 0;
  }
  /* hide empty cells (editor fills them with a lone <br>) */
  div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper td:has(> br:only-child) {
    display: none;
  }
  div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper td:first-child {
    margin-bottom: 2px;
    font-size: 0.875rem;
  }
  div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper td:nth-child(2) {
    font-size: 1rem;
  }
  div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper td:nth-child(3) {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--nh-line);
    font-size: 0.875rem;
  }
  div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper tbody tr:has(> td:first-child > br:only-child) {
    padding-top: 0;
  }
  div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper tbody tr:has(> td:first-child > br:only-child) > td:nth-child(2) {
    padding-left: 18px;
  }
  div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper tbody tr:has(> td:first-child > br:only-child) > td:nth-child(2)::before {
    left: 2px;
  }
  div[data-testid="informa-paragraph"]:has(> .table-wrapper) .table-wrapper tbody tr:has(> td:first-child > br:only-child) > td:nth-child(3) {
    margin-left: 18px;
    padding-top: 10px;
  }
}