/* The AI Alignment Landscape (alignment-landscape.html).
   Builds on the shared text-page shell in styles.css; everything here is scoped to .landscape-page
   or to elements only this page uses. Grey is darker than the site's rgba(0, 0, 0, 0.42) so that
   small type in captions, keys and charts passes the 4.5:1 contrast minimum on #f9f9f9. */

.landscape-page {
  --ink: #000;
  --paper: #f9f9f9;
  --grey: rgba(0, 0, 0, 0.6);
  --rule: rgba(0, 0, 0, 0.16);
}

.landscape-page .text-shell {
  margin-bottom: 120px;
}

/* ---------- report prose ---------- */

.prose .report-meta {
  margin-top: -20px;
  color: var(--grey);
}

.tm {
  display: inline-block;
  flex: none;
  color: var(--ink);
  overflow: visible;
}

.prose .contents {
  margin: 48px 0 0;
}

.prose .contents-title {
  margin: 0 0 12px;
  font-size: 18px;
}

.prose .contents-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.prose .contents-list li {
  margin: 0 0 2px;
}

.prose .report-section {
  margin-top: 96px;
}

/* Ruled: each section opens under a full-width rule, its number hanging in a margin column */
.prose .report-section > h2 {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  margin: 0 0 28px;
  padding-top: 12px;
  border-top: 1px solid var(--ink);
  font-size: 22px;
}

.prose h3 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.24;
}

.prose .report-note {
  margin-top: 72px;
  color: var(--grey);
  font-size: 15px;
}

.report-noscript {
  width: min(780px, calc(100vw - 52px));
  margin: 0 auto 90px;
}

/* ---------- definitions: a ruled five-column table on desktop, rows aligned across columns ---------- */

.prose .defs-title {
  margin: 48px 0 14px;
}

.defs-axis {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
  font-size: 15px;
  color: var(--grey);
}

.defs-axis i {
  flex: 1;
  height: 1px;
  background: var(--ink);
}

.defs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(5, auto);
  border: 1px solid var(--ink);
  font-size: 14px;
  line-height: 1.32;
  overflow-wrap: break-word;
}

.def {
  display: grid;
  grid-row: span 5;
  grid-template-rows: subgrid;
  row-gap: 0;
}

.def + .def {
  border-left: 1px solid var(--ink);
}

.def > * {
  margin: 0;
  padding: 9px 10px 10px;
}

.def-mark {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 0;
  font-size: 18px;
}

.prose .def h4 {
  margin: 0;
  padding-top: 6px;
  border-bottom: 1px solid var(--ink);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.22;
}

.prose .def p {
  margin: 0;
}

.prose .def .def-q,
.prose .def .def-n {
  border-top: 1px solid var(--ink);
}

.def-n {
  color: var(--grey);
}

.def-n a {
  color: var(--ink);
}

/* focus swatch: the value scale used throughout */
.sw {
  display: inline-block;
  flex: none;
  width: 12px;
  height: 12px;
  border: 1px solid var(--ink);
  vertical-align: -1px;
}

/* ---------- figures ---------- */

.prose .figure {
  margin: 0;
  padding: 0 20px 20px;
  border: 1px solid var(--ink);
}

.prose .figure + .figure {
  margin-top: 56px;
}

.prose .findings {
  margin-bottom: 40px;
}

.prose .figure-title {
  margin: 0 -20px 22px;
  padding: 10px 20px 11px;
  border-bottom: 1px solid var(--ink);
}

.figure-frame {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.figure-frame svg {
  display: block;
  width: 100%;
  height: auto;
}

.figure-caption {
  margin-top: 20px;
  font-size: 15px;
  line-height: 1.33;
}

.key {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 32px;
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--ink);
  font-size: 15px;
  line-height: 1.24;
}

.key:empty {
  display: none;
}

.key-title {
  width: 100%;
}

.key-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.key-item svg {
  flex: none;
  overflow: visible;
}

/* ---------- chart type and marks (inline SVG) ---------- */

