/*
 * Modular patch layer
 *
 * This file carries the prototype's black hardware surfaces, cables, ports,
 * LEDs, switches, and hard shadows. Typography remains owned by style.css and
 * the page-local styles in index.html / lab.html.
 */

html[data-theme="modular"] {
  --patch-paper: #292a2e;
  --patch-ink: #0b0c0f;
  --patch-metal: #666d78;
  --patch-surface: #0f1115;
  --patch-surface-mid: #292e37;
  --patch-surface-raised: #3a414d;
  --patch-screen: #090c11;
  --patch-text: #ebece7;
  --patch-body-text: #c8ccd2;
  --patch-muted: #a6adb8;
  --patch-switch-knob: #f7f7f2;

  --signal-cyan: #23d7c1;
  --signal-magenta: #ff315f;
  --signal-yellow: #f0d348;
  --signal-violet: #9b6cff;
  --signal-blue: #52a9ff;
  --signal-green: #3edb8f;
  --signal-orange: #ff8a2b;

  --signal: var(--signal-cyan);
  --patch-radius: 8px;
  --patch-border: 1px solid var(--patch-ink);
  --patch-shadow: 4px 4px 0 var(--patch-ink);
  --patch-shadow-raised: 6px 6px 0 var(--patch-ink);
  --patch-shadow-large: 10px 10px 0 var(--patch-ink);

  background-color: var(--patch-paper);
  background-image: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.1) 1px, transparent 1.15px);
  background-position: 0 0;
  background-size: 22px 22px;
  -webkit-font-smoothing: auto;
  -moz-osx-font-smoothing: auto;
  text-rendering: optimizeLegibility;
}

html[data-theme="modular"] body {
  overflow-x: clip;
  color: var(--patch-ink);
  background: transparent;
}

html[data-theme="modular"][data-page-transition] main {
  will-change: transform;
}

