/* self-hosted webfonts (all SIL OFL — licenses alongside in assets/fonts/).
   family names are referenced via --font-body / --font-display / --font-ui. */
@font-face {
  font-family: "iA Writer Quattro";
  src: url("../assets/fonts/iAWriterQuattroS-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "iA Writer Quattro";
  src: url("../assets/fonts/iAWriterQuattroS-Italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "iA Writer Quattro";
  src: url("../assets/fonts/iAWriterQuattroS-Bold.woff2") format("woff2");
  font-weight: 500 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "iA Writer Quattro";
  src: url("../assets/fonts/iAWriterQuattroS-BoldItalic.woff2") format("woff2");
  font-weight: 500 700; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Serif";
  src: url("../assets/fonts/IBMPlexSerif-Medium-Latin1.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Lilex";
  src: url("../assets/fonts/Lilex-Variable.woff2") format("woff2");
  font-weight: 100 700; font-style: normal; font-display: swap;
}

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

html {
  scroll-behavior: smooth;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background: var(--frame-bg);
  color: var(--fg);
  line-height: 1.6;
  transition: background 0.15s ease, color 0.15s ease;
}

/* faint paper-noise texture over the frame; panels sit above it */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url("https://images.zed.dev/noise.webp") repeat;
  background-size: 180px;
  opacity: var(--noise-opacity);
  pointer-events: none;
  z-index: 0;
}

[data-theme="light"] ::selection { background: #eceadf; color: #201e13; }

/* framed center column: header, main panel and footer share 1px side borders */
.frame {
  position: relative;
  z-index: 1;
  max-width: 75rem;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* 3/2/3 color bar atop the header and the main panel */
.stripe {
  display: grid;
  grid-template-columns: 3fr 2fr 3fr;
  height: 6px;
}
.stripe span:nth-child(1) { background: var(--stripe-1); }
.stripe span:nth-child(2) { background: var(--stripe-2); }
.stripe span:nth-child(3) { background: var(--stripe-3); }

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

code {
  font-family: var(--font-ui);
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  font-size: 0.88em;
}

.muted { color: var(--fg-muted); }
.stamp { font-size: 0.85em; margin-top: 1rem; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  border: 1px solid var(--border);
  border-top: 0;
  background: var(--bg);
}
.site-header-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  padding: 0.75rem 1.25rem;
  font-family: var(--font-ui);
  font-size: 0.8rem;
}
.site-header .brand {
  font-weight: 600;
  color: var(--fg);
}
.site-header nav {
  display: flex;
  gap: 1rem;
  flex: 1;
}
.site-header nav a { color: var(--fg-muted); }
.site-header nav a:hover { color: var(--fg); }
.site-header nav a[aria-current="page"] {
  color: var(--fg);
  text-decoration: underline;
}

[data-theme-toggle] {
  background: var(--bg-elev);
  color: var(--fg);
  border: 1px solid var(--border);
  height: 2rem;
  padding: 0 0.8rem;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  cursor: pointer;
}
[data-theme-toggle]:hover { border-color: var(--accent); }

main {
  flex: 1;
  border-inline: 1px solid var(--border);
  background: var(--bg);
}

/* reading column inside the panel (widened per page type below) */
.main-inner {
  max-width: 48rem;
  margin: 0 auto;
  padding: 2.5rem 2rem;
}

@media (max-width: 700px) {
  .frame { padding: 0.5rem; }
  .main-inner { padding: 1.75rem 1.25rem; }
}

main section { margin-bottom: 3rem; }

h1, h2 { font-family: var(--font-display); font-weight: 500; }
h1 { font-size: 2rem; margin: 0 0 0.5rem; line-height: 1.2; }
h2 { font-size: 1.3rem; margin: 0 0 1rem; }

.site-footer {
  padding: 0.9rem 1.25rem;
  border: 1px solid var(--border);
  background: var(--bg);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.logo-track {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2.5rem;
  list-style: none;
  padding: 0.5rem 0;
  margin: 0;
}
.logo-track a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}
.logo-track a:hover,
.logo-track a:focus { color: var(--accent); text-decoration: none; }
.logo-track svg {
  width: 32px;
  height: 32px;
  fill: currentColor;
}
.logo-track span { font-size: 0.8em; }

/* in the header the links become square bordered icon buttons */
.site-header .logo-track { gap: 0.5rem; padding: 0; }
.site-header .logo-track a {
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--border);
  background: var(--bg-elev);
}
.site-header .logo-track a:hover,
.site-header .logo-track a:focus { border-color: var(--accent); }
.site-header .logo-track svg { width: 15px; height: 15px; }

.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.post-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.post-list-controls {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.post-search {
  flex: 1;
  max-width: 16rem;
  background: var(--bg-elev);
  color: var(--fg);
  border: 1px solid var(--border);
  padding: 0.3rem 0.7rem;
  font-family: var(--font-ui);
  font-size: 0.75rem;
}
.post-search:focus { outline: none; border-color: var(--accent); }
.post-empty { margin-top: 0.75rem; }
[data-sort-toggle]:disabled { opacity: 0.5; cursor: default; }
[data-sort-toggle] {
  background: var(--bg-elev);
  color: var(--fg);
  border: 1px solid var(--border);
  padding: 0.3rem 0.7rem;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  cursor: pointer;
}
[data-sort-toggle]:hover { border-color: var(--accent); }

/* Game portfolio grid — bigger cover previews and metadata than the blog list.
   The index gets a wider column so cards can sit two/three across. */
main:has(.game-grid) .main-inner { max-width: 60rem; }

.game-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}
.game-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: border-color 0.15s ease;
}
.game-card:hover { border-color: var(--accent); }
.game-card-cover {
  display: block;
  aspect-ratio: 16 / 9;
  background: var(--code-bg);
  overflow: hidden;
}
.game-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.game-card-cover.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  text-decoration: none;
}
.game-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem 1.1rem 1.2rem;
  flex: 1;
}
.game-card-title { font-family: var(--font-display); font-weight: 500; font-size: 1.15rem; margin: 0; }
.game-card-title a { color: var(--fg); }
.game-card-title a:hover { color: var(--accent); text-decoration: none; }
.game-card-body .stamp { margin-top: 0; }
.game-card-summary { font-size: 0.9em; margin: 0; flex: 1; }
.game-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin: 0;
  margin-top: auto;
  padding-top: 0.25rem;
  font-size: 0.85em;
}

