:root {
  color-scheme: light;
  --paper: #f5f7f2;
  --surface: #ffffff;
  --ink: #1e2421;
  --muted: #647069;
  --line: #dfe5dc;
  --line-strong: #b9c8bf;
  --teal: #12766f;
  --teal-soft: #dff0ed;
  --red: #be4b44;
  --red-soft: #f6dfdc;
  --gold: #a97816;
  --gold-soft: #f4ead0;
  --leaf: #4d7c2f;
  --leaf-soft: #e5efdc;
  --shadow: 0 20px 70px rgba(28, 36, 31, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(18, 118, 111, 0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(18, 118, 111, 0.05) 1px, transparent 1px),
    var(--paper);
  background-size: 36px 36px;
  font-family: system-ui, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button,
a,
select {
  min-height: 40px;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 3px solid rgba(18, 118, 111, 0.45);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 50;
  transform: translateY(-140%);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px 14px;
}

.skip-link:focus {
  transform: translateY(0);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid rgba(185, 200, 191, 0.75);
  background: rgba(245, 247, 242, 0.88);
  padding: 14px 24px;
  backdrop-filter: blur(16px);
  overflow: hidden;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 760;
}

.brand-mark {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--ink);
  color: var(--surface);
  font-size: 0.78rem;
}

.nav-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

.nav-actions a,
.search-trigger,
.filter-chip,
.search-row button,
.note-form button,
.skill-card button,
.starter-row button,
.dialog-close {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  transition:
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.nav-actions a {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  color: var(--muted);
}

.nav-actions a:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.search-trigger {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  padding: 7px 10px 7px 14px;
  color: var(--muted);
}

kbd {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f8f5;
  padding: 3px 6px;
  color: var(--muted);
  font-size: 0.72rem;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.78fr);
  gap: 36px;
  align-items: stretch;
  padding: 54px 0 30px;
  min-width: 0;
}

.hero-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 760px;
  margin: 0;
  font-size: 4.4rem;
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1.15;
  letter-spacing: 0;
}

h3 {
  margin: 22px 0 10px;
  font-size: 0.92rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-text {
  max-width: 660px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.search-panel {
  max-width: 700px;
  margin-top: 30px;
}

.search-panel label,
.note-form label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 720;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.search-row input,
.note-form input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  padding: 13px 14px;
  box-shadow: 0 1px 0 rgba(30, 36, 33, 0.04);
}

.search-row input::placeholder,
.note-form input::placeholder {
  color: #8d9991;
}

.search-row button,
.note-form button,
.starter-row button {
  padding: 0 16px;
  font-weight: 760;
}

.search-row button:hover,
.note-form button:hover,
.starter-row button:hover,
.skill-card button:hover,
.dialog-close:hover {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: #0b4f4b;
}

.hero-stats {
  display: grid;
  max-width: 680px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 22px;
}

.hero-stats div {
  border-top: 1px solid var(--line-strong);
  padding-top: 12px;
}

.hero-stats strong {
  display: block;
  font-size: 1.55rem;
  line-height: 1;
}

.hero-stats span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.85rem;
}

.skill-map {
  position: relative;
  min-width: 0;
  min-height: 420px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background:
    radial-gradient(circle at 28% 20%, rgba(190, 75, 68, 0.18), transparent 28%),
    radial-gradient(circle at 82% 72%, rgba(169, 120, 22, 0.2), transparent 34%),
    #eef4ed;
  box-shadow: var(--shadow);
}

#skillCanvas {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 100%;
}

.map-caption {
  position: absolute;
  right: 18px;
  bottom: 18px;
  left: 18px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid rgba(30, 36, 33, 0.14);
  padding-top: 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.map-caption strong {
  color: var(--ink);
}

.controls {
  display: grid;
  grid-template-columns: minmax(180px, 0.36fr) minmax(0, 1fr);
  gap: 26px;
  align-items: end;
  padding: 28px 0 18px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.filter-chip {
  padding: 9px 13px;
  color: var(--muted);
  font-weight: 720;
}

.filter-chip:hover,
.filter-chip.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--surface);
}

.library-shell {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  padding-bottom: 54px;
  min-width: 0;
}

.side-panel {
  position: sticky;
  top: 86px;
  border-left: 3px solid var(--teal);
  padding: 8px 0 8px 18px;
}

.workflow-list {
  display: grid;
  gap: 18px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.workflow-list li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
}

.workflow-list span {
  color: var(--red);
  font-size: 0.82rem;
  font-weight: 840;
}

