/* Lab Explorer — styled to match MicrosoftLearning/Jekyll-Theme, the remote theme
   used by the mslearn-* lab sites. Tokens taken from that theme's _sass/theme.scss. */

:root {
  /* Palette */
  --page: #f5f1e8; /* the theme's warm cream page background */
  --surface: #ffffff; /* content surfaces: cards, note blocks, filter bar */
  --footer-bg: #f8f9fa; /* Bootstrap .bg-light, as used by the theme footer */
  --text: #222222;
  --muted: #5f5f68; /* darkened from the theme's greys to clear 4.5:1 on cream */
  --border: #e3e3e3;
  --accent: #6b4ba1;
  --accent-hover: #8a6fc1; /* theme hover purple; only ever paired with an underline */
  --accent-visited: #7355a8; /* accessible stand-in for the theme's visited purple */
  --accent-bg: #efe9f7; /* light purple tint; the theme has no direct equivalent */
  --tag-bg: #f1f1f3;
  --tag-text: #52525b;
  --warn-bg: #fef3c7;
  --warn-text: #92400e;
  --radius: 6px;

  /* Type stacks, verbatim from the theme */
  --font-body: segoe-ui_normal, "Segoe UI", Segoe, "Segoe WP", "Helvetica Neue", Helvetica,
    sans-serif;
  --font-light: segoe-ui_light, "Segoe UI Light", "Segoe WP", "Helvetica Neue", Helvetica,
    sans-serif;
  --font-semibold: segoe-ui_semibold, "Segoe UI Semibold", "Segoe WP", "Helvetica Neue",
    Helvetica, sans-serif;
}

/* The upstream theme has no dark mode. This is a warm dark variant that keeps the
   purple accent rather than inverting the cream into a cold grey. */
@media (prefers-color-scheme: dark) {
  :root {
    --page: #1c1a17;
    --surface: #262320;
    --footer-bg: #211e1b;
    --text: #ece8e1;
    --muted: #aaa59c;
    --border: #3a3630;
    --accent: #bda3e4;
    --accent-hover: #d3c0ef;
    --accent-visited: #ac90d8;
    --accent-bg: #352a4c;
    --tag-bg: #322e29;
    --tag-text: #cac4ba;
    --warn-bg: #463612;
    --warn-text: #f3d68a;
  }
}

* {
  box-sizing: border-box;
}

html {
  -ms-text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  color-scheme: light dark;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 100%;
  line-height: 160%;
}

/* ---------- typography ---------- */

h1,
h2,
h3,
h4,
h5,
h6,
.title {
  font-style: normal;
  font-weight: 300;
  line-height: 1.3;
  text-rendering: optimizeLegibility;
  word-wrap: break-word;
}

h1,
h2,
.title {
  font-family: var(--font-light);
}

h3,
h4,
h5,
h6 {
  font-family: var(--font-semibold);
}

h1 {
  font-size: 2.5rem;
}

h2,
.title {
  font-size: 1.75rem;
}

a {
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
  word-wrap: break-word;
}

a:visited {
  color: var(--accent-visited);
}

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

small {
  font-size: 11px;
}

/* ---------- layout: Bootstrap 4 .container equivalent ---------- */

.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 15px;
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  z-index: 10;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

.site-header .title {
  display: block;
  margin: 1.25rem 0 0.625rem;
  color: var(--text);
}

.site-header hr {
  border: 0;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  margin: 1rem 0;
}

@media (prefers-color-scheme: dark) {
  .site-header hr {
    border-top-color: rgba(255, 255, 255, 0.12);
  }
}

.lede {
  margin: 0 0 1.5rem;
  color: var(--muted);
  max-width: 46rem;
}

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

.site-footer {
  margin-top: 3rem;
  background: var(--footer-bg);
  border-top: 1px solid var(--border);
  padding: 0.5rem 1rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--muted);
}

.site-footer p {
  margin: 0.25rem 0;
}

.site-footer .sep {
  padding: 0 0.35rem;
}

.site-footer .gh-icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  fill: currentColor;
  margin-right: 0.3em;
}

/* ---------- filter bar ---------- */

.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
  gap: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  background: var(--surface);
}

.filter {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.filter--search {
  grid-column: 1 / -1;
}

.filter--duration {
  grid-column: 1;
}

.filter--actions {
  grid-column: 4;
  align-items: flex-end;
  justify-content: flex-end;
}

@media (max-width: 900px) {
  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter--actions {
    grid-column: 2;
  }
}

.filters label {
  font-family: var(--font-semibold);
  text-transform: uppercase;
  font-size: 0.78em;
  letter-spacing: 0.06em;
  color: var(--muted);
  line-height: 1.3;
}

.filters input[type="search"],
.filters select {
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 0.5rem;
  width: 100%;
}

.filters select[multiple] {
  padding: 0.2rem;
}

.filters select[multiple] option {
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
}

.filters select[multiple] option:checked {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
}

.filters select[multiple] option.is-zero {
  color: var(--muted);
}

.topic-search {
  margin-bottom: 0.15rem;
}

.hint {
  margin: 0;
  font-size: 0.72em;
  color: var(--muted);
  line-height: 1.4;
}

.btn {
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.45rem 0.85rem;
}

.btn:hover {
  background: var(--accent-bg);
}

/* ---------- result bar ---------- */

.resultbar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 1rem;
  margin: 1.5rem 0 0.85rem;
}

.count {
  margin: 0;
  font-family: var(--font-semibold);
  font-size: 1.188rem;
  font-weight: 300;
  line-height: 1.3;
}

.active-filters {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

/* ---------- cards ---------- */

.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: 1rem;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

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

.card h2 {
  margin: 0;
  font-family: var(--font-semibold);
  font-size: 1.188rem;
  line-height: 1.3;
}

.card .repo {
  font-family: var(--font-semibold);
  font-size: 0.78em;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0;
  line-height: 1.4;
}

.card .desc {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.card .tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
}

.tag {
  display: inline-block;
  font-size: 0.72em;
  line-height: 1.6;
  padding: 0.12em 0.5em;
  border-radius: 999px;
  background: var(--tag-bg);
  color: var(--tag-text);
  white-space: nowrap;
}

.tag--accent {
  background: var(--accent-bg);
  color: var(--accent);
}

.tag--warn {
  background: var(--warn-bg);
  color: var(--warn-text);
}

.card .meta {
  margin: auto 0 0;
  padding-top: 0.2rem;
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  line-height: 1.5;
}

/* ---------- states ---------- */

.empty,
.error {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
}

.empty h2,
.error h2 {
  margin: 0 0 0.35rem;
  font-size: 1.75rem;
  color: var(--text);
}

.empty p,
.error p {
  margin: 0 0 0.85rem;
}

@media (max-width: 640px) {
  .filters {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }

  .filter--search,
  .filter--topic,
  .filter--duration,
  .filter--actions {
    grid-column: 1;
  }

  h1 {
    font-size: 2rem;
  }
}
