/* =============================================================================
   KERNEL 2.1, by CEDIS Lab — css/responsive.css
   -----------------------------------------------------------------------------
   Phone and tablet layouts, and reduced-motion overrides. Load this file last.
   Breakpoints (max-width): 1000 tablets · 900 · 760 phones · 520 · 420
   ============================================================================= */
/* Tablets: navigation keeps fewer links. */
@media (max-width: 1000px) { .nav-links a.nl.opt { display: none; } }
/* Phones: the bar keeps the logo, the wordmark, Download and the menu button.
   The section links open as a panel under the bar (js/app.js toggles .menu-open). */
@media (max-width: 760px) {
  .nav-r { gap: 16px; }
  .nav-menu { display: grid; }
  .nav-links { display: none; position: absolute; top: calc(100% + 8px); right: max(12px, env(safe-area-inset-right, 0px)); width: min(260px, calc(100vw - 24px));
    flex-direction: column; align-items: stretch; gap: 2px; padding: 8px; border-radius: 20px;
    background: rgba(22, 22, 24, .94); -webkit-backdrop-filter: blur(20px) saturate(1.6); backdrop-filter: blur(20px) saturate(1.6);
    border: 1px solid rgba(255, 255, 255, .1); box-shadow: 0 24px 48px -16px rgba(0, 0, 0, .8); }
  .menu-open .nav-links { display: flex; }
  .nav-links a.nl, .nav-links a.nl.opt { display: block; padding: 12px 14px; border-radius: 12px; font-size: 1.0625rem; color: var(--white); }
  .nav-links a.nl:hover, .nav-links a.nl[aria-current="true"] { background: rgba(255, 255, 255, .08); }
}

/* Home: chips move below the drawing on phones. */
@media (max-width: 760px) {
  .chips-float { position: static; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 14px; padding-inline: 16px; }
  .chip-f { position: static; }
  .chip-note { width: min(320px, 100%); }
}

/* Features: two columns on tablets, one on phones. */
@media (max-width: 900px) { .feat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .feat-grid { grid-template-columns: minmax(0, 1fr); } }

/* Live demo: readouts under the chart; two per row. */
@media (max-width: 900px) { .sched-side { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Forecast: diagram under the chart; load cards two per row, then one. */
@media (max-width: 900px) { .fc { grid-template-columns: minmax(0, 1fr); } .fc-items { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .fc-items { grid-template-columns: minmax(0, 1fr); } }

/* Intelligence: brain on top, the two lists side by side, then stacked. */
@media (max-width: 1000px) {
  .ci { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .axons { display: none; }
  .ci .brain-wrap { grid-column: 1 / -1; order: -1; width: min(240px, 70%); justify-self: center; }
  .ci-col.left .ci-item { grid-template-columns: auto minmax(0, 1fr); text-align: left; }
  .ci-col.left .ci-item .ic { grid-column: 1; }
  .ci-col.left .ci-item b, .ci-col.left .ci-item .t { grid-column: 2; }
}
@media (max-width: 640px) { .ci { grid-template-columns: minmax(0, 1fr); } .ci .brain-wrap { width: min(220px, 70%); } }

/* Control: sphere above the list; no wires. */
@media (max-width: 900px) {
  .dc { grid-template-columns: minmax(0, 1fr); row-gap: 28px; }
  .dc .sphere-wrap { width: min(300px, 78%); justify-self: center; }
  .wires { display: none; }
}
@media (max-width: 420px) { .ctl { grid-template-columns: auto minmax(0, 1fr); } .ctl .live { grid-row: auto; grid-column: 2; justify-self: start; } }

/* Library: code under the configuration; facts two per row, then one. */
@media (max-width: 900px) { .lib-grid { grid-template-columns: minmax(0, 1fr); } .lib-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .lib-facts { grid-template-columns: minmax(0, 1fr); } .lib-top .seg button { padding: 9px 12px; } pre.code, pre.out { font-size: .74rem; } }

/* Version history: the version line above its card. */
@media (max-width: 760px) {
  .rel { grid-template-columns: minmax(0, 1fr); gap: 10px; padding-left: 30px; }
  .rel-v { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-top: 0; }
  .rel::before { top: 5px; }
  .rel:not(:last-child)::after { top: 13px; }
}

/* Download: email field above the button on small phones. */
@media (max-width: 480px) { .wl { grid-template-columns: minmax(0, 1fr); } .dl .link { margin-left: 0; } }

/* Reduced motion: no smooth scrolling, reveal, drawing animations or spinning. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .rise:not(.in) { transform: none; }
  .site .ping, .pa .bob, .sphere .ring, .wires .flow, .run.busy svg { animation: none; }
  .site .pk { display: none; }
  .site .ping { opacity: 0; }
  .curve circle { display: none; }
  .nav-menu path { transition: none; }
  .toast { transition: none; }
}

/* Navigation: the lab name beside the mark on wide screens only. */
@media (max-width: 1100px) { .nav .lab-n { display: none; } }
