:root {
  --bg: #eee;
  --bg-box: #ffff;
  --text: #2e2e2e;
  --link: #ff6600;
  --link-hover: #ffffff;
  --accent: #011907;
  --font: 'Berkeley Mono Trial', monospace;
}

@font-face {
	font-family: 'Berkeley Mono Trial';
	src: url('/fonts/BerkeleyMonoTrial-Regular.ttf') format('truetype');
	font-display: swap;
}

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

html {
  overflow-x: hidden;
  margin-right: calc(100% - 100vw);
  background: #eee;
  height: 100%;
}


body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5rem;
}

.site-wrapper {
  max-width: 900px;
  margin: 2rem auto;
}

.site-box {
  background: var(--bg-box);
  color: var(--text);
  width: 100%;
  min-height: calc(100vh - 4rem);
  display: flex;
  flex-direction: column;
  padding: .5rem 1rem;
  border: 1px solid #888;
  box-shadow: 2px 2px #ccc;
}


header nav li {
  flex: 1;
}

.black {
  color: #000;
  fill: #000;
}

header nav {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px dashed var(--accent);
}

header nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  justify-content: center;
}


.site-title {
  font-size: 1rem;
  font-weight: bold;
  color: var(--accent);
  margin-bottom: 1rem;
  font-stretch: condensed;
}

header nav a {
  display: block;
  min-width: 6rem;
  font-size: smaller;
  font-weight: bold;
  text-align: center;
  padding: .10rem .2rem;
  border: 1px solid #888;
  box-shadow: 2px 2px #ccc;
  color: var(--accent);
}

header nav a:hover {
  background: black;
  text-decoration: none;
}

header nav a.nav-active {
  background: var(--accent);
  color: #fff;
  box-shadow: none;
}

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

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

h1,
h2,
h3 {
  color: var(--accent);
  margin-bottom: 1rem;
}

p {
  margin-bottom: 1rem;
}

img {
  max-width: 100%;
  image-rendering: pixelated;
}

footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px dashed var(--accent);
  font-size: 0.85rem;
}


/* ── Home ── */
.home-intro {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px dashed var(--accent);
}

.home-section {
  margin-bottom: 2.5rem;
}

.home-section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1rem;
  padding-bottom: .4rem;
  border-bottom: 1px dashed var(--accent);
}

.home-section-header h2 {
  margin-bottom: 0;
}

.home-more {
  font-size: 0.8rem;
  color: var(--link);
}

.home-more:hover {
  color: var(--link-hover);
}

.home-projects {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
}

.home-articles {
  display: flex;
  flex-direction: column;
}

.article-row {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: .35rem 0;
  border-bottom: 1px dashed #ddd;
  text-decoration: none;
  color: var(--text);
}

.article-row:last-child {
  border-bottom: none;
}

.article-row:hover {
  color: var(--accent);
  text-decoration: none;
}

.article-row-date {
  font-size: 0.75rem;
  color: #888;
  flex-shrink: 0;
  min-width: 7rem;
}

.article-row-title {
  font-weight: bold;
  font-size: 0.9rem;
  color: var(--accent);
}

.home-empty {
  color: #888;
  font-size: 0.9rem;
}

/* ── Card thumbnail ── */
.card-thumb {
  height: 110px;
  overflow: hidden;
  border-bottom: 1px solid #ddd;
  background: repeating-linear-gradient(
    -45deg,
    #f2f2f2,
    #f2f2f2 2px,
    #e8e8e8 2px,
    #e8e8e8 9px
  );
  flex-shrink: 0;
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: auto;
}

.card-body {
  flex: 1;
  padding: .6rem .75rem;
  display: flex;
  flex-direction: column;
}

/* ── Articles list page ── */
.articles-list {
  display: flex;
  flex-direction: column;
}

.articles-list-item {
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: 1rem;
  align-items: start;
  padding: .75rem 0;
  border-bottom: 1px dashed #ddd;
  text-decoration: none;
  color: var(--text);
}

.articles-list-item:last-child {
  border-bottom: none;
}

.articles-list-item:hover {
  color: var(--accent);
  text-decoration: none;
}

.articles-list-item .article-date {
  font-size: 0.8rem;
  color: #888;
  padding-top: .15rem;
}

.articles-list-body h2 {
  font-size: 1rem;
  margin-bottom: .25rem;
  color: var(--accent);
}

.articles-list-body p {
  font-size: 0.85rem;
  margin-bottom: 0;
  color: var(--text);
}

