:root {
  color-scheme: light dark;

  /* Light defaults */
  --bg: #ffffff;
  --fg: #111111;
  --muted: #555555;
  --link: #0b5fff;
  --card: #f4f6f8;

  /* Layout */
  --page-pad: 20px;
  --main-top: 24px;

  /* Navbar tokens (light) */
  --nav-bg: rgba(255, 255, 255, 0.75);
  --nav-border: rgba(17, 17, 17, 0.10);
  --nav-shadow: 0 10px 30px rgba(17, 17, 17, 0.06);
  --nav-link-bg: rgba(17, 17, 17, 0.04);
  --nav-link-border: rgba(17, 17, 17, 0.10);
  --nav-link-hover-bg: rgba(11, 95, 255, 0.10);
  --nav-link-hover-border: rgba(11, 95, 255, 0.35);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f14;
    --fg: #e7edf5;
    --muted: #a7b2bf;
    --link: #7ab7ff;
    --card: #121a24;

    /* Navbar tokens (dark) */
    --nav-bg: rgba(11, 15, 20, 0.65);
    --nav-border: rgba(231, 237, 245, 0.12);
    --nav-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --nav-link-bg: rgba(231, 237, 245, 0.06);
    --nav-link-border: rgba(231, 237, 245, 0.12);
    --nav-link-hover-bg: rgba(122, 183, 255, 0.12);
    --nav-link-hover-border: rgba(122, 183, 255, 0.40);
  }
}

@media (max-width: 520px) {
  :root {
    --page-pad: 14px;
    --main-top: 16px;
  }
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

img, video, canvas, svg {
  max-width: 100%;
  height: auto;
}

a { color: var(--link); }
p { color: var(--fg); }
small, .muted { color: var(--muted); }

/* Navbar */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  padding: 12px var(--page-pad);

  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  border-bottom: 1px solid var(--nav-border);
  box-shadow: var(--nav-shadow);
}

.nav__brand {
  font-weight: 750;
  letter-spacing: 0.2px;
  text-decoration: none;
  color: var(--fg);
  white-space: nowrap;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Make links easier to tap on mobile */
.nav__link {
  text-decoration: none;
  color: var(--fg);

  padding: 10px 12px;
  border-radius: 10px;

  background: var(--nav-link-bg);
  border: 1px solid var(--nav-link-border);

  transition: background 160ms ease, border-color 160ms ease, transform 60ms ease;
  -webkit-tap-highlight-color: transparent;
}

.nav__link:hover {
  background: var(--nav-link-hover-bg);
  border-color: var(--nav-link-hover-border);
  transform: translateY(-1px);
}

.nav__link:active {
  transform: translateY(0);
}

/* Mobile navbar layout: wrap + full-width buttons */
@media (max-width: 520px) {
  .nav {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .nav__links {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr; /* two buttons */
    gap: 10px;
  }

  .nav__link {
    display: block;
    text-align: center;
  }
}

/* Main container */
main {
  max-width: 780px;
  margin: var(--main-top) auto auto;
  padding: 0 var(--page-pad);

  /* If you ever have long tokens/strings, this stops horizontal scrolling */
  overflow-wrap: anywhere;
}

text {
  min-width: 342px;
  max-width: 100%;
}

textarea {
  min-width: 342px;
  max-width: 100%;
  height: 120px;
}

.card {
  background: var(--card);
  padding: 16px 18px;
  border-radius: 12px;
}

.full-width-textarea {
  width: 100%;
  height: 150px;
  resize: none;
}

/* Example of overriding highlight.js styles to use your variables */
.hljs {
  background: rgba(0, 0, 0, 0.2) !important; /* Let the container handle the background */
  color: var(--fg); /* If you define a foreground variable */
}


/* for block of numbers */
.hljs-ln-numbers {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;

    text-align: right;
    color: var(--fg);
    border-right: 1px solid var(--fg);
    vertical-align: top;
    padding-right: 5px;

    /* your custom style here */
}

/* for block of code */
.hljs-ln-code {
    padding-left: 10px !important;
}

.hljs-ln td {
  padding: 0px !important;
  padding-right: 2px !important;
  padding-left: 4px !important;
}