html[data-theme="modular"][data-page-transition="enter-forward"] main {
  animation: modularPageEnterForward 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

html[data-theme="modular"][data-page-transition="enter-backward"] main {
  animation: modularPageEnterBackward 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

html[data-theme="modular"][data-page-transition="leave-forward"] main {
  animation: modularPageLeaveForward 320ms cubic-bezier(0.55, 0.06, 0.68, 0.19) both;
}

html[data-theme="modular"][data-page-transition="leave-backward"] main {
  animation: modularPageLeaveBackward 320ms cubic-bezier(0.55, 0.06, 0.68, 0.19) both;
}

@keyframes modularPageEnterForward {
  0% {
    transform: translate3d(clamp(28px, 6vw, 72px), 0, 0);
  }

  72% {
    transform: translate3d(-4px, 0, 0);
  }

  100% {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes modularPageEnterBackward {
  0% {
    transform: translate3d(clamp(-72px, -6vw, -28px), 0, 0);
  }

  72% {
    transform: translate3d(4px, 0, 0);
  }

  100% {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes modularPageLeaveForward {
  to {
    transform: translate3d(clamp(-72px, -6vw, -28px), 0, 0);
  }
}

@keyframes modularPageLeaveBackward {
  to {
    transform: translate3d(clamp(28px, 6vw, 72px), 0, 0);
  }
}

/* The modular theme uses only the page-level horizontal transition. */
html[data-theme="modular"] body > header,
html[data-theme="modular"] body > footer,
html[data-theme="modular"] .identity-bar,
html[data-theme="modular"] .social-bar,
html[data-theme="modular"] .filters,
html[data-theme="modular"] .profile-page,
html[data-theme="modular"] .purpose-page,
html[data-theme="modular"] .contact-section,
html[data-theme="modular"] .lab-hero-content,
html[data-theme="modular"] .lab-eyebrow,
html[data-theme="modular"] .lab-headline,
html[data-theme="modular"] .lab-tagline,
html[data-theme="modular"] .lab-description {
  animation: none !important;
}

html[data-theme="modular"] .lab-section {
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
}

html[data-theme="modular"] main {
  position: relative;
  isolation: isolate;
}

html[data-theme="modular"] .works-page main {
  padding-bottom: 24px;
}

html[data-theme="modular"] main > *:not(.patch-cables) {
  position: relative;
  z-index: 2;
}

/* ---------- Black hardware surfaces ---------- */
html[data-theme="modular"] body > header,
html[data-theme="modular"] body > footer {
  position: relative;
  color: var(--patch-text);
  background: var(--patch-surface);
  border: var(--patch-border);
  border-radius: var(--patch-radius);
  box-shadow: none;
}

html[data-theme="modular"] body > header {
  margin-top: 10px;
  padding: 9px;
  padding-right: 28px;
}

html[data-theme="modular"] header nav a {
  color: var(--patch-muted);
  background: var(--patch-surface-mid);
  border: 1px solid #050607;
  border-radius: 5px;
  transition:
    color 140ms ease,
    transform 140ms ease,
    background 140ms ease,
    box-shadow 140ms ease;
}

html[data-theme="modular"] .logo-wrap {
  padding: 8px 14px;
  color: var(--patch-text);
  background: transparent;
  border: 0;
  border-radius: 0;
}

html[data-theme="modular"] .logo-main {
  font-size: 0.875rem;
}

html[data-theme="modular"] .logo-main,
html[data-theme="modular"] header nav a:hover,
html[data-theme="modular"] header nav a.active {
  color: var(--patch-text);
}

html[data-theme="modular"] header nav a:hover,
html[data-theme="modular"] header nav a.active {
  background: var(--patch-surface-raised);
}

html[data-theme="modular"] header nav a:hover {
  transform: translateY(-2px);
  box-shadow: 3px 3px 0 #050607;
}

html[data-theme="modular"] body > footer {
  margin-bottom: 30px;
  padding: 19px 22px;
}

html[data-theme="modular"] body > footer span {
  color: var(--patch-muted);
}

html[data-theme="modular"] .index-intro {
  margin-top: 24px;
  margin-bottom: 32px;
  padding: 30px;
  color: var(--patch-text);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.035), transparent 42%),
    var(--patch-surface);
  border: var(--patch-border);
  border-radius: var(--patch-radius);
}

html[data-theme="modular"] .lab-eyebrow,
html[data-theme="modular"] .lab-headline {
  color: rgba(255, 255, 255, 0.82);
}

html[data-theme="modular"] .lab-description {
  color: rgba(255, 255, 255, 0.92);
}

html[data-theme="modular"] .index-intro .p-name {
  color: var(--patch-text);
}

html[data-theme="modular"] .index-intro .p-kana {
  color: var(--patch-muted);
}

html[data-theme="modular"] .index-intro > p {
  color: var(--patch-body-text);
}

html[data-theme="modular"] .index-intro .social-links-simple a {
  color: var(--patch-muted);
  background: var(--patch-surface-mid);
  border: 1px solid #050607;
  border-radius: 5px;
  box-shadow: none;
  transition:
    color 140ms ease,
    background 140ms ease,
    transform 140ms ease,
    box-shadow 140ms ease;
}

html[data-theme="modular"] .index-intro .social-links-simple a:hover {
  color: var(--patch-text);
  background: var(--patch-surface-raised);
  border-color: #050607;
  transform: translateY(-2px);
  box-shadow: 3px 3px 0 #050607;
}

html[data-theme="modular"] .section-wrap {
  margin-bottom: 48px;
  padding: 16px;
  background: var(--patch-surface);
  border: var(--patch-border);
  border-radius: var(--patch-radius);
  box-shadow: none;
  overflow: visible;
}

html[data-theme="modular"] .works-page .section-wrap:last-child {
  margin-bottom: 0;
}

html[data-theme="modular"] .section-header {
  margin-bottom: 12px;
  padding: 13px 18px;
  color: var(--patch-text);
  background: var(--patch-surface-mid);
  border: 1px solid #050607;
  border-radius: 5px;
}

html[data-theme="modular"] .section-num,
html[data-theme="modular"] .section-en,
html[data-theme="modular"] .section-ja {
  color: var(--patch-text);
}

html[data-theme="modular"] .section-num,
html[data-theme="modular"] .section-ja {
  opacity: 0.62;
}

html[data-theme="modular"] .accordion-item {
  margin-top: 10px;
  color: var(--patch-text);
  background: var(--patch-surface-mid);
  border: 1px solid #050607;
  border-radius: 6px;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    background 150ms ease;
}

html[data-theme="modular"] .accordion-item .acc-trigger {
  color: var(--patch-text);
  background: transparent;
}

html[data-theme="modular"] .accordion-item .acc-trigger:hover {
  background: rgba(255, 255, 255, 0.035);
}

html[data-theme="modular"] .accordion-item .acc-left {
  background: rgba(20, 22, 27, 0.83);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 4px;
}

html[data-theme="modular"] .accordion-item .acc-title {
  color: var(--patch-text);
}

html[data-theme="modular"] .accordion-item .acc-tag {
  color: var(--signal);
}

html[data-theme="modular"] .accordion-item .acc-body {
  color: var(--patch-text);
  background: #11141a;
  border-radius: 0 0 5px 5px;
}

html[data-theme="modular"] .accordion-item .acc-text {
  color: var(--patch-body-text);
}

html[data-theme="modular"] .accordion-item .acc-links a {
  color: var(--patch-muted);
  background: var(--patch-surface-mid);
  border: 1px solid #050607;
  border-radius: 5px;
  box-shadow: none;
  transition:
    color 140ms ease,
    background 140ms ease,
    transform 140ms ease,
    box-shadow 140ms ease;
}

html[data-theme="modular"] .accordion-item .acc-links a:hover {
  color: var(--patch-text);
  background: var(--patch-surface-raised);
  transform: translateY(-2px);
  box-shadow: 3px 3px 0 #050607;
}

html[data-theme="modular"] .lab-section {
  padding: 24px;
  color: var(--patch-text);
  background: var(--patch-surface);
  border: var(--patch-border);
  border-radius: var(--patch-radius);
}

html[data-theme="modular"] .lab-section .ls-heading {
  margin: -24px -24px 22px;
  padding: 15px 58px 15px 20px;
  color: var(--patch-text);
  background: var(--patch-surface-mid);
  border-bottom-color: #050607;
  border-radius: 7px 7px 0 0;
}

html[data-theme="modular"] .lab-section .ls-num,
html[data-theme="modular"] .lab-section .ls-title {
  color: var(--patch-text);
}

html[data-theme="modular"] .lab-section .ls-num {
  opacity: 0.82;
}

html[data-theme="modular"] .lab-section .ls-body {
  color: var(--patch-body-text);
}

html[data-theme="modular"] .lab-section .ls-callout,
html[data-theme="modular"] .lab-section .lab-donation-note,
html[data-theme="modular"] .lab-section .lab-research-card,
html[data-theme="modular"] .lab-section .lab-table {
  color: var(--patch-text);
  background: var(--patch-surface-mid);
  border-color: #050607;
  box-shadow: none;
}

html[data-theme="modular"] .lab-section .lab-research-card {
  transition: none;
}

html[data-theme="modular"] .lab-section .lab-research-card:hover {
  border-color: #050607;
  transform: none;
  box-shadow: none;
}

html[data-theme="modular"] .lab-section .lab-research-name,
html[data-theme="modular"] .lab-section .lab-table td:first-child {
  color: var(--signal);
}

html[data-theme="modular"] .lab-section .lab-research-title,
html[data-theme="modular"] .lab-section .lab-table thead td {
  color: var(--patch-text) !important;
}

html[data-theme="modular"] .lab-section .lab-research-body,
html[data-theme="modular"] .lab-section .lab-table td,
html[data-theme="modular"] .lab-section .ls-list li,
html[data-theme="modular"] .lab-section .lab-join-list li {
  color: var(--patch-body-text);
}

html[data-theme="modular"] .lab-section .lab-notes {
  color: var(--patch-body-text);
}

html[data-theme="modular"] .lab-section .lab-notes li::before {
  color: var(--signal);
}

html[data-theme="modular"] .lab-section .ls-list li::before,
html[data-theme="modular"] .lab-section .lab-join-list li::before {
  color: var(--signal);
  background: var(--signal);
}

html[data-theme="modular"] .lab-section .lab-table td {
  border-color: #505661;
}

html[data-theme="modular"] .lab-section .lab-zemi-meta,
html[data-theme="modular"] .lab-section .lab-about-name {
  color: var(--patch-text);
}

html[data-theme="modular"] .lab-section .lab-zemi-desc,
html[data-theme="modular"] .lab-section .lab-research-placeholder,
html[data-theme="modular"] .lab-section .lab-wip,
html[data-theme="modular"] .lab-section .lab-about-handle {
  color: var(--patch-body-text);
  border-color: #505661;
}

html[data-theme="modular"] .lab-section strong {
  color: var(--patch-text);
}

html[data-theme="modular"] .lab-page figcaption {
  color: var(--patch-body-text) !important;
}

html[data-theme="modular"] .lab-section .mermaid {
  color: var(--patch-text);
  background: var(--patch-surface-mid);
  border: 1px solid #050607;
}

html[data-theme="modular"] .lab-section .lab-research-body a {
  color: var(--signal) !important;
}

html[data-theme="modular"] .lab-section .ls-body p[style*="color: var(--fg)"] {
  color: var(--patch-text) !important;
}

html[data-theme="modular"] .lab-section .ls-body p[style*="color: var(--accent)"] {
  color: var(--signal) !important;
}

html[data-theme="modular"] .lab-section a[href="schedule.html"] {
  color: var(--patch-muted) !important;
  background: var(--patch-surface-mid) !important;
  border: 1px solid #050607;
  border-radius: 5px !important;
  box-shadow: none;
  transition:
    color 140ms ease,
    background 140ms ease,
    transform 140ms ease,
    box-shadow 140ms ease;
}

html[data-theme="modular"] .lab-section a[href="schedule.html"]:hover {
  color: var(--patch-text) !important;
  background: var(--patch-surface-raised) !important;
  filter: none !important;
  transform: translateY(-2px);
  box-shadow: 3px 3px 0 #050607;
}

/* Keep the Lab hero inside the same module width as the Works panels. */
html[data-theme="modular"] .lab-hero-full {
  width: 100%;
  margin: 24px 0 72px;
  min-height: 82vh;
  background: var(--patch-surface);
  border: var(--patch-border);
  border-radius: var(--patch-radius);
  box-shadow: none;
  overflow: hidden;
}

/* ---------- Patch-free Profile ---------- */
html[data-theme="modular"] .profile-page {
  margin-top: 24px;
  padding: 30px;
  color: var(--patch-text);
  background: var(--patch-surface);
  border: var(--patch-border);
  border-radius: var(--patch-radius);
  box-shadow: none;
}

html[data-theme="modular"] .profile-header {
  padding: 0 0 32px;
  color: var(--patch-text);
  background: transparent;
  border: 0;
  border-radius: 0;
}

html[data-theme="modular"] .profile-page .p-name {
  color: var(--patch-text);
}

html[data-theme="modular"] .profile-page .profile-intro p {
  color: var(--patch-body-text);
}

html[data-theme="modular"] .profile-page .p-kana,
html[data-theme="modular"] .profile-page .section-label,
html[data-theme="modular"] .profile-page .tl-date {
  color: var(--patch-muted);
}

html[data-theme="modular"] .profile-page .section-label {
  padding: 0 0 10px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #505661;
  border-radius: 0;
}

html[data-theme="modular"] .profile-page .timeline {
  background: transparent;
  border: 0;
  border-radius: 0;
  overflow: visible;
}

html[data-theme="modular"] .profile-page .tl-item,
html[data-theme="modular"] .profile-page .tl-item:hover {
  color: var(--patch-text);
  background: transparent;
  border-bottom-color: #505661;
  border-radius: 0;
  box-shadow: none;
  transform: none;
}

html[data-theme="modular"] .profile-page .tl-body,
html[data-theme="modular"] .profile-page .tl-item.highlight .tl-body {
  color: var(--patch-body-text);
}

html[data-theme="modular"] .profile-page .tl-item.highlight .tl-date,
html[data-theme="modular"] .profile-page .tl-link {
  color: var(--signal);
}

html[data-theme="modular"] .profile-page .tl-link {
  border-bottom-color: color-mix(in srgb, var(--signal) 48%, transparent);
}

html[data-theme="modular"] .profile-page .tl-link:hover {
  color: var(--patch-text);
  background: color-mix(in srgb, var(--signal) 20%, transparent);
  border-bottom-color: var(--signal);
}

/* ---------- Patch-free Contact ---------- */
html[data-theme="modular"] .contact-section {
  margin-top: 24px;
  padding: 30px;
  color: var(--patch-text);
  background: var(--patch-surface);
  border: var(--patch-border);
  border-radius: var(--patch-radius);
  box-shadow: none;
}

html[data-theme="modular"] .contact-section .contact-lead {
  color: var(--patch-muted);
}

html[data-theme="modular"] .contact-section .contact-email {
  padding: 12px 18px;
  color: var(--patch-muted);
  background: var(--patch-surface-mid);
  border: 1px solid #050607;
  border-radius: 5px;
  box-shadow: none;
  transition:
    color 140ms ease,
    background 140ms ease,
    transform 140ms ease,
    box-shadow 140ms ease;
}

html[data-theme="modular"] .contact-section .contact-email:hover {
  color: var(--patch-text);
  background: var(--patch-surface-raised);
  transform: translateY(-2px);
  box-shadow: 3px 3px 0 #050607;
}

/* ---------- Theme config ---------- */
.theme-config-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 30px;
  padding: 12px 14px;
  color: var(--fg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.theme-config-label {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.theme-config-options {
  display: flex;
  gap: 6px;
}

.theme-config-button {
  appearance: none;
  padding: 7px 12px;
  color: var(--fg-sub);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
  transition:
    color 140ms ease,
    background 140ms ease,
    transform 140ms ease,
    box-shadow 140ms ease;
}

.theme-config-button.is-active {
  color: var(--bg);
  background: var(--fg);
  border-color: var(--fg);
}

.theme-config-button:hover {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--fg);
}

html[data-theme="modular"] .theme-config-panel {
  position: relative;
  padding-right: 28px;
  color: var(--patch-text);
  background: var(--patch-surface);
  border-color: var(--patch-ink);
  border-radius: var(--patch-radius);
}

html[data-theme="modular"] .theme-config-button {
  color: var(--patch-muted);
  background: var(--patch-surface-mid);
  border-color: #050607;
  border-radius: 5px;
}

html[data-theme="modular"] .theme-config-button.is-active {
  color: var(--patch-text);
  background: var(--patch-surface-raised);
  border-color: #050607;
}

html[data-theme="modular"] .theme-config-button:hover {
  color: var(--patch-text);
  background: var(--patch-surface-raised);
  transform: translateY(-2px);
  box-shadow: 3px 3px 0 #050607;
}

html[data-theme="modular"] .theme-config-button.is-active:hover {
  color: var(--patch-text);
  background: var(--patch-surface-raised);
}

/* ---------- Static panel LEDs ---------- */
html[data-theme="modular"] .section-wrap,
html[data-theme="modular"] .lab-hero-full,
html[data-theme="modular"] .lab-section,
html[data-theme="modular"] .profile-page,
html[data-theme="modular"] .contact-section {
  position: relative;
}

html[data-theme="modular"] body > header::after,
html[data-theme="modular"] body > footer::after,
html[data-theme="modular"] .section-wrap::after,
html[data-theme="modular"] .lab-hero-full::after,
html[data-theme="modular"] .lab-section::after,
html[data-theme="modular"] .profile-page::after,
html[data-theme="modular"] .contact-section::after,
html[data-theme="modular"] .theme-config-panel::after {
  content: "";
  position: absolute;
  z-index: 9;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border: 1px solid #070809;
  border-radius: 50%;
  background: var(--panel-led-color, var(--signal-cyan));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  pointer-events: none;
}

html[data-theme="modular"] body > footer,
html[data-theme="modular"] .section-wrap:nth-of-type(3),
html[data-theme="modular"] .lab-section:nth-of-type(3) {
  --panel-led-color: var(--signal-violet);
}

html[data-theme="modular"] .section-wrap:nth-of-type(4),
html[data-theme="modular"] .lab-section:nth-of-type(4),
html[data-theme="modular"] .contact-section {
  --panel-led-color: var(--signal-magenta);
}

html[data-theme="modular"] .section-wrap:nth-of-type(5),
html[data-theme="modular"] .lab-section:nth-of-type(5),
html[data-theme="modular"] .profile-page {
  --panel-led-color: var(--signal-yellow);
}

/* ---------- Hard module shadows ---------- */
html[data-theme="modular"] .section-header[data-patch-id] {
  box-shadow: none;
}

html[data-theme="modular"] .accordion-item[data-patch-id] {
  box-shadow: none;
}

html[data-theme="modular"] .index-intro[data-patch-id] {
  box-shadow: none;
}

html[data-theme="modular"] .accordion-item[data-patch-id]:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--patch-shadow-raised);
}

html[data-theme="modular"] .accordion-item[data-patch-id].open {
  border-color: var(--signal);
  box-shadow: none;
}

html[data-theme="modular"] .accordion-item[data-patch-id].open:hover {
  box-shadow: var(--patch-shadow-raised);
}

/* ---------- Ports ---------- */
html[data-theme="modular"] [data-patch-id] {
  position: relative;
  overflow: visible;
}

html[data-theme="modular"] .patch-port {
  position: absolute;
  z-index: 8;
  width: 18px;
  height: 18px;
  border: 4px solid #070809;
  border-radius: 50%;
  background: var(--signal);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.25),
    0 0 0 1px #6f7580;
  pointer-events: none;
}

html[data-theme="modular"] .patch-port-in {
  top: 28px;
  left: -9px;
}

html[data-theme="modular"] .patch-port-out {
  right: -9px;
  bottom: 24px;
}

html[data-theme="modular"] .patch-port.patch-route-left {
  right: auto !important;
  left: -9px !important;
}

html[data-theme="modular"] .patch-port.patch-route-right {
  right: -9px !important;
  left: auto !important;
}

html[data-theme="modular"] [data-patch-powered="true"] > .patch-port {
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.35),
    0 0 0 1px #6f7580;
}

/* ---------- LEDs ---------- */
html[data-theme="modular"] .patch-led {
  position: absolute;
  z-index: 9;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border: 1px solid #070809;
  border-radius: 50%;
  background: var(--patch-metal);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  pointer-events: none;
  transition: background 170ms ease, box-shadow 170ms ease;
}

html[data-theme="modular"] .patch-led.is-on {
  background: var(--signal);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

/* ---------- Accordion power switch ---------- */
html[data-theme="modular"] .accordion-item .acc-icon {
  position: relative;
  right: auto;
  display: block;
  flex: 0 0 54px;
  width: 54px;
  height: 30px;
  overflow: hidden;
  color: transparent !important;
  text-indent: -9999px;
  background: #101216;
  border: 3px solid #050607;
  border-radius: 999px;
  box-shadow:
    inset 0 0 0 2px #4c515b,
    0 0 0 1px #737984;
  transform: none !important;
  transition: background 170ms ease, box-shadow 170ms ease;
}

html[data-theme="modular"] .accordion-item .acc-icon::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border: 1px solid #050607;
  border-radius: 50%;
  background: linear-gradient(#f4f5f2, #aeb3ba);
  box-shadow:
    2px 2px 0 #050607,
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
  transition: transform 190ms cubic-bezier(0.2, 0.8, 0.2, 1), background 170ms ease;
}

html[data-theme="modular"] .accordion-item .acc-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #4e535d;
  box-shadow: inset 0 0 0 1px #070809;
  transform: translateY(-50%);
  transition: background 170ms ease, box-shadow 170ms ease;
}

html[data-theme="modular"] .accordion-item.open .acc-icon {
  background: var(--signal);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.28),
    0 0 0 1px #050607;
}

