
:root {
  --amsab-red: #d71724;
  --amsab-red-dark: #b4121d;
  --amsab-green: #619144;
  --text: #808080;
  --text-dark: #333333;
  --heading: #1f1f1f;
  --muted: #999999;
  --border: #eeeeee;
  --surface: #ffffff;
  --surface-alt: #f5f5f5;
  --footer: #050505;
  --footer-text: #707070;
  --page-width: 1000px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: #fff;
}

body {
  color: var(--text);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 18px;
}

img {
  max-width: 100%;
  height: auto;
  border: 0;
}

a,
a:link,
a:visited {
  color: #333;
  text-decoration: none;
  outline: none;
  transition: color 70ms linear;
}

a:hover,
a:focus,
a:active {
  color: var(--amsab-red);
  text-decoration: none;
}

p { margin: 12px 0; }

h1,h2,h3,h4,h5,h6 {
  color: var(--heading);
  margin: 10px 0;
  letter-spacing: 0;
  font-weight: 300;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

h1 { font-size: 34px; line-height: 44px; }
h2 { font-size: 22px; line-height: 32px; }
h3 { font-size: 18px; line-height: 27px; }
h4 { font-size: 15px; line-height: 24px; }

code, pre {
  font-family: Monaco, Menlo, Consolas, "Courier New", monospace;
  font-size: 12px;
}

code {
  padding: 2px 4px;
  color: #d14;
  background: #f7f7f9;
  border: 1px solid #e1e1e8;
}

pre {
  overflow-x: auto;
  padding: 24px 30px;
  color: #666;
  background: #f5f5f5;
  border: 0;
  border-top: 1px solid #eaeaea;
  white-space: pre-wrap;
}

.page-shell {
  width: min(var(--page-width), calc(100% - 40px));
  margin: 0 auto;
}

.site-header {
  background: #fff;
  border-bottom: 1px solid #f2f2f2;
}

.site-header-inner {
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 18px;
  color: #222 !important;
  text-decoration: none;
}

.site-logo {
  display: block;
  width: 130px;
  height: 130px;
  object-fit: contain;
  flex: 0 0 130px;
}

.site-brand-text {
  color: #222;
  font-size: 20px;
  font-weight: 300;
  line-height: 1.25;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0;
  margin: 0;
}

.site-nav a {
  display: block;
  padding: 18px 12px 16px;
  color: #aaa;
  font-size: 12px;
  font-weight: 300;
  text-transform: uppercase;
  border-top: 4px solid transparent;
}

.site-nav a:hover,
.site-nav a:focus {
  color: #000;
  border-top-color: var(--amsab-red);
}

main.page-shell {
  padding-top: 28px;
  padding-bottom: 48px;
}

.record-header {
  margin-bottom: 22px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}

.subtitle {
  margin-top: 0;
  color: #999;
  font-size: 15px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--amsab-red);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.resource-uri,
.muted { color: #999; }

.resource-uri { word-break: break-word; }

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  margin: 0 0 18px;
  padding: 0;
  color: #999;
  font-size: 12px;
  line-height: 30px;
}

.breadcrumbs a { color: #777; }
.breadcrumbs a:hover { color: var(--amsab-red); }

.card,
.service,
.query-example,
.uri-box {
  margin: 16px 0;
  padding: 18px 20px;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 0;
}

.card h2,
.service h3,
.query-example h3 { margin-top: 0; }

.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
  gap: 16px;
}

.button,
.button:link,
.button:visited {
  display: inline-block;
  padding: 8px 22px;
  background: var(--amsab-red);
  border: 1px solid var(--amsab-red);
  border-radius: 0;
  color: #fff;
  font-size: 12px;
  line-height: 12px;
  text-align: center;
  text-decoration: none;
}

.button:hover,
.button:focus,
.button:active {
  background: #fff;
  color: var(--amsab-red);
}

.button-secondary,
.button-secondary:link,
.button-secondary:visited {
  background: #f5f5f5;
  border-color: #ddd;
  color: #333;
}

.button-secondary:hover,
.button-secondary:focus {
  background: #fff;
  border-color: #999;
  color: #000;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.record-table-wrap { overflow-x: auto; }

.record-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.record-table th,
.record-table td {
  padding: 7px 10px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid #f3f3f3;
}

.record-table th {
  width: 220px;
  color: #666;
  font-weight: 600;
}

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

.value-list {
  margin: 0;
  padding-left: 18px;
}

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

.file-list li {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}

.file-list li:last-child { border-bottom: 0; }

.file-format {
  color: #999;
  font-size: 12px;
  white-space: nowrap;
}

details { margin-top: 10px; }

summary {
  cursor: pointer;
  color: #333;
  font-size: 12px;
  font-weight: 600;
}

summary:hover { color: var(--amsab-red); }

.yasgui-page,
.yasgui-page body { height: 100%; }

.yasgui-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: #fff;
}

.yasgui-shell .site-header,
.yasgui-shell > [data-site-header] { flex: 0 0 auto; }

.yasgui-shell #yasgui {
  flex: 1 1 auto;
  min-height: 0;
  background: #fff;
}

