/* Layout grid (mobile-first) */
.page-grid {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr auto auto;
  grid-template-areas:
    "api"
    "stacks"
    "content"
    "architecture";
  gap: 12px;
  padding: 12px 12px 18px;
  max-width: 1200px;
  margin: 0 auto;
  align-items: start;
}

.online-panel {
  max-width: 1200px;
  margin: 0 auto 12px;
  padding: 0 20px;
  box-sizing: border-box;
}
.online-inner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--color-text);
  font-size: 13px;
  box-shadow: var(--shadow-sm);
}
.online-label { font-weight: 500; }
#online-count { font-weight: 700; }

.ml-search-container {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.ml-search-input {
  flex: 1;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.9rem;
  outline: none;
}

.ml-search-input::placeholder {
  color: var(--color-secondary);
}

.ml-search-input:focus {
  border-color: rgba(198, 169, 146, 0.9);
  box-shadow: 0 0 0 2px rgba(198, 169, 146, 0.35);
}

.ml-search-button {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(74, 52, 46, 0.25);
  background: rgba(198, 169, 146, 0.28);
  color: var(--color-primary);
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.08s ease-out, box-shadow 0.08s ease-out, background 0.12s ease-out, border-color 0.12s ease-out;
  white-space: nowrap;
}

.ml-search-button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  border-color: rgba(74, 52, 46, 0.35);
  background: rgba(198, 169, 146, 0.38);
}

.ml-search-button:active {
  transform: translateY(0);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
}

.ml-search-results {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  line-height: 1.4;
  max-height: 210px;
  overflow-y: auto;
}

.ml-search-results-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ml-search-result-item {
  padding: 0.4rem 0.6rem;
  border-radius: 0.55rem;
  background: var(--color-surface);
  border: 1px solid var(--border);
}

.ml-search-result-section {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-secondary);
}

.ml-search-result-text {
  margin-top: 0.1rem;
  color: var(--color-text);
}
/* Desktop layout: show sidebar + content */
@media (min-width: 961px) {
  .page-grid {
    grid-template-columns: 320px 1fr;
    grid-template-areas:
      "api api"
      "stacks content"
      "architecture architecture"
      "footer footer";
  }
}

/* Make lane items wrap earlier to avoid horizontal overflow on tablets */
@media (max-width: 960px) {
  .lane-inner { flex-wrap: wrap; gap: 10px; }
  .topic-card { width: calc(50% - 10px); min-width: 0; }
}

/* Mobile-first responsive adjustments */
@media (max-width: 720px) {
  .page-grid {
    padding: 8px 8px 12px;
    gap: 8px;
  }
  .page-grid { max-width: 100%; }
  .api-title { font-size: 20px; }
  .api-subtitle { font-size: 13px; }

  .api-grid { gap: 6px; }
  .api-card { padding: 6px 8px; }
  .api-name { font-size: 12px; }

  .lamp-button { font-size: 13px; padding: 8px 10px; }

  /* Make lane items wrap to multiple rows if needed and increase touch area */
  .lane-inner { flex-wrap: wrap; gap: 10px; }
  .topic-card { width: calc(50% - 10px); min-width: 0; }
  .topic-title { font-size: 13px; }
  .topic-list { font-size: 12px; }

  .wn-list li { padding: 8px 10px; font-size: 13px; }
}

@media (max-width: 420px) {
  .page-grid { grid-template-columns: 1fr; padding: 6px; gap: 6px; }
  .api-title { font-size: 18px; }
  .api-subtitle { font-size: 12px; }

  /* Make topic cards full width for very small screens */
  .topic-card { width: 100%; }
  .lane-inner { overflow-x: visible; }

  /* Slightly reduce visual accents to preserve space */
  .wn-list li { padding: 6px 8px; font-size: 12px; border-radius: 6px; }
  .lamp-button { padding: 7px 8px; font-size: 12px; }

  .panel, .card { padding: 10px 12px; }
}

