/* =========================================================================
   hub.css — home pages: the root hub and each subject's roadmap page.
   Load after theme.css and base.css.
   ========================================================================= */

/* ================= Root hub (subject cards) ================= */
.hub-head { padding-bottom: 6px; }
.totals { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.totals span {
  font-family: var(--mono); font-size: 12px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px;
}
.totals b { color: var(--fg); font-weight: 600; }

.subjects {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
  gap: 16px;
  margin-top: 36px;
}
.subj {
  --acc: var(--muted);
  position: relative; display: flex; flex-direction: column; gap: 12px; min-width: 0;
  padding: 22px 22px 20px; border-radius: 16px;
  border: 1px solid var(--line); background: var(--panel);
  color: inherit; text-decoration: none;
}
.subj .glyph {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--acc) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--acc) 55%, transparent);
}
.subj .glyph svg { width: 24px; height: 24px; stroke: var(--acc); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.subj h2 { margin: 0; font-size: 24px; font-weight: 600; }
.subj p { margin: 0; color: var(--fg-soft); }
.subj .meta {
  margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding-top: 12px; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 12px; color: var(--muted);
}
.subj .meta b { color: var(--acc); font-weight: 600; }
.subj .track { height: 6px; background: var(--track); border-radius: 4px; overflow: hidden; }
.subj .track i { display: block; height: 100%; background: var(--acc); }
a.subj { transition: transform .15s, border-color .15s, background .15s; }
a.subj:hover { transform: translateY(-3px); border-color: var(--acc); background: var(--panel-2); }
a.subj .go { color: var(--acc); font-weight: 600; transition: transform .15s; }
a.subj:hover .go { transform: translateX(3px); }
a.subj:focus-visible { outline-color: var(--acc); outline-offset: 3px; }
.subj.soon { background: transparent; border-style: dashed; }
.subj.soon h2 { color: var(--fg-soft); }

.recent { margin-top: 48px; }
.section-rule {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 600; color: var(--muted); margin: 0 0 12px;
}
.section-rule::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.recent ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.recent a {
  display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline;
  padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line);
  text-decoration: none; color: var(--fg);
}
.recent a:hover { border-color: var(--cyan); background: var(--panel); }
.recent .tag { font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.recent .note { color: var(--muted); }
.recent .t { font-weight: 600; }

/* ================= Subject roadmap page ================= */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 32px; align-items: end; padding-bottom: 28px; border-bottom: 1px solid var(--line);
}
@media (max-width: 820px) { .hero { grid-template-columns: minmax(0, 1fr); } }

