/* /datasheet/ — one page in the shape of an ARM architecture reference manual.
   All colors come from the site variables so light, dark, and print all work. */

.sub {
  padding: 4.75rem 0 5.5rem;
}

.sub h1 {
  font-size: clamp(2.6rem, 6vw, 4.6rem);
}

html[lang="zh-Hans"] .sub h1 {
  font-size: clamp(2.9rem, 8vw, 5.2rem);
}

.sub-lead {
  max-width: 38rem;
  margin: 1.9rem 0 0;
  font-family: var(--serif);
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  line-height: 1.5;
  text-wrap: pretty;
}

.ds-doc {
  margin-top: 3.2rem;
}

/* Chapter heading: manual register — mono, uppercase, numbered. */
.ds-ch {
  margin-top: 3.2rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line-strong);
}

.ds-ch > h2 {
  margin: 0 0 1rem;
  font-family: var(--mono);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  display: flex;
  gap: 0.9rem;
  align-items: baseline;
}

.ds-ch > h2 .ds-no {
  color: var(--accent);
  min-width: 1.6rem;
}

.ds-p {
  max-width: 42rem;
  margin: 0 0 1rem;
  line-height: 1.6;
}

.ds-note {
  max-width: 42rem;
  margin: 0.9rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

/* Tables: scrollable regions so 375px never breaks the page. */
.ds-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  -webkit-overflow-scrolling: touch;
}

.ds-scroll:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.ds-table {
  width: 100%;
  min-width: 34rem;
  border-collapse: collapse;
  font-size: 0.92rem;
  line-height: 1.45;
}

.ds-table caption {
  caption-side: top;
  text-align: left;
  padding: 0.55rem 0.75rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  background: var(--wash);
}

.ds-table th,
.ds-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.ds-table thead th {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}

.ds-table tbody th {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}

.ds-table tbody th sub {
  font-size: 0.68em;
}

.ds-table tr:last-child th,
.ds-table tr:last-child td {
  border-bottom: 0;
}

