/* open-dsa /analyses
   Mirrors the variables from site/style.css so the section feels of-a-piece
   with the apex. Kept deliberately minimal so future design choices can
   replace this without rewriting the templates. */

:root {
  --ink: #1a1a1a;
  --muted: #5a6470;
  --accent: #1a3d6b;
  --accent-2: #143055;
  --rule: #e3e6ea;
  --bg: #ffffff;
  --soft: #f7f8fa;
  --warn: #b85700;
  --warn-bg: #fff4e3;
  --info: #1a3d6b;
  --info-bg: #eaf0f8;
  --error: #9a1a1a;
  --error-bg: #fbeaea;
}

* { box-sizing: border-box; }
html { font-size: 18px; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

/* ---------------------------------------------------------------- header */

.site-header {
  border-bottom: 1px solid var(--rule);
  padding: 1.4rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.2rem;
}
.site-header .logo-link { display: inline-flex; }
.site-header .logo-link img { display: block; height: 40px; width: auto; }
.site-header nav {
  display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap;
}
.site-header nav a {
  text-decoration: none; color: var(--ink); font-size: 0.95rem;
}
.site-header nav a:hover { color: var(--accent); }
.site-header nav a.current { color: var(--accent); font-weight: 600; }
.site-header nav a.login {
  border: 1px solid var(--accent); color: var(--accent);
  padding: 0.4rem 0.9rem; border-radius: 4px;
}

.inline-form { display: inline; margin: 0; }
.link-button {
  background: none; border: 0; padding: 0; margin: 0;
  font: inherit; color: var(--ink); cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}
.link-button:hover { color: var(--accent); }
.link-button.danger { color: var(--error); }

/* ---------------------------------------------------------------- flashes & banners */

.flashes { padding: 0.6rem 2rem 0; }
.flash {
  padding: 0.6rem 0.9rem; margin: 0 auto 0.4rem; max-width: 960px;
  border-radius: 4px; font-size: 0.95rem;
}
.flash-info { background: var(--info-bg); color: var(--info); }
.flash-error { background: var(--error-bg); color: var(--error); }

.banner {
  padding: 0.6rem 2rem; text-align: center; font-size: 0.95rem;
}
.banner-warn { background: var(--warn-bg); color: var(--warn); }

/* ---------------------------------------------------------------- layouts */

main { max-width: 960px; margin: 0 auto; padding: 3rem 2rem; }
main.narrow { max-width: 560px; }
main.post-page { max-width: 920px; }
main.list-page { max-width: 1080px; }
main.admin { max-width: 1080px; }

.page-head { margin-bottom: 2rem; }
.page-head h1 {
  font-size: 2rem; margin: 0 0 0.4rem; letter-spacing: -0.01em; font-weight: 700;
}
.page-head .lead { font-size: 1.1rem; color: var(--muted); margin: 0; max-width: 60ch; }

/* ---------------------------------------------------------------- list page */

.empty { color: var(--muted); padding: 2rem 0; }

.featured {
  border-top: 4px solid var(--ink);
  padding: 1.6rem 0 2rem;
  margin-bottom: 2.4rem;
}
.featured .block-link {
  display: block; text-decoration: none; color: inherit;
}
.featured .block-link:hover .featured-headline { color: var(--accent); }
.featured-meta {
  display: flex; gap: 1rem; font-size: 0.85rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.featured-headline {
  font-size: 2.4rem; line-height: 1.1; margin: 0.6rem 0 0.6rem;
  letter-spacing: -0.01em; font-weight: 700;
}
.featured-subtitle {
  font-size: 1.15rem; color: var(--muted); margin: 0; max-width: 60ch;
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.6rem;
  border-top: 1px solid var(--rule);
  padding-top: 2rem;
}
.tile { padding: 1rem 0; }
.tile .block-link {
  display: block; text-decoration: none; color: inherit;
}
.tile .block-link:hover .tile-headline { color: var(--accent); }
.tile-meta {
  display: flex; gap: 0.8rem; font-size: 0.8rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.tile-headline {
  font-size: 1.25rem; line-height: 1.25; margin: 0.4rem 0 0.4rem;
  font-weight: 600;
}
.tile-subtitle { font-size: 0.95rem; color: var(--muted); margin: 0; }

/* ---------------------------------------------------------------- post page */

.post-head { border-bottom: 1px solid var(--rule); padding-bottom: 1.4rem; margin-bottom: 1.6rem; }
.post-head .kicker {
  font-size: 0.85rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 0.4rem;
}
.post-head h1 {
  font-size: 2.4rem; margin: 0 0 0.6rem; letter-spacing: -0.01em;
  line-height: 1.1; font-weight: 700;
}
.post-subtitle { font-size: 1.2rem; color: var(--muted); margin: 0 0 0.8rem; }
.byline { font-size: 0.9rem; color: var(--muted); margin: 0; }

.figure { margin: 2rem 0; }
.iframe-wrap {
  position: relative; width: 100%; padding-top: 65%;
  background: var(--soft); border: 1px solid var(--rule); border-radius: 4px;
  overflow: hidden;
}
.iframe-wrap iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
}
.figure-source {
  font-size: 0.85rem; color: var(--muted); margin: 0.4rem 0 0; text-align: right;
}

.post-body { font-size: 1.05rem; }
.post-body p { margin: 0 0 1rem; }
.post-body h2 { font-size: 1.4rem; margin: 1.8rem 0 0.6rem; }
.post-body h3 { font-size: 1.15rem; margin: 1.4rem 0 0.4rem; }
.post-body blockquote {
  border-left: 3px solid var(--rule);
  padding: 0.2rem 0 0.2rem 1rem;
  margin: 1rem 0;
  color: var(--muted);
}
.post-body code { background: var(--soft); padding: 0.1rem 0.3rem; border-radius: 3px; font-size: 0.9em; }
.post-body pre {
  background: var(--soft); padding: 0.8rem; border-radius: 4px;
  overflow-x: auto; font-size: 0.85rem;
}

.post-foot {
  margin-top: 2.4rem; padding-top: 1.2rem; border-top: 1px solid var(--rule);
}
.citation { font-size: 0.85rem; color: var(--muted); margin: 0; }
.citation code { background: var(--soft); padding: 0.1rem 0.3rem; border-radius: 3px; }

/* ---------------------------------------------------------------- forms */

.stacked-form { display: flex; flex-direction: column; gap: 1.1rem; max-width: 640px; }
.post-form { max-width: 760px; }

.stacked-form label {
  display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; font-weight: 500;
}
.stacked-form input[type="text"],
.stacked-form input[type="email"],
.stacked-form input[type="password"],
.stacked-form textarea,
.stacked-form select {
  font: inherit;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--bg);
}
.stacked-form input:focus,
.stacked-form textarea:focus,
.stacked-form select:focus {
  outline: 2px solid var(--accent); outline-offset: -1px;
}
.stacked-form input:disabled { background: var(--soft); color: var(--muted); }
.stacked-form small { font-weight: 400; color: var(--muted); font-size: 0.8rem; }
.stacked-form .opt { color: var(--muted); font-weight: 400; }
.stacked-form fieldset {
  border: 1px solid var(--rule); border-radius: 4px;
  padding: 0.8rem 1rem; display: flex; flex-direction: column; gap: 0.8rem;
}
.stacked-form legend { padding: 0 0.4rem; font-size: 0.85rem; color: var(--muted); }

.form-actions {
  display: flex; gap: 0.8rem; align-items: center; margin-top: 0.4rem;
}
button.primary, a.primary {
  display: inline-block;
  background: var(--accent); color: var(--bg);
  border: 1px solid var(--accent);
  padding: 0.55rem 1.1rem;
  font: inherit; font-weight: 500;
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
}
button.primary:hover, a.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
a.cancel { color: var(--muted); }

/* ---------------------------------------------------------------- editor (Quill) */

#editor {
  min-height: 320px;
  border: 1px solid var(--rule);
  border-top: 0;
  border-radius: 0 0 4px 4px;
  background: var(--bg);
}
.ql-toolbar.ql-snow {
  border: 1px solid var(--rule);
  border-radius: 4px 4px 0 0;
  background: var(--soft);
}

