/* ============================================================
   StudyVaults — subject page styles
   (loaded in addition to styles.css)
   ============================================================ */

/* ---- Subject hero ---- */
.subject-hero { position: relative; padding: clamp(40px, 7vw, 76px) 0 clamp(28px, 4vw, 44px); overflow: hidden; }
.subject-hero::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(55% 70% at 85% -20%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%);
  pointer-events: none;
}
.subject-hero__inner { position: relative; max-width: 760px; }

.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .88rem; color: var(--muted); margin-bottom: 22px; }
.breadcrumb a { color: var(--muted); transition: color .2s var(--ease); }
.breadcrumb a:hover { color: var(--accent-ink); }
.breadcrumb span[aria-hidden] { opacity: .5; }
.breadcrumb .breadcrumb__current { color: var(--ink); font-weight: 500; }

.subject-hero__icon {
  display: grid; place-items: center;
  width: 58px; height: 58px; border-radius: 16px;
  background: var(--accent-tint); color: var(--accent-ink);
  margin-bottom: 22px;
}
.subject-hero__icon svg { width: 30px; height: 30px; }

.subject-hero h1 {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(2.2rem, 5.5vw, 3.6rem); letter-spacing: -.03em;
}
.subject-hero h1 em { font-style: italic; color: var(--accent-ink); }
.subject-hero__intro { margin-top: 18px; font-size: clamp(1.02rem, 2.2vw, 1.18rem); color: var(--muted); max-width: 620px; }

.subject-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.subject-meta span {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: .85rem; font-weight: 500; color: var(--ink);
}
.subject-meta span svg { width: 15px; height: 15px; color: var(--accent-ink); }

/* ---- PDF download CTA ---- */
.subject-pdf-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 22px; }
.subject-pdf-cta .btn { flex-shrink: 0; }
.subject-pdf-cta__note { color: var(--muted); font-size: .85rem; margin: 0; }
.pdf-cta.is-loading { opacity: .6; cursor: wait; pointer-events: none; }
.subject-hero__flashcards { margin-top: 14px; }

/* ---- Filter bar ---- */
.topic-toolbar {
  position: sticky; top: 68px; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 16px 0; margin-bottom: 8px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topic-toolbar__count { font-size: .9rem; color: var(--muted); }
.topic-toolbar__count strong { color: var(--ink); font-weight: 600; }

/* ---- Units & topics ---- */
.units { padding: clamp(20px, 4vw, 40px) 0 clamp(48px, 8vw, 88px); }
.unit { padding: 28px 0; border-top: 1px solid var(--line); }
.unit:first-child { border-top: 0; }
.unit__head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 20px; }
.unit__index { font-family: var(--font-display); font-size: 1.05rem; color: var(--accent-ink); font-weight: 500; min-width: 2.2ch; }
.unit__title { font-size: 1.35rem; font-weight: 600; letter-spacing: -.01em; }
.unit__count { margin-left: auto; font-size: .82rem; color: var(--muted); white-space: nowrap; }

.topics-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }

.topic {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color .25s var(--ease), transform .25s var(--ease), box-shadow .25s var(--ease);
}
.topic:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); transform: translateY(-2px); box-shadow: var(--shadow); }
.topic__name { font-size: .98rem; font-weight: 500; }
.topic__name small { display: block; font-weight: 400; color: var(--muted); font-size: .84rem; margin-top: 2px; }

.topic__read {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px;
  font-size: .82rem; font-weight: 600; white-space: nowrap;
  color: var(--accent-ink); background: var(--accent-tint);
  border: 1px solid transparent;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.topic__read svg { width: 14px; height: 14px; }
.topic:hover .topic__read { background: var(--accent); color: #fff; }
[data-theme="dark"] .topic:hover .topic__read { color: #14131a; }

.topic.is-hidden, .unit.is-hidden { display: none; }
.topics-empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---- Revised state on cards ---- */
.topic__actions { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; }
.topic__revised {
  display: none; align-items: center; gap: 6px;
  padding: 8px 13px; border-radius: 999px;
  font-size: .82rem; font-weight: 600; white-space: nowrap;
  color: var(--success-ink); background: var(--success-tint);
}
.topic__revised svg { width: 14px; height: 14px; }
.topic.is-revised { border-color: color-mix(in srgb, var(--success) 40%, var(--line)); }
.topic.is-revised .topic__read { display: none; }
.topic.is-revised .topic__revised { display: inline-flex; }

/* ---- Subject progress bar ---- */
.subject-progress { margin: 2px 0 26px; }
.subject-progress__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.subject-progress__text { font-size: .9rem; font-weight: 600; color: var(--ink); }
.subject-progress__reset {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; font-size: .85rem; color: var(--muted); text-decoration: underline;
  text-underline-offset: 2px; transition: color .2s var(--ease);
}
.subject-progress__reset:hover { color: var(--accent-ink); }
.subject-progress__track { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.subject-progress__bar { height: 100%; width: 0; border-radius: 999px; background: var(--success); transition: width .5s var(--ease); }

/* ---- Other subjects ---- */
.other { padding: clamp(48px, 8vw, 80px) 0; background: var(--surface-2); }
.other h2 { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.6rem, 4vw, 2.2rem); margin-bottom: 24px; }
.other__chips { display: flex; flex-wrap: wrap; gap: 10px; }
.other__chip {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 10px 16px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-weight: 500; font-size: .95rem;
  transition: border-color .2s var(--ease), transform .2s var(--ease), background .2s var(--ease);
}
.other__chip:hover { border-color: var(--accent); transform: translateY(-2px); }
.other__chip svg { width: 18px; height: 18px; color: var(--accent-ink); }

@media (max-width: 720px) {
  .topics-list { grid-template-columns: 1fr; }
  .unit__count { display: none; }
}
