:root {
  --ink: #111412;
  --muted: #53605b;
  --paper: #edf1ed;
  --panel: #fbfcf7;
  --green: #123d36;
  --green-2: #0b2a2f;
  --copper: #c27a2c;
  --mint: #a9f2d1;
  --line: rgba(17, 20, 18, 0.14);
  --shadow: 0 24px 80px rgba(17, 20, 18, 0.14);
  --danger: #9f2d2d;
  --blueprint: #18242d;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Aptos", "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(244, 240, 231, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1160px, calc(100% - 32px));
  min-height: 72px;
  margin: 0 auto;
  gap: 24px;
}

.brand,
.nav-links {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand {
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--mint);
  background: var(--green);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.nav-links a {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
}

.nav-links a:hover {
  color: var(--ink);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1.1fr);
  align-items: center;
  width: min(1240px, calc(100% - 32px));
  min-height: calc(100vh - 72px);
  margin: 0 auto;
  padding: 48px 0 72px;
  gap: 34px;
}

.hero-copy {
  max-width: 620px;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 14px;
  color: var(--copper);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 20px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(4.7rem, 16vw, 12rem);
  line-height: 0.82;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.15rem, 5vw, 4.8rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 12px;
  font-size: 1.25rem;
}

.lead {
  max-width: 580px;
  color: #303b36;
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  line-height: 1.5;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid var(--ink);
  text-decoration: none;
  font-weight: 800;
}

.button.primary {
  color: var(--paper);
  background: var(--ink);
}

.button.secondary {
  color: var(--ink);
  background: transparent;
}

.hero-visual {
  position: relative;
}

.hero-visual img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid rgba(18, 61, 54, 0.2);
  box-shadow: var(--shadow);
}

.section {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 96px 0;
  border-top: 1px solid var(--line);
}

.intro,
.manufacturing,
.mistakes {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(280px, 1fr);
  gap: 56px;
  align-items: start;
}

.intro p,
.manufacturing p,
.mistakes p,
.feature p,
.step-panel p {
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.65;
}

.section-heading {
  margin-bottom: 34px;
}

.section-heading.full {
  grid-column: 1 / -1;
}

.workflow-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
}

.step-list {
  display: grid;
  gap: 10px;
}

.step-button {
  min-height: 58px;
  padding: 0 18px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-weight: 850;
  text-align: left;
  cursor: pointer;
}

.step-button:hover,
.step-button.is-active {
  color: var(--mint);
  background: var(--green);
  border-color: var(--green);
}

.step-panel {
  min-height: 280px;
  padding: clamp(28px, 5vw, 56px);
  color: var(--panel);
  background:
    linear-gradient(90deg, rgba(169, 242, 209, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(169, 242, 209, 0.08) 1px, transparent 1px),
    linear-gradient(135deg, var(--green), var(--green-2));
  background-size: 34px 34px, 34px 34px, auto;
}

.step-panel h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
}