/* metadata chips — shared by the cards (.game-meta) and writeups (.post-meta) */
.game-meta,
.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
.post-meta { margin-top: 0.75rem; }
.game-meta li,
.post-meta li {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--border);
  color: var(--fg-muted);
}
.post-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 0.75rem 0 0;
  font-size: 0.9em;
}

/* inline trailer/demo player — 16:9, fills the reading column */
.video-embed {
  aspect-ratio: 16 / 9;
  margin: 0 0 1.5rem;
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--code-bg);
}
.video-embed iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
}

/* Blog posts get a wider column than the default 48rem reading width. */
main:has(.post) .main-inner { max-width: 55rem; }

.post-header { margin-bottom: 2rem; }
.post-header h1 { margin-bottom: 0.25rem; }
.post-header .stamp { margin-top: 0; }

.post h1, .post h2, .post h3 { font-family: var(--font-display); font-weight: 500; }
.post h1 { font-size: 1.75rem; margin: 2rem 0 0.75rem; line-height: 1.25; color: var(--post-h1); }
.post h2 { font-size: 1.4rem;  margin: 2rem 0 0.75rem; line-height: 1.3;  color: var(--post-h2); }
.post h3 { font-size: 1.15rem; margin: 1.5rem 0 0.5rem;  color: var(--post-h3); }
.post h4 { font-size: 1rem;    margin: 1.25rem 0 0.5rem; color: var(--post-h4); }
.post h5 { font-size: 0.95em;  margin: 1rem 0 0.5rem;    color: var(--post-h5); }
.post h6 { font-size: 0.95em;  margin: 1rem 0 0.5rem;    color: var(--post-h6); }
.post-header > h1:first-child { margin-top: 0; }

.post p { margin: 0 0 1rem; }
.post strong { font-weight: 600; }
.post em { font-style: italic; }

.post ul,
.post ol { margin: 0 0 1rem; padding-left: 1.5rem; }
.post li { margin: 0.25rem 0; }
.post li > ul,
.post li > ol { margin: 0.25rem 0; }

.post blockquote {
  margin: 1rem 0;
  padding: 0.25rem 1rem;
  border-left: 3px solid var(--border);
  color: var(--fg-muted);
}
.post blockquote p:last-child { margin-bottom: 0; }

.post pre {
  font-family: var(--font-ui);
  background: var(--code-bg);
  border: 1px solid var(--border);
  padding: 0.85rem 1rem;
  margin: 0 0 1rem;
  overflow-x: auto;
  font-size: 0.9em;
  line-height: 1.5;
}
.post pre code {
  background: none;
  padding: 0;
  font-size: 1em;
  color: inherit;
}

/* syntax highlighting: highlight.js token classes mapped to per-theme vars
   (see --hl-* in css/themes.css). build.js bakes the .hljs-* spans in. */
.hljs-comment,
.hljs-quote { color: var(--hl-comment); font-style: italic; }

.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-section,
.hljs-doctag { color: var(--hl-keyword); }

.hljs-built_in,
.hljs-symbol,
.hljs-bullet { color: var(--hl-builtin); }

.hljs-type,
.hljs-class .hljs-title,
.hljs-title.class_ { color: var(--hl-type); }

.hljs-title,
.hljs-title.function_,
.hljs-function .hljs-title { color: var(--hl-function); }

.hljs-string,
.hljs-regexp,
.hljs-char.escape_,
.hljs-meta .hljs-string { color: var(--hl-string); }

.hljs-number,
.hljs-addition,
.hljs-deletion { color: var(--hl-number); }

.hljs-attr,
.hljs-attribute,
.hljs-property,
.hljs-variable,
.hljs-template-variable,
.hljs-name,
.hljs-selector-id,
.hljs-selector-class { color: var(--hl-attr); }

.hljs-meta,
.hljs-operator,
.hljs-punctuation,
.hljs-params { color: var(--hl-meta); }

.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }

.post hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.post img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1rem auto;
}

.post table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1rem;
  font-size: 0.95em;
}
.post th,
.post td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.post th { font-family: var(--font-ui); font-size: 0.85em; font-weight: 600; background: var(--bg-elev); }

.post kbd {
  font-family: var(--font-ui);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  padding: 0.05em 0.4em;
  font-size: 0.85em;
}
