@font-face {
  font-family: 'JetBrains Mono';
  src: url('../fonts/jetbrains-mono-regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('../fonts/jetbrains-mono-bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --font: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --max-width: 760px;
}

[data-theme="light"] {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #666666;
  --accent: #b0530a;
  --border: #dddddd;
  --code-bg: #f6f6f6;
}

[data-theme="dark"] {
  --bg: #111111;
  --fg: #e8e8e8;
  --muted: #999999;
  --accent: #e08a3c;
  --border: #333333;
  --code-bg: #1b1b1b;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: clamp(0.95rem, 0.9rem + 0.25vw, 1.05rem);
  line-height: 1.6;
  background: var(--bg);
  color: var(--fg);
}

a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 0.15em;
}
a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.site-nav,
.content,
.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.site-nav .brand {
  font-weight: 700;
  text-decoration: none;
  color: var(--fg);
}

.nav-links {
  display: flex;
  gap: 1rem;
  margin-left: 1.5rem;
}

.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}
.nav-link:hover {
  color: var(--accent);
}

.theme-toggle {
  font-family: inherit;
  font-size: 0.85rem;
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  margin-left: auto;
}
.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.content {
  padding-top: 2rem;
  padding-bottom: 3rem;
  min-height: 60vh;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  padding-bottom: 2rem;
  color: var(--muted);
  font-size: 0.85rem;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;
  font-weight: 700;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.75rem 0;
}

/* --- shared entry list (used by home previews, /projects, /posts) --- */

.entry-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.entry-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.entry-item:first-child {
  padding-top: 0;
}

.entry-title {
  font-weight: 700;
  text-decoration: none;
  color: var(--fg);
}
.entry-title:hover {
  color: var(--accent);
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.8rem;
}
.entry-meta span {
  border: 1px solid var(--border);
  padding: 0.05rem 0.4rem;
}

.entry-item > p {
  margin: 0.5rem 0 0;
  color: var(--muted);
}

.see-all-link {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--accent);
}

/* --- homepage intro (content/about.md) --- */

.intro h1:first-child,
.intro h2:first-child {
  margin-top: 0;
}
.intro p {
  max-width: 68ch;
}

/* --- entry detail (a single project or post page) --- */

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
}
.back-link:hover {
  color: var(--accent);
}

.entry h1 {
  margin: 0 0 0.5rem;
}

.entry p {
  max-width: 68ch;
}

.entry img,
.intro img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  margin: 0.5rem 0;
}

/* an image that's itself a link (e.g. a social icon) shouldn't get the
   photo/diagram treatment above -- no border, no full-width scaling */
.icon-link {
  display: inline-block;
  line-height: 0;
}
.icon-link img {
  width: 28px;
  height: 28px;
  border: none;
  max-width: none;
  opacity: 0.8;
  transition: opacity 0.15s ease;
}
.icon-link:hover img {
  opacity: 1;
}

/* --- code blocks --- */

pre.code-block {
  background: var(--code-bg);
  border: 1px solid var(--border);
  padding: 0.85rem 1rem;
  overflow-x: auto;
  font-size: 0.85em;
  line-height: 1.5;
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--code-bg);
}
pre.code-block code {
  font-family: inherit;
  white-space: pre;
}
pre.code-block::-webkit-scrollbar {
  height: 8px;
}
pre.code-block::-webkit-scrollbar-track {
  background: var(--code-bg);
}
pre.code-block::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
pre.code-block::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

@media (max-width: 480px) {
  .site-nav,
  .content,
  .site-footer {
    padding: 0 0.85rem;
  }
}
