/* Portal styles: used by index.html and module.html only. Items style themselves. */

:root {
  color-scheme: light dark;
  --bg: #f6f6f4;
  --surface: #ffffff;
  --text: #1c1c1e;
  --muted: #5d6167;
  --border: #dadad6;
  --accent: #2553b8;
  --accent-soft: #e7edfa;
  --on-accent: #ffffff;
  --good: #1e7a3c;
  --good-soft: #e3f3e8;
  --mid: #8a5a00;
  --mid-soft: #fbf0d9;
  --weak: #b3261e;
  --weak-soft: #fbe7e5;
  --radius: 10px;
  --max-width: 960px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141517;
    --surface: #1d1f23;
    --text: #ececee;
    --muted: #a2a6ad;
    --border: #34373d;
    --accent: #93b1ff;
    --accent-soft: #1f2940;
    --on-accent: #10131a;
    --good: #7fd69a;
    --good-soft: #173222;
    --mid: #f2c46b;
    --mid-soft: #3a2e14;
    --weak: #ff8a80;
    --weak-soft: #3a1c1a;
  }
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
}

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

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

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 16px;
  min-height: 56px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.site-nav {
  display: flex;
  gap: 16px;
  font-size: 0.95rem;
}

.site-nav a {
  text-decoration: none;
}

.site-nav a[aria-current="page"] {
  color: var(--text);
  font-weight: 600;
}

.site-name {
  color: var(--text);
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
}

/* Page content */

main {
  padding: 32px 0 48px;
}

h1 {
  margin: 0 0 8px;
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  line-height: 1.2;
}

h2 {
  margin: 36px 0 12px;
  font-size: 1.25rem;
}

.lead {
  margin: 0;
  color: var(--muted);
  max-width: 60ch;
}

.breadcrumb {
  display: inline-block;
  margin-bottom: 16px;
  font-size: 0.95rem;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.notice {
  margin-top: 24px;
  padding: 16px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
}

/* Cards */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.page-home .grid {
  margin-top: 28px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.card-title {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.3;
}

.card-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.card-meta {
  margin-top: auto;
  padding-top: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.badge {
  align-self: flex-start;
  padding: 2px 8px;
  background: var(--accent-soft);
  border-radius: 999px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
}

/* Progress */

h3 {
  margin: 24px 0 8px;
  font-size: 1.05rem;
}

.hint {
  color: var(--muted);
  font-size: 0.92rem;
}

.panel {
  margin-top: 12px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.grid .panel {
  margin-top: 0;
}

.status {
  color: var(--muted);
  font-size: 0.85rem;
}

.card .status {
  margin-top: auto;
  padding-top: 8px;
}

.status-done {
  color: var(--good);
  font-weight: 600;
}

.score {
  display: inline-block;
  min-width: 3.2em;
  padding: 1px 7px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}

.score-strong { background: var(--good-soft); color: var(--good); }
.score-developing { background: var(--mid-soft); color: var(--mid); }
.score-weak { background: var(--weak-soft); color: var(--weak); }

.meter-wrap {
  display: block;
  margin-top: 8px;
}

.meter {
  display: block;
  height: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.meter-fill {
  display: block;
  height: 100%;
  background: var(--accent);
}

.meter-fill.meter-strong { background: var(--good); }
.meter-fill.meter-developing { background: var(--mid); }
.meter-fill.meter-weak { background: var(--weak); }

.meter-label {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.85rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  gap: 12px;
}

.stat {
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-label {
  color: var(--muted);
  font-size: 0.88rem;
}

.stat-weak .stat-value {
  color: var(--weak);
}

.topic-list,
.status-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.topic {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.topic .hint {
  margin: 6px 0 0;
}

.topic-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.topic-name {
  font-weight: 600;
}

.status-list {
  gap: 6px;
  margin-top: 12px;
}

.status-list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.question-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 1.4em;
}

/* Forms and buttons */

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
}

.field {
  display: flex;
  flex: 1 1 220px;
  flex-direction: column;
  gap: 4px;
  font-size: 0.92rem;
  font-weight: 600;
}

.field-inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
}

input,
select {
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-weight: 400;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.button {
  display: inline-block;
  padding: 9px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

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

.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}

.button:focus-within {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.link-button {
  padding: 0;
  background: none;
  border: 0;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Instructor dashboard */

.import {
  margin-top: 24px;
}

.dropzone {
  padding: 16px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.dropzone p {
  margin: 0;
}

.dropzone .actions {
  justify-content: center;
}

.dropzone.dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.errors {
  margin: 0;
  padding-left: 1.2em;
  color: var(--weak);
  font-size: 0.92rem;
}

.table-scroll {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.class-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.class-table th,
.class-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.class-table thead th {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  vertical-align: bottom;
}

.class-table thead .link-button {
  color: var(--muted);
}

.class-table .item-col {
  max-width: 9em;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
}

.class-table tbody tr:last-child > * {
  border-bottom: 0;
}

.class-table tr.selected {
  background: var(--accent-soft);
}

@media (prefers-reduced-motion: reduce) {
  .card {
    transition: none;
  }
  .card:hover {
    transform: none;
  }
}

/* Sign-in (home page) */

.signin {
  margin-top: 24px;
  max-width: 640px;
}

.signin h2 {
  margin-top: 0;
}

.signin-error {
  padding: 10px 14px;
  background: var(--mid-soft);
  border-left: 4px solid var(--mid);
  border-radius: 8px;
  color: var(--mid);
  font-weight: 600;
}

.trainee-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 16px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
