@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,400;0,500;1,400&family=Press+Start+2P&family=Oswald:wght@500;700&display=swap');

@font-face {
  font-family: 'Excalifont';
  src: url('/fonts/excalifont/Excalifont-Latin.woff2') format('woff2');
  unicode-range: U+20-7E,U+A0-A3,U+A5-A6,U+A8-AB,U+AD-B1,U+B4,U+B6-B8,U+BA-FF,U+131,U+152-153,U+2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+2013-2014,U+2018-201A,U+201C-201E,U+2020,U+2022,U+2024-2026,U+2030,U+2039-203A,U+20AC,U+2122,U+2212;
  font-display: swap;
}
@font-face {
  font-family: 'Excalifont';
  src: url('/fonts/excalifont/Excalifont-LatinExt.woff2') format('woff2');
  unicode-range: U+100-130,U+132-137,U+139-149,U+14C-151,U+154-17E,U+192,U+1FC-1FF,U+218-21B,U+237,U+1E80-1E85,U+1EF2-1EF3,U+2113;
  font-display: swap;
}
@font-face {
  font-family: 'Excalifont';
  src: url('/fonts/excalifont/Excalifont-Cyrillic.woff2') format('woff2');
  unicode-range: U+400-45F,U+490-491,U+2116;
  font-display: swap;
}
@font-face {
  font-family: 'Excalifont';
  src: url('/fonts/excalifont/Excalifont-CyrillicExt.woff2') format('woff2');
  unicode-range: U+462-463,U+472-475,U+4D8-4D9,U+4E2-4E3,U+4E6-4E9,U+4EE-4EF;
  font-display: swap;
}
@font-face {
  font-family: 'Excalifont';
  src: url('/fonts/excalifont/Excalifont-Diacritics.woff2') format('woff2');
  unicode-range: U+2C7,U+2D8-2D9,U+2DB,U+2DD,U+302,U+306-307,U+30A-30C,U+326-328,U+212E,U+2211,U+FB01-FB02;
  font-display: swap;
}
@font-face {
  font-family: 'Excalifont';
  src: url('/fonts/excalifont/Excalifont-Combining.woff2') format('woff2');
  unicode-range: U+300-301,U+303;
  font-display: swap;
}

:root, [data-theme="gruvbox"] {
  --bg:        #1d2021;
  --bg1:       #282828;
  --bg2:       #32302f;
  --bg3:       #3c3836;
  --border:    #504945;
  --border2:   #665c54;
  --fg:        #ebdbb2;
  --fg2:       #d5c4a1;
  --muted:     #928374;
  --yellow:    #d79921;
  --yellow-br: #fabd2f;
  --orange:    #d65d0e;
  --orange-br: #fe8019;
  --green:     #98971a;
  --green-br:  #b8bb26;
  --aqua:      #689d6a;
  --aqua-br:   #8ec07c;
  --red:       #cc241d;

  --radius-lg: 6px;
  --radius-md: 4px;

  --font-hand: 'Excalifont', 'Comic Sans MS', cursive;
}

[data-theme="ascii"] {
  --bg:        #000000;
  --bg1:       #0d0d0d;
  --bg2:       #141414;
  --bg3:       #1c1c1c;
  --border:    #333333;
  --border2:   #4d4d4d;
  --fg:        #ffffff;
  --fg2:       #cfcfcf;
  --muted:     #7a7a7a;
  --yellow:    #ffffff;
  --yellow-br: #ffffff;
  --orange:    #dddddd;
  --orange-br: #dddddd;
  --green:     #bbbbbb;
  --green-br:  #bbbbbb;
  --aqua:      #999999;
  --aqua-br:   #cccccc;
  --red:       #ffffff;

  --radius-lg: 0;
  --radius-md: 0;

  --font-hand: 'Press Start 2P', 'IBM Plex Mono', monospace;
}

