/* learn-it.app — Core styles (extracted & normalized)
   Depends on: core-tokens.css
   Scope: index pages + shared primitives
*/

html{ scrollbar-gutter: stable; }
body{ overflow-y: scroll; }

*{ box-sizing:border-box; }

body{
  margin:0;
  font-family: system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
  background:
    radial-gradient(1200px 600px at 18% 8%, var(--glowA), transparent 55%),
    radial-gradient(900px 500px at 82% 18%, var(--glowB), transparent 55%),
    var(--bg);
  color:var(--text);
  min-height:100vh;
  /* Anchor layout to the top to avoid large empty space when content is short */
  display:block;
  padding:24px 18px 18px;
}

a{ color:inherit; }

.wrap{ width:min(1150px, 100%); display:grid; gap:14px; margin:0 auto; }

/* Topbar */
.topbar{
  margin-top:12px;
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:10px;
  padding:14px 16px;
  background: rgba(255,255,255,.03);
  border:1px solid var(--border);
  border-radius:14px;
  backdrop-filter: blur(6px);
  justify-content: space-between;
}

.brand{ flex:0 0 auto; display:flex; align-items:baseline; gap:10px; user-select:none; }
.spacer{ flex: 0 0 auto; }

/* Right tools */
.rightTools{display:flex; align-items:center; gap:10px; flex:0 0 auto; }

.langSwitch{
  display:flex;
  padding:4px;
  border-radius:12px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.03);
  gap:4px;
}
.langSwitch .seg{
  padding:7px 10px;
  border-radius:10px;
  border:1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor:pointer;
  font-weight:800;
  font-size:12px;
  letter-spacing:.3px;
  user-select:none;
  transition: background .15s ease, border-color .15s ease;
}
.langSwitch .seg:hover{ background: rgba(255,255,255,.05); }
.langSwitch .seg.active{
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.10);
  color: var(--text);
}
.langSwitch a.seg{
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.langSwitch .seg[disabled]{
  opacity:.45;
  cursor:not-allowed;
}


/* Language dropdown */
.langSwitch.single .seg{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:7px 10px;
}
.langSwitch.single .seg svg{ display:block; }

.langSwitch.dropdown{ position:relative; }
.langSwitch.dropdown details{ position:relative; }
.langSwitch.dropdown summary{ list-style:none; }
.langSwitch.dropdown summary::-webkit-details-marker{ display:none; }
.langSwitch.dropdown .langPanel{
  position:absolute;
  right:0;
  top: calc(100% + 6px);
  display:flex;
  flex-direction:column;
  gap:4px;
  padding:4px;
  border-radius:12px;
  border:1px solid var(--border);
  /* Opaque dropdown panel (0% transparency) */
  background: #0f1624;
  backdrop-filter: none;
  min-width:62px;
  z-index:60;
}
.langSwitch.dropdown .langPanel .seg{
  width:100%;
}

.iconBtn{
  width:40px;
  height:40px;
  border-radius:12px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.03);
  color: var(--text);
  cursor:pointer;
  display:grid;
  place-items:center;
  transition: transform .04s ease, background .15s ease, border-color .15s ease;
  user-select:none;
  font-size:16px;
  line-height:1;
}
.iconBtn:hover{ background: rgba(255,255,255,.05); }
.iconBtn:active{ transform: translateY(1px); }

/* Icons */
.icon{ display:block; }
.icon-cog{ transform: scale(1.5); transform-origin: 50% 50%; }

/* Compact logo */
.logoMark{
  display:flex;
  flex-direction:column;
  gap:6px;
  padding:12px 14px 11px;
  border-radius:22px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.03);
  text-decoration:none;
  color: var(--text);
  box-shadow:
    0 0 0 1px rgba(255,255,255,.02) inset,
    0 10px 40px rgba(0,0,0,.35),
    0 0 26px var(--glowA);
  align-items:center;
}
.logoText{
  font-size:30px;
  font-weight:900;
  letter-spacing:-0.02em;
  line-height:1;
  text-align:center;
  width:100%;
}
.logoBar{
  width:170px;
  height:10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.25);
  overflow:hidden;
  box-shadow: 0 0 0 1px rgba(0,0,0,.2) inset;
  margin: 0 auto;
}
.logoFill{
  height:100%;
  width:52%;
  border-radius:999px;
  background: var(--accent);
  box-shadow: 0 0 14px var(--glowA);
}