.lsvg {
  font-family: "Courier Prime", "Courier New", Courier, monospace;
  overflow: visible;
}

.lsvg text {
  font-size: 13px;
  fill: var(--ink);
}

.lsvg .sm {
  font-size: 12px;
}

.lsvg .lg {
  font-size: 15px;
}

.lsvg .xs {
  font-size: 10px;
}

.lsvg .grey {
  fill: rgba(0, 0, 0, 0.6);
}

.lsvg .grid {
  stroke: var(--ink);
  stroke-width: 0.6;
  fill: none;
}

.lsvg .hair {
  stroke: var(--rule);
  stroke-width: 1;
  fill: none;
}

.lsvg .bar {
  fill: var(--ink);
}

.lsvg .unit {
  stroke: var(--ink);
  stroke-width: 0.8;
  cursor: pointer;
}

.lsvg .unit:hover {
  stroke-width: 2;
}

.lsvg .hit {
  fill: transparent;
  cursor: pointer;
}

.lsvg .hit:hover,
.lsvg .hit.is-on {
  fill: rgba(0, 0, 0, 0.05);
}

.lsvg [tabindex]:focus {
  outline: none;
}

.lsvg .hit:focus-visible {
  fill: rgba(0, 0, 0, 0.05);
  stroke: var(--ink);
  stroke-width: 2;
}

.lsvg .lead {
  stroke: var(--ink);
  stroke-width: 0.8;
  fill: none;
}

.lsvg .event {
  stroke: var(--ink);
  stroke-width: 0.8;
  stroke-dasharray: 3 3;
}

.lsvg .dense {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: square;
}

.lsvg .seg {
  stroke: var(--ink);
  stroke-width: 0.6;
  cursor: pointer;
}

.lsvg .seg:hover,
.lsvg .seg.is-on,
.lsvg .seg:focus-visible {
  stroke-width: 2;
  outline: none;
}

.lsvg .inv {
  fill: var(--paper);
}

.lsvg .pole {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.2;
  stroke-dasharray: 5 4;
}

.lsvg .nopoint {
  pointer-events: none;
}

.lsvg a text {
  text-decoration: underline;
}

.lsvg .tm-g {
  cursor: pointer;
  color: var(--ink);
}

.lsvg .tm-g:focus-visible .tm-ring {
  stroke: var(--ink);
  stroke-width: 1.5;
}

/* maps: contents are clipped to the frame drawn inside the SVG */
.lsvg.map {
  overflow: hidden;
}

.lsvg .frame {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1;
}

.lsvg .land {
  fill: var(--paper);
  stroke: var(--ink);
  stroke-width: 0.5;
  stroke-linejoin: round;
}

.lsvg .lake {
  stroke: var(--ink);
  stroke-width: 0.5;
}

.lsvg .border {
  fill: none;
  stroke: var(--ink);
  stroke-width: 0.6;
  stroke-dasharray: 4 3;
}

.lsvg .state {
  fill: none;
  stroke: var(--ink);
  stroke-width: 0.5;
  stroke-dasharray: 1 3;
}

.lsvg .city {
  fill: var(--ink);
  stroke: var(--paper);
  stroke-width: 1;
  cursor: pointer;
}

.lsvg .city:hover,
.lsvg .city:focus-visible {
  stroke: var(--ink);
  stroke-width: 2;
  fill-opacity: 0.75;
  outline: none;
}

.lsvg .halo {
  stroke: var(--paper);
  stroke-width: 4;
  stroke-linejoin: round;
  paint-order: stroke;
}

/* ---------- metro table ---------- */

.metro {
  margin-top: 28px;
  border-top: 1px solid var(--ink);
  font-size: 15px;
}

.metro-head {
  padding: 8px 0;
  color: var(--grey);
}

.metro-row {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr) 40px;
  gap: 0 12px;
  align-items: center;
  padding: 3px 0;
  cursor: pointer;
}

.metro-row:hover .metro-name,
.metro-row:focus-visible .metro-name {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.metro-row:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 2px;
}

.metro-bar {
  height: 10px;
}

