/* Components — buttons, cards, badges, grids shared across views. */

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  font-family: var(--font-body); font-size: var(--step-0); font-weight: 600;
  padding: var(--sp-3) var(--sp-5);
  border-radius: 999px; border: 1.5px solid transparent;
  cursor: pointer; text-decoration: none; line-height: 1;
  transition: transform .12s ease, background .15s ease, box-shadow .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--clay); color: #fff; box-shadow: 0 8px 18px -8px rgba(191,90,60,.7); }
.btn--primary:hover { background: var(--clay-dark); color: #fff; }
.btn--accent, .btn--solid { background: var(--accent); color: #fff; }
.btn--accent:hover, .btn--solid:hover { filter: brightness(.92); color: #fff; }
.btn--sm { font-size: var(--step--1); padding: var(--sp-2) var(--sp-4); }
.btn--ghost { background: transparent; border-color: var(--line-2); color: var(--ink); }
.btn--ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn--quiet { background: transparent; color: var(--ink-2); padding-inline: var(--sp-3); }
.btn--quiet:hover { color: var(--clay-dark); }
.btn--lg { font-size: var(--step-1); padding: var(--sp-4) var(--sp-6); }
.btn--block { display: flex; width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card--pad { padding: var(--sp-5); }

.grid { display: grid; gap: var(--sp-5); }
.grid--subjects { grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr)); }
.grid--topics { grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }

/* ---- Subject card ---- */
.subject-card {
  --c: var(--accent);
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp-5);
  text-decoration: none; color: var(--ink);
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  position: relative; overflow: hidden;
}
.subject-card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--c);
}
.subject-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--c); color: var(--ink); }
.subject-card__glyph {
  width: 52px; height: 52px; border-radius: 13px;
  display: grid; place-items: center; font-size: 1.7rem;
  background: color-mix(in srgb, var(--c) 14%, var(--surface));
  color: var(--c); margin-bottom: var(--sp-3);
}
.subject-card h3 { font-size: var(--step-1); margin-bottom: var(--sp-1); }
.subject-card p { font-size: var(--step--1); color: var(--ink-2); flex: 1; }
.subject-card__foot {
  margin-top: var(--sp-4); padding-top: var(--sp-3); border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
  font-size: var(--step--1); color: var(--ink-3); font-weight: 500;
}
.subject-card__foot .go { color: var(--c); font-weight: 600; }

/* ---- Topic card ---- */
.topic-card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--sp-5);
  text-decoration: none; color: var(--ink);
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.topic-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--accent); color: var(--ink); }
.topic-card__top { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.topic-card h3 { font-size: var(--step-1); margin-bottom: var(--sp-2); }
.topic-card__enquiry { font-size: var(--step--1); color: var(--ink-2); font-style: italic; flex: 1; }
.topic-card__foot {
  margin-top: var(--sp-4); padding-top: var(--sp-3); border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
  font-size: var(--step--1); color: var(--ink-3);
}

/* ---- Badges / chips ---- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .72rem; font-weight: 600; letter-spacing: .02em;
  padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2);
  border: 1px solid var(--line);
}
.chip--year { background: color-mix(in srgb, var(--accent) 13%, var(--surface)); color: var(--accent); border-color: transparent; }
.chip--hands { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip--done { background: var(--good-soft); color: var(--good); border-color: transparent; }
.chip--maths { background: color-mix(in srgb, var(--s-mathematics) 14%, var(--surface)); color: var(--s-mathematics); border-color: transparent; }

/* progress dots — calm, never a competitive bar */
.dots { display: inline-flex; gap: 4px; }
.dots i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--line-2); display: block;
}
.dots i.on { background: var(--accent); }