/* ── Article page ── */
.article-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px dashed var(--accent);
}

.article-date {
  font-size: 0.85rem;
  color: #888;
  display: block;
  margin-bottom: .25rem;
}

.article-description {
  color: #888;
  margin-top: .5rem;
  margin-bottom: 0;
}

/* ── Content layout (main + optional sidebar) ── */
/* Sidebar is fixed-positioned outside the body box on wide screens */

.projects-sidebar {
  background: var(--bg-box);
  border: 1px solid #888;
  box-shadow: 2px 2px #ccc;
  font-size: 0.85rem;
  position: fixed;
  left: calc(50vw + 450px + 1rem);
  top: 9.5rem;
  width: 160px;
  max-height: calc(100vh - 11.5rem);
  overflow-y: auto;
}

@media (max-width: 1100px) {
  .projects-sidebar {
    display: none;
  }
}

.sidebar-title {
  padding: .35rem .75rem;
  font-weight: bold;
  color: var(--accent);
  border-bottom: 1px dashed var(--accent);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.sidebar-year {
  display: block;
  width: 100%;
  padding: .3rem .75rem;
  font-weight: bold;
  cursor: pointer;
  color: var(--accent);
  background: none;
  border: none;
  border-bottom: 1px solid #ddd;
  text-align: left;
  font-family: var(--font);
  font-size: 0.85rem;
}

.sidebar-year.active,
.sidebar-year:hover {
  background: black;
  color: white;
}

.sidebar-project {
  display: block;
  padding: .2rem .75rem .2rem 1.1rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.8rem;
  border-bottom: 1px dashed #ddd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-project:hover {
  color: var(--accent);
  text-decoration: none;
}

.sidebar-project::before {
  content: "└ ";
  color: #bbb;
}

.sidebar-group:last-child .sidebar-year {
  border-bottom: none;
}

.sidebar-group:last-child .sidebar-project {
  border-bottom: none;
}

.sidebar-group:last-child .sidebar-year:not(:last-child) {
  border-bottom: 1px solid #ddd;
}

/* ── Projects listing ── */
.projects-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1.5rem;
}

.projects-filters {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.projects-actions {
  display: flex;
  gap: .4rem;
}

.projects-filters button,
.sort-btn,
.view-btn {
  font-family: var(--font);
  font-size: smaller;
  font-weight: bold;
  padding: .1rem .5rem;
  border: 1px solid #888;
  box-shadow: 2px 2px #ccc;
  background: var(--bg-box);
  color: var(--accent);
  cursor: pointer;
}

.projects-filters button.active,
.projects-filters button:hover,
.sort-btn:hover,
.view-btn:hover {
  background: black;
  color: white;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.projects-list {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.projects-list .card-thumb {
  display: none;
}

.projects-list .project-card {
  flex-direction: row;
  align-items: stretch;
}

.projects-list .card-body {
  display: grid;
  grid-template-columns: 3rem 1fr 2fr;
  align-items: baseline;
  gap: 0 1rem;
  padding: .5rem .75rem;
}

.projects-list .card-body h2,
.projects-list .card-body p {
  margin-bottom: 0;
}

.project-card {
  display: flex;
  flex-direction: column;
  border: 1px solid #888;
  box-shadow: 2px 2px #ccc;
  color: var(--text);
  text-decoration: none;
}

.project-card:hover {
  border-color: var(--accent);
  text-decoration: none;
  color: var(--text);
}

.card-body .project-year {
  font-size: 0.75rem;
  color: #888;
  display: block;
}

.card-body h2 {
  font-size: 1rem;
  margin-bottom: .25rem;
  color: var(--accent);
}

.card-body p {
  font-size: 0.85rem;
  margin-bottom: 0;
}

.projects-empty {
  color: #888;
}

/* ── Individual project page ── */
.project-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px dashed var(--accent);
}

.project-header .project-year {
  font-size: 0.85rem;
  color: #888;
  display: block;
  margin-bottom: .25rem;
}

.project-description {
  color: #888;
  margin-top: .5rem;
  margin-bottom: 0;
}

/* ── Prose content area ── */
.project-content,
.article-content {
  line-height: 1.75;
}

.project-content h2,
.article-content h2 {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--accent);
}

.project-content h3,
.article-content h3 {
  margin-top: 1.5rem;
}

.project-content ul,
.article-content ul,
.project-content ol,
.article-content ol {
  margin: 0 0 1rem 1.5rem;
}

.project-content li,
.article-content li {
  margin-bottom: .25rem;
}

.project-content pre,
.article-content pre {
  background: #f4f4f0;
  border: 1px solid #ddd;
  padding: .75rem 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  line-height: 1.6;
}

.project-content code,
.article-content code {
  font-family: var(--font);
  font-size: 0.88em;
  background: #f4f4f0;
  border: 1px solid #ddd;
  padding: .05em .35em;
}

.project-content pre code,
.article-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
}

