/* ============================================================================
   One topic in detail — sticky topic rail on the left, skills by grade on the
   right. BolEnglish palette; each topic keeps its accent colour but wears it
   lightly. CSS transitions only.
   ========================================================================== */
body { font-family: 'Inter', system-ui, sans-serif; font-size: 1.0625rem; }
h1, h2, h3 { font-family: 'Inter', system-ui, sans-serif; }

:root { --tp-grad: linear-gradient(135deg, #7c3aed, #ec4899);
        --tp-ease: cubic-bezier(.4, 0, .2, 1);
        --tp-stick: 96px; }

/* -------------------------------------------------------------- layout ---- */
.tp-layout { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 26px;
             align-items: start; padding: 18px 0 70px; }
@media (max-width: 900px) { .tp-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; } }
.tp-side, .tp-main { min-width: 0; }

/* view switcher, shared with the other two pages */
.tp-views { display: inline-flex; padding: 4px; border-radius: 999px; background: #efeafb;
            margin: 16px 0 4px; }
.tp-view { padding: 9px 20px; border-radius: 999px; min-height: 42px; display: inline-flex;
           align-items: center; text-decoration: none; font-size: .875rem; font-weight: 700;
           color: #6b6482; transition: color .2s var(--tp-ease), background .2s var(--tp-ease); }
.tp-view:hover { color: var(--purple); }
.tp-view.is-on { background: #fff; color: #4c1d95; box-shadow: 0 4px 14px -5px rgba(124,58,237,.5); }
.tp-view:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }

/* ============================== TOPIC RAIL ============================== */
.tp-side-in { position: sticky; top: var(--tp-stick); }
@media (max-width: 900px) { .tp-side-in { position: static; } }
.tp-railhead { font-size: .6875rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
               color: var(--muted); margin-bottom: 9px; }
.tp-railsearch { width: 100%; padding: 9px 13px; border-radius: 10px; min-height: 42px;
                 margin-bottom: 9px; border: 1.5px solid var(--line); background: var(--card);
                 color: var(--ink); font-family: inherit; font-size: .8125rem;
                 transition: border-color .18s var(--tp-ease), box-shadow .18s var(--tp-ease); }
.tp-railsearch:focus { outline: none; border-color: var(--purple);
                       box-shadow: 0 0 0 3px rgba(124, 58, 237, .14); }

.tp-rail { display: grid; gap: 2px; max-height: min(66vh, 640px); overflow-y: auto;
           padding-right: 4px; scrollbar-width: thin; }
@media (max-width: 900px) {
  /* a horizontal rail on small screens rather than a tall stack */
  .tp-rail { grid-auto-flow: column; grid-auto-columns: max-content; max-height: none;
             overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
  .tp-rail::-webkit-scrollbar { display: none; }
  .tp-railn { display: none; }
}
.tp-railitem { display: flex; align-items: center; gap: 8px; padding: 8px 11px; border-radius: 9px;
               text-decoration: none; color: var(--ink); font-size: .8125rem; font-weight: 600;
               min-height: 40px; white-space: nowrap;
               transition: background .16s var(--tp-ease), transform .16s var(--tp-ease); }
.tp-railitem:hover { background: color-mix(in srgb, var(--c) 9%, transparent); transform: translateX(2px); }
.tp-railitem:focus-visible { outline: 2px solid var(--c); outline-offset: -2px; }
.tp-railitem.is-on { background: color-mix(in srgb, var(--c) 13%, transparent); color: var(--c); }
.tp-raildot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--c);
              opacity: .55; transition: opacity .16s var(--tp-ease), transform .16s var(--tp-ease); }
.tp-railitem.is-on .tp-raildot { opacity: 1; transform: scale(1.3); }
.tp-railname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tp-railn { flex: none; font-size: .6875rem; font-weight: 700; color: var(--muted); }
.tp-railnone { font-size: .8125rem; color: var(--muted); padding: 8px 2px; }

/* touch targets stay at the 44px minimum on small screens. Declared here, after
   the base rule, so source order does not defeat it. */
@media (max-width: 900px) {
  .tp-railitem { min-height: 44px; padding: 10px 13px; }
}

/* ========================= HEADER + PROGRESS RING ====================== */
.tp-head { display: flex; align-items: center; justify-content: space-between; gap: 18px;
           flex-wrap: wrap; padding: 18px 20px; border-radius: 16px; background: var(--card);
           border: 1px solid var(--line); border-top: 3px solid var(--c); margin-bottom: 16px; }