.flow { display: block; width: 100%; height: auto; margin-top: 22px; }
.flow .w { stroke: var(--fg); stroke-width: 2; fill: none; }
.flow .n { fill: var(--panel-2); stroke: var(--line); }
.flow .lb { fill: var(--teal); }
.flow .sv { fill: var(--yellow); }
.flow text { font-family: var(--display); font-size: 12px; font-weight: 600; text-anchor: middle; }
.flow .t-fg { fill: var(--fg); }
.flow .t-ink { fill: var(--ink); }
.flow .t-on { fill: var(--on-accent); }
.flow .pkt { fill: var(--cyan); }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; min-width: 0; }
.stat b { display: block; font-size: 30px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat span { font-family: var(--mono); font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.meter { grid-column: 1 / -1; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.meter .row { display: flex; justify-content: space-between; gap: 10px; font-family: var(--mono); font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.meter .track { height: 10px; background: var(--track); border-radius: 6px; overflow: hidden; }
.meter .track i { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--cyan)); border-radius: 6px; }

.toolbar {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(6px);
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 14px 0; margin: 8px 0 6px; border-bottom: 1px solid var(--line);
}
@media (max-width: 700px) { .toolbar { position: static; } }
.search {
  flex: 1 1 240px; min-width: 0;
  font: 500 15px var(--display); color: var(--fg);
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px;
}
.search::placeholder { color: var(--faint); }
.seg { display: flex; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { font: 600 13px var(--display); color: var(--muted); background: none; border: 0; border-radius: 8px; padding: 8px 12px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--pill); color: var(--ink); }
.jump { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.jump a {
  font-family: var(--mono); font-size: 11px; letter-spacing: .05em; text-decoration: none;
  color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px;
}
.jump a:hover { color: var(--fg); border-color: var(--muted); }

.phase { margin-top: 44px; scroll-margin-top: 120px; }
.phase-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; margin-bottom: 6px; }
.phase-head .num { font-family: var(--mono); font-size: 12px; color: var(--accent-text); letter-spacing: .08em; text-transform: uppercase; }
.phase-head h2 { font-size: 28px; font-weight: 600; margin: 0; }
.phase-head .weeks { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.week { margin-top: 20px; }
.week .wk { font-family: var(--mono); font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
.day-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 10px; }

.day-card {
  position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 0;
  padding: 14px 16px 15px; border-radius: 12px; border: 1px solid var(--line);
  background: transparent; text-decoration: none;
}
.day-card .day { font-family: var(--mono); font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
.day-card .topic { font-weight: 600; font-size: 16px; line-height: 1.3; color: var(--fg-soft); }
.day-card .status { margin-top: auto; padding-top: 6px; font-family: var(--mono); font-size: 11px; color: var(--faint); }
.day-card.live { background: var(--panel); border-color: var(--teal); transition: transform .15s, border-color .15s, background .15s; }
.day-card.live .day { color: var(--teal-text); }
.day-card.live .topic { color: var(--fg); }
.day-card.live .status { color: var(--cyan); }
.day-card.live::after { content: "→"; position: absolute; top: 12px; right: 14px; color: var(--cyan); font-weight: 600; transition: transform .15s; }
.day-card.live:hover { transform: translateY(-2px); background: var(--panel-2); border-color: var(--cyan); }
.day-card.live:hover::after { transform: translateX(3px); }
.day-card.review { border-style: dashed; }
.empty { color: var(--muted); padding: 40px 0; text-align: center; }

.howto { margin-top: 56px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.howto .box { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; min-width: 0; }
.howto h4 { margin: 0 0 8px; font-size: 16px; }
.howto p { margin: 0; color: var(--fg-soft); }

/* System design track switch (HLD / LLD), shown at the top of each track's roadmap */
.track-tabs { display: inline-flex; gap: 4px; padding: 4px; margin: 4px 0 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.track-tabs a { display: grid; gap: 1px; padding: 8px 18px; border-radius: 10px; color: var(--fg-soft); text-decoration: none; }
.track-tabs a b { font-size: 15px; letter-spacing: .04em; }
.track-tabs a span { font-size: 12px; color: var(--muted); }
.track-tabs a:hover { background: var(--panel-2); color: var(--fg); }
.track-tabs a[aria-current="page"] { background: var(--teal-wash); color: var(--fg); box-shadow: inset 0 0 0 1px var(--teal); }
.empty-track { border: 1.5px dashed var(--line); border-radius: 16px; padding: 28px 24px; margin: 8px 0 24px; color: var(--fg-soft); }
.empty-track h2 { margin: 0 0 8px; font-size: 20px; color: var(--fg); }
.empty-track p { margin: 6px 0; }

/* week-level "at a glance" pattern atlas card */
.day-card.atlas-card { border-color: var(--accent-text); border-style: dashed; }
.day-card.atlas-card .day { color: var(--accent-text); }
.day-card.atlas-card:hover { border-color: var(--accent-text); }

/* collapsible weeks on the roadmaps */
details.week > summary { list-style: none; cursor: pointer; border-radius: 8px; padding: 4px 0; }
details.week > summary::-webkit-details-marker { display: none; }
details.week > summary::before { content: "▸"; font-size: 12px; color: var(--faint); transition: transform .15s; display: inline-block; width: 12px; }
details.week[open] > summary::before { transform: rotate(90deg); }
details.week > summary:hover { color: var(--fg); }
details.week > summary:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
details.week:not([open]) > summary { margin-bottom: 0; }
.wk-meta { font-family: var(--mono); font-size: 11px; color: var(--faint); font-weight: 400; order: 3; }
details.week > summary::after { order: 2; }