/* Stronger single-column rules for small/medium screens */
@media (max-width: 1024px) {
  .page-grid { grid-template-columns: 1fr !important; grid-template-areas: "api" "stacks" "content" "architecture" "footer"; }
  .stacks-panel { width: 100%; order: 1; }
  .content-panel { order: 2; }
  .architecture-bar { order: 3; }
  .site-footer { order: 4; }

  /* Ensure side panels don't force min-widths */
  .stacks-panel, .content-panel, .api-section { min-width: 0; }

  /* Make left/right columns full width and stacked */
  .lane-inner { overflow-x: visible !important; }
  .topic-card { width: 100% !important; }

  /* reduce fixed shadows/large radii on very small screens */
  .api-card, .lamp-button, .topic-card, .panel { box-shadow: none; border-radius: 6px; }

  /* theme toggle: keep accessible but smaller */
  .theme-toggle { top: 12px; right: 12px; padding: 8px 10px; font-size: 16px; }
}

/* API section */
.api-section { grid-area: api; background: transparent; padding: 8px 14px 2px 14px; margin: 0; border-radius: 0; box-shadow: none; backdrop-filter: none; overflow: visible; }
.api-header { text-align: left; margin-bottom: 8px; padding: 0 8px; }
.api-title { font-size: 24px; font-weight: 900; margin: 0 0 6px; color: var(--color-primary); text-shadow: none; }
.api-subtitle { font-size: 14px; color: var(--color-secondary); margin: 0; text-shadow: none; }
.api-grid { display: flex; gap: 6px; margin-bottom: 0; flex-wrap: wrap; justify-content: flex-start; }
.api-card { background: var(--color-surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; transition: all 0.15s ease; display: flex; gap: 6px; flex-shrink: 0; cursor: pointer; box-shadow: var(--shadow-sm); }
.api-card:hover { background: rgba(255,255,255,0.92); border-color: rgba(43,43,43,0.18); box-shadow: var(--shadow); }
.api-icon { flex-shrink: 0; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; }
.api-icon svg { width: 16px; height: 16px; stroke: var(--color-primary); fill: none; stroke-width: 2; }
.api-content { flex: 1; min-width: 0; }
.api-name { font-size: 12px; font-weight: 700; margin: 0; color: var(--color-text); white-space: nowrap; }
.api-category { display: none; }
.api-desc { display: none; }
.api-tag { display: inline-block; font-size: 10px; padding: 2px 6px; background: #edf2f7; color: #4a5568; border-radius: 3px; margin-top: 6px; font-weight: 500; }
.api-footer { text-align: center; font-size: 13px; color: var(--color-secondary); padding: 0 8px; text-shadow: none; }
.api-footer a { color: var(--color-primary); text-decoration: none; font-weight: 700; }
.api-footer a:hover { text-decoration: underline; }

/* Stacks & buttons */
.lamp-button { display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin: 0; background: var(--color-surface); border: 1px solid var(--border); border-radius: 10px; color: var(--color-text); text-decoration: none; font-size: 13px; font-weight: 600; box-shadow: var(--shadow-sm); transition: all 0.15s ease; width: 100%; justify-content: flex-start; }
.lamp-button:hover { background: rgba(255,255,255,0.92); border-color: rgba(43,43,43,0.18); box-shadow: var(--shadow); transform: translateY(-1px); }
.lamp-button svg { width: 18px; height: 18px; }

.stack-section-title { font-size: 13px; font-weight: 800; color: var(--color-primary); margin: 4px 0 2px 0; text-transform: uppercase; letter-spacing: 0.5px; display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-radius: 10px; cursor: pointer; background: rgba(255,255,255,0.78); border: 1px solid var(--border); transition: background 0.15s ease, border 0.15s ease; box-shadow: var(--shadow-sm); }
.stack-section-title:hover { background: rgba(255,255,255,0.92); border-color: rgba(43,43,43,0.18); }
.stack-section-title .accordion-caret { font-size: 12px; color: var(--color-secondary); transition: transform 0.7s ease; }
.stack-section-title.expanded .accordion-caret { transform: rotate(90deg); }
.stack-section { display:flex; flex-direction:column; gap:2px; margin-top:4px; width: 100%; max-width: none; }
.stack-links { display:flex; flex-direction:column; gap:4px; transition: max-height 0.7s ease, opacity 0.7s ease, padding 0.7s ease; overflow: hidden; }
.stack-links.collapsed { max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0; }

/* Panels */
.stacks-panel { grid-area: stacks; display:flex; flex-direction:column; gap:6px; align-self:start; padding: 0 2px; min-width: 0; }
.content-panel { grid-area: content; display:flex; flex-direction:column; gap:8px; align-self:start; padding: 0 4px; min-width: 0; }

/* Architecture reserved area (bottom full-width) */
.architecture-bar {
  grid-area: architecture;
  background: rgba(255,255,255,0.78);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  display:flex;
  align-items:flex-start;
  justify-content:flex-start;
  gap: 12px;
  flex-wrap: wrap;
  min-height: auto;
  box-shadow: var(--shadow-sm);
}
.ml-card { background: var(--color-surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm); padding: 12px 14px; width: 100%; box-sizing: border-box; color: var(--color-text); display: flex; flex-direction: column; gap: 6px; }
.ml-title { font-size: 14px; font-weight: 900; margin: 0; color: var(--color-primary); }
.ml-text { font-size: 12px; line-height: 1.35; margin: 0; color: var(--color-text); }
.ml-topics { max-height: 400px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.ml-section { border: 1px solid var(--border); border-radius: 6px; background: var(--color-surface); }
.ml-section-title { font-size: 11px; font-weight: 800; padding: 8px 10px; margin: 0; cursor: pointer; user-select: none; display: flex; align-items: center; justify-content: space-between; color: var(--color-text); transition: all 0.2s ease; }
.ml-section-title:hover { background: rgba(198, 169, 146, 0.18); color: var(--color-text); }
.ml-section-title::after { content: "▼"; font-size: 8px; transition: transform 0.2s ease; display: inline-block; }
.ml-section-title.collapsed::after { transform: rotate(-90deg); }
.ml-list { margin: 0; padding: 0 10px 8px 20px; font-size: 11px; line-height: 1.4; color: var(--color-text); max-height: 999px; overflow: hidden; transition: max-height 0.2s ease; list-style: none; }
.ml-section.collapsed .ml-list { max-height: 0; padding: 0 10px 0 20px; }
/* Make ML bullet items look and feel like clickable buttons */
.ml-list li {
  margin: 4px 0;
  display: block;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--color-surface);
  border: 1px solid var(--border);
  box-shadow: 0 3px 8px rgba(0,0,0,0.12);
  cursor: pointer;
  user-select: none;
  transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}
.ml-list li:hover,
.ml-list li:focus {
  background: rgba(198, 169, 146, 0.18);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.18);
  outline: none;
}
.ml-list li:active {
  transform: translateY(0);
  box-shadow: 0 3px 10px rgba(0,0,0,0.16);
}
.architecture-inner { max-width: 1100px; width: 100%; text-align: center; }
.architecture-title { margin: 0; font-size: 16px; font-weight: 900; color: var(--color-primary); }
.architecture-note { margin: 4px 0 0; color: var(--color-secondary); font-size: 13px; }

/* Architecture cards - stacked & compact */
.arch-lanes { display:flex; flex-direction:column; gap:8px; margin-top:10px; width:100%; }
.lane { width:100%; display:flex; flex-direction:column; gap:6px; align-items:flex-start; }
.lane-title { font-size:12px; font-weight:900; color: var(--color-primary); text-transform:uppercase; letter-spacing:0.6px; margin-left:4px; }
.lane-inner { display:flex; gap:8px; align-items:flex-start; padding:6px; width:100%; flex-wrap:wrap; overflow-x:visible; }
.lane-inner::-webkit-scrollbar { height:8px; }
.lane-inner::-webkit-scrollbar-thumb { background: rgba(74, 52, 46, 0.18); border-radius: 8px; }

/* topic cards inside lanes - compact and horizontal */
.topic-card { flex:0 0 auto; width:100%; min-height:48px; background: var(--color-surface); border: 1px solid var(--border); border-radius: 8px; padding:8px 10px; box-shadow: 0 3px 8px rgba(0,0,0,0.06); display:flex; flex-direction:column; align-items:flex-start; justify-content:flex-start; text-align:left; box-sizing: border-box; }
.topic-title { font-size:12px; font-weight:800; margin:0 0 6px; color: var(--color-text); white-space:normal; overflow:visible; text-overflow:clip; }
.topic-list { display:block; margin:0; padding-left:14px; font-size:11px; line-height:1.08; color: var(--color-secondary); max-height:none; overflow:visible; }
.topic-list li { margin:1px 0; }

/* compact visual tweaks to remove empty vertical space */
.architecture-note { margin-top:6px; }
.architecture-inner { padding-top:6px; padding-bottom:6px; }

/* selected / highlighted topic */
.topic-card.selected { outline: 2px solid rgba(74, 52, 46, 0.25); box-shadow: 0 6px 18px rgba(0,0,0,0.12); transform: translateY(-2px); }

@media (max-width: 960px) {
  .arch-lanes { flex-direction:column; gap:12px; }
  .lane { width:100%; }
  .lane-inner { overflow-x:visible; }
  .topic-card { min-width: 0; max-width: 100%; }
  .ml-card { width: 100%; }
}

/* Restore desktop lane sizing at wider widths */
@media (min-width: 961px) {
  .lane-inner { flex-wrap: nowrap; overflow-x: auto; }
  .topic-card { width: 160px; }
}
.panel { background:var(--color-surface); padding:10px 12px; border-radius:12px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.card { background:var(--color-surface); padding:18px 24px; border-radius:12px; box-shadow: var(--shadow); text-align:center; border: 1px solid var(--border); }

/* Web & Networking placeholder (right-column small card) */
.web-network-card { align-self: flex-end; background: var(--color-surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; box-shadow: var(--shadow-sm); margin-top: 8px; }
.web-network-title { font-size:14px; font-weight:900; color: var(--color-primary); text-align:center; }

@media (max-width: 960px) {
  .web-network-card { width: 100%; align-self: stretch; }
}

/* styling for the Web & Networking exam list to match Top 5 panel */
.web-network-panel { align-self: stretch; width: 100%; padding: 6px 8px; box-sizing: border-box; }
.web-network-panel .web-exams { margin: 8px 0 0 18px; padding: 0; font-size: 13px; color: var(--color-text); line-height: 1.3; }
.web-network-panel .web-exams li { margin: 4px 0; }
@media (max-width: 960px) {
  .web-network-panel { width: 100%; align-self: stretch; }
}

/* web & networking sections */
.wn-section { margin-top: 6px; text-align: left; min-width: 0; }
.wn-title { font-size: 13px; font-weight:900; color: var(--color-primary); text-transform:uppercase; letter-spacing:0.5px; margin: 6px 0 6px 0; }
.wn-list { margin: 0 0 0 12px; padding: 0; font-size: 13px; color: var(--color-text); line-height: 1.25; }
.wn-list li { margin: 2px 0; }

/* Make list items look like compact, glassy buttons */
.wn-list li {
  display: block;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--color-surface);
  border: 1px solid var(--border);
  box-shadow: 0 4px 10px rgba(0,0,0,0.14);
  transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
  cursor: pointer;
  user-select: none;
}
.wn-list li:hover,
.wn-list li:focus {
  background: rgba(198, 169, 146, 0.18);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0,0,0,0.22);
  outline: none;
}
.wn-list li:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(0,0,0,0.16);
}
.wn-list li[role="button"] { }


