/*
 * Shared mobile reading safeguards.
 * Table classes and wrappers are added by /js/mobile-reading.js.
 */

.glogo {
  align-items: center !important;
}

.glogo::before {
  content: "";
  display: inline-block;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 8px;
  background: url("/assets/brand/techhikaku-logo-512.png") center / contain no-repeat;
}

html {
  max-inline-size: 100%;
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  max-inline-size: 100%;
  overflow-wrap: normal;
  word-break: normal;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

main,
article,
section,
header,
footer,
nav,
aside {
  max-inline-size: 100%;
}

img,
picture,
video,
canvas,
svg,
iframe {
  max-inline-size: 100%;
}

img,
video,
canvas,
svg {
  block-size: auto;
}

iframe {
  border: 0;
}

:where(p, li, dd, dt, blockquote, figcaption, td, th) {
  overflow-wrap: break-word;
  word-break: normal;
}

a,
code,
kbd,
samp {
  overflow-wrap: anywhere;
  word-break: break-word;
}

pre {
  max-inline-size: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

pre code,
pre kbd,
pre samp {
  overflow-wrap: normal;
  word-break: normal;
}

.table-scroll {
  --mobile-table-min: 42rem;
  position: relative;
  max-inline-size: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.table-scroll__hint {
  display: none;
}

.table-scroll > table {
  inline-size: max(100%, var(--mobile-table-min));
  min-inline-size: var(--mobile-table-min);
}

@media (max-width: 44rem) {
  body {
    font-size: 0.9375rem;
    line-height: 1.75;
  }

  h1,
  h2,
  h3 {
    overflow-wrap: break-word !important;
    word-break: normal !important;
  }

  main h2,
  main h3 {
    padding-inline-end: 0 !important;
  }

  .gheader {
    position: sticky;
    top: 0;
  }

  .gheader > .gheader-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 0;
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 0;
    padding: 0;
    overflow: visible;
  }

  .gheader > .gheader-top > .glogo {
    width: 100%;
    min-width: 0;
    padding: 0.875rem 0.875rem 0.75rem;
  }

  .gheader > .gheader-top > .glogo::before {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
    border-radius: 7px;
  }

  .gheader > .gheader-top > .gheader-search {
    display: none;
  }

  .gheader > .gheader-top > .gnav {
    display: flex;
    flex-wrap: nowrap;
    gap: 1.25rem;
    width: 100%;
    max-width: none;
    min-width: 0;
    margin-left: 0 !important;
    padding-inline: 0.875rem;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    white-space: nowrap;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .gheader > .gheader-top > .gnav::-webkit-scrollbar {
    display: block;
    height: 3px;
  }

  .gheader > .gheader-top > .gnav a {
    flex: 0 0 auto;
    max-width: none;
    padding-block: 0.75rem;
    overflow: visible;
    white-space: nowrap;
    text-overflow: clip;
  }

  .section-head {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: start !important;
    gap: 0.625rem !important;
    margin-bottom: 1rem !important;
  }

  .section-head > * {
    min-width: 0;
  }

  .section-head .eyebrow {
    font-size: 0.8125rem !important;
    letter-spacing: 0.12em !important;
    line-height: 1.45 !important;
  }

  .section-head h2 {
    align-items: flex-start !important;
    gap: 0.625rem !important;
    font-size: 1.25rem !important;
    line-height: 1.4 !important;
  }

  .section-head h2::before {
    inline-size: 0.3125rem !important;
    block-size: 1.25rem !important;
    margin-top: 0.125rem;
    flex: 0 0 auto;
  }

  .section-head .sub,
  .section-head .more {
    justify-self: start;
    font-size: 0.8125rem !important;
    line-height: 1.45 !important;
    letter-spacing: 0.12em !important;
  }

  .lead,
  p.lead,
  .prose .lead {
    font-size: 0.9375rem !important;
    line-height: 1.85 !important;
  }

  .diag-group__title {
    font-size: 1rem !important;
    line-height: 1.5 !important;
  }

  .rank-row {
    grid-template-columns: 3.25rem minmax(0, 1fr) !important;
    align-items: start !important;
    gap: 0.75rem !important;
    padding: 1rem !important;
  }

  .rank-row__num {
    font-size: 2rem !important;
  }

  .rank-row__main {
    min-width: 0;
  }

  .rank-row__tag {
    display: none !important;
  }

  .table-scroll {
    margin-inline: 0;
    padding-block-start: 2rem;
  }

  .table-scroll__hint {
    position: absolute;
    inset-block-start: 0;
    inset-inline-start: 0;
    display: block;
    width: max-content;
    max-width: 100%;
    margin: 0;
    padding: 0.25rem 0.5rem;
    color: #334155;
    background: #eef2f6;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 0.8125rem;
    font-weight: 700;
    line-height: 1.4;
  }

  .table-scroll > table th,
  .table-scroll > table td {
    min-inline-size: 8rem;
  }

  .table-scroll > table th:first-child,
  .table-scroll > table td:first-child {
    min-inline-size: 9rem;
  }

  table:not(.mobile-reading-wide-table):not(.mobile-reading-if-then) {
    inline-size: 100%;
    max-inline-size: 100%;
    table-layout: fixed;
  }

  .mobile-reading-key-value,
  .mobile-reading-key-value tbody,
  .mobile-reading-key-value tr {
    display: block;
    inline-size: 100%;
  }

  .mobile-reading-key-value tr {
    margin-block: 0 0.75rem;
    border: 1px solid #d7dee7;
  }

  .mobile-reading-key-value th,
  .mobile-reading-key-value td {
    max-width: none;
    overflow: visible;
    overflow-wrap: break-word !important;
    white-space: normal !important;
    word-break: normal !important;
    text-overflow: clip !important;
    line-height: 1.65;
  }

  .mobile-reading-key-value--row-headings th,
  .mobile-reading-key-value--row-headings td {
    display: block;
    inline-size: 100% !important;
    min-inline-size: 0;
    text-align: start !important;
  }

  .mobile-reading-key-value--row-headings th {
    border-block-end: 1px solid #d7dee7;
    background: #f4f6f8;
    font-weight: 700;
  }

  .mobile-reading-key-value--column-headings thead {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }

  .mobile-reading-key-value--column-headings td {
    display: block;
    inline-size: 100% !important;
    min-inline-size: 0;
    text-align: start !important;
  }

  .mobile-reading-key-value--column-headings td::before {
    content: attr(data-mobile-label);
    display: block;
    margin: -0.25rem -0.25rem 0.5rem;
    padding: 0.25rem;
    color: #334155;
    background: #f4f6f8;
    font-size: 0.8125rem;
    font-weight: 700;
    line-height: 1.4;
  }

  .mobile-reading-if-then {
    inline-size: 100% !important;
    max-inline-size: 100% !important;
    min-inline-size: 0 !important;
    border: 0 !important;
    table-layout: auto !important;
  }

  .mobile-reading-if-then thead {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }

  .mobile-reading-if-then,
  .mobile-reading-if-then tbody,
  .mobile-reading-if-then tr,
  .mobile-reading-if-then td {
    display: block;
    inline-size: 100% !important;
    min-inline-size: 0 !important;
    max-inline-size: 100% !important;
  }

  .mobile-reading-if-then tr {
    margin: 0 0 0.875rem;
    background: var(--paper, #fff);
    border: 1px solid var(--line, #d7dee7);
  }

  .mobile-reading-if-then td {
    padding: 0.75rem 0.875rem !important;
    border: 0 !important;
    border-bottom: 1px dashed var(--line, #d7dee7) !important;
    white-space: normal !important;
    text-align: start !important;
    text-overflow: clip !important;
    overflow-wrap: break-word !important;
    word-break: normal !important;
    line-height: 1.65 !important;
  }

  .mobile-reading-if-then tr td:last-child {
    border-bottom: 0 !important;
  }

  .mobile-reading-if-then td::before {
    content: attr(data-mobile-label);
    display: block;
    margin: 0 0 0.375rem;
    color: #5b6573;
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.35;
  }

  .mobile-reading-if-then td:nth-child(1) {
    font-size: 0.875rem !important;
  }

  .mobile-reading-if-then td:nth-child(2) {
    font-size: 1rem !important;
    line-height: 1.5 !important;
  }

  .mobile-reading-if-then td:nth-child(3) {
    font-size: 0.875rem !important;
  }

  .mobile-reading-if-then td b {
    margin-inline-end: 0.35rem;
  }

  .mobile-reading-if-then .pick {
    display: inline;
    white-space: normal !important;
    font-size: 1rem !important;
    font-weight: 700;
    line-height: 1.5 !important;
  }
}