.project-content blockquote,
.article-content blockquote {
  border-left: 3px solid var(--accent);
  padding: .25rem 0 .25rem 1rem;
  color: #666;
  margin: 1rem 0;
  font-style: italic;
}

.project-content table,
.article-content table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.project-content th,
.article-content th {
  border: 1px solid #ddd;
  padding: .4rem .75rem;
  background: #f4f4f0;
  text-align: left;
  color: var(--accent);
}

.project-content td,
.article-content td {
  border: 1px solid #ddd;
  padding: .4rem .75rem;
}

.project-content tr:nth-child(even) td,
.article-content tr:nth-child(even) td {
  background: #fafafa;
}

.project-content figure,
.article-content figure {
  margin: 1.5rem 0;
}

.project-content figcaption,
.article-content figcaption {
  font-size: 0.8rem;
  color: #888;
  margin-top: .5rem;
  text-align: center;
  font-style: italic;
}

.project-content img,
.article-content img {
  max-width: 100%;
  height: auto;
  display: block;
  border: 1px solid #ddd;
}

.project-content video,
.article-content video {
  width: 100%;
  display: block;
  border: 1px solid #ddd;
  background: #111;
  margin-bottom: 1rem;
}

.project-content hr,
.article-content hr {
  border: none;
  border-top: 1px dashed var(--accent);
  margin: 2rem 0;
}

/* Download link */
.download-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .2rem .6rem;
  border: 1px solid #888;
  box-shadow: 2px 2px #ccc;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  margin: .25rem 0;
}

.download-link:hover {
  background: black;
  color: white;
  text-decoration: none;
  box-shadow: none;
}

/* ── Table of contents ── */
.toc {
  margin-bottom: 1.5rem;
  padding: .6rem .9rem;
  border: 1px dashed var(--accent);
  font-size: 0.85rem;
}

.toc-title {
  font-weight: bold;
  color: var(--accent);
  margin-bottom: .4rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}

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

.toc-h3 {
  padding-left: 1rem;
}

.toc-list li {
  padding: .1rem 0;
}

.toc-list a {
  color: var(--text);
}

.toc-list a:hover {
  color: var(--accent);
  text-decoration: none;
}

/* ── Search input ── */
.search-input {
  font-family: var(--font);
  font-size: smaller;
  padding: .1rem .4rem;
  border: 1px solid #888;
  box-shadow: 2px 2px #ccc;
  background: var(--bg-box);
  color: var(--text);
  width: 9rem;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: none;
}

/* ── Breadcrumb ── */
.breadcrumb {
  font-size: 0.8rem;
  margin-bottom: 1.5rem;
  color: #888;
}

.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb-sep {
  color: #bbb;
}

/* ── Prev / Next navigation ── */
.post-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--accent);
}

.post-nav-prev,
.post-nav-next {
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid #888;
  box-shadow: 2px 2px #ccc;
  padding: .15rem .5rem;
}

.post-nav-next {
  margin-left: auto;
}

.post-nav-prev:hover,
.post-nav-next:hover {
  background: black;
  color: white;
  text-decoration: none;
  box-shadow: none;
}

/* ── Responsive home grid ── */
@media (max-width: 700px) {
  .home-projects {
    grid-template-columns: 1fr;
  }
}

/* ── Sitemap ── */
.sitemap-tree {
  padding: 0;
  overflow-x: auto;
  line-height: 1.8;
  font-size: 0.9rem;
  color: var(--text);
}

.sitemap-tree a {
  color: var(--link);
}

.sitemap-tree a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

/* ── Dim mode toggle button ── */
.dim-toggle {
  position: fixed;
  top: 1rem;
  z-index: 100;
  font-family: var(--font);
  font-size: smaller;
  font-weight: bold;
  padding: .1rem .4rem;
  border: 1px solid #888;
  box-shadow: 2px 2px #ccc;
  background: var(--bg-box);
  color: var(--accent);
  cursor: pointer;
}

@media (min-width: 1100px) {
  .dim-toggle {
    left: calc(50vw + 450px + 1rem);
    top: 2rem;
  }
}