[data-theme="paper"] {
  --bg:        #f1ede2;
  --bg1:       #f1ede2;
  --bg2:       #e8e2d1;
  --bg3:       #ded5bf;
  --border:    #1a1a1a;
  --border2:   #1a1a1a;
  --fg:        #1a1a1a;
  --fg2:       #3a3a3a;
  --muted:     #857f6e;
  --yellow:    #ce422b;
  --yellow-br: #ce422b;
  --orange:    #a8341f;
  --orange-br: #a8341f;
  --green:     #2f2f2f;
  --green-br:  #2f2f2f;
  --aqua:      #1a1a1a;
  --aqua-br:   #5c5646;
  --red:       #ce422b;

  --radius-lg: 0;
  --radius-md: 0;

  --font-hand: 'Oswald', 'IBM Plex Mono', sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--fg);
  background: var(--bg);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 17px;
  line-height: 1.75;
}

a {
  color: var(--yellow-br);
  text-decoration: none;
  transition: color 140ms;
}
a:hover {
  color: var(--orange-br);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

img { max-width: 100%; display: block; }

code, pre, .eyebrow, .post-list time, .site-nav a {
  font-family: 'IBM Plex Mono', monospace;
}

.layout {
  display: flex;
  align-items: flex-start;
  gap: 40px;
  width: min(calc(100% - 40px), 1040px);
  margin: 0 auto;
  padding: 28px 0 48px;
}

.sidebar {
  position: sticky;
  top: 28px;
  flex: 0 0 140px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.portrait-frame {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg1);
}
.portrait-frame::before,
.portrait-frame::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid var(--yellow-br);
  z-index: 1;
}
.portrait-frame::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.portrait-frame::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.portrait-gif {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.05);
}

.theme-switch {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.theme-switch button,
.music-button {
  padding: 6px 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 140ms, color 140ms, border-color 140ms;
}
.theme-switch button:hover,
.music-button:hover {
  border-color: var(--yellow-br);
  color: var(--fg);
}
.theme-switch button[aria-pressed="true"],
.music-button[aria-pressed="true"] {
  background: var(--yellow-br);
  border-color: var(--yellow-br);
  color: var(--bg);
}

.sidebar-badge {
  align-self: center;
  justify-self: center;
  width: 88px;
  margin-top: 14px;
}
.sidebar-badge img { width: 88px; height: 31px; image-rendering: pixelated; }
.sidebar-badge:focus-visible { outline: 2px solid var(--yellow-br); outline-offset: 3px; }
.sidebar-music { margin-top: 0; }
.music-button {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  border-radius: 0;
}
.music-icon { color: inherit; font-size: 0.68rem; }
.music-label { font-size: inherit; }
.music-label br { display: none; }
.music-button:focus-visible,
.sidebar .friend-btn:focus-visible {
  outline: 2px solid var(--yellow-br);
  outline-offset: 3px;
}
.music-status {
  display: block;
  color: var(--muted);
  font-size: 0.65rem;
  line-height: 1.5;
}
.music-status:empty { display: none; }

.page-shell {
  flex: 1 1 auto;
  min-width: 0;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  /* bold left accent — this is the top of the page */
  border-left: 4px solid var(--yellow);
}

.site-brand {
  flex: 1 1 220px;
  min-width: 0;
}

.site-brand a {
  color: var(--yellow-br);
  font-family: var(--font-hand);
  font-size: 1.4rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  text-decoration: none;
}
.site-brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.88rem;
  font-style: italic;
}

.site-nav {
  display: flex;
  flex-wrap: nowrap;
  flex-shrink: 0;
  gap: 2px;
}
.site-nav a {
  display: inline-flex;
  align-items: center;
  padding: 5px 8px;
  white-space: nowrap;
  border-radius: var(--radius-md);
  color: var(--fg2);
  font-size: 0.82rem;
  text-decoration: none;
  transition: background 140ms, color 140ms;
}
.site-nav a:hover {
  background: var(--bg3);
  color: var(--yellow-br);
  text-decoration: none;
}