.metro-bar i {
  display: block;
  height: 100%;
  background: var(--ink);
}

.metro-n {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.metro-foot {
  padding: 8px 0 0;
  margin-top: 6px;
  border-top: 1px solid var(--rule);
  color: var(--grey);
}

/* ---------- places: a ruled table of shares ---------- */

.ptable {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.24;
}

.ptable th,
.ptable td {
  padding: 8px 10px;
  font-weight: 400;
  text-align: left;
  vertical-align: middle;
}

.ptable thead th {
  vertical-align: bottom;
  border-bottom: 1px solid var(--ink);
  font-size: 14px;
}

.ptable tbody tr + tr th,
.ptable tbody tr + tr td {
  border-top: 1px solid var(--rule);
}

.ptable th + th,
.ptable td,
.ptable th + td {
  border-left: 1px solid var(--rule);
}

.ptable th[scope="row"] {
  padding-left: 0;
  white-space: nowrap;
}

.ptable .pt-n {
  width: 1%;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.pt-place,
.pt-cell {
  cursor: pointer;
}

.pt-place:hover,
.pt-place:focus-visible {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  outline: none;
}

.pt-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pt-bar {
  flex: 1;
  height: 8px;
  max-width: 80px;
  border: 1px solid var(--ink);
}

.pt-bar i {
  display: block;
  height: 100%;
  background: var(--ink);
}

.pt-v {
  min-width: 3ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.pt-cell:hover .pt-v,
.pt-cell:focus-visible .pt-v {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.pt-cell:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 2px;
}

/* figure 6 on a phone: one ranked list per measure */
.pm + .pm {
  margin-top: 22px;
}

.prose .pm-head {
  margin: 0 0 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--ink);
  font-size: 15px;
}

.pm-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px 36px;
  gap: 0 8px;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 14px;
  cursor: pointer;
}

.pm-row:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 2px;
}

/* ---------- index ---------- */

.index-scroll {
  max-height: min(640px, 70vh);
  overflow-y: auto;
  border: 1px solid var(--ink);
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.index-scroll:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 2px;
}

.index-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 30px;
  margin: 0 0 18px;
  font-size: 15px;
}

.filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.filter-label {
  margin-right: 2px;
}

.filter select,
.filter input {
  appearance: none;
  -webkit-appearance: none;
  min-width: 0;
  border: 0;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  background-color: transparent;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  outline: 0;
}

.filter select {
  max-width: 230px;
  padding-right: 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M.5.5 5 5 9.5.5' fill='none' stroke='%23000'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 2px center;
  cursor: pointer;
}

/* wide enough for the whole placeholder, "name, city, description" */
.filter input {
  width: 25ch;
  max-width: 100%;
}

.filter input::placeholder {
  color: var(--grey);
  opacity: 1;
}

.filter input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.filter select:focus-visible,
.filter input:focus-visible {
  border-bottom-width: 2px;
}

.index-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px 28px;
  margin: 0 0 20px;
}

.index-count {
  color: var(--grey);
}

.prose .index-list {
  list-style: none;
  margin: 0;
  padding: 0 16px;
}

.prose .index-list li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 0 8px;
  margin: 0;
  padding: 11px 0 12px;
  border-bottom: 1px solid var(--rule);
}

.prose .index-list li[hidden] {
  display: none;
}

.ix-mark {
  padding-top: 3px;
}

.ix-mark .tm {
  margin: -3px 0 0 -2px;
}

.ix-meta,
.ix-desc {
  display: block;
  font-size: 15px;
}

.ix-meta {
  margin-top: 2px;
  color: var(--grey);
}

.ix-desc {
  display: none;
  margin-top: 6px;
}

.index-list.show-desc .ix-desc {
  display: block;
}

.ix-empty {
  color: var(--grey);
}

/* ---------- card shown on hover, focus or tap ---------- */

.ls-card {
  position: absolute;
  z-index: 20;
  width: 360px;
  max-width: calc(100vw - 32px);
  padding: 13px 16px 15px;
  border: 1px solid var(--ink);
  background: var(--paper);
  font-size: 15px;
  line-height: 1.3;
}

