/* matteOpus — midnight indigo, mathematical mystery */

:root {
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --w: 1100px;
  --w-prose: 680px;
  --r: 10px;
  --r-lg: 18px;
  --ease: cubic-bezier(.32,.72,0,1);
}

:root, :root[data-theme="light"] {
  --bg: #faf9f5;
  --surface: #ffffff;
  --surface-2: #f0eee6;
  --ink: #2c2a26;
  --muted: #6b6963;
  --soft: #a09e97;
  --line: #e8e6dd;
  --line-2: #d4d2c8;
  --accent: #c15f3c;
  --accent-2: #a14e2d;
  --accent-bg: rgba(217, 119, 87, .12);
  --header-bg: rgba(250, 249, 245, .85);
}

:root[data-theme="dark"] {
  --bg: #0e0f1a;
  --surface: #161725;
  --surface-2: #1e1f2f;
  --ink: #e8e7ef;
  --muted: #93919f;
  --soft: #5d5b6f;
  --line: #25253a;
  --line-2: #383857;
  --accent: #a288e7;
  --accent-2: #c4afff;
  --accent-bg: rgba(162, 136, 231, .15);
  --header-bg: rgba(14, 15, 26, .8);
}

*,*::before,*::after { box-sizing: border-box; }
::selection { background: var(--accent-bg); color: var(--accent-2); }

html, body { margin: 0; padding: 0; }
body {
  font: 15px/1.55 var(--sans);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body, .header, .footer, .card, .row, .row-link, .row-links a, .nav a, .theme-toggle, .stat-num, .stat-src, .stat-lbl, .tag, input, .card-arrow, .card-progress, .crumbs, .crumbs a, .row-term, .card-id, .card-name, .card-meta, .lede, .section-h, .done, .done-wrap, .summary, h1, h2, h3, p {
  transition: background-color .5s var(--ease), color .5s var(--ease), border-color .5s var(--ease), fill .5s var(--ease);
}

a { color: inherit; text-decoration: none; }
em { font-family: var(--serif); font-style: italic; color: var(--accent); font-weight: 400; }

h1,h2,h3 { margin: 0 0 .5em; font-weight: 500; letter-spacing: -.02em; line-height: 1.15; }
h1 { font-size: clamp(2.1rem, 4.4vw, 3.2rem); letter-spacing: -.03em; font-weight: 500; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }

/* — header / footer — */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 50;
}
.brand { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; letter-spacing: -.01em; font-size: 1.05rem; }
.brand-mark {
  width: 3.4rem; height: 3.4rem;
  color: var(--accent);
  flex-shrink: 0;
}
.brand em { color: var(--accent); }
.nav { display: flex; gap: 2px; }
.nav a { padding: 6px 14px; border-radius: 999px; color: var(--muted); font-size: .9rem; transition: color .15s var(--ease), background .15s var(--ease); }
.nav a:hover { color: var(--ink); background: var(--surface-2); }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 999px;
  color: var(--muted); font-size: 1rem;
  background: transparent; border: 0; cursor: pointer;
  margin-left: 4px;
  transition: color .15s var(--ease), background .15s var(--ease);
}
.theme-toggle:hover { background: var(--surface-2); color: var(--accent); }
.theme-toggle::before { content: '☾'; }
:root[data-theme="dark"] .theme-toggle::before { content: '☀'; }

main { flex: 1; max-width: var(--w); margin: 0 auto; width: 100%; padding: 56px 32px 80px; }

.footer { padding: 22px 32px; border-top: 1px solid var(--line); font-size: .82rem; color: var(--muted); text-align: center; }
.footer a { text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.footer a:hover { color: var(--ink); }

/* — primitives — */

.tag {
  display: inline-block;
  font-size: .72rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--accent); background: var(--accent-bg);
  padding: 5px 12px; border-radius: 999px;
  margin-bottom: 18px;
}
.tag-soft { background: transparent; color: var(--soft); padding: 0; }

.lede { font-size: 1.08rem; color: var(--muted); max-width: 56ch; line-height: 1.55; }

.crumbs {
  display: flex; align-items: center; gap: 8px;
  font-size: .85rem; color: var(--muted);
  margin-bottom: 28px;
}
.crumbs a { transition: color .15s; }
.crumbs a:hover { color: var(--accent); }
.crumbs span { color: var(--soft); }

.prose { max-width: var(--w-prose); margin: 0 auto; }
.prose.about ul { padding-left: 22px; color: var(--muted); }
.prose.about li { margin-bottom: 8px; }
.prose.about a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.prose.about h2 { margin-top: 36px; font-size: 1.2rem; }