/* ---------------------------------------------------------------- admin */

.admin-table {
  width: 100%; border-collapse: collapse; font-size: 0.95rem; margin-top: 1rem;
}
.admin-table th, .admin-table td {
  padding: 0.6rem 0.5rem;
  text-align: left; border-bottom: 1px solid var(--rule);
}
.admin-table th {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); font-weight: 600;
}
.admin-table td.actions { white-space: nowrap; }
.admin-table td.actions a, .admin-table td.actions .link-button { margin-right: 0.6rem; }

.pill {
  display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px;
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em;
  background: var(--soft); color: var(--muted);
}
.pill-published { background: #e6f1ea; color: #1f6b3a; }
.pill-draft { background: var(--soft); color: var(--muted); }
.pill-pending_review { background: var(--warn-bg); color: var(--warn); }

/* ---------------------------------------------------------------- footer */

.site-footer {
  border-top: 1px solid var(--rule);
  padding: 1.6rem 2rem;
  font-size: 0.9rem; color: var(--muted); text-align: center;
}
.site-footer a { color: var(--muted); }

/* ---------------------------------------------------------------- responsive */

@media (max-width: 640px) {
  .site-header { flex-direction: column; align-items: flex-start; }
  .site-header nav { gap: 0.8rem; flex-wrap: wrap; }
  main { padding: 2rem 1.4rem; }
  .featured-headline { font-size: 1.8rem; }
  .post-head h1 { font-size: 1.8rem; }
  .iframe-wrap { padding-top: 110%; }
}

/* ---------------------------------------------------------------- metrics */

.metrics-legend { display: flex; gap: 1.1rem; margin-bottom: 1.2rem; font-size: 0.85rem; flex-wrap: wrap; }
.metrics-legend .key { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--muted); }
.metrics-legend .key::before { content: ""; width: 12px; height: 12px; border-radius: 2px; display: inline-block; }
.key-human::before { background: var(--accent); }
.key-unsure::before { background: #c9b558; }
.key-bot::before { background: #cdd2d9; }
.key-marker::before { width: 2px !important; height: 14px !important; border-radius: 0 !important; background: #c0392b; }

.metric-card { border: 1px solid var(--rule); border-radius: 10px; padding: 1rem 1.2rem; margin-bottom: 1.2rem; }
.metric-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.metric-head h3 { margin: 0; font-size: 1.1rem; }
.metric-totals { display: flex; gap: 0.8rem; font-size: 0.82rem; color: var(--muted); flex-wrap: wrap; }
.metric-totals .t-human { color: var(--accent); }
.metric-totals .t-unsure { color: #8a7a1f; }
.metric-totals .t-bot { color: #7a828c; }

.metric-chart { display: block; width: 100%; height: auto; margin: 0.7rem 0 0.2rem; }
.metric-chart .axis { stroke: var(--rule); stroke-width: 1; }
.metric-chart .seg-human { fill: var(--accent); }
.metric-chart .seg-unsure { fill: #c9b558; }
.metric-chart .seg-bot { fill: #cdd2d9; }
.metric-chart .marker { stroke: #c0392b; stroke-width: 1; stroke-dasharray: 3 2; opacity: 0.85; }
.metric-chart .marker-published { stroke: #2f6b3a; }

.metric-axis { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--muted); }
.metric-empty { color: var(--muted); font-size: 0.9rem; }
.metric-countries { margin-top: 0.7rem; display: flex; gap: 0.5rem; flex-wrap: wrap; font-size: 0.82rem; align-items: center; }
.metric-countries .mc { background: var(--soft); border-radius: 999px; padding: 0.1rem 0.6rem; }
.metric-countries .mc-label { color: var(--muted); }
.metric-note { margin-top: 1.6rem; border-top: 1px solid var(--rule); padding-top: 0.9rem; color: var(--muted); font-size: 0.83rem; max-width: 70ch; }