.site-main {
  margin: 14px 0;
  padding: 28px 28px 32px;
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.page-intro {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--aqua-br);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.1;
  color: var(--fg);
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 300;
  letter-spacing: -0.01em;
}
h1 {
  font-family: var(--font-hand);
  font-weight: 400;
  font-size: clamp(2.1rem, 6vw, 3.2rem);
}

h2 {
  margin-top: 32px;
  font-size: 1.25rem;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 500;
  color: var(--yellow-br);
}
h2::before { content: '## '; color: var(--border2); }

h3 {
  margin-top: 22px;
  font-size: 1.05rem;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--orange-br);
}
h3::before { content: '### '; color: var(--border2); }

p, ul, ol, blockquote { margin: 14px 0 0; }
.page-content > :first-child { margin-top: 0; }

ul, ol { padding-left: 22px; }
li + li { margin-top: 6px; }

blockquote {
  padding: 10px 16px;
  border-left: 3px solid var(--aqua);
  background: var(--bg2);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--fg2);
  font-style: italic;
}

code {
  padding: 0.15em 0.4em;
  border-radius: var(--radius-md);
  background: var(--bg3);
  color: var(--green-br);
  font-size: 0.9em;
}
pre {
  overflow-x: auto;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  line-height: 1.6;
}
pre code {
  padding: 0;
  background: transparent;
  color: var(--fg2);
}
.code-block {
  position: relative;
  margin: 1em 0;
}
.code-block pre {
  margin: 0;
  padding-top: 44px;
}
.code-block .code-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 8px;
  font-size: 12px;
  line-height: 1.5;
}
.code-block .code-copy::after { font-size: 10px; }

.post-list {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}
.post-list li {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  padding: 11px 0;
  border-top: 1px solid var(--border);
}
.post-list li:first-child {
  border-top: 0;
  padding-top: 0;
}
.post-list time {
  color: var(--muted);
  font-size: 0.82rem;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 6px;
  padding: 16px 4px 0;
  border-top: 1px dashed var(--border);
  color: var(--muted);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--yellow-br); }
.site-footer p { margin: 0; }