.ds-table .num {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.ds-table thead th.num {
  text-align: right;
}

.ds-table .mono {
  font-family: var(--mono);
  font-size: 0.85rem;
  white-space: nowrap;
}

.ds-table td.wide {
  min-width: 16rem;
}

/* The title block is a narrow two-column table; let it fit without scrolling. */
.ds-title .ds-table {
  min-width: 0;
}

/* Features: datasheet bullet list. */
.ds-features {
  max-width: 44rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ds-features li {
  position: relative;
  padding-left: 1.4rem;
  margin: 0.5rem 0;
  line-height: 1.55;
}

.ds-features li::before {
  content: "■";
  position: absolute;
  left: 0;
  top: 0.14em;
  font-size: 0.55rem;
  color: var(--accent);
}

/* Functional description block diagram. */
.ds-fig {
  margin: 1.5rem 0 0;
}

.ds-fig-cap {
  margin-top: 0.6rem;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.ds-facts {
  margin-top: 2rem;
}

.ds-events {
  margin-top: 1rem;
}

.ds-bd {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.55fr) auto minmax(0, 1fr);
  gap: 0.8rem;
  align-items: center;
  margin: 1.5rem 0 0;
}

.ds-bd-col {
  display: grid;
  gap: 0.6rem;
  align-content: center;
}

.ds-bd-tag {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.ds-bd-box {
  border: 1px solid var(--line-strong);
  padding: 0.6rem 0.75rem;
  font-size: 0.88rem;
  line-height: 1.45;
  background: var(--wash);
}

.ds-bd-core .ds-bd-box {
  border: 2px solid var(--ink);
  background: transparent;
}

.ds-bd-core .ds-bd-box p {
  margin: 0.3rem 0;
}

.ds-bd-core .ds-bd-box p + p {
  border-top: 1px dashed var(--line);
  padding-top: 0.45rem;
}

.ds-bd-arrow {
  font-family: var(--mono);
  font-size: 1.3rem;
  color: var(--accent);
}

/* Timing diagram. WATER is dashed: its timing was never characterized. */
.ds-wave {
  display: block;
  width: 100%;
  height: auto;
  margin: 1.3rem 0 0;
}

.ds-wave .sig {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linejoin: miter;
}

.ds-wave .sig-soft {
  stroke: var(--line-strong);
  stroke-dasharray: 4 3;
}

.ds-wave .grid {
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 2 4;
}

.ds-wave text {
  font-family: var(--mono);
  font-size: 11px;
  fill: var(--muted);
}

.ds-wave .lbl {
  font-weight: 600;
  fill: var(--ink);
}

.ds-wave .edge {
  fill: var(--accent);
  font-weight: 600;
}

/* Errata: one bordered record per defect, real-manual four parts. */
.ds-errata {
  display: grid;
  gap: 1rem;
  margin: 1.2rem 0 0;
}

.ds-err {
  border: 1px solid var(--line-strong);
  padding: 0.85rem 1rem 1rem;
}

.ds-err-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.2rem;
  align-items: baseline;
  margin: 0 0 0.6rem;
  font-family: var(--mono);
  font-size: 0.8rem;
}

.ds-err-id {
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.06em;
}

.ds-err-aff {
  color: var(--muted);
}

.ds-err dl {
  margin: 0;
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 0.3rem 1rem;
  font-size: 0.92rem;
  line-height: 1.5;
}

.ds-err dt {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 0.22rem;
}

.ds-err dd {
  margin: 0;
}

.ds-st {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 600;
}

.ds-st .sym {
  display: inline-block;
  width: 1.25em;
}

/* Ordering information. */
.ds-pn {
  margin: 0 0 1rem;
  font-family: var(--mono);
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  letter-spacing: 0.04em;
}

.ds-pn .ds-pn-dim {
  color: var(--muted);
}

/* Legal notice. */
.ds-legal {
  max-width: 42rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.ds-legal p {
  margin: 0 0 0.8rem;
}

@media (max-width: 720px) {
  .ds-bd {
    grid-template-columns: 1fr;
  }

  .ds-bd-arrow {
    transform: rotate(90deg);
    justify-self: center;
  }

  .ds-err dl {
    grid-template-columns: 1fr;
    gap: 0.05rem;
  }

  .ds-err dd {
    margin-bottom: 0.5rem;
  }
}

@media print {
  @page {
    margin: 16mm;
  }

  :root,
  :root[data-theme="dark"] {
    --bg: #ffffff;
    --surface: #ffffff;
    --ink: #000000;
    --muted: #333333;
    --line: #999999;
    --line-strong: #000000;
    --accent: #000000;
    --wash: transparent;
    --raised: #ffffff;
  }

  .site-header,
  footer,
  .skip-link,
  .lang-switch,
  .theme-toggle {
    display: none !important;
  }

  body {
    background: #ffffff;
    color: #000000;
    font-size: 10.5pt;
  }

  .sub {
    padding: 0;
  }

  .sub h1 {
    font-size: 24pt;
  }

  .ds-doc {
    margin-top: 14mm;
  }

  .ds-ch {
    break-inside: auto;
    page-break-inside: auto;
  }

  .ds-ch > h2 {
    break-after: avoid;
    page-break-after: avoid;
  }

  .ds-scroll {
    overflow: visible;
    border: 0;
  }

  .ds-table {
    min-width: 0;
    font-size: 9.5pt;
  }

  /* Print pages are narrower than the screen; cells must wrap, not clip.
     tbody th is the Parameter column of the wide tables — it may not keep
     the screen nowrap or it crushes the last column. Numbers stay nowrap. */
  .ds-table thead th,
  .ds-table tbody th,
  .ds-table .mono {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .ds-table thead {
    display: table-header-group;
  }

  .ds-table tr,
  .ds-err,
  .ds-bd,
  .ds-wave {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  a {
    color: inherit;
    text-decoration: none;
  }
}