.web-network-panel { display: block; }
.web-network-panel .web-network-header { padding-bottom: 6px; }
.web-network-panel .wn-grid { display: grid; grid-template-columns: repeat(3, minmax(160px, 1fr)); gap: 12px; align-items: start; }
.web-network-panel::-webkit-scrollbar { width: 0; height: 0; }

@media (max-width: 960px) {
  /* stack sections on medium/smaller screens */
  .web-network-panel .wn-grid { grid-template-columns: 1fr; }
  .wn-title { margin-left: 4px; }
}

/* ML layered concepts panel */
.ml-layered-panel {
  align-self: stretch;
  width: 100%;
  padding: 10px 12px;
  box-sizing: border-box;
}
.ml-layered-header { padding-bottom: 6px; }
.ml-layered-subtitle {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-secondary);
  margin-top: 4px;
}
.ml-layered-block { margin-top: 10px; }
.ml-layered-label {
  font-size: 12px;
  font-weight: 900;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}
.ml-layered-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--color-text);
}
.ml-layered-goals {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.35;
  color: var(--color-text);
}
.ml-layered-goals li { margin: 4px 0; }
.ml-layered-hint {
  font-size: 12px;
  color: var(--color-secondary);
  margin: 4px 0 8px;
}

.ml-layer {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--color-surface);
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
  margin: 8px 0;
  overflow: hidden;
}
.ml-layer-title {
  list-style: none;
  cursor: pointer;
  user-select: none;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 900;
  color: var(--color-text);
  background: rgba(198, 169, 146, 0.18);
}
.ml-layer[open] .ml-layer-title {
  background: rgba(198, 169, 146, 0.28);
}
.ml-layer-title::-webkit-details-marker { display: none; }
.ml-layer-title::after {
  content: "▾";
  float: right;
  color: var(--color-primary);
  font-weight: 900;
}
.ml-layer[open] .ml-layer-title::after { content: "▴"; }
.ml-layer-body {
  padding: 10px 12px 12px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--color-text);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ml-layer-k {
  color: var(--color-primary);
  font-weight: 900;
}