.copy {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 2px 10px;
  border: 1px solid var(--border2);
  border-radius: var(--radius-md);
  background: var(--bg3);
  color: var(--green-br);
  font: inherit;
  font-size: 0.95em;
  cursor: pointer;
  transition: background 140ms, color 140ms, border-color 140ms;
}
.copy::after {
  content: 'copy';
  color: var(--muted);
  font-size: 0.7em;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.copy:hover,
.copy:focus-visible {
  border-color: var(--yellow-br);
  color: var(--yellow-br);
  outline: none;
}
.copy.copied {
  border-color: var(--yellow-br);
  background: var(--yellow-br);
  color: var(--bg);
}
.copy.copied::after { content: 'copied!'; color: inherit; }
.copy.copy-failed::after { content: 'press ctrl+c'; color: var(--red); }

.friends { margin: 14px 0 0; }
.sidebar .friends { margin: 4px 0 0; }
.sidebar .friends-grid { flex-direction: column; align-items: center; }
.sidebar .friends-title { text-align: center; }
.sidebar .friend-btn:not(.has-img) { width: 100%; }
.friends-title {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.friends-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.friend-btn {
  display: inline-block;
  box-sizing: border-box;
  width: 88px;
  height: 31px;
  padding: 0 6px;
  line-height: 29px;
  text-align: center;
  overflow: hidden;
  border: 1px solid var(--border2);
  border-radius: var(--radius-md);
  background: var(--bg1);
  color: var(--fg2);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: background 140ms, color 140ms, border-color 140ms;
}
.friend-btn:hover {
  background: var(--yellow-br);
  border-color: var(--yellow-br);
  color: var(--bg);
}
.friend-btn.has-img { padding: 0; border: 0; background: none; line-height: 0; }
.friend-btn.has-img:hover { opacity: 0.85; }
.friend-btn img { display: block; width: 88px; height: 31px; image-rendering: pixelated; }
.friend-btn, .friend-btn:hover { text-decoration: none; }
[data-theme="ascii"] .friend-btn,
[data-theme="ascii"] .friend-btn:hover { text-decoration: none; }

::selection {
  background: var(--yellow);
  color: var(--bg);
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

@media (max-width: 640px) {
  .layout {
    flex-direction: column;
    width: calc(100% - 24px);
    padding-top: 14px;
    gap: 16px;
  }
  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    align-items: center;
    width: 100%;
    flex: 0 0 auto;
  }
  .portrait-frame {
    width: 64px;
    height: 64px;
    flex: 0 0 auto;
    aspect-ratio: auto;
  }
  .theme-switch {
    flex: 1;
    flex-direction: row;
  }
  .theme-switch button { flex: 1; }
  .sidebar-badge { grid-column: 1 / -1; }
  .sidebar-music { grid-column: 1 / -1; }
  .sidebar .friends { grid-column: 1 / -1; }
  .sidebar .friends-grid { flex-direction: row; justify-content: center; }
  .sidebar .friend-btn:not(.has-img) { width: 88px; }
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 18px;
  }
  .site-brand { flex: 0 1 auto; }
  .site-nav { flex-wrap: wrap; }
  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 16px 2px 0;
  }
  .site-main { padding: 20px; }
  .post-list li {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

[data-theme="ascii"] body {
  background-image: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.025) 0px,
    rgba(255, 255, 255, 0.025) 1px,
    transparent 1px,
    transparent 3px
  );
}
[data-theme="paper"] body {
  background-image:
    radial-gradient(rgba(0, 0, 0, 0.05) 0.6px, transparent 0.6px),
    radial-gradient(rgba(0, 0, 0, 0.035) 0.6px, transparent 0.6px);
  background-size: 4px 4px, 4px 4px;
  background-position: 0 0, 2px 2px;
}

[data-theme="ascii"] h1 {
  font-size: clamp(1.1rem, 3.6vw, 1.65rem);
  line-height: 1.65;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
[data-theme="ascii"] .site-brand a {
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
[data-theme="paper"] h1 {
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: -0.01em;
}
[data-theme="paper"] .site-brand a {
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.01em;
}

[data-theme="ascii"] a {
  text-decoration: underline;
  text-decoration-color: var(--border2);
  text-underline-offset: 0.2em;
}
[data-theme="ascii"] a:hover {
  text-decoration-color: currentColor;
}

[data-theme="ascii"] .site-nav a,
[data-theme="paper"] .site-nav a {
  border: 1px solid var(--border);
  text-transform: uppercase;
}
[data-theme="ascii"] .site-nav a:hover,
[data-theme="paper"] .site-nav a:hover {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}

[data-theme="ascii"] .site-header,
[data-theme="ascii"] .site-main,
[data-theme="paper"] .site-header,
[data-theme="paper"] .site-main {
  position: relative;
}
[data-theme="ascii"] .site-header::before,
[data-theme="ascii"] .site-header::after,
[data-theme="ascii"] .site-main::before,
[data-theme="ascii"] .site-main::after,
[data-theme="paper"] .site-header::before,
[data-theme="paper"] .site-header::after,
[data-theme="paper"] .site-main::before,
[data-theme="paper"] .site-main::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: var(--yellow-br);
  border-style: solid;
  pointer-events: none;
}
[data-theme="ascii"] .site-header::before,
[data-theme="paper"] .site-header::before,
[data-theme="ascii"] .site-main::before,
[data-theme="paper"] .site-main::before {
  top: -1px;
  left: -1px;
  border-width: 2px 0 0 2px;
}
[data-theme="ascii"] .site-header::after,
[data-theme="paper"] .site-header::after,
[data-theme="ascii"] .site-main::after,
[data-theme="paper"] .site-main::after {
  bottom: -1px;
  right: -1px;
  border-width: 0 2px 2px 0;
}
