:root {
  --bg: #1a1a1a;
  --panel-bg: #202020;
  --panel-raised: #282828;
  --panel-border: #514b42;
  --panel-grid: rgba(238, 238, 238, 0.035);
  --string-color: #cabaa1;
  --string-destination-color: #eb9a3d;
  --node-color: #b8b1a8;
  --node-input-color: #70b7c9;
  --node-output-color: #eb9a3d;
  --guide-color: rgba(238, 238, 238, 0.12);
  --muted-text: #aaa39a;
  --text-color: #eee;
  --toggle-bg: #1a1a1a;
  --toggle-fg: #f4f1ea;
}

/* light theme overrides -- applied via [data-theme="light"] on <html> */
html[data-theme="light"] {
  --bg: #f4f1ea;
  --panel-bg: #ebe7dd;
  --panel-raised: #dfd9ce;
  --panel-border: #aa9e8b;
  --panel-grid: rgba(34, 34, 34, 0.045);
  --string-color: #88795f;
  --string-destination-color: #eb9a3d;
  --node-color: #655f56;
  --node-input-color: #247f98;
  --node-output-color: #cc7410;
  --guide-color: rgba(34, 34, 34, 0.16);
  --muted-text: #71695e;
  --text-color: #222;
  --toggle-bg: #f4f1ea;
  --toggle-fg: #1a1a1a;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-color);
  font-family: monospace;
  font-size: 1.15rem;
  line-height: 1.6;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.layout {
  position: relative;
  width: 100%;
  height: 100vh; /* Forces the layout to be the full height of the browser window */
  /* OR min-height: 800px; if you want a fixed size */
  overflow: hidden;
}

.network-window {
  position: absolute;
  top: 2rem;
  bottom: 5.25rem;
  left: 2rem;
  width: calc(58% - 4rem);
  min-height: 440px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.28),
    inset 0 0 0 1px color-mix(in srgb, var(--text-color) 3%, transparent);
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}

.network-titlebar {
  min-height: 42px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 0.85rem;
  background: var(--panel-raised);
  border-bottom: 1px solid var(--panel-border);
  color: var(--muted-text);
  font-size: 0.72rem;
  letter-spacing: 0.045em;
  user-select: none;
}

.network-titlegroup,
.window-controls,
.network-legend,
.network-legend span,
.network-ready {
  display: flex;
  align-items: center;
}

.network-titlegroup {
  gap: 0.55rem;
}

.network-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--node-input-color);
  box-shadow: 0 0 9px var(--node-input-color);
}

.network-title {
  color: var(--text-color);
}

.network-version {
  opacity: 0.55;
}

.window-controls {
  align-self: stretch;
}

.window-control {
  width: 42px;
  height: 100%;
  display: grid;
  place-items: center;
  border-left: 1px solid color-mix(in srgb, var(--panel-border) 72%, transparent);
  font-family: system-ui, sans-serif;
  font-size: 0.82rem;
  color: var(--muted-text);
}

.window-control--close {
  color: var(--node-output-color);
}

.network-stage {
  position: relative;
  min-height: 0;
  flex: 1;
  overflow: hidden;
  background-image:
    linear-gradient(var(--panel-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--panel-grid) 1px, transparent 1px);
  background-size: 24px 24px;
}

#string-graph-container {
  position: absolute;
  inset: 0;
  z-index: 1;
  touch-action: none;
}

.network-legend {
  position: absolute;
  top: 0.85rem;
  right: 1rem;
  z-index: 2;
  gap: 0.9rem;
  color: var(--muted-text);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  pointer-events: none;
}

.network-legend span {
  gap: 0.35rem;
}

.legend-node {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--node-color);
}

.legend-node--input {
  background: var(--node-input-color);
}

.legend-node--output {
  background: var(--node-output-color);
}

.network-instruction {
  position: absolute;
  right: 1rem;
  bottom: 0.75rem;
  left: 1rem;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted-text);
  font-size: 0.68rem;
  letter-spacing: 0.025em;
  pointer-events: none;
}

.network-ready {
  gap: 0.4rem;
  white-space: nowrap;
}

.network-ready i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--node-input-color);
}

.right-pane {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 40%;
  z-index: 2;
  background: transparent;
  pointer-events: none;
}

.right-pane > * {
  pointer-events: auto;
}

/* ---- mobile layout: stack vertically instead of overlaying ---- */
@media (max-width: 1500px) {
  .layout {
    height: auto;
    min-height: 100vh;
    overflow: visible;
    display: flex;
    flex-direction: column;
  }

  .network-window {
    position: relative;
    inset: auto;
    width: calc(100% - 2rem);
    height: 46vh;
    min-height: 340px;
    margin: 1rem;
    flex-shrink: 0;
  }

  .right-pane {
    position: relative;
    inset: auto;
    width: 100%;
    height: auto;
    pointer-events: auto;
    padding-bottom: 6rem;
  }

  .quick-nav {
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: blur(6px);
    padding: 0.6rem 1rem;
    border-radius: 999px;
  }
  .string-edge-math {
    display: none;
  }
}