/* Slogan */
.topCenter{
  flex: 1;
  display:flex;
  justify-content:center;
  align-items:center;
  padding: 0 12px;
  min-width: 0;
}
.slogan{
  max-width: 560px;
  width: 100%;
  text-align: center;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.02);
  color: var(--muted);
  font-weight: 700;
  letter-spacing: .1px;
  line-height: 1.25;
  box-shadow: 0 0 18px rgba(0,0,0,.18) inset;
  text-wrap: balance;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Breadcrumbs (shown instead of slogan when browsing) */
.breadcrumbsWrap{ max-width: 760px; width:100%; }
.crumbs{
  display:flex;
  justify-content:center;
  align-items:center;
  flex-wrap:wrap;
  gap:8px;
  padding:10px 14px;
  border-radius:14px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.02);
  color: var(--muted);
  font-weight: 750;
  font-size: 13px;
  line-height: 1.2;
  box-shadow: 0 0 18px rgba(0,0,0,.18) inset;
  text-wrap: balance;
}
.crumb{ color: inherit; text-decoration:none; padding:2px 4px; border-radius:8px; }
.crumb:hover{ background: rgba(255,255,255,.05); }
.crumbSep{ opacity:.6; }

/* Filters */
.filtersRow{ display:flex; flex-wrap:wrap; gap:10px; justify-content:center; }
.filter{ border:1px solid var(--border); border-radius:14px; background: rgba(255,255,255,.02); overflow:hidden; }
.filter[open]{ background: rgba(255,255,255,.03); }
.filterSummary{
  cursor:pointer;
  list-style:none;
  padding:10px 12px;
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:12px;
  user-select:none;
}
.filterSummary::-webkit-details-marker{ display:none; }
.filterLabel{ font-weight:900; letter-spacing:.2px; color: var(--text); }
.filterValue{ font-weight:750; color: var(--muted); font-size:12px; white-space:nowrap; }
.filterPanel{ display:grid; gap:8px; padding:10px 12px 12px; border-top:1px solid var(--border); }
.filterItem{ display:flex; align-items:center; gap:10px; cursor:pointer; color: var(--text); }
.filterItem input{ width:16px; height:16px; }
.filterItemText{ font-weight:650; color: var(--text); }

@media (max-width: 820px){
  .slogan{ max-width: 420px; font-size: 13px; padding: 9px 12px; }
}
@media (max-width: 620px){
  .topCenter{ display:none; }
}

/* Main content */
.main{ display:grid; grid-template-columns: 1fr; gap:14px; }

.card{
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border:1px solid var(--border);
  border-radius:18px;
  overflow:hidden;
  box-shadow: 0 14px 40px rgba(0,0,0,.35);
}
.cardHead{
  padding:14px 16px;
  border-bottom:1px solid var(--border);
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
}
.title{
  font-weight:800;
  letter-spacing:.2px;
  display:flex;
  gap:10px;
  align-items:baseline;
  flex-wrap:wrap;
}
.title .h{ font-size:16px; }
.title .sub{ color:var(--muted); font-weight:500; font-size:13px; letter-spacing:0; }
.content{ padding:16px; }

.pill{
  padding:7px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.03);
  color:var(--muted);
  font-size:12px;
  user-select:none;
  white-space:nowrap;
}

.subjectTabs{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  justify-content:center;
}

.tab{
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.03);
  color:var(--text);
  cursor:pointer;
  user-select:none;
  font-weight:750;
  font-size:13px;
  transition: background .15s ease, border-color .15s ease, transform .04s ease;
}
.tab:hover{ background: rgba(255,255,255,.05); }
.tab:active{ transform: translateY(1px); }