.section-h { font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; color: var(--soft); font-weight: 500; margin-bottom: 18px; }

/* — hero — */

.hero { text-align: center; max-width: var(--w-prose); margin: 0 auto 64px; }
.hero h1 { margin-bottom: 22px; }
.hero .lede { margin: 0 auto; }

.stats { display: flex; justify-content: center; gap: 56px; margin-top: 44px; flex-wrap: wrap; }
.stat-num { display: block; font: italic 400 2.2rem/1 var(--serif); color: var(--accent); }
.stat-src { display: block; font-size: .95rem; font-weight: 600; color: var(--accent); line-height: 1.35; transition: color .15s; }
.stat-src + .stat-src { margin-top: 2px; }
.stat-src:hover { color: var(--accent-2); text-decoration: underline; text-underline-offset: 3px; }
.stat-lbl { display: block; font-size: .72rem; color: var(--soft); text-transform: uppercase; letter-spacing: .12em; margin-top: 8px; }

/* — course grid — */

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.card {
  position: relative;
  display: block;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  transition: transform .2s var(--ease), border-color .2s var(--ease);
}
.card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.card-id { font: 600 1.4rem/1 var(--sans); color: var(--accent); letter-spacing: -.02em; }
.card-name { font-weight: 600; margin-top: 14px; }
.card-meta { font-size: .82rem; color: var(--soft); margin-top: 2px; }
.card-arrow {
  position: absolute; right: 18px; bottom: 18px;
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); background: var(--surface-2);
  font-size: .9rem; transition: all .2s var(--ease);
}
.card:hover .card-arrow { background: var(--accent); color: #fff; transform: translateX(2px); }

/* — exam list — */

.exams { list-style: none; padding: 0; margin: 0 auto; max-width: var(--w-prose); border-top: 1px solid var(--line); margin-top: 32px; }
.row {
  display: grid; grid-template-columns: 28px 110px 1fr;
  align-items: center; gap: 16px;
  padding: 18px 6px;
  border-bottom: 1px solid var(--line);
  transition: padding .15s var(--ease), background .15s var(--ease), opacity .15s var(--ease);
}
.row:hover { background: var(--surface); padding-inline: 18px; border-radius: var(--r); }
.row.is-done { opacity: .5; }
.row.is-done .row-title { text-decoration: line-through; text-decoration-color: var(--soft); }
.row-term { font: 600 .82rem/1 var(--sans); color: var(--accent); letter-spacing: .08em; text-transform: uppercase; }
.row-title { font-weight: 500; }
.row-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: inherit; }
.row-link:hover { color: var(--accent); }
.row-arrow { color: var(--soft); transition: color .15s, transform .15s; font-size: 1.05rem; }
.row-link:hover .row-arrow { color: var(--accent); transform: translateX(3px); }

.row-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.row-links a {
  font-size: .82rem;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line);
  font-weight: 500;
  transition: all .15s var(--ease);
}
.row-links a:hover { background: var(--accent-bg); color: var(--accent-2); border-color: transparent; }

/* — checkbox — */

.done-wrap { display: flex; align-items: center; justify-content: center; cursor: pointer; }
.done {
  appearance: none; -webkit-appearance: none;
  width: 18px; height: 18px;
  border: 1.5px solid var(--line-2);
  border-radius: 5px;
  background: var(--surface);
  cursor: pointer;
  transition: all .15s var(--ease);
  position: relative;
  margin: 0;
}
.done:hover { border-color: var(--accent); }
.done:checked { background: var(--accent); border-color: var(--accent); }
.done:checked::after {
  content: ''; position: absolute;
  left: 4px; top: 0;
  width: 5px; height: 10px;
  border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* — card progress — */

.card-progress { font-size: .78rem; color: var(--accent); font-weight: 600; margin-top: 6px; min-height: 1em; }
.card.is-done .card-progress::after { content: ' ✓'; }

/* — responsive — */

@media (max-width: 640px) {
  .header { padding: 14px 18px; }
  main { padding: 36px 18px 64px; }
  .footer { padding: 20px 18px; }
  .grid { grid-template-columns: 1fr; }
  .row { grid-template-columns: 24px 70px 1fr; gap: 10px; padding: 16px 4px; }
  .row:hover { padding-inline: 12px; }
  .row-term { font-size: .76rem; }
  .stats { gap: 32px; }
}