.ml-layer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.ml-layer-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: var(--color-primary);
  background: rgba(198, 169, 146, 0.18);
  border: 1px solid rgba(74, 52, 46, 0.25);
  box-shadow: var(--shadow-sm);
  transition: transform 0.08s ease-out, box-shadow 0.08s ease-out, background 0.12s ease-out, border-color 0.12s ease-out;
}

.ml-layer-link:hover,
.ml-layer-link:focus {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  background: rgba(198, 169, 146, 0.28);
  border-color: rgba(74, 52, 46, 0.35);
  outline: none;
}

/* (use case panel removed) */

/* Footer - minimal and glassy */
.site-footer {
  grid-area: footer;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 14px;
  margin-top: 10px;
  background: var(--color-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}
.site-footer .footer-inner {
  max-width: 1100px;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  color: var(--color-secondary);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.site-footer .footer-sep {
  color: var(--color-secondary);
}
.site-footer .footer-link {
  color: var(--color-primary);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(74, 52, 46, 0.25);
  background: rgba(198, 169, 146, 0.18);
  transition: transform 0.08s ease-out, box-shadow 0.08s ease-out, background 0.12s ease-out, border-color 0.12s ease-out;
}
.site-footer .footer-link:hover,
.site-footer .footer-link:focus {
  transform: translateY(-1px);
  border-color: rgba(74, 52, 46, 0.35);
  background: rgba(198, 169, 146, 0.28);
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
  outline: none;
}
.site-footer .footer-link:active {
  transform: translateY(0);
  box-shadow: none;
}

@media (max-width: 600px) {
  .site-footer .footer-inner { font-size:11px; flex-wrap: wrap; }
  .site-footer .footer-link { padding: 3px 8px; }
}