/* ---- Hero ---- */
.hero { padding-block: var(--sp-8) var(--sp-7); }
.hero__inner { display: grid; grid-template-columns: 1.15fr .85fr; gap: var(--sp-7); align-items: center; }
.hero h1 { margin-bottom: var(--sp-4); }
.hero .lead { margin-bottom: var(--sp-5); }
.hero__actions { display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.hero__card {
  background: var(--ink-blue); color: #e9e4d8;
  border-radius: var(--radius-lg); padding: var(--sp-6);
  box-shadow: var(--shadow-lg);
}
.hero__card h3 { color: var(--paper); font-size: var(--step-1); margin-bottom: var(--sp-3); }
.hero__card ul { list-style: none; padding: 0; }
.hero__card li { display: flex; gap: var(--sp-3); padding-block: var(--sp-2); font-size: var(--step--1); }
.hero__card li::before { content: "✦"; color: var(--clay); flex: none; }

/* ---- Stat row ---- */
.stats { display: flex; flex-wrap: wrap; gap: var(--sp-6); }
.stat { }
.stat b { font-family: var(--font-display); font-size: var(--step-3); font-weight: 600; display: block; color: var(--accent); line-height: 1; }
.stat span { font-size: var(--step--1); color: var(--ink-3); }

/* ---- Principle cards ---- */
.principle { padding: var(--sp-5); }
.principle__icon { font-size: 1.7rem; margin-bottom: var(--sp-2); }
.principle h3 { font-size: var(--step-1); margin-bottom: var(--sp-2); }
.principle p { font-size: var(--step--1); color: var(--ink-2); }

/* ---- Notice / callout ---- */
.notice {
  border-left: 4px solid var(--accent);
  background: var(--surface-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: var(--sp-4) var(--sp-5);
}
.notice--warn { border-color: var(--warn); background: var(--warn-soft); }
.notice strong { display: block; margin-bottom: 4px; }
.notice p { font-size: var(--step--1); }

/* ---- Section heading ---- */
.section-head { margin-bottom: var(--sp-6); }
.section-head h2 { margin-bottom: var(--sp-2); }
.section-head p { color: var(--ink-2); }

/* ---- Year switcher ---- */
.yearswitch { display: inline-flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 999px; border: 1px solid var(--line); }
.yearswitch button {
  border: none; background: transparent; cursor: pointer;
  font-family: var(--font-body); font-weight: 600; font-size: var(--step--1);
  padding: 6px 14px; border-radius: 999px; color: var(--ink-3);
}
.yearswitch button.on { background: var(--accent); color: #fff; }

/* ---- Empty / loading ---- */
.placeholder { text-align: center; padding: var(--sp-8) var(--sp-5); color: var(--ink-3); }
.spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid var(--line-2); border-top-color: var(--accent);
  margin: 0 auto var(--sp-4); animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Definition / accordion ---- */
details.accordion {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); margin-top: var(--sp-3);
}
details.accordion summary {
  cursor: pointer; padding: var(--sp-3) var(--sp-4); font-weight: 600;
  list-style: none; display: flex; justify-content: space-between; align-items: center;
}
details.accordion summary::-webkit-details-marker { display: none; }
details.accordion summary::after { content: "+"; color: var(--accent); font-size: 1.3rem; }
details.accordion[open] summary::after { content: "–"; }
details.accordion .accordion__body { padding: 0 var(--sp-4) var(--sp-4); }

@media (max-width: 820px) {
  .hero__inner { grid-template-columns: 1fr; }
}

/* ---- Rendered markdown (prose sections from the planners) ---- */
.teach-block h3 + *, .accordion__body > * { margin-top: var(--sp-2); }
.teach-block ul, .teach-block ol { padding-left: var(--sp-5); }
.teach-block li { margin-top: var(--sp-1); }
.teach-block h3, .teach-block h4, .teach-block h5 { margin-top: var(--sp-4); }
.teach-block p { max-width: var(--reading); }
.teach-block blockquote {
  border-left: 3px solid var(--accent); padding-left: var(--sp-3);
  color: var(--ink-2); font-style: italic; margin-block: var(--sp-2);
}
.teach-block code, .activity code {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 5px; padding: 1px 5px; font-size: .88em;
}
.md-table {
  width: 100%; border-collapse: collapse; margin-block: var(--sp-3);
  font-size: var(--step--1);
}
.md-table th, .md-table td {
  border: 1px solid var(--line); padding: var(--sp-2) var(--sp-3);
  text-align: left; vertical-align: top;
}
.md-table th { background: var(--surface-2); font-weight: 600; }
.md-table tr:nth-child(even) td { background: var(--surface-2); }