html[data-theme="modular"] .accordion-item.open .acc-icon::before {
  background: var(--patch-switch-knob);
  transform: translateX(24px);
}

html[data-theme="modular"] .accordion-item.open .acc-icon::after {
  right: auto;
  left: 8px;
  background: #ffffff;
  box-shadow: none;
}

/* Open state is communicated by hardware, not by revealing/inverting images. */
html[data-theme="modular"] .accordion-item.open .acc-trigger::before {
  opacity: 0 !important;
}

html[data-theme="modular"] .accordion-item.open .acc-trigger {
  align-items: center;
  color: var(--patch-text);
  text-shadow: none;
  background: rgba(255, 255, 255, 0.025);
}

html[data-theme="modular"] .accordion-item.open .acc-left {
  color: var(--patch-text);
  background: rgba(20, 22, 27, 0.94);
  border-color: var(--signal);
  border-left-width: 4px;
  box-shadow: none;
}

html[data-theme="modular"] .accordion-item.open .acc-title {
  color: var(--patch-text);
}

html[data-theme="modular"] .accordion-item.open .acc-tag {
  color: var(--signal);
  text-shadow: none;
}

html[data-theme="modular"] .accordion-item.open .acc-body {
  border-top: 2px solid var(--signal);
  box-shadow: none;
}

