/* learn.thisisalgebra.com. Mobile first. Colours follow the Algebra website, with the Institute's green accent. */

:root {
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --bg: #f4f3ef;
  --surface: #ffffff;
  --ink: #0e0e0e;
  --muted: #5e5e5a;
  --line: #d8d5cd;
  --field-line: #85827b;
  --accent: #0b7a5b;
  --on-accent: #ffffff;
  --danger: #b3261e;
  --on-danger: #ffffff;
  --ok: #0b6b4f;
  --late-bg: #fbe9e7;
  --radius: 6px;
  --gutter: 16px;
  --max: 46rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0d0c;
    --surface: #1a1a19;
    --ink: #f2f1ec;
    --muted: #a09e98;
    --line: #2c2c2a;
    --field-line: #75736d;
    --accent: #3ccb9a;
    --on-accent: #0e0e0e;
    --danger: #ff8a7a;
    --on-danger: #0e0e0e;
    --ok: #5fd6a8;
    --late-bg: #3a1d19;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 1rem/1.6 var(--font);
}
a {
  color: var(--ink);
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}
a:hover {
  color: var(--accent);
}
/* Links that stand on their own, outside a sentence, get a target at least 24 pixels tall (WCAG 2.2, 2.5.8). */
.eyebrow a,
.week a,
.stats a,
.list a,
.card h2 a,
.submission p > a,
.download a,
.table a {
  display: inline-block;
  min-height: 24px;
  padding: 0.15rem 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
h1,
h2,
h3 {
  line-height: 1.25;
  margin: 1.5em 0 0.5em;
}
h1 {
  font-size: 1.75rem;
  margin-top: 0.5em;
}
h2 {
  font-size: 1.25rem;
}
h3 {
  font-size: 1.05rem;
}
p,
ul,
ol,
dl {
  margin: 0 0 1rem;
}
.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.main {
  padding-top: 1rem;
  padding-bottom: 3rem;
}
.main:focus {
  outline: none;
}

/* Skip link */
.skip {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  padding: 0.5rem 1rem;
  background: var(--surface);
  border: 2px solid var(--accent);
  z-index: 10;
}
.skip:focus {
  top: 0.5rem;
}

/* Header and footer */
.header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.header__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}
.brand {
  font-weight: 700;
  text-decoration: none;
}
.nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav a,
.linkish {
  display: inline-block;
  min-height: 24px;
  padding: 0.25rem 0;
}
.nav form {
  margin: 0;
}
.linkish {
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
  cursor: pointer;
}
.footer {
  border-top: 1px solid var(--line);
  padding: 1.5rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.footer a {
  color: var(--muted);
}

/* Text */
.lead {
  font-size: 1.1rem;
}
.eyebrow {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}
.muted,
.hint {
  color: var(--muted);
}
.hint {
  font-size: 0.9rem;
  margin: 0.25rem 0;
}
.draft {
  font-size: 0.85rem;
  color: var(--muted);
  border-left: 3px solid var(--accent);
  padding-left: 0.5rem;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.answer,
.comment__body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Buttons */
.button {
  display: inline-block;
  min-height: 44px;
  padding: 0.6rem 1.1rem;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.button:hover {
  color: var(--on-accent);
  filter: brightness(1.08);
}
.button--ghost {
  background: transparent;
  color: var(--ink);
}
.button--ghost:hover {
  color: var(--ink);
}
.button--small {
  min-height: 36px;
  padding: 0.3rem 0.8rem;
  font-size: 0.95rem;
}
.button--danger,
.button--danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--on-danger);
}

/* Forms */
.field {
  margin: 0 0 1.25rem;
}
.field label {
  display: block;
  font-weight: 600;
}
.optional {
  font-weight: 400;
  color: var(--muted);
}
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
textarea,
select {
  width: 100%;
  min-height: 44px;
  padding: 0.5rem 0.65rem;
  border: 2px solid var(--field-line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
textarea {
  resize: vertical;
}
[aria-invalid="true"] {
  border-color: var(--danger);
}
.field-error {
  color: var(--danger);
  font-weight: 600;
  margin: 0.25rem 0;
}
.field--check {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.65rem;
  align-items: start;
}
.field--check .field-error {
  grid-column: 1 / -1;
}
.field--check input {
  width: 24px;
  height: 24px;
  margin: 0.15rem 0 0;
  accent-color: var(--accent);
}
.field--check label {
  font-weight: 400;
}
.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.5rem;
  margin: 0.5rem 0;
}
.inline-form label {
  flex-basis: 100%;
  font-weight: 600;
}
.inline-form select {
  width: auto;
  max-width: 100%;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: end;
  margin: 1rem 0;
}
.actions form {
  margin: 0;
}
.danger-zone {
  border: 2px solid var(--danger);
  border-radius: var(--radius);
  padding: 1rem;
}
.danger-zone input {
  margin: 0.25rem 0 0.75rem;
}

/* Notices */
.notice {
  border: 2px solid var(--line);
  border-left-width: 6px;
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0.75rem 1rem;
  margin: 0 0 1.5rem;
}
.notice > :last-child {
  margin-bottom: 0;
}
.notice h2 {
  margin-top: 0;
  font-size: 1.05rem;
}
.notice--error {
  border-color: var(--danger);
}
.notice--ok {
  border-color: var(--ok);
}
.notice--info {
  border-color: var(--accent);
}

/* Lists, cards, tags */
.cards,
.weeks,
.comments,
.stats {
  list-style: none;
  padding: 0;
}
.card,
.week,
.applicant,
.submission {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 0 0 0.75rem;
}
.card h2 {
  margin-top: 0;
}
.card--open {
  border-left: 6px solid var(--accent);
}
.list li {
  margin-bottom: 0.5rem;
}
.tag {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0 0.45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}
.tag--late {
  border-color: var(--danger);
  background: var(--late-bg);
  color: var(--danger);
}
.tag--draft {
  border-color: var(--accent);
}
.week progress {
  width: 100%;
  height: 0.5rem;
  accent-color: var(--accent);
}
.week p {
  margin: 0.25rem 0;
  font-size: 0.9rem;
}
.week--waiting-for-date,
.week--waiting-for-tasks {
  opacity: 0.85;
}
.stats li {
  margin: 0 0 0.5rem;
}
.stats strong {
  font-size: 1.4rem;
  margin-right: 0.35rem;
}
.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.25rem 1rem;
}
.facts dt {
  color: var(--muted);
}
.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.comments li {
  border-left: 3px solid var(--line);
  padding: 0.25rem 0 0.25rem 0.75rem;
  margin: 0 0 0.75rem;
}
.comment__meta {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.comment-form label {
  display: block;
  font-weight: 600;
  margin-top: 0.5rem;
}
.comment-form textarea {
  margin: 0.25rem 0 0.5rem;
}
.hidden-comment {
  opacity: 0.6;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin: 0 0 1rem;
}
.table {
  border-collapse: collapse;
  width: 100%;
  background: var(--surface);
}
.table th,
.table td {
  border: 1px solid var(--line);
  padding: 0.35rem 0.5rem;
  text-align: left;
  vertical-align: top;
}
.table td.late {
  background: var(--late-bg);
  color: var(--danger);
  font-weight: 600;
}
tr.withdrawn {
  color: var(--muted);
}

/* Video: a note with scripts off, a button with scripts on, the player only after a press. */
.video {
  margin: 1rem 0;
}
.video figcaption {
  margin-top: 0.5rem;
}
.video__nojs {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}

/* The written guide */
.guide ul,
.guide ol {
  padding-left: 1.4rem;
}
.guide li {
  margin-bottom: 0.4rem;
}
.tip {
  border-left: 4px solid var(--accent);
  background: var(--surface);
  padding: 0.6rem 0.9rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.task-prompt {
  font-weight: 600;
}
.download {
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0.6rem 0.9rem;
}
.download a {
  font-weight: 600;
}
.week__theme {
  font-weight: 600;
}
.week__title {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}
.week__lessons {
  margin: 0.25rem 0 0;
  padding-left: 1.2rem;
}
.video__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000000;
  border-radius: var(--radius);
  overflow: hidden;
}
.video__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

@media (min-width: 48rem) {
  h1 {
    font-size: 2.1rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
