/* 02805 Network Stories — dark network-science theme */

:root {
  --bg: #0d1117;
  --bg-elevated: #161b22;
  --border: #21262d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-green: #3fb950;
  --glow: rgba(88, 166, 255, 0.15);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, sans-serif;
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent-green);
  text-decoration: underline;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg) 100%);
  padding: 2rem 1.5rem 1.5rem;
  text-align: center;
}

.site-header h1 {
  margin: 0 0 0.35rem;
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-green) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.site-header .tagline {
  margin: 0;
  color: var(--text-muted);
  font-size: 1rem;
}

main {
  max-width: 820px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

main.wide {
  max-width: 960px;
}

.group-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
  box-shadow: 0 0 24px var(--glow);
}

.group-card h2 {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.group-card .group-name {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
}

.group-card .members {
  margin: 0;
  color: var(--text-muted);
}

.post-list {
  list-style: none;
  padding: 0;
  margin: 2rem 0 0;
}

.post-list li {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.75rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.post-list li:hover {
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--glow);
}

.post-list a {
  display: block;
  padding: 1rem 1.25rem;
  text-decoration: none;
  color: inherit;
}

.post-list a:hover {
  text-decoration: none;
}

.post-list .post-title {
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.post-list .post-meta {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.post-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.post-header h1 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  line-height: 1.25;
}

.post-header .meta {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

article h2 {
  margin: 2rem 0 0.75rem;
  font-size: 1.25rem;
  color: var(--accent-green);
}

article p {
  margin: 0 0 1rem;
}

article ul {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

article li {
  margin-bottom: 0.35rem;
}

figure {
  margin: 2rem 0;
  padding: 0;
}

figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4), 0 0 32px var(--glow);
}

figure figcaption {
  margin-top: 0.65rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 2rem;
}

.stat-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
}

.stat-box .value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-box .label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}

table.data-table th,
table.data-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

table.data-table th {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

table.data-table tr:hover td {
  background: var(--bg-elevated);
}

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

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

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

@media (max-width: 600px) {
  .site-header h1 {
    font-size: 1.5rem;
  }

  main {
    padding: 1.5rem 1rem 3rem;
  }
}

/* ---------------------------------------------------------------- week 2 --
   Callouts, the shuffle explorable, and the worked-solutions layout. */

.tldr {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 1.1rem 1.4rem;
  margin: 1.75rem 0;
}

.tldr h3 {
  margin: 0 0 0.6rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
}

.tldr ol,
.tldr ul {
  margin: 0;
  padding-left: 1.2rem;
}

.tldr li {
  margin-bottom: 0.45rem;
}

.tldr li:last-child {
  margin-bottom: 0;
}

.callout {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-green);
  border-radius: 8px;
  padding: 1rem 1.3rem;
  margin: 1.5rem 0;
}

.callout.warn {
  border-left-color: #f0883e;
}

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

.callout .callout-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

article h3 {
  margin: 1.6rem 0 0.5rem;
  font-size: 1.05rem;
  color: var(--text);
}

article code {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.08em 0.35em;
  font-size: 0.9em;
}

article pre {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.5;
}

article pre code {
  background: none;
  border: none;
  padding: 0;
}

.table-scroll {
  overflow-x: auto;
  margin: 1.5rem 0;
}

.table-scroll table.data-table {
  margin: 0;
  min-width: 560px;
}

table.data-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

table.data-table th.num {
  text-align: right;
}

.z-dies {
  color: #f778ba;
  font-weight: 600;
}

.z-lives {
  color: var(--accent-green);
  font-weight: 600;
}

.z-frozen {
  color: var(--text-muted);
  font-style: italic;
}

/* --- the shuffle explorable --- */

.explorable {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin: 2rem 0;
  box-shadow: 0 0 28px var(--glow);
}

.explorable > h3 {
  margin: 0 0 0.15rem;
  font-size: 1.05rem;
  color: var(--accent);
}

.explorable .sm-sub {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.sm-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 0.85rem;
}

.sm-controls select,
.sm-controls button {
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.42rem 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.sm-controls select {
  flex: 1 1 260px;
  cursor: pointer;
}

.sm-controls button:hover:not(:disabled),
.sm-controls select:hover {
  border-color: var(--accent);
}

.sm-controls button[data-role="run"] {
  border-color: var(--accent);
  color: var(--accent);
  min-width: 190px;
}

.sm-controls button:disabled {
  opacity: 0.55;
  cursor: progress;
}

.sm-blurb {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 0.9rem;
  min-height: 2.4em;
}

.sm-body {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 1.1rem;
  align-items: start;
}

.sm-body canvas {
  width: 100%;
  height: 260px;
  display: block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.sm-readout {
  font-size: 0.9rem;
}

.sm-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.42rem 0;
  border-bottom: 1px solid var(--border);
}

.sm-row:last-child {
  border-bottom: none;
}

.sm-row span {
  color: var(--text-muted);
}

.sm-row strong {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.sm-status {
  margin: 0.85rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 700px) {
  .sm-body {
    grid-template-columns: 1fr;
  }
}

/* --- worked solutions --- */

.ex {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 1.5rem 0;
  overflow: hidden;
}

.ex > h2 {
  margin: 0;
  padding: 0.85rem 1.2rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  font-size: 1.05rem;
  color: var(--accent);
}

.ex > h2 .tag {
  float: right;
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  padding-top: 0.3rem;
}

.ex-body {
  padding: 0.4rem 1.2rem 1rem;
}

.ex-body h3 {
  margin: 1.2rem 0 0.4rem;
  font-size: 0.95rem;
  color: var(--accent-green);
}

.ex-body h3:first-child {
  margin-top: 0.9rem;
}

.ex-body figure {
  margin: 1.2rem 0;
}

.toc {
  columns: 2;
  column-gap: 2rem;
  list-style: none;
  padding: 0;
  margin: 1rem 0 2rem;
  font-size: 0.95rem;
}

.toc li {
  margin-bottom: 0.35rem;
  break-inside: avoid;
}

@media (max-width: 600px) {
  .toc {
    columns: 1;
  }
}

.post-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 2.5rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.post-nav a {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 1rem;
  font-size: 0.92rem;
}

.post-nav a:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.post-list .post-tag {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--bg);
  background: var(--accent);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  margin-left: 0.5rem;
  vertical-align: 0.12em;
}