.workflow-list p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.results-area {
  min-width: 0;
}

.results-bar {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.results-bar p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.results-bar select {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 8px 32px 8px 12px;
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.skill-card {
  display: flex;
  min-height: 224px;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  padding: 18px;
  box-shadow: 0 1px 0 rgba(30, 36, 33, 0.04);
}

.skill-card:hover {
  border-color: var(--line-strong);
  background: #ffffff;
  transform: translateY(-2px);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.category {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.76rem;
  font-weight: 800;
}

.category.Systems {
  background: var(--teal-soft);
  color: #0d5a55;
}

.category.Quality {
  background: var(--red-soft);
  color: #8f332e;
}

.category.Motion {
  background: var(--gold-soft);
  color: #72500d;
}

.category.Layout {
  background: var(--leaf-soft);
  color: #365c20;
}

.category.Writing {
  background: #e7e5f3;
  color: #4a446b;
}

.category.Process {
  background: #e2edf2;
  color: #2d5d70;
}

.skill-card h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.2;
  text-transform: none;
}

.skill-card p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.55;
}

.card-footer {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
}

.review-time {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 740;
}

.skill-card button {
  padding: 8px 12px;
  font-weight: 760;
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.updates {
  display: grid;
  grid-template-columns: minmax(0, 0.75fr) minmax(300px, 0.52fr);
  gap: 36px;
  align-items: end;
  border-top: 1px solid var(--line-strong);
  padding: 42px 0 56px;
}

.updates p {
  max-width: 620px;
  color: var(--muted);
  line-height: 1.65;
}

.note-form div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.note-form button {
  background: var(--ink);
  color: var(--surface);
}

.form-note,
.copy-status {
  min-height: 22px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.skill-dialog {
  width: min(720px, calc(100% - 28px));
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 26px;
  box-shadow: var(--shadow);
}

.skill-dialog::backdrop {
  background: rgba(18, 24, 21, 0.42);
  backdrop-filter: blur(2px);
}

.dialog-close {
  float: right;
  padding: 8px 12px;
}

.dialog-meta {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 0.82rem;
  font-weight: 820;
  text-transform: uppercase;
}

.skill-dialog h2 {
  max-width: 560px;
}

.skill-dialog p {
  color: var(--muted);
  line-height: 1.65;
}

.skill-dialog ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.starter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.starter-row code {
  display: block;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f8f5;
  padding: 13px;
  color: #28302b;
  white-space: normal;
}

footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  border-top: 1px solid var(--line);
  padding: 24px;
  color: var(--muted);
  font-size: 0.9rem;
}

footer span + span::before {
  content: "/";
  padding-right: 10px;
  color: var(--line-strong);
}

@media (max-width: 920px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .nav-actions {
    display: none;
  }

  .hero,
  .library-shell,
  .updates {
    grid-template-columns: minmax(0, 1fr);
  }

  .skill-map {
    min-height: 340px;
  }

  .side-panel {
    position: static;
  }
}

@media (max-width: 700px) {
  body {
    overflow-x: hidden;
  }

  main {
    width: calc(100% - 22px);
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 12px;
  }

  .brand {
    min-width: 0;
  }

  .brand span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .search-trigger {
    justify-self: end;
    max-width: 96px;
    padding-inline: 10px;
  }

  .search-trigger kbd {
    display: none;
  }

  .hero {
    gap: 22px;
    padding-top: 34px;
    overflow: hidden;
  }

  .hero-copy,
  .skill-map {
    width: calc(100vw - 22px);
    max-width: 100%;
  }

  h1 {
    max-width: calc(100vw - 22px);
    font-size: 2.25rem;
    line-height: 1.03;
  }

  .hero-text,
  .search-panel {
    max-width: calc(100vw - 22px);
  }

  .hero-text {
    font-size: 1rem;
  }

  .hero-stats,
  .controls,
  .skill-grid,
  .search-row {
    grid-template-columns: 1fr;
  }

  .search-row button {
    width: 100%;
  }

  .filter-row {
    justify-content: flex-start;
  }

  .results-bar,
  .card-footer,
  .note-form div,
  .starter-row {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .results-bar select {
    width: 100%;
  }

  .skill-card {
    min-height: 0;
  }
}

@media (max-width: 480px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .search-trigger {
    display: none;
  }

  .hero-copy,
  .hero-text,
  .search-panel {
    max-width: 340px;
  }

  h1 {
    max-width: 330px;
    font-size: 2.05rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