/* When a domain (category) is selected, softly highlight ALL its subjects
   so the domain tab and its subject chips feel like a single cohesive block. */
:root[data-active-domain] #subjects .tab{
  background: var(--accentSoftBg);
  border-color: var(--accentSoftBorder);
  box-shadow: 0 0 0 2px var(--accentSoftInset) inset;
}
:root[data-active-domain] #subjects .tab:hover{ background: rgba(255,255,255,.045); }

@supports (background: color-mix(in srgb, #fff 10%, transparent)){
  :root[data-active-domain] #subjects .tab:hover{
    background: color-mix(in srgb, var(--accentSoftBg) 70%, rgba(255,255,255,.04));
  }
}

.tab.active{
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border-color: color-mix(in srgb, var(--accent) 65%, transparent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 28%, transparent) inset;
}

.grid{
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap:12px;
  margin-top:12px;
}
@media (max-width: 980px){ .grid{ grid-template-columns: 1fr; } }

.module{
  grid-column: span 6;
  border:1px solid var(--border);
  border-radius:16px;
  background: rgba(0,0,0,.16);
  padding:14px;
  display:flex;
  flex-direction:column;
  gap:10px;
  position:relative;
  overflow:hidden;
}
.module::before{
  content:"";
  position:absolute;
  inset:-40px -40px auto auto;
  width:140px;
  height:140px;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 35%, transparent), transparent 70%);
  filter: blur(1px);
  opacity:.7;
  pointer-events:none;
  transform: rotate(12deg);
}

.moduleHead{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  position:relative;
  z-index:1;
}
.moduleName{ font-weight:850; letter-spacing:.2px; }
.moduleDesc{
  color:var(--muted);
  font-size:13px;
  line-height:1.35;
  margin-top:4px;
}
.badge{
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.03);
  color:var(--muted);
  font-size:12px;
  white-space:nowrap;
  user-select:none;
}

.actions, .moduleActions{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:2px;
  position:relative;
  z-index:1;
}
a.btn{
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.03);
  color:var(--text);
  font-size:14px;
  font-weight:750;
  transition: transform .04s ease, background .15s ease, border-color .15s ease;
  user-select:none;
}
a.btn:hover{ background: rgba(255,255,255,.05); }
a.btn:active{ transform: translateY(1px); }
a.btn.primary{
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
}
a.btn[aria-disabled="true"]{ opacity:.55; pointer-events:none; }

.kbd{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size:12px;
  padding:2px 6px;
  border-radius:7px;
  border:1px solid var(--border);
  background: rgba(0,0,0,.20);
  color:var(--muted);
  user-select:none;
}
.mono{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  color:var(--muted);
  font-size:12px;
}

@media (max-width: 520px){
  .rightTools{ gap:8px; }
  .langSwitch .seg{ padding:6px 9px; }
  .iconBtn{ width:36px; height:36px; border-radius:11px; }
  .logoText{ font-size:26px; }
  .logoBar{ width:150px; height:9px; }
  .logoMark{ padding:10px 12px 10px; border-radius:20px; }
}

/* Page version (single indicator: bottom-right only) */
.pageVersion{
  position: fixed;
  right: 12px;
  bottom: 8px;
  z-index: 50;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  color: var(--muted);
  opacity: .75;
  pointer-events: none;
  user-select: none;
}


