/* NCST Report public reading site */
:root {
  --text: #222;
  --muted: #5c5c5c;
  --border: #e4e4e4;
  --accent: #f7921e;
  --bg: #fafafa;
  --card: #fff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 85%;
  max-width: 85%;
  margin: 0 auto;
  padding: 0 1rem;
  box-sizing: border-box;
}

.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-left: 0;
  padding-right: 0;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
  line-height: 1;
  font-size: 2em;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.site-brand-logo {
  height: 1em;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

.site-brand-name {
  font-size: 0.75em;
  font-weight: inherit;
  line-height: 1;
  letter-spacing: inherit;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--accent);
}

.site-main {
  padding: 2rem 0 3rem;
  flex: 1 0 auto;
}

.site-main > h1 {
  font-size: 2em;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
}

.site-footer {
  flex-shrink: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 1rem 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.site-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  flex-wrap: wrap;
}

.site-footer-links {
  display: flex;
  gap: 1rem;
  margin-left: auto;
}

.to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--card);
  color: var(--muted);
  padding: 0;
  line-height: 1;
  cursor: pointer;
  font-size: 1.5rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.to-top.is-visible {
  display: inline-flex;
}

.to-top:hover,
.to-top:focus-visible {
  color: var(--accent);
}

.site-footer-links a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer-links a:hover {
  color: var(--accent);
}

.legal {
  max-width: 42rem;
}

.legal h1 {
  margin-top: 0;
}

.legal h2 {
  margin-top: 1.75em;
}

.lead { color: var(--muted); }

.muted { color: var(--muted); }

.recent-changes {
  margin-top: 4rem;
}

.collapsible-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.collapsible-heading h2 {
  margin: 0;
}
.collapse-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
}
.collapse-toggle i {
  font-size: 1.15rem;
  transition: transform 0.15s ease;
}
.collapse-toggle:hover,
.collapse-toggle:focus-visible {
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.collapsible-section.is-collapsed .collapsible-body {
  display: none;
}
.collapsible-section.is-collapsed .collapse-toggle i {
  transform: rotate(-90deg);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.card {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  text-decoration: none;
  color: inherit;
  min-height: 9rem;
}

.card:hover { border-color: var(--accent); }

.card h3 {
  margin: 0 0 0.35rem;
}

.card p {
  margin: 0;
}

.card.card-cover {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background-color: #1a1a1a;
  background-size: cover;
  background-position: center;
  border-color: transparent;
  color: #fff;
}

.card.card-cover::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.65) 0%, rgba(0, 0, 0, 0.15) 45%, transparent 70%);
  pointer-events: none;
}

.card.card-cover h3,
.card.card-cover p {
  position: relative;
  z-index: 1;
  color: #fff;
  margin: 0;
  text-align: left;
}

.card.card-cover p {
  margin-top: 0.35rem;
  color: rgba(255, 255, 255, 0.92);
}

.card.card-cover:hover {
  border-color: var(--accent);
}

.report-hero {
  position: relative;
  min-height: 220px;
  margin: 0 0 2rem;
  border-radius: 8px;
  overflow: hidden;
  background-color: #1a1a1a;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: flex-end;
}

.report-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.2) 55%, transparent 100%);
}

.report-hero-inner {
  position: relative;
  z-index: 1;
  padding: 1.5rem;
  color: #fff;
  width: 100%;
}

.report-hero-inner h1 {
  margin: 0 0 0.35rem;
  color: #fff;
}

.report-hero-inner .lead {
  margin: 0;
  color: rgba(255, 255, 255, 0.92);
}

.report-description {
  margin: -1rem 0 2rem;
}

.report-description .lead {
  margin: 0 0 1rem;
}

.report-description .lead:last-child {
  margin-bottom: 0;
}

.recent-list { list-style: none; padding: 0; margin: 0; }
.recent-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.15rem 0;
  border-bottom: 1px solid var(--border);
}
.recent-list time {
  color: var(--muted);
  font-size: 0.875rem;
  flex-shrink: 0;
  white-space: nowrap;
}
.recent-report {
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.875rem;
  color: var(--muted);
  text-decoration: none;
}
.recent-report:hover {
  color: var(--accent);
}
.recent-file {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  padding: 0.3rem 0.5rem;
  margin-left: -0.5rem;
  border-radius: 4px;
  font-size: 0.95rem;
  color: var(--text);
  text-decoration: none;
}
.recent-file:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--accent);
}
.recent-file .tree-file-icon {
  font-size: 0.9rem;
  color: var(--muted);
  flex-shrink: 0;
}
.recent-file .tree-item-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breadcrumb { font-size: 0.875rem; color: var(--muted); margin-bottom: 1rem; }
.breadcrumb a { color: var(--accent); }

.prose h1, .prose h2, .prose h3 { margin-top: 1.5em; }
.prose a { color: var(--accent); }
.prose mark { background: rgba(255, 208, 0, 0.4); }
.prose blockquote { border-left: 3px solid var(--accent); margin-left: 0; padding-left: 1rem; color: var(--muted); }
.prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
  height: 0;
  background: none;
}

