/* Optional soft-pink theme for phone-first reading. */
[data-md-color-scheme="default"] {
  --md-default-bg-color: #fff8fb;
  --md-default-bg-color--light: #fffafd;
  --md-default-fg-color: #342a31;
  --md-default-fg-color--light: #6e5b65;
  --md-default-fg-color--lighter: #b6a1ac;
  --md-default-fg-color--lightest: #eadde4;
  --md-primary-fg-color: #c56f91;
  --md-primary-fg-color--light: #dd9ab3;
  --md-primary-fg-color--dark: #a85173;
  --md-primary-bg-color: #ffffff;
  --md-accent-fg-color: #ad4c72;
  --md-code-bg-color: #fff0f6;
  --md-footer-bg-color: #f4dfe9;
  --md-footer-fg-color: #4f3944;
  --md-footer-fg-color--light: #6e5360;
  --md-typeset-a-color: #a9496e;
}

[data-md-color-scheme="default"] .md-header,
[data-md-color-scheme="default"] .md-tabs {
  background-color: #c56f91;
}

[data-md-color-scheme="default"] .md-typeset table:not([class]) th {
  background-color: #f7e4ec;
}

[data-md-color-scheme="default"] .md-typeset table:not([class]),
[data-md-color-scheme="default"] .md-typeset table:not([class]) td,
[data-md-color-scheme="default"] .md-typeset table:not([class]) th {
  border-color: #e7cbd7;
}

/* Default dark theme. */
[data-md-color-scheme="slate"] {
  --md-default-bg-color: #0d1117;
  --md-default-bg-color--light: #161b22;
  --md-code-bg-color: #161b22;
  --md-footer-bg-color: #090c10;
  --md-typeset-a-color: #67d5d1;
}

/* Keep the current-page label, but remove the oversized site-name label. */
.md-header__topic:first-child {
  display: none;
}

/* The site name is not needed above the primary navigation. */
.md-sidebar--primary .md-nav--primary > .md-nav__title {
  display: none;
}

/* Keep ordinary reference tables readable; the overview matrix has its own responsive layout below. */
.md-typeset table:not([class]) {
  display: block;
  overflow-x: auto;
  white-space: normal;
}

/* Use the available desktop width instead of keeping the default narrow grid. */
@media screen and (min-width: 76.25em) {
  .md-grid,
  .md-main__inner {
    width: calc(100% - clamp(24px, 2vw, 48px));
    max-width: none;
  }

  .md-main__inner {
    margin-left: auto;
    margin-right: auto;
  }

  .md-sidebar--primary {
    width: 220px;
  }

  .md-sidebar--secondary {
    width: 180px;
  }

  [dir="ltr"] .md-sidebar--primary:not([hidden]) ~ .md-content > .md-content__inner {
    margin-left: 16px;
  }

  [dir="ltr"] .md-sidebar--secondary:not([hidden]) ~ .md-content > .md-content__inner {
    margin-right: 16px;
  }

  [dir="rtl"] .md-sidebar--primary:not([hidden]) ~ .md-content > .md-content__inner {
    margin-right: 16px;
  }

  [dir="rtl"] .md-sidebar--secondary:not([hidden]) ~ .md-content > .md-content__inner {
    margin-left: 16px;
  }
}

/* The total itinerary is a date-by-date matrix, not a sideways scrolling list. */
.itinerary-matrix {
  width: 100%;
  overflow-x: hidden;
}

.itinerary-matrix table:not([class]) {
  display: table;
  width: 100%;
  max-width: none;
  table-layout: fixed;
  overflow: visible;
  white-space: normal;
}

.itinerary-matrix th,
.itinerary-matrix td {
  width: auto;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  vertical-align: top;
}

.itinerary-matrix thead th:first-child,
.itinerary-matrix tbody td:first-child {
  width: 7rem;
}

.itinerary-matrix thead th {
  text-align: center;
}

@media screen and (max-width: 76.24em) {
  /* On a phone each matrix field becomes a vertical stack of dated cards. */
  .itinerary-matrix table:not([class]),
  .itinerary-matrix tbody,
  .itinerary-matrix tr,
  .itinerary-matrix td {
    display: block;
    width: 100%;
  }

  .itinerary-matrix thead {
    display: none;
  }

  .itinerary-matrix tbody tr {
    margin: 0 0 0.85rem;
    border: 1px solid var(--md-default-fg-color--lightest);
    border-radius: 0.35rem;
    overflow: hidden;
  }

  .itinerary-matrix tbody td:first-child {
    width: 100%;
    padding: 0.7rem 0.8rem;
    color: var(--md-primary-fg-color);
    background: var(--md-default-bg-color--light);
    font-weight: 700;
  }

  [data-md-color-scheme="slate"] .itinerary-matrix tbody td:first-child {
    color: var(--md-typeset-a-color);
  }

  .itinerary-matrix tbody td:not(:first-child) {
    padding: 0.7rem 0.8rem 0.7rem 5.2rem;
    position: relative;
    min-height: 2.8rem;
  }

  .itinerary-matrix tbody td:not(:first-child)::before {
    position: absolute;
    top: 0.7rem;
    left: 0.8rem;
    width: 4rem;
    color: var(--md-default-fg-color--light);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.25;
  }

  .itinerary-matrix tbody td:nth-child(2)::before { content: "10/4\A 周日"; white-space: pre; }
  .itinerary-matrix tbody td:nth-child(3)::before { content: "10/5\A 周一"; white-space: pre; }
  .itinerary-matrix tbody td:nth-child(4)::before { content: "10/6\A 周二"; white-space: pre; }
  .itinerary-matrix tbody td:nth-child(5)::before { content: "10/7\A 周三"; white-space: pre; }
  .itinerary-matrix tbody td:nth-child(6)::before { content: "10/8\A 周四"; white-space: pre; }
  .itinerary-matrix tbody td:nth-child(7)::before { content: "10/9\A 周五"; white-space: pre; }
  .itinerary-matrix tbody td:nth-child(8)::before { content: "10/10\A 周六"; white-space: pre; }
  .itinerary-matrix tbody td:nth-child(9)::before { content: "10/11\A 周日"; white-space: pre; }
  .itinerary-matrix tbody td:nth-child(10)::before { content: "10/12\A 周一"; white-space: pre; }
}