/* Domains (top-level directions) */
.domainTabs{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.domainTabs .tab{ /* reuse same look as subject tabs */ }

/* Home / discovery blocks */
.collections{ display:grid; gap:12px; margin-top:12px; }
.collection{
  border:1px solid var(--border);
  border-radius:16px;
  background: rgba(0,0,0,.14);
  padding:14px;
}
.collectionHead{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:10px;
}
.collectionTitle{ font-weight:850; }
.itemsRow{ display:flex; flex-wrap:wrap; gap:10px; margin-top:10px; }



/* --- v2.0.45: Topbar filters + vertical language switch --- */
.filtersTop{ display:flex; align-items:flex-start; }
.filtersTop .filtersRow{
  display:flex;
  flex-direction:column;
  justify-content:flex-start;
  flex-wrap:nowrap;
  gap:8px;
  align-items:flex-end;
}
.filtersTop .filter{ min-width: 118px; }

/* v2.0.51: Topbar filters open as dropdown panels (overlay), like language menu */
.filtersTop .filter{
  position: relative;
  overflow: visible; /* allow panel to escape without increasing topbar height */
}
.filtersTop .filterPanel{
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 60;
  min-width: 190px;
  padding: 10px 12px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  /* Opaque dropdown panel (0% transparency) */
  background: #0f1624;
  backdrop-filter: none;
  box-shadow: 0 12px 28px rgba(0,0,0,.45);
}



.rightTools{ gap:14px; }

.sideControls{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap:8px;
}

.langSwitch.vertical{ flex-direction:column; }
.langSwitch.vertical .seg{
  width:48px;
  text-align:center;
}

.settingsBtn svg{ fill: currentColor; }
.langSwitch .seg.disabled{ opacity:.55; cursor:not-allowed; }



/* ===== v2.0.45 slogan ===== */
.slogan { display: block; font-size: 14px; font-weight: 600; opacity: 0.9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; padding: 6px 10px; }


/* ===== v2.0.45 filters hover ===== */
.filtersTop .filterSummary:hover{
  background: rgba(255,255,255,.02);
}
.filtersTop .filterSummary:focus-visible{
  outline: none;
  box-shadow: 0 0 0 2px rgba(255,255,255,.06);
  background: rgba(255,255,255,.02);
}


/* ===== v2.0.45 hover system ===== */
/* Two interaction levels:
   - Primary: for categories/subjects/main nav (uses accent, stronger).
   - Soft: for utility controls (filters/language/settings), subtle.
*/
:root {
  --hoverSoftBg: rgba(255,255,255,.02);
  --focusSoftRing: rgba(255,255,255,.06);
  --hoverPrimaryRing: rgba(255,255,255,.10);
  --hoverPrimaryBg: rgba(255,255,255,.03);
}


/* Logo: no hover highlight */
.logo, .logo * { transition: none; }
.logo:hover, .logo:focus, .logo:focus-visible { box-shadow: none !important; outline: none !important; background: transparent !important; }


/* Primary nav buttons: stronger hover/focus */
.domainsRow button:hover,
.subjectsRow button:hover,
.navButton:hover,
.categoryBtn:hover,
.subjectBtn:hover {
  box-shadow: 0 0 0 1px var(--accent, rgba(255,255,255,.22));
  background: var(--hoverPrimaryBg);
}

.domainsRow button:focus-visible,
.subjectsRow button:focus-visible,
.navButton:focus-visible,
.categoryBtn:focus-visible,
.subjectBtn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent, rgba(255,255,255,.22));
  background: var(--hoverPrimaryBg);
}


/* Utility controls: soft hover/focus */
.filtersTop .filterSummary:hover,
.langButton:hover,
.settingsButton:hover,
.langToggle button:hover,
.topbarRight button:hover,
.topbarRight .iconButton:hover {
  background: var(--hoverSoftBg);
  box-shadow: 0 0 0 2px rgba(255,255,255,.04);
}

.filtersTop .filterSummary:focus-visible,
.langButton:focus-visible,
.settingsButton:focus-visible,
.langToggle button:focus-visible,
.topbarRight button:focus-visible,
.topbarRight .iconButton:focus-visible {
  outline: none;
  background: var(--hoverSoftBg);
  box-shadow: 0 0 0 3px var(--focusSoftRing);
}