.prose .table-wrap { overflow-x: auto; margin: 1rem 0; }
.prose table { border-collapse: collapse; width: 100%; }
.prose th, .prose td { border: 1px solid var(--border); padding: 0.5rem 0.75rem; }
.prose th { background: #f6f6f6; }

.prose aside.callout, .prose details.callout {
  background: #f6f6f6;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
}

.prose .footnotes { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--border); font-size: 0.9rem; }
.prose .footnote-ref { text-decoration: none; }
.prose .embed-article { border: 1px dashed var(--border); padding: 0.75rem; margin: 1rem 0; border-radius: 6px; }

.article-tree-section {
  margin: 1.5rem 0 2rem;
}

.public-tree {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  width: 100%;
  max-width: none;
}

.public-tree .tree-root {
  min-height: 1.5rem;
}

.public-tree .tree-folder {
  margin: 0.1rem 0;
}

.public-tree .tree-folder-header {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  border: none;
  background: transparent;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.public-tree .tree-folder-header:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--text);
}

.public-tree .tree-chevron {
  font-size: 0.7rem;
  width: 0.85rem;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.public-tree .tree-folder--collapsed .tree-chevron {
  transform: rotate(-90deg);
}

.public-tree .tree-folder-icon {
  font-size: 0.9rem;
  color: var(--muted);
  flex-shrink: 0;
}

.public-tree .tree-folder--topic > .tree-folder-header .tree-folder-icon {
  color: var(--accent);
}

.public-tree .tree-folder-label {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.public-tree .tree-folder-count {
  flex-shrink: 0;
  font-weight: 500;
  color: var(--muted);
}

.public-tree .tree-folder-children {
  margin-left: 0.65rem;
  padding-left: 0.5rem;
  border-left: 1px solid var(--border);
}

.public-tree .tree-folder--collapsed > .tree-folder-children {
  display: none;
}

.public-tree .tree-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  font-size: 0.95rem;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

.public-tree .tree-item:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--accent);
}

.public-tree .tree-file-icon {
  font-size: 0.9rem;
  color: var(--muted);
  flex-shrink: 0;
}

.public-tree .tree-item-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.article-list { list-style: none; padding-left: 0; }
.article-list-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.article-list-thumb {
  flex: 0 0 64px;
  width: 64px;
  height: 48px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.article-list-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.article-featured {
  margin: 1rem 0 0;
}
.article-featured img {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: 8px;
}

.article-dates {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
}
.article-dates strong {
  font-weight: 700;
  color: var(--text);
}
.article-dates time {
  color: var(--text);
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}
.article-tag {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  line-height: 1.3;
  background: var(--tag-bg, #6c757d);
  color: var(--tag-fg, #fff);
}

.ask-question {
  position: relative;
  margin-top: 4rem;
}
.ask-question h2 {
  margin: 0;
}
.ask-question-form {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-width: 36rem;
  margin-top: 1rem;
}
.ask-label {
  font-weight: 600;
  color: var(--text);
  margin-top: 0.65rem;
}
.ask-question-form textarea,
.ask-question-form input[type="text"],
.ask-question-form input[type="email"] {
  font: inherit;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
}
.ask-honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.ask-submit {
  margin-top: 0.75rem;
  align-self: flex-start;
  font: inherit;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
.ask-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.ask-error {
  color: #b02a37;
}
.ask-success {
  color: #0f5132;
  font-weight: 600;
}
.cf-turnstile {
  margin-top: 0.75rem;
}

.article-qa {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.article-qa h2 {
  font-size: 1.25rem;
  margin: 0;
}
.section-count {
  font-weight: 500;
  color: var(--muted);
}
.article-qa .collapsible-body {
  padding: 1.5rem 40px 0;
}
.article-qa-item {
  width: 100%;
  margin: 0 0 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.article-qa-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.article-qa-question {
  margin: 0 0 1rem;
}
.article-qa-prefix {
  font-weight: 700;
}
.article-qa-answer {
  margin: 0;
}
.article-qa-label {
  margin: 0 0 0.35rem;
  font-size: inherit;
  font-weight: 400;
  line-height: inherit;
}

.article-media {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.article-media h2 {
  font-size: 1.25rem;
  margin: 0 0 1rem;
}
.article-media-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.article-media-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  gap: 0.5rem 0.75rem;
  align-items: center;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}
.article-media-item:last-child {
  border-bottom: 0;
}
.article-media-icon {
  color: var(--muted);
}
.article-media-name {
  font-weight: 500;
  word-break: break-word;
}
.article-media-type,
.article-media-size {
  font-size: 0.85rem;
  white-space: nowrap;
}
.article-media-action a {
  white-space: nowrap;
}
@media (max-width: 640px) {
  .article-media-item {
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "icon name action"
      "icon type size";
  }
  .article-media-icon { grid-area: icon; }
  .article-media-name { grid-area: name; }
  .article-media-action { grid-area: action; }
  .article-media-type { grid-area: type; }
  .article-media-size { grid-area: size; }
}

.file-link {
  word-break: break-word;
}

.site-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.82);
}

.site-lightbox[hidden] {
  display: none !important;
}

.site-lightbox-img {
  max-width: min(96vw, 1200px);
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.45);
}

.site-lightbox-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  border: 0;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.site-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

body.site-lightbox-open {
  overflow: hidden;
}