.tp-headmain { display: flex; gap: 14px; align-items: flex-start; min-width: 0; flex: 1; }
.tp-ico { flex: none; width: 46px; height: 46px; border-radius: 13px; display: grid;
          place-items: center; font-size: 1.375rem;
          background: color-mix(in srgb, var(--c) 12%, transparent); }
.tp-headtx { min-width: 0; }
.tp-h1 { font-size: clamp(1.5rem, 3.4vw, 2rem); font-weight: 700; letter-spacing: -.02em;
         color: var(--c); line-height: 1.15; }
.tp-desc { color: var(--muted); font-size: .875rem; line-height: 1.55; margin-top: 4px; max-width: 62ch; }
.tp-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.tp-pill { padding: 5px 12px; border-radius: 999px; font-size: .75rem; font-weight: 600;
           color: var(--muted); background: var(--bg-soft, #f5f3fb); border: 1px solid var(--line); }
.tp-pill b { color: var(--c); font-weight: 800; }
.tp-pill.is-ready b { color: #059669; }

.tp-ring { position: relative; flex: none; width: 60px; height: 60px; display: grid; place-items: center; }
.tp-ring svg { transform: rotate(-90deg); }
.tp-ringbg { fill: none; stroke: var(--line); stroke-width: 6; }
.tp-ringfg { fill: none; stroke: var(--c); stroke-width: 6; stroke-linecap: round;
             transition: stroke-dashoffset .7s var(--tp-ease); }
.tp-ringtx { position: absolute; display: flex; flex-direction: column; align-items: center; line-height: 1; }
.tp-ringtx b { font-size: .8125rem; font-weight: 800; color: var(--c); }
.tp-ringtx small { font-size: .5625rem; color: var(--muted); }

/* ================================ TOOLBAR ============================== */
.tp-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.tp-findwrap { position: relative; flex: 1; min-width: 200px; max-width: 320px; }
.tp-findwrap input { width: 100%; padding: 10px 14px 10px 36px; border-radius: 11px; min-height: 44px;
                     border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
                     font-family: inherit; font-size: .875rem;
                     transition: border-color .18s var(--tp-ease), box-shadow .18s var(--tp-ease); }
.tp-findwrap input:focus { outline: none; border-color: var(--purple);
                           box-shadow: 0 0 0 3px rgba(124, 58, 237, .14); }
.tp-findico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
              pointer-events: none; color: var(--muted); font-size: .875rem; }
.tp-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.tp-fchip { padding: 8px 14px; border-radius: 999px; cursor: pointer; min-height: 44px;
            white-space: nowrap; border: 1.5px solid var(--line); background: var(--card);
            color: var(--ink); font-family: inherit; font-size: .78125rem; font-weight: 600;
            transition: border-color .16s var(--tp-ease), transform .16s var(--tp-ease); }
.tp-fchip:hover { border-color: var(--purple); transform: translateY(-1px); }
.tp-fchip:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }
.tp-fchip.is-on { background: var(--tp-grad); border-color: transparent; color: #fff;
                  box-shadow: 0 6px 15px -8px rgba(124, 58, 237, .8); }
.tp-shown { margin-left: auto; font-size: .78125rem; font-weight: 600; color: var(--muted); }

/* ============================= GRADE COLUMNS ========================== */
/* CSS columns keep the grade blocks flowing like a printed index */
.tp-cols { columns: 3; column-gap: 22px; }
@media (max-width: 1100px) { .tp-cols { columns: 2; } }
@media (max-width: 640px)  { .tp-cols { columns: 1; } }

.tp-grade { break-inside: avoid; page-break-inside: avoid; margin-bottom: 20px;
            transition: opacity .35s var(--tp-ease), transform .35s var(--tp-ease); }
.tp-grade.tp-pre { opacity: 0; transform: translateY(10px); }

.tp-gh { display: flex; align-items: center; gap: 8px; margin-bottom: 7px;
         font-size: .9375rem; font-weight: 700; color: var(--c); }
.tp-gbadge { flex: none; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 7px;
             display: grid; place-items: center; background: var(--c); color: #fff;
             font-size: .6875rem; font-weight: 800; }
.tp-gn { margin-left: auto; font-size: .6875rem; font-weight: 700; color: var(--muted); }

.tp-rows { list-style: none; display: grid; gap: 1px; }
.tp-row { display: flex; align-items: center; gap: 7px; padding: 5px 7px; border-radius: 8px;
          transition: background .16s var(--tp-ease); }
.tp-row:hover { background: color-mix(in srgb, var(--c) 7%, transparent); }
.tp-row.is-done .tp-name { color: var(--muted); text-decoration: line-through; }

.tp-check { flex: none; width: 18px; height: 18px; border-radius: 5px; cursor: pointer; padding: 0;
            display: grid; place-items: center; font-size: .625rem; line-height: 1;
            border: 1.5px solid var(--line); background: var(--card); color: transparent;
            transition: border-color .16s var(--tp-ease), background .16s var(--tp-ease),
                        color .16s var(--tp-ease); }
.tp-check:hover { border-color: var(--c); }
.tp-check:focus-visible { outline: 2px solid var(--c); outline-offset: 2px; }
.tp-row.is-done .tp-check { background: var(--c); border-color: var(--c); color: #fff; }

.tp-code { flex: none; min-width: 30px; font-size: .625rem; font-weight: 800; color: var(--muted);
           font-variant-numeric: tabular-nums; }
.tp-name { flex: 1; min-width: 0; font-size: .8125rem; font-weight: 600; line-height: 1.45;
           color: var(--ink); text-decoration: none;
           transition: color .16s var(--tp-ease); }
a.tp-name:hover { color: var(--c); text-decoration: underline; text-underline-offset: 2px; }
a.tp-name:focus-visible { outline: 2px solid var(--c); outline-offset: 2px; border-radius: 4px; }
.tp-row.is-soon .tp-name { color: var(--muted); font-weight: 500; }
.tp-name em { font-style: normal; font-size: .625rem; font-weight: 700; text-transform: uppercase;
              letter-spacing: .04em; color: var(--muted); }

/* level dot: filled a little more at each step */
.tp-lvl { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.tp-lvl[data-level="beginner"]     { opacity: .3; }
.tp-lvl[data-level="intermediate"] { opacity: .6; }
.tp-lvl[data-level="advanced"]     { opacity: 1; }

.tp-empty { padding: 44px 0; text-align: center; color: var(--muted); }

/* legend */
.tp-legend { display: flex; gap: 14px; flex-wrap: wrap; margin: 4px 0 18px;
             font-size: .6875rem; color: var(--muted); }
.tp-legend span { display: inline-flex; align-items: center; gap: 5px; }
.tp-legend i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); display: block; }
.tp-legend i.l1 { opacity: .3; } .tp-legend i.l2 { opacity: .6; } .tp-legend i.l3 { opacity: 1; }

/* =========================== PREV / NEXT TOPIC ========================= */
.tp-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px;
          padding-top: 20px; border-top: 1px solid var(--line); }