/* ---------- Outside-gutter cables ---------- */
html[data-theme="modular"] .patch-cables {
  position: absolute;
  inset: 0 auto auto 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

html[data-theme="modular"] .patch-cable-under {
  fill: none;
  stroke: rgba(5, 6, 8, 0.92);
  stroke-width: 9;
  stroke-linecap: round;
  opacity: 0.96;
}

html[data-theme="modular"] .patch-cable-main {
  fill: none;
  stroke: var(--cable-color, var(--signal-cyan));
  stroke-width: 4;
  stroke-linecap: round;
  opacity: 0.72;
  filter: none;
  transition: opacity 160ms ease, stroke-width 160ms ease, filter 160ms ease;
}

html[data-theme="modular"] .patch-cable-main.is-active {
  opacity: 1;
  stroke-width: 5;
  filter: none;
}

@keyframes modularPatchSignalFlow {
  to {
    stroke-dashoffset: -30;
  }
}

html[data-theme="modular"] .patch-cable-main.is-powered {
  opacity: 1;
  stroke-width: 5;
  stroke-dasharray: 12 8;
  animation: modularPatchSignalFlow 0.72s linear infinite;
  filter: none;
}

@media (max-width: 860px) {
  html[data-theme="modular"] .patch-cables {
    display: none;
  }
}

@media (max-width: 640px) {
  html[data-theme="modular"] body > header {
    margin-top: 7px;
  }

  html[data-theme="modular"] .index-intro,
  html[data-theme="modular"] .section-wrap,
  html[data-theme="modular"] .lab-section,
  html[data-theme="modular"] .profile-page,
  html[data-theme="modular"] .contact-section {
    padding: 18px;
  }

  html[data-theme="modular"] .lab-section .ls-heading {
    margin: -18px -18px 20px;
  }

  html[data-theme="modular"] .patch-port {
    display: none;
  }

  html[data-theme="modular"] .accordion-item.open .acc-trigger {
    aspect-ratio: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  html[data-theme="modular"][data-page-transition] main {
    animation: none !important;
  }

  html[data-theme="modular"] .patch-cables {
    display: none;
  }

  html[data-theme="modular"] .patch-led,
  html[data-theme="modular"] header nav a,
  html[data-theme="modular"] .index-intro .social-links-simple a,
  html[data-theme="modular"] .accordion-item,
  html[data-theme="modular"] .accordion-item .acc-links a,
  html[data-theme="modular"] .accordion-item .acc-icon,
  html[data-theme="modular"] .accordion-item .acc-icon::before,
  html[data-theme="modular"] .accordion-item .acc-icon::after,
  html[data-theme="modular"] .lab-section .lab-research-card,
  html[data-theme="modular"] .lab-section a[href="schedule.html"],
  html[data-theme="modular"] .contact-section .contact-email,
  html[data-theme="modular"] .theme-config-button {
    transition: none;
    transform: none;
  }
}