.ls-card[hidden] {
  display: none;
}

.ls-card h3 {
  margin: 0 0 6px;
  padding-right: 48px;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.22;
}

.ls-card p {
  margin: 0 0 8px;
}

.ls-card p:last-child {
  margin-bottom: 0;
}

.ls-card .card-meta {
  color: var(--grey);
}

.ls-card .card-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 8px 0 0;
  max-height: 320px;
  overflow-y: auto;
  border-top: 1px solid var(--ink);
}

.ls-card .card-list li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 3px;
}

.ls-card .card-list .tm {
  align-self: center;
}

.ls-card .card-dl {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 3px 12px;
  margin: 10px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--rule);
}

.ls-card .card-dl dt {
  color: var(--grey);
}

.ls-card .card-dl dd {
  margin: 0;
}

.ls-card .card-dl .sw {
  margin-right: 7px;
}

.ls-card .card-close {
  position: absolute;
  top: 13px;
  right: 16px;
}

.ls-card a:focus-visible,
.ls-card button:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 2px;
}

/* ---------- section 3: the eleven types ---------- */

.tdefs {
  margin: 0 0 40px;
  border-top: 1px solid var(--ink);
  font-size: 15px;
  line-height: 1.28;
}

.tdef {
  display: grid;
  grid-template-columns: minmax(0, 15em) minmax(0, 1fr) 3ch;
  gap: 0 20px;
  padding: 8px 0 9px;
  border-bottom: 1px solid var(--rule);
}

.tdef-name {
  cursor: pointer;
}

.tdef-name:hover,
.tdef-name:focus-visible {
  text-decoration: underline;
  outline: none;
}

.tdef-n {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.lsvg .seg-mix {
  fill: url(#mix-hatch);
  stroke: var(--ink);
  stroke-width: 0.6;
  cursor: pointer;
}

.lsvg .seg-non {
  fill: var(--paper);
  stroke: var(--ink);
  stroke-width: 0.6;
  cursor: pointer;
}

.lsvg rect.bar[tabindex] {
  cursor: pointer;
}

.lsvg .seg-mix:hover,
.lsvg .seg-non:hover,
.lsvg rect.bar[tabindex]:hover,
.lsvg .seg-mix:focus-visible,
.lsvg .seg-non:focus-visible,
.lsvg rect.bar[tabindex]:focus-visible {
  stroke: var(--ink);
  stroke-width: 2;
  outline: none;
}

/* ---------- mobile ---------- */

@media (max-width: 700px) {
  .landscape-page .text-shell {
    margin-bottom: 90px;
  }

  .prose .report-section {
    margin-top: 72px;
  }

  .prose .report-section > h2 {
    margin-bottom: 18px;
  }

  .prose .figure + .figure {
    margin-top: 56px;
  }

  /* charts are redrawn at the frame's width by the phone layouts in landscape.js */
  .figure-frame {
    overflow-x: hidden;
  }

  .index-scroll {
    max-height: 60vh;
  }

  .defs {
    display: block;
    font-size: 15px;
  }

  .def {
    display: block;
  }

  .def + .def {
    border-left: 0;
    border-top: 1px solid var(--ink);
  }

  .metro-row {
    grid-template-columns: minmax(0, 120px) minmax(0, 1fr) 30px;
  }

  .prose .figure {
    padding: 0 12px 14px;
  }

  .prose .figure-title {
    margin: 0 -12px 16px;
    padding: 9px 12px 10px;
  }

  .prose .report-section > h2 {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .prose .index-list {
    padding: 0 12px;
  }

  .index-filters {
    gap: 14px 20px;
  }

  .filter select {
    max-width: 200px;
  }

  .ls-card {
    width: calc(100vw - 32px);
  }

  .tdef {
    grid-template-columns: minmax(0, 1fr) 3ch;
  }

  .tdef-text {
    grid-column: 1;
    grid-row: 2;
    color: var(--grey);
  }

}