.tp-navbtn { display: inline-flex; align-items: center; gap: 10px; padding: 12px 17px;
             border-radius: 12px; min-height: 52px; text-decoration: none; color: var(--ink);
             background: var(--card); border: 1px solid var(--line);
             transition: transform .18s var(--tp-ease), border-color .18s var(--tp-ease),
                         box-shadow .18s var(--tp-ease); }
.tp-navbtn:hover { border-color: var(--c); transform: translateY(-2px);
                   box-shadow: 0 10px 22px -16px var(--c); }
.tp-navbtn:focus-visible { outline: 2px solid var(--c); outline-offset: 2px; }
.tp-navbtn span { display: flex; flex-direction: column; font-size: .875rem; font-weight: 700; }
.tp-navbtn small { font-size: .625rem; font-weight: 700; text-transform: uppercase;
                   letter-spacing: .06em; color: var(--muted); }
.tp-navbtn.is-next { margin-left: auto; text-align: right; }
.tp-navbtn.is-next span { align-items: flex-end; }

/* ============================ REDUCED MOTION =========================== */
@media (prefers-reduced-motion: reduce) {
  .tp-railitem, .tp-raildot, .tp-grade, .tp-row, .tp-check, .tp-name, .tp-navbtn,
  .tp-fchip, .tp-ringfg, .tp-view, .tp-railsearch, .tp-findwrap input { transition: none !important; }
  .tp-grade.tp-pre { opacity: 1; transform: none; }
  .tp-railitem:hover, .tp-navbtn:hover, .tp-fchip:hover { transform: none; }
}

/* ================================= PRINT =============================== */
@media print {
  .tp-side, .tp-toolbar, .tp-nav, .tp-views, .tp-ring,
  .topbar, .site-footer, #scrollTopBtn { display: none !important; }
  .tp-layout { display: block; padding: 0; }
  .tp-cols { columns: 2; }
  .tp-grade { opacity: 1 !important; transform: none !important; }
  .tp-check { display: none; }
}
