* { margin: 0; padding: 0; box-sizing: border-box;}

@media (prefers-color-scheme: dark) {
  * {
    --textcolor: #e6e1e5;
    --bgcolor: #121212;
    --highlight: #e6e1e5;
  }
}

body {
  font-size: 18px;
  font-family: system-ui, sans-serif;
  line-height: 1.4;
  color: #e6e1e5;
  background: #121212;
  border-color: #2c2c2c;
  position: relative;
  max-width: 64em;  /* remove this for a full-width layout */
  margin: 0 auto;  /* centers the layout */
}

/* ------- Sections ------- */

section {
  padding: calc(6em + 5vw) 5vw 8vw 5vw;
  /* ! Everything below is needed ! */
  display: none;
  position: absolute;
  top: 0;
  min-height: 100vh;
  width: 100%;
  background: var(--bgcolor);
}

section:target { /* Show section */
  display: block;
}

section#home { /* Show #home by default */
  display: block;
}

/* ------- Header ------- */

header {
  padding: 5vw 5vw 0 5vw;
  display: flex;
  flex-wrap: wrap;
  position: absolute;
  width: 100%;
  z-index: 2;
}

header h1 {
  font-size: 1em;
  flex: 1; /* pushes nav to the right */
  white-space: nowrap;
  padding: 0 5vw .5em 0;
}

nav a:not(:last-of-type) {
  margin-right: 1.5vw;
}

/* ------- General ------- */

a {
  text-decoration: none;
  color: var(--highlight);
}

a:hover {
  border-bottom: 1px solid;
}

section h1 {
  font-size: 1em;
  margin: 0 0 1em 0;
}

h2, h3, h4 {
  font-size: 1em;
  font-weight: 600;
  margin-bottom: .6em;
}

/* ------- Cheatsheet ------------ */
.columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 2px solid #7c7fce;
}

.col {
  padding: 2rem 2.5rem;
}

/* ── Link cards (used in Introduction) ── */
.link-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid #2c2c2c;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 2rem;
}

.link-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.1rem;
  background: #121212;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}

.link-card + .link-card {
  border-top: 1px solid #dde0ec;
}

.link-card:hover { background: #1e1e2e; }

.link-card .link-title {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-weight: 600;
  color: #7c7fce;
  font-size: 0.95rem;
}

.link-card .link-sub {
  font-size: 0.8rem;
  color: #888;
}

.link-card .arrow {
  color: #7c7fce;
  font-size: 1.1rem;
}

/* ── Code block ── */
.code-block {
  background: #121212;
  border: 1px solid #2c2c2c;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 2rem;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 0.82rem;
}

.code-block .code-label {
  background: #1e1e2e;
  color: #888;
  padding: 0.4rem 0.85rem;
  font-size: 0.75rem;
  font-family: 'Helvetica Neue', Arial, sans-serif;
}

.code-block pre {
  padding: 0.85rem 1rem;
  white-space: pre;
  overflow-x: auto;
  line-height: 1.7;
  text-wrap: wrap;
}

/* ── Syntax colours ── */
.kw   { color: #7c7fce; }   /* keywords: var, func, const, package, import */
.str  { color: #4db89a; }   /* strings */
.num  { color: #4db89a; }   /* numbers */
.fn   { color: #1a6faa; }   /* function names */
.cm   { color: #999; }      /* comments */

/* ── Responsive: stack on small screens ── */
@media (max-width: 780px) {
  .columns { grid-template-columns: 1fr; padding-top: 2em; padding-bottom: 2em; }
  .col {  padding-bottom: 0; padding-top: 0;}
}

/* ------- Smaller screens ------- */

@media only screen and (max-width: 680px) {
  body { font-size: 16px; }
}

@media only screen and (max-width: 540px) {
  nav { width: 100%; } /* Fix for older webkit versions */
}