.step-panel p {
  max-width: 720px;
  color: rgba(255, 250, 240, 0.82);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.feature {
  min-height: 250px;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.feature-index {
  display: block;
  margin-bottom: 44px;
  color: var(--copper);
  font-weight: 900;
}

.deliverables {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.deliverables span {
  padding: 12px 14px;
  color: var(--mint);
  background: var(--green);
  font-weight: 850;
}

.mistake-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mistake-list li {
  padding: 16px 18px;
  background: rgba(255, 250, 240, 0.72);
  border-left: 4px solid var(--copper);
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 56px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.footer p {
  margin-bottom: 0;
}

.footer a {
  font-weight: 850;
}

.studio-body {
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(17, 20, 18, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(17, 20, 18, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
}

.studio-main {
  width: min(1440px, calc(100% - 28px));
  margin: 0 auto;
  padding: 34px 0 64px;
}

.studio-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.studio-topbar h1 {
  margin-bottom: 0;
  font-size: clamp(3.2rem, 7vw, 6.4rem);
}

.project-actions,
.board-stats,
.net-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-actions {
  flex: 1 1 430px;
  justify-content: flex-end;
}

.export-select {
  display: flex;
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.export-select span {
  padding: 0 9px 0 12px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.export-select select {
  height: 40px;
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  font: inherit;
  font-weight: 850;
}

.tool-button,
.net-button,
.library-item,
.trace-row button,
.nudge {
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--panel);
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.tool-button {
  min-height: 42px;
  padding: 0 13px;
}

.tool-button.primary,
.tool-button:hover,
.net-button:hover,
.library-item:hover,
.nudge:hover {
  color: var(--mint);
  background: var(--green);
  border-color: var(--green);
}

.tool-button.danger:hover {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

.studio-layout {
  display: grid;
  grid-template-columns: 280px minmax(480px, 1fr) 320px;
  gap: 12px;
  align-items: start;
}

.studio-panel,
.board-workspace,
.document-workspace,
.result-panel {
  background: rgba(251, 252, 247, 0.92);
  border: 1px solid var(--line);
  box-shadow: 0 16px 42px rgba(17, 20, 18, 0.08);
}

.studio-panel,
.result-panel {
  padding: 18px;
}

.panel-heading {
  margin-bottom: 16px;
}

.panel-heading.compact {
  margin-bottom: 12px;
}

.panel-heading h2,
.board-header h2,
.result-panel h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.55rem, 3vw, 2.25rem);
  line-height: 1;
}

.library-list {
  display: grid;
  gap: 9px;
}

.library-heading {
  margin-top: 28px;
}

.panel-note {
  margin: -6px 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.project-tree {
  display: grid;
  gap: 8px;
}

.tree-item {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(17, 20, 18, 0.035);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.tree-item span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.tree-item:hover,
.tree-item.is-active {
  color: var(--mint);
  background: var(--green);
  border-color: var(--green);
}

.tree-item:hover span,
.tree-item.is-active span {
  color: rgba(255, 250, 240, 0.8);
}

.library-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 70px;
  padding: 12px;
  text-align: left;
}

.library-item small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.library-prefix {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--mint);
  background: var(--green);
}

.board-workspace,
.document-workspace {
  min-width: 0;
  padding: 16px;
}

.document-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.document-tab {
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(17, 20, 18, 0.035);
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.document-tab:hover,
.document-tab.is-active {
  color: var(--mint);
  background: var(--green);
  border-color: var(--green);
}

.doc-view {
  display: none;
}

.doc-view.is-active {
  display: block;
}

.project-summary-grid,
.schematic-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.schematic-grid {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
}

.project-summary-grid article,
.schematic-card {
  padding: 16px;
  background: rgba(17, 20, 18, 0.04);
  border: 1px solid var(--line);
}

.project-summary-grid h3,
.schematic-card h3 {
  margin-bottom: 10px;
}

.project-summary-grid p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.doc-kind {
  display: inline-block;
  margin-bottom: 18px;
  padding: 6px 8px;
  color: var(--mint);
  background: var(--green);
  font-size: 0.76rem;
  font-weight: 900;
}

.schematic-list {
  display: grid;
  gap: 8px;
}

.schematic-row {
  display: grid;
  gap: 4px;
  padding: 10px;
  background: rgba(255, 250, 240, 0.6);
  border-left: 4px solid var(--copper);
}

.schematic-row small {
  color: var(--muted);
  font-weight: 750;
}

.board-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.board-stats {
  justify-content: flex-end;
}

.board-stats span,
.status-pill {
  padding: 7px 9px;
  background: rgba(17, 20, 18, 0.06);
  font-size: 0.8rem;
  font-weight: 850;
}

.status-pill.ok {
  color: #0d513b;
  background: rgba(54, 163, 115, 0.18);
}

.status-pill.warning {
  color: #7a4b00;
  background: rgba(224, 154, 54, 0.2);
}

.status-pill.error {
  color: #7f1f1f;
  background: rgba(159, 45, 45, 0.16);
}

.board-frame {
  overflow: auto;
  background: var(--blueprint);
  border: 1px solid rgba(17, 20, 18, 0.4);
}

.pcb-canvas {
  display: block;
  width: 100%;
  min-width: 560px;
  aspect-ratio: 16 / 10;
}

.pcb-board-base {
  fill: #123d36;
  stroke: rgba(169, 242, 209, 0.72);
  stroke-width: 0.8;
}

.pcb-grid-line {
  stroke: rgba(169, 242, 209, 0.12);
  stroke-width: 0.15;
}

.pcb-trace {
  fill: none;
  stroke: #e2a044;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pcb-trace.bottom {
  stroke: #7bd8c8;
  stroke-dasharray: 2 2;
}

.pcb-component {
  cursor: pointer;
}

.component-body {
  stroke: rgba(255, 255, 255, 0.82);
  stroke-width: 0.5;
}

.pcb-component.selected .component-body {
  stroke: #f5c46b;
  stroke-width: 1.3;
}

.component-ref {
  fill: #0a1013;
  font-family: "Aptos", "Segoe UI", sans-serif;
  font-size: 5px;
  font-weight: 900;
  pointer-events: none;
}

.pcb-pad {
  fill: #ffd991;
  stroke: #744514;
  stroke-width: 0.45;
}

.pcb-via {
  fill: #7bd8c8;
  stroke: #0b2a2f;
  stroke-width: 0.45;
}

.pcb-hole {
  fill: #071014;
  stroke: rgba(255, 250, 240, 0.8);
  stroke-width: 0.5;
}

.route-panel {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 14px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.route-panel h3,
.trace-list h3 {
  margin-bottom: 0;
}

.net-button {
  display: grid;
  min-height: 46px;
  padding: 8px 10px;
  text-align: left;
}

.net-button small {
  color: var(--muted);
  font-size: 0.72rem;
}

.net-button.is-routed,
.net-button:disabled {
  color: #31544b;
  background: rgba(169, 242, 209, 0.28);
  border-color: rgba(18, 61, 54, 0.18);
  cursor: default;
}

.selection-card {
  min-height: 144px;
  padding: 14px;
  background: rgba(17, 20, 18, 0.04);
}

.selection-card dl {
  display: grid;
  gap: 9px;
  margin: 0;
}

.selection-card div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.selection-card dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.selection-card dd {
  margin: 0;
  font-weight: 850;
  text-align: right;
}

.move-controls {
  display: grid;
  grid-template-columns: repeat(3, 52px);
  grid-template-areas:
    ". up ."
    "left . right"
    ". down .";
  justify-content: center;
  gap: 8px;
  margin: 16px 0;
}

.nudge {
  width: 52px;
  height: 42px;
  font-size: 1.2rem;
}

.nudge.up { grid-area: up; }
.nudge.left { grid-area: left; }
.nudge.right { grid-area: right; }
.nudge.down { grid-area: down; }

.trace-list {
  display: grid;
  gap: 8px;
}

.trace-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  background: rgba(17, 20, 18, 0.04);
}

.trace-row span {
  font-weight: 850;
}

.trace-row button {
  width: 30px;
  height: 30px;
  color: var(--danger);
  background: #fff;
}

.studio-results {
  display: grid;
  grid-template-columns: repeat(4, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.studio-results.gerber-results {
  grid-template-columns: minmax(280px, 0.8fr) minmax(280px, 0.9fr) minmax(360px, 1.3fr);
}

.drc-summary {
  margin-bottom: 12px;
  padding: 12px;
  font-weight: 900;
}

.drc-summary.ok {
  color: #0d513b;
  background: rgba(54, 163, 115, 0.16);
}

.drc-summary.warning {
  color: #7a4b00;
  background: rgba(224, 154, 54, 0.18);
}

.drc-summary.error {
  color: #7f1f1f;
  background: rgba(159, 45, 45, 0.14);
}

.drc-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.drc-list li {
  display: grid;
  gap: 5px;
  padding: 10px;
  background: rgba(17, 20, 18, 0.04);
}

.drc-list li.warning {
  border-left: 4px solid #d08a26;
}

.drc-list li.error {
  border-left: 4px solid var(--danger);
}

.drc-list span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.empty-state {
  color: #0d513b;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.export-panel textarea {
  width: 100%;
  min-height: 240px;
  resize: vertical;
  padding: 12px;
  color: #dcefe8;
  background: #111a20;
  border: 1px solid rgba(17, 20, 18, 0.25);
  font: 0.82rem/1.45 "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

@media (max-width: 880px) {
  .nav {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 0;
  }

  .nav-links {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
    overflow-x: auto;
  }

  .hero,
  .intro,
  .manufacturing,
  .mistakes,
  .workflow-shell {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: 0;
    padding-top: 42px;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1160px) {
  .studio-layout,
  .studio-results {
    grid-template-columns: 1fr;
  }

  .studio-results.gerber-results {
    grid-template-columns: 1fr;
  }

  .studio-topbar,
  .board-header,
  .route-panel {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .project-summary-grid,
  .schematic-grid {
    grid-template-columns: 1fr;
  }

  .board-stats {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: clamp(4rem, 23vw, 6.5rem);
  }

  .section {
    padding: 72px 0;
  }

  .hero-actions,
  .footer {
    flex-direction: column;
  }

  .button {
    width: 100%;
  }

  .project-actions {
    flex-direction: column;
  }

  .tool-button,
  .export-select,
  .export-select select {
    width: 100%;
  }

  .export-select {
    align-items: stretch;
    flex-direction: column;
  }

  .export-select span {
    padding: 9px 12px 0;
  }

  .export-select select {
    border-left: 0;
  }

  .pcb-canvas {
    min-width: 420px;
  }
}