@media (max-width: 640px) {
  .network-window {
    width: calc(100% - 1rem);
    height: 43vh;
    min-height: 300px;
    margin: 0.5rem;
    border-radius: 7px;
  }

  .network-titlebar {
    min-height: 38px;
  }

  .network-version,
  .network-legend,
  .network-instruction > :first-child {
    display: none;
  }

  .network-instruction {
    justify-content: flex-end;
  }

  .window-control {
    width: 36px;
  }
}

.string-graph {
  display: block;
  width: 100%;
  height: 100%;
  user-select: none;
  touch-action: none;
}

.string {
  fill: none;
  stroke: var(--string-color);
  stroke-width: 5;
  stroke-linecap: round;
  opacity: 0.75;
  transition:
    stroke 0.2s ease,
    opacity 0.2s ease;
  cursor: pointer;
  pointer-events: stroke;
}

.string--destination {
  stroke: var(--string-destination-color);
  stroke-width: 7;
}

.string-node {
  fill: var(--node-color);
  stroke: color-mix(in srgb, var(--node-color) 45%, var(--bg));
  stroke-width: 1.5;
  opacity: 0.95;
  transition:
    fill 0.2s ease,
    stroke 0.2s ease;
}

.string-node--labeled {
  opacity: 1;
  stroke: var(--text-color);
  stroke-width: 1;
}

.string-node--input {
  fill: var(--node-input-color);
  stroke: color-mix(in srgb, var(--node-input-color) 55%, var(--bg));
}

.string-node--output {
  fill: var(--node-output-color);
  stroke: color-mix(in srgb, var(--node-output-color) 55%, var(--bg));
}

.string-layer-guide {
  stroke: var(--guide-color);
  stroke-width: 1;
  stroke-dasharray: 3 9;
  pointer-events: none;
}

.string-layer-label {
  fill: var(--muted-text);
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 1.2px;
  text-anchor: middle;
  opacity: 0.75;
  pointer-events: none;
}

.string-node-label {
  fill: var(--text-color);
  stroke: var(--bg);
  stroke-width: 1px;
  paint-order: stroke fill;
  font-size: 20px;
  font-family: inherit;
  letter-spacing: 1px;
  text-anchor: start;
  dominant-baseline: auto;
  pointer-events: none;
  transition: fill 0.2s ease;
}

.string-edge-math {
  fill: var(--text-color);
  stroke: var(--bg);
  stroke-width: 5px;
  paint-order: stroke fill;

  font-family: inherit;
  font-size: 1rem;
  letter-spacing: 1px;
  text-anchor: middle;

  pointer-events: none;
  transition:
    fill 0.2s ease,
    stroke 0.2s ease;
}

#right-panel {
  padding: 2rem;
}

@keyframes stream-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stream-in {
  animation: stream-in 0.35s ease both;
}

@media (prefers-reduced-motion: reduce) {
  .stream-in {
    animation: none;
  }
}

.idle-hint {
  /* centers the idle hint within the pane without affecting the
     layout once real section content replaces it -- the flex
     centering below only applies while .idle-hint is present */
  font-size: 1.6rem;
  opacity: 0.6;
  text-align: center;
}

#right-panel:has(.idle-hint) {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

#right-panel a {
  color: var(--string-destination-color);
  text-decoration-color: color-mix(
    in srgb,
    var(--string-destination-color) 60%,
    transparent
  );
}

#right-panel a:hover {
  text-decoration-color: var(--string-destination-color);
}

#right-panel a:visited {
  color: var(--string-destination-color);
  opacity: 0.85;
}

.project {
  margin-bottom: 1.75rem;
}

.project h3 {
  margin-bottom: 0.25rem;
}

.project-role {
  font-weight: normal;
  font-size: 0.85em;
  opacity: 0.75;
}

.metrics-table {
  border-collapse: collapse;
  margin: 1rem 0;
}

.metrics-table td {
  padding: 0.25rem 1rem 0.25rem 0;
  border-bottom: 1px solid var(--string-color);
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-width: 420px;
  margin-top: 1rem;
}

.contact-form input,
.contact-form textarea {
  font-family: inherit;
  background: transparent;
  color: var(--text-color);
  border: 1px solid var(--string-color);
  padding: 0.5rem;
  margin-bottom: 0.75rem;
}

.contact-form textarea {
  min-height: 100px;
  resize: vertical;
}

.contact-form button {
  font-family: inherit;
  background: var(--string-destination-color);
  color: var(--bg);
  border: none;
  padding: 0.6rem 1rem;
  cursor: pointer;
  align-self: flex-start;
}

.contact-status {
  font-size: 0.85em;
  opacity: 0.8;
}

.quick-nav {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 1.5rem;
  align-items: center;
  z-index: 10;
}

.quick-nav-btn {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text-color);
  text-decoration: underline;
  cursor: pointer;
  transition: color 0.2s ease;
}

.quick-nav-btn:hover {
  color: var(--string-destination-color);
}

.theme-toggle {
  background: var(--toggle-bg);
  border-radius: 0px;
  border-width: 0px;
  padding: 0px;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease;
  text-decoration: underline;
  color: var(--text-color);
}

.theme-toggle:hover {
  color: var(--string-destination-color);
}