.site-footer {
  padding: 30px 0 40px;
  background: var(--footer);
  color: var(--footer-text);
  font-size: 11px;
/*  line-height: 42px; */
}

.site-footer a { color: #fff; }
.site-footer a:hover {
  color: #fff;
  text-decoration: underline;
}

@media (max-width: 767px) {
  .page-shell {
    width: calc(100% - 30px);
  }

  .site-header-inner {
    min-height: 0;
    flex-direction: column;
    align-items: flex-start;
    padding-top: 15px;
    padding-bottom: 15px;
  }

  .site-logo {
    width: 90px;
    height: 90px;
    flex-basis: 90px;
  }

  .site-brand-text { font-size: 18px; }

  .site-nav {
    width: 100%;
    justify-content: flex-start;
    border-top: 1px solid #f2f2f2;
  }

  .site-nav a {
    padding: 10px 12px 8px 0;
    margin-right: 12px;
    border-top: 0;
    border-bottom: 2px solid transparent;
  }

  .site-nav a:hover,
  .site-nav a:focus {
    border-bottom-color: var(--amsab-red);
  }

  h1 {
    font-size: 28px;
    line-height: 36px;
  }

  .record-table th,
  .record-table td {
    display: block;
    width: 100%;
  }

  .record-table th {
    padding-bottom: 2px;
    border-bottom: 0;
  }

  .record-table td { padding-top: 0; }

  .file-list li {
    flex-direction: column;
    gap: 2px;
  }
}


/* =========================================================
   AMSAB shell hardening
   Keep application-specific CSS (YASGUI/search) from
   overriding the shared site chrome.
   ========================================================= */

body .site-header {
  width: 100%;
  background: #ffffff !important;
  border-bottom: 1px solid #f2f2f2 !important;
}

body .site-header .page-shell {
  width: min(var(--page-width), calc(100% - 40px)) !important;
  max-width: var(--page-width) !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

body .site-header .site-brand,
body .site-header .site-brand:link,
body .site-header .site-brand:visited,
body .site-header .site-brand:hover {
  color: #222222 !important;
  text-decoration: none !important;
}

body .site-header .site-logo {
  width: 130px !important;
  height: 130px !important;
  max-width: 130px !important;
  object-fit: contain;
}

body .site-header .site-nav a,
body .site-header .site-nav a:link,
body .site-header .site-nav a:visited {
  color: #777777 !important;
  background: transparent !important;
  text-decoration: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

body .site-header .site-nav a:hover,
body .site-header .site-nav a:focus,
body .site-header .site-nav a[aria-current="page"],
body .site-header .site-nav a[aria-current="location"] {
  color: #d71724 !important;
  background: transparent !important;
  border-top-color: #d71724 !important;
}

/* Search page: force shared AMSAB shell, not the older blue UI */
body.search-page {
  background: #ffffff !important;
  color: #808080 !important;
}

body.search-page main.page-shell {
  width: min(var(--page-width), calc(100% - 40px)) !important;
  max-width: var(--page-width) !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* YASGUI: constrain the entire editor to the AMSAB content width */
body .yasgui-content {
  display: block !important;
  width: min(var(--page-width), calc(100% - 40px)) !important;
  max-width: var(--page-width) !important;
  margin: 24px auto 40px !important;
  padding: 0 !important;
  overflow: hidden;
}

body .yasgui-content #yasgui,
body .yasgui-content .yasgui {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
}

body .yasgui-content .yasgui .tabPanel,
body .yasgui-content .yasgui .yasqe,
body .yasgui-content .yasgui .yasr {
  max-width: 100% !important;
}

@media (max-width: 767px) {
  body .site-header .page-shell,
  body.search-page main.page-shell,
  body .yasgui-content {
    width: calc(100% - 30px) !important;
  }

  body .site-header .site-logo {
    width: 90px !important;
    height: 90px !important;
    max-width: 90px !important;
  }
}

/* Dataset selectors shared by the home and downloads pages. */
.dataset-picker { margin: 16px 0; }
.dataset-picker label { display: block; margin-bottom: 6px; color: var(--text-dark); }
.dataset-picker select {
  width: 100%;
  max-width: 360px;
  padding: 10px 12px;
  font: inherit;
  color: var(--text-dark);
  background: var(--surface);
  border: 1px solid #999;
}
.dataset-picker select:focus-visible { outline: 3px solid var(--amsab-red); outline-offset: 3px; }
.service code { overflow-wrap: anywhere; }
