/* Dataset detail: generous typography, a focused download card and a compact sample. */
.detail-page {
  --dp-ink: #203d30;
  --dp-muted: #536658;
  --dp-line: #d8e1d4;
  max-width: 1440px;
  margin: auto;
  padding: 32px clamp(20px, 5vw, 72px) 64px;
  color: var(--dp-ink);
  font-size: 16px;
  line-height: 1.65;
}
.detail-page a { text-underline-offset: 4px; }
.detail-page a:focus-visible, .detail-page [tabindex]:focus-visible { outline: 3px solid #397657; outline-offset: 5px; }
.detail-admin-note { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 16px 20px; margin-bottom: 24px; background: #e8efdd; border-radius: 12px; font-size: 14px; }
.detail-trail { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 28px; color: var(--dp-muted); font-size: 14px; }
.detail-trail a { display: flex; gap: 10px; align-items: center; text-decoration: none; color: var(--dp-ink); }
.detail-trail a:hover { text-decoration: underline; }
.detail-title-block { position: relative; padding: clamp(28px, 4vw, 52px); border: 1px solid #d6e0cd; border-radius: 24px; background: radial-gradient(ellipse at top right, #dce8c5 0, transparent 65%), #edf1e3; }
.detail-kicker { display: flex; gap: 10px; align-items: center; margin: 0 0 12px; font-size: 12px; font-weight: 700; line-height: 1.5; letter-spacing: .12em; color: #4e6844; }
.detail-title-icon { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid #b7c8a6; border-radius: 8px; font-size: 22px; }
.detail-title-block h1 { max-width: 1000px; margin: 22px 0; font-size: clamp(36px, 4.4vw, 62px); line-height: 1.12; letter-spacing: -.045em; font-weight: 600; text-wrap: balance; overflow-wrap: anywhere; }
.detail-title-bottom { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.detail-title-bottom > p { max-width: 62ch; margin: 0; font-size: 18px; line-height: 1.7; color: var(--dp-muted); }
.detail-title-bottom > a { display: flex; align-items: center; gap: 16px; flex-shrink: 0; padding: 12px 18px; border: 1px solid #a8bd96; border-radius: 10px; font-size: 15px; font-weight: 600; text-decoration: none; color: #274e36; background: #ffffff80; }
.detail-title-bottom > a:hover { background: #fffef9; }
.detail-jump-links { display: flex; flex-wrap: wrap; gap: 28px; padding: 8px 0; margin: 20px 0 32px; border-bottom: 1px solid var(--dp-line); }
.detail-jump-links a { padding: 12px 2px; font-size: 16px; font-weight: 600; text-decoration: none; color: var(--dp-muted); }
.detail-jump-links a:hover { color: #205b45; text-decoration: underline; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 40px; align-items: start; }
.detail-about, .full-download, .detail-preview { scroll-margin-top: 110px; min-width: 0; }
.detail-about { padding: 16px 0; }
.detail-about h2, .detail-section-heading h2 { margin: 0 0 20px; font-size: 32px; font-weight: 600; letter-spacing: -.035em; line-height: 1.25; }
.detail-page .dataset-description { max-width: 66ch; padding: 0; margin: 0 0 32px; font-size: 18px; line-height: 1.85; color: var(--dp-muted); white-space: pre-line; overflow-wrap: anywhere; }
.detail-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; padding: 14px 0; border-top: 1px solid var(--dp-line); border-bottom: 1px solid var(--dp-line); }
.detail-facts > div { display: flex; align-items: baseline; gap: 6px; }
.detail-facts > div + div { border-left: 1px solid var(--dp-line); padding-left: 18px; }
.detail-facts span { font-size: 13px; color: var(--dp-muted); }
.detail-facts b, .detail-facts b.detail-fact-formats { font-size: 15px; line-height: 1.5; font-weight: 600; font-variant-numeric: tabular-nums; }
.full-download { grid-column: 2; grid-row: 1 / 3; position: sticky; top: 108px; padding: 28px; background: #234a36; color: #f8faef; border: 1px solid #234a36; border-radius: 20px; box-shadow: 0 16px 40px -24px #183d3555; }
.full-download-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.full-download-heading > span:last-child { font-size: 11px; font-weight: 600; letter-spacing: .07em; border: 1px solid #69856a; padding: 6px 9px; border-radius: 6px; color: #e0ebce; }
.full-download-icon { display: grid; place-items: center; width: 44px; height: 44px; background: #ffffff0c; border: 1px solid #69856a; border-radius: 12px; font-size: 28px; }
.full-download .detail-kicker { color: #c4d6af; font-size: 12px; }
.full-download #download-title { margin: 0 0 16px; font-size: 29px; line-height: 1.25; font-weight: 600; letter-spacing: -.035em; color: #f8faef; white-space: normal; }
.full-download-intro, .full-download .files-pending { font-size: 16px; line-height: 1.75; color: #d7e3cc; margin: 0 0 24px; }
.full-download-intro strong { color: #fff; }
.full-download-actions { display: flex; flex-direction: column; gap: 12px; }
.complete-download-button { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 54px; padding: 14px 18px; border: 1px solid #e2efbc; border-radius: 10px; background: #e2efbc; color: #203e2c; font-size: 16px; font-weight: 700; text-decoration: none; }
.complete-download-button:hover { background: #f1f8de; border-color: #f1f8de; }
.complete-download-button span { font-size: 22px; }
.complete-download-button.download-alternate { background: transparent; border-color: #93aa80; color: #f1f7e4; }
.complete-download-button.download-alternate:hover { background: #355c43; }
.full-download a:focus-visible { outline-color: #e2efbc; }
.full-download-signin, .full-download-account { margin: 4px 0 0; text-align: center; font-size: 14px; color: #d6e4ca; }
.full-download-signin a { color: #fff; }
.full-download-assurance { display: flex; align-items: start; gap: 10px; border-top: 1px solid #608065; margin-top: 24px; padding-top: 18px; }
.full-download-assurance p { margin: 0; color: #d1e0c4; font-size: 13px; line-height: 1.75; }
.detail-content { grid-column: 1; min-width: 0; padding-top: 4px; }
.detail-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 12px; }
.detail-section-heading h2 { margin-bottom: 0; }
.detail-preview-explanation { margin: 0 0 24px; font-size: 16px; line-height: 1.8; color: var(--dp-muted); }
.detail-preview-explanation a { color: #2d6242; }
.detail-page .preview-panel { margin: 0; padding: 0; overflow: hidden; border: 1px solid #cddbc5; border-radius: 16px; background: #fffef9; box-shadow: 0 8px 30px -22px #254a3433; }
.detail-page .preview-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; padding: 18px 22px; border: 0; border-bottom: 1px solid var(--dp-line); background: #edf2e5; color: #4d6244; font-size: 14px; line-height: 1.6; }
.preview-scroll-hint { font-size: 13px; white-space: nowrap; }
.detail-page .preview-scroll { width: 100%; max-width: 100%; max-height: 420px; overflow: auto; scrollbar-width: auto; scrollbar-color: #96ad86 #edf2e5; }
.detail-page .preview-table { width: max-content; min-width: 100%; margin: 0; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-family: inherit; font-size: 12px; }
.detail-page .preview-table th, .detail-page .preview-table td { width: 190px; min-width: 155px; max-width: 250px; padding: 11px 13px; border-right: 1px solid #dce5d5; border-bottom: 1px solid #dce5d5; text-align: left; vertical-align: top; font-size: 12px; line-height: 1.7; white-space: normal; overflow-wrap: anywhere; }
.detail-page .preview-table thead th[class] { position: sticky; top: 0; z-index: 2; padding-block: 11px; background: var(--field-tint); color: var(--field-color); border-top: 3px solid var(--field-color); font-size: 12px; font-weight: 600; box-shadow: none; }
.detail-page .preview-table .row-number { position: sticky; left: 0; z-index: 1; width: 42px; min-width: 42px; max-width: 42px; padding: 12px 9px; text-align: center; background: #f0f3e9; color: #5e7253; font-size: 10px; font-weight: 400; }
.detail-page .preview-table thead .row-number { z-index: 3; background: #e7eddd; border-top-color: #9db18b; }
.detail-page .preview-table .column-kind { position: static; display: block; width: auto; height: auto; clip-path: none; overflow: visible; white-space: normal; margin-bottom: 4px; font-size: 9px; font-weight: 600; letter-spacing: .06em; opacity: 1; }
.detail-page .preview-table td[class] .cell-value { display: block; white-space: pre-line; overflow-wrap: anywhere; font-size: 12px; line-height: 1.7; color: #344a3b; background: none; border: 0; padding: 0; }
.detail-page .preview-table .primary-field { position: static; box-shadow: none; }
.detail-page .preview-table td[class] { background: #fffefb; }
.detail-page .preview-table tbody tr:nth-child(even) td[class] { background: #f5f7ef; }
.detail-page .preview-table tbody tr:hover td[class] { background: #eaf1e2; }
.detail-page .missing-value { color: #68765e; }
.detail-page .preview-empty { padding: 48px 24px; text-align: center; }
.detail-page .preview-empty > span { font-size: 36px; color: #58744a; }
.detail-page .preview-empty h3 { font-size: 24px; }
.detail-table-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 16px 22px; background: #fffef9; font-size: 14px; color: #536748; }
.detail-table-footer i { font-style: normal; margin-right: 6px; }
.detail-table-footer a { color: #305d3c; }
.detail-page .preview-lock { position: static; display: flex; align-items: center; gap: 16px; padding: 22px 24px; margin-top: 20px; background: #eaf0df; border: 1px solid var(--dp-line); border-radius: 12px; }
.detail-lock-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: #fffef9; color: #4b6b3c; flex-shrink: 0; }
.detail-page .preview-lock b { font-size: 16px; color: #2f5036; }
.detail-page .preview-lock p { font-size: 15px; color: var(--dp-muted); margin: 4px 0 0; line-height: 1.7; }
.detail-page .preview-lock > a { margin-left: auto; color: #315b3c; font-size: 15px; font-weight: 600; white-space: nowrap; }
.column-tone-0 { --field-color: #426035; --field-tint: #e8efdb; }
.column-tone-1 { --field-color: #315e64; --field-tint: #e4efec; }
.column-tone-2 { --field-color: #655275; --field-tint: #eee9f2; }
.column-tone-3 { --field-color: #405f83; --field-tint: #e7edf5; }
.column-tone-4 { --field-color: #725b2d; --field-tint: #f1ecdd; }
.column-tone-5 { --field-color: #805366; --field-tint: #f2e7ed; }
.detail-next { display: flex; align-items: center; gap: 24px; margin-top: 56px; padding: 32px; border: 1px solid var(--dp-line); border-radius: 20px; background: #edf1e4; }
.detail-next > span { color: #668448; font-size: 52px; }
.detail-next h2 { margin: 0 0 8px; font-size: 28px; line-height: 1.25; letter-spacing: -.03em; }
.detail-next p:not(.detail-kicker) { margin: 0; font-size: 16px; color: var(--dp-muted); }
.detail-next > a { display: flex; gap: 20px; align-items: center; margin-left: auto; padding: 14px 18px; border: 1px solid #afc29c; border-radius: 10px; color: #345b3b; text-decoration: none; font-size: 15px; white-space: nowrap; background: #fffef980; }
.detail-next > a:hover { background: #fffef9; }
@media (min-width: 851px) {
  .detail-page .preview-lock { flex-wrap: wrap; }
  .detail-page .preview-lock > a { margin-left: 56px; }
}
@media (max-width: 1100px) {
  .detail-layout { grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; }
  .full-download { padding: 24px; }
  .detail-title-bottom { align-items: start; flex-direction: column; }
}
@media (max-width: 850px) {
  .detail-layout { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .detail-about { padding: 0; }
  .detail-content { padding-top: 8px; }
  .full-download { grid-column: 1; grid-row: auto; position: static; }
  .detail-next { flex-wrap: wrap; }
  .detail-next > a { margin-left: 0; }
}
@media (max-width: 540px) {
  .detail-page { padding: 22px 16px 40px; }
  .detail-trail { font-size: 13px; gap: 8px; margin-bottom: 22px; }
  .detail-title-block { padding: 26px 22px; border-radius: 18px; }
  .detail-title-block h1 { font-size: 36px; margin: 20px 0; }
  .detail-title-bottom > p { font-size: 17px; }
  .detail-title-bottom > a { width: 100%; justify-content: space-between; font-size: 14px; }
  .detail-kicker { font-size: 11px; }
  .detail-jump-links { gap: 22px; margin: 12px 0 26px; }
  .detail-jump-links a { font-size: 14px; }
  .detail-about h2, .detail-section-heading h2 { font-size: 28px; }
  .detail-page .dataset-description { font-size: 17px; line-height: 1.8; }
  .detail-facts { gap: 10px 12px; }
  .detail-facts > div + div { padding-left: 12px; }
  .full-download { padding: 24px; border-radius: 16px; }
  .detail-section-heading { flex-wrap: wrap; gap: 12px; }
  .detail-preview-badge { font-size: 12px; }
  .detail-page .preview-toolbar { padding: 16px; font-size: 13px; }
  .detail-page .preview-toolbar > span:last-child { max-width: none; text-align: left; }
  .detail-page .preview-table th, .detail-page .preview-table td { width: 170px; min-width: 150px; padding: 10px 12px; }
  .detail-table-footer { padding: 16px; font-size: 13px; }
  .detail-page .preview-lock { display: grid; grid-template-columns: 32px minmax(0, 1fr); align-items: start; gap: 12px; padding: 18px; }
  .detail-lock-icon { width: 32px; height: 36px; }
  .detail-page .preview-lock > a { grid-column: 2; margin-left: 0; padding-block: 8px; }
  .detail-next { margin-top: 36px; padding: 24px; gap: 16px; }
  .detail-next > span { font-size: 40px; }
  .detail-next h2 { font-size: 26px; }
  .detail-next > a { width: 100%; justify-content: space-between; }
}

/* Optional preview controls; the server-rendered sample remains usable without JS. */
.detail-page [hidden] { display: none !important; }
.preview-tools { display: flex; flex-wrap: wrap; align-items: start; gap: 8px; padding: 14px; border-bottom: 1px solid var(--dp-line); background: #fffef9; }
.preview-tools button, .preview-column-picker summary, .preview-dialog > header > button { border: 1px solid #c4d2bb; background: #f5f7ee; border-radius: 8px; padding: 9px 12px; color: #304f36; font-family: inherit; font-size: 14px; line-height: 1.5; min-height: 42px; cursor: pointer; }
.preview-tools button:hover, .preview-column-picker summary:hover { background: #e9efdf; }
.preview-tools button:disabled { opacity: .55; cursor: default; }
.preview-search { flex: 1 1 180px; min-width: 0; }
.preview-search input { display: block; width: 100%; min-width: 0; border: 1px solid #c4d2bb; border-radius: 8px; background: #fff; padding: 9px 12px; color: var(--dp-ink); font: inherit; font-size: 16px; height: 42px; }
.preview-column-picker summary { list-style: none; }
.preview-column-picker summary::-webkit-details-marker { display: none; }
.preview-column-picker summary::after { content: ' ▾'; }
.preview-column-picker[open] { flex-basis: 100%; order: 5; }
.preview-column-picker[open] summary { width: fit-content; background: #e9efdf; }
.preview-column-picker fieldset { min-width: 0; border: 0; padding: 14px 0 0; margin: 0; }
.preview-column-picker legend { font-size: 14px; padding: 12px 0 0; color: var(--dp-muted); }
.preview-column-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; max-height: 220px; overflow: auto; padding: 8px 4px; margin-bottom: 10px; }
.preview-column-options label { display: flex; align-items: start; gap: 9px; font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; cursor: pointer; }
.preview-column-options input { width: 17px; height: 17px; margin: 4px 0 0; flex: none; accent-color: #315b3c; }
.detail-page .preview-sort-button { display: flex; align-items: start; justify-content: space-between; gap: 12px; width: 100%; background: transparent; border: 0; border-radius: 3px; padding: 0; color: inherit; font-family: inherit; font-size: 12px; font-weight: 600; line-height: 1.7; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.preview-sort-button > span { flex: none; }
.preview-no-matches { padding: 20px; margin: 0; color: var(--dp-muted); font-size: 14px; border-bottom: 1px solid var(--dp-line); }
.preview-modal-open { overflow: hidden; }
.preview-dialog { width: min(1440px, calc(100vw - 40px)); max-width: none; max-height: calc(100dvh - 40px); margin: auto; padding: 24px; border: 1px solid #c4d2bb; border-radius: 18px; background: #f6f5ef; color: var(--dp-ink); overflow: auto; }
.preview-dialog:not([open]) { display: none; }
.preview-dialog::backdrop { background: #12291f99; }
.preview-dialog > header { display: flex; align-items: start; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.preview-dialog h2 { font-size: 24px; line-height: 1.3; margin: 0 0 6px; }
.preview-dialog > header p { margin: 0; font-size: 14px; color: var(--dp-muted); }
.preview-dialog > header > button { flex: none; }
.detail-page .preview-dialog .preview-scroll { max-height: 60dvh; }
@media (max-width: 540px) {
  .preview-tools { padding: 12px; }
  .preview-search { flex-basis: 100%; }
  .preview-column-options { grid-template-columns: minmax(0, 1fr); }
  .preview-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); padding: 16px; border-radius: 12px; }
  .preview-dialog > header { gap: 12px; }
  .preview-dialog h2 { font-size: 21px; }
}

.full-download-actions form { margin: 0; }
.full-download-actions button.complete-download-button { width: 100%; font-family: inherit; cursor: pointer; }