/* ===== v2.0.45 stronger primary hover ===== */
.domainsRow button:hover,
.subjectsRow button:hover,
.navButton:hover,
.categoryBtn:hover,
.subjectBtn:hover {
  background: rgba(255,255,255,.06);
  box-shadow:
    0 0 0 3px rgba(255,255,255,.06),
    0 0 0 2px var(--accent, rgba(255,255,255,.30)),
    0 0 18px rgba(255,255,255,.08);
}

.domainsRow button:focus-visible,
.subjectsRow button:focus-visible,
.navButton:focus-visible,
.categoryBtn:focus-visible,
.subjectBtn:focus-visible {
  outline: none;
  background: rgba(255,255,255,.06);
  box-shadow:
    0 0 0 3px rgba(255,255,255,.06),
    0 0 0 3px var(--accent, rgba(255,255,255,.34)),
    0 0 18px rgba(255,255,255,.10);
}


/* ===== v2.0.45 stronger primary hover ===== */
.domainsRow button:hover,
.subjectsRow button:hover,
.navButton:hover,
.categoryBtn:hover,
.subjectBtn:hover {
  background: rgba(255,255,255,.10);
  box-shadow:
    0 0 0 2px rgba(0,0,0,.15) inset,
    0 0 0 4px rgba(255,255,255,.08),
    0 0 0 3px var(--accent, rgba(255,255,255,.42)),
    0 0 26px rgba(255,255,255,.14);
}

.domainsRow button:focus-visible,
.subjectsRow button:focus-visible,
.navButton:focus-visible,
.categoryBtn:focus-visible,
.subjectBtn:focus-visible {
  outline: none;
  background: rgba(255,255,255,.10);
  box-shadow:
    0 0 0 2px rgba(0,0,0,.15) inset,
    0 0 0 4px rgba(255,255,255,.08),
    0 0 0 4px var(--accent, rgba(255,255,255,.46)),
    0 0 28px rgba(255,255,255,.16);
}


/* ===== v2.0.45 interaction accents (tabs + card buttons) ===== */
/* Targets:
   - navigation tabs in #domains / #subjects (.tab)
   - primary action buttons on cards (a.btn / a.btn.primary)
   Requirements:
   - reduce perceived border/ring thickness ~1.5x vs stepB
   - keep strong, readable hover/focus accent
   - preserve :focus-visible for keyboard navigation
*/

#domains .tab:hover,
#subjects .tab:hover,
a.btn:hover{
  background: rgba(255,255,255,.10);
  border-color: var(--accent);
  box-shadow:
    0 0 0 1px rgba(0,0,0,.14) inset,
    0 0 0 1px rgba(255,255,255,.06),
    0 0 0 1px var(--accent),
    0 0 16px rgba(255,255,255,.12);
}

#domains .tab:focus-visible,
#subjects .tab:focus-visible,
a.btn:focus-visible{
  outline: none;
  background: rgba(255,255,255,.10);
  border-color: var(--accent);
  box-shadow:
    0 0 0 1px rgba(0,0,0,.14) inset,
    0 0 0 1px rgba(255,255,255,.06),
    0 0 0 2px var(--accent),
    0 0 16px rgba(255,255,255,.12);
}

/* Primary card action: keep its base tint, but add the same accent ring/glow */
a.btn.primary:hover,
a.btn.primary:focus-visible{
  background: color-mix(in srgb, var(--accent) 24%, rgba(255,255,255,.06));
  border-color: color-mix(in srgb, var(--accent) 70%, transparent);
}

/* When a domain is selected, subjects have a soft accent by default.
   Ensure hover/focus on an individual subject still dominates. */
:root[data-active-domain] #subjects .tab:hover,
:root[data-active-domain] #subjects .tab:focus-visible{
  background: color-mix(in srgb, var(--accentSoftBg) 60%, rgba(255,255,255,.06));
  border-color: var(--accent);
  box-shadow:
    0 0 0 1px rgba(0,0,0,.14) inset,
    0 0 0 1px var(--accentSoftInset) inset,
    0 0 0 1px rgba(255,255,255,.06),
    0 0 0 2px var(--accent),
    0 0 18px rgba(255,255,255,.12);
}