.dim-toggle:hover {
  background: black;
  color: white;
  box-shadow: none;
}

/* ── Dim mode ── */
html.dim {
  background: #1c1c1c;
  --bg: #1c1c1c;
  --bg-box: #242424;
  --text: #a8a4a0;
  --link: #ff7733;
  --link-hover: #ffcc99;
  --accent: #6a9a6a;
}

html.dim .site-box,
html.dim .project-card,
html.dim .projects-sidebar,
html.dim .dim-toggle {
  border-color: #3a3a3a;
  box-shadow: 2px 2px #111;
}

html.dim header nav a {
  border-color: #3a3a3a;
  box-shadow: 2px 2px #111;
}

html.dim header nav a:hover,
html.dim .dim-toggle:hover {
  background: var(--accent);
  color: #fff;
  box-shadow: none;
}

html.dim .card-thumb {
  border-bottom-color: #3a3a3a;
  background: repeating-linear-gradient(
    -45deg,
    #2a2a2a,
    #2a2a2a 2px,
    #222 2px,
    #222 9px
  );
}

html.dim .projects-filters button,
html.dim .sort-btn,
html.dim .view-btn {
  border-color: #3a3a3a;
  box-shadow: 2px 2px #111;
}

html.dim .projects-filters button.active,
html.dim .projects-filters button:hover,
html.dim .sort-btn:hover,
html.dim .view-btn:hover {
  background: var(--accent);
  color: #fff;
  box-shadow: none;
}

html.dim .sidebar-year {
  border-bottom-color: #3a3a3a;
}

html.dim .sidebar-project,
html.dim .article-row,
html.dim .articles-list-item {
  border-bottom-color: #333;
}

html.dim header nav a.nav-active {
  background: var(--accent);
  color: #fff;
  box-shadow: none;
}

html.dim .toc {
  border-color: #3a3a3a;
}

html.dim .toc-list a {
  color: var(--text);
}

html.dim .search-input {
  border-color: #3a3a3a;
  box-shadow: 2px 2px #111;
}

html.dim .search-input:focus {
  border-color: var(--accent);
  box-shadow: none;
}

html.dim .project-content pre,
html.dim .article-content pre,
html.dim .project-content code,
html.dim .article-content code {
  background: #1e1e1e;
  border-color: #333;
}

html.dim .project-content th,
html.dim .article-content th {
  background: #1e1e1e;
  border-color: #333;
}

html.dim .project-content td,
html.dim .article-content td {
  border-color: #333;
}

html.dim .project-content tr:nth-child(even) td,
html.dim .article-content tr:nth-child(even) td {
  background: #1a1a1a;
}

html.dim .project-content blockquote,
html.dim .article-content blockquote {
  color: #777;
}

html.dim .project-content img,
html.dim .article-content img,
html.dim .project-content video,
html.dim .article-content video {
  border-color: #333;
}

html.dim .download-link {
  border-color: #3a3a3a;
  box-shadow: 2px 2px #111;
}

html.dim .download-link:hover {
  background: var(--accent);
  color: #fff;
  box-shadow: none;
}

html.dim .post-nav-prev,
html.dim .post-nav-next {
  border-color: #3a3a3a;
  box-shadow: 2px 2px #111;
}

html.dim .post-nav-prev:hover,
html.dim .post-nav-next:hover {
  background: var(--accent);
  color: #fff;
  box-shadow: none;
}

html.dim .breadcrumb-sep {
  color: #555;
}

html.dim .card-body .project-year,
html.dim .projects-empty,
html.dim .home-empty,
html.dim .article-date,
html.dim .articles-list-item .article-date {
  color: #666;
}

/* ── Media queries ── */
@media (max-width: 640px) {
  html {
    margin-right: 0;
  }

  body {
    font-size: 15px;
  }

  .site-wrapper {
    margin: 0;
  }

  .site-box {
    min-height: 100vh;
    border-left: none;
    border-right: none;
    box-shadow: none;
  }
}

btn-classic {
  font-family: 'Berkeley Mono Trial', monospace;
  line-height: 1.5rem;
  position: relative;
  top: -2px;
  display: inline-block;
  height: 1.75rem;
  padding: .1rem .5rem 0;
  cursor: pointer;
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
  text-decoration: none;
  color: #000;
  border: .1rem solid #000;
  border-radius: 0;
  outline: 0;
  background: #fff;
  box-shadow: 2px 2px #bbb;
  -webkit-appearance: none;
  appearance: none;
  fill: #000;
}
