@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;600&display=swap");

:root,
[data-theme="light"] {
  --bg: #f7f7f5;
  --panel: #ffffff;
  --text: #111111;
  --muted: #667085;
  --line: #e6e6e1;
  --rail: #111111;
  --rail-text: #f5f5f2;
  --soft: #f0f0eb;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] {
  --bg: #0c0d0f;
  --panel: #15171c;
  --text: #f2f3f5;
  --muted: #9aa3b2;
  --line: #2a2f3a;
  --rail: #08090b;
  --rail-text: #f2f3f5;
  --soft: #1c2028;
  --shadow: none;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body.hub {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px 1fr;
  font-family: Inter, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.rail {
  background: var(--rail);
  color: var(--rail-text);
  padding: 1rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 100vh;
  position: sticky;
  top: 0;
}

.logo {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  padding: 0.35rem 0.45rem;
}

.logo span {
  opacity: 0.55;
  font-weight: 500;
}

.deg {
  text-align: left;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  border-radius: 10px;
  padding: 0.75rem 0.8rem;
  cursor: pointer;
  font: inherit;
  line-height: 1.25;
}

.deg small {
  display: block;
  opacity: 0.65;
  font-size: 0.75rem;
  margin-top: 0.2rem;
  font-weight: 500;
}

.deg[aria-pressed="true"] {
  background: rgba(255, 255, 255, 0.1);
}

.rail-foot {
  margin-top: auto;
  display: grid;
  gap: 0.4rem;
}

.rail-foot button,
.rail-foot a {
  color: inherit;
  text-decoration: none;
  font: inherit;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: transparent;
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  cursor: pointer;
  text-align: left;
}

.rail-foot button:hover,
.rail-foot a:hover {
  background: rgba(255, 255, 255, 0.06);
}

.workspace {
  padding: 1.25rem 1.35rem 2rem;
  min-width: 0;
}

.bar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.bar h1 {
  margin: 0;
  font-size: clamp(1.15rem, 2.5vw, 1.4rem);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.meta {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 0.25rem;
}

.module-grid {
  display: grid;
  gap: 0.65rem;
}

.module-grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.module-grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.module {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  min-height: 112px;
  padding: 1rem;
  text-decoration: none;
  color: inherit;
  display: grid;
  gap: 0.3rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.module::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: var(--accent, #9db7ff);
}

.module:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent, #9db7ff) 40%, var(--line));
}

.module .code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
  padding-left: 0.35rem;
}

.module .name {
  font-size: 1.08rem;
  font-weight: 650;
  padding-left: 0.35rem;
  line-height: 1.2;
}

.module .chev {
  color: var(--muted);
  font-size: 0.78rem;
  padding-left: 0.35rem;
  margin-top: auto;
}

[data-degree-panel][hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .module-grid.cols-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  body.hub {
    grid-template-columns: 1fr;
  }

  .rail {
    position: relative;
    min-height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .deg {
    flex: 1 1 180px;
  }

  .rail-foot {
    margin-top: 0;
    margin-left: auto;
    display: flex;
    flex-wrap: wrap;
  }
}

@media (max-width: 520px) {
  .module-grid.cols-3,
  .module-grid.cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace {
    padding: 1rem 0.9rem 1.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .module {
    transition: none;
  }
  .module:hover {
    transform: none;
  }
}
