/* DM Mono, self-hosted (OFL-1.1, via @fontsource/dm-mono 5.3.0). It tops out at
   500, so that file also answers the 600 the site asks for (no faux bold). The
   latin-ext files only download when a page actually uses one of those glyphs. */
@font-face {
  font-family: 'DM Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/dm-mono-latin-400.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'DM Mono';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url('../fonts/dm-mono-latin-500.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'DM Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/dm-mono-latin-ext-400.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'DM Mono';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url('../fonts/dm-mono-latin-ext-500.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* theme tokens. Every colour that differs between light and dark lives here,
   so page styles just say var(--accent) instead of pairing each rule with a
   body:not(.dark-mode) twin. Pages may add their own tokens (numbers/ does). */
:root {
  --bg: #ffffff;
  --text: #111111;
  --accent: #1e6e1e;
  --border: #e3e3e3;
  --soft: #666666;   /* secondary text that still needs to be read */
  --muted: #666666;  /* descriptions */
  --faint: #737373;  /* indices, separators */
  --ghost: #737373;  /* barely-there labels */
  --surface: #f6f7f6;
  --criticalstart: #233d63;
  --fsu: #782f40;
}

body.dark-mode {
  --bg: #191a1b;
  --text: #f1f1f1;
  --accent: #6fcf6f;
  --border: #2a2a2a;
  --soft: #b0b6b1;
  --muted: #969f98;
  --faint: #88918b;
  --ghost: #88918b;
  --surface: #202324;
  --criticalstart: #8ea6c8;
  --fsu: #c58a97;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: 'DM Mono', ui-monospace, monospace;
  /* a monospace space is a full character wide, which reads like a double space
     in running text; pull words a little closer */
  word-spacing: -0.2em;
}

/* keep true fixed-width spacing where columns have to line up */
pre, code, kbd, samp, input, textarea {
  word-spacing: normal;
}

h1, h2, h3 {
  font-family: inherit;
}

.criticalstart,
.criticalstart:visited {
  color: var(--criticalstart);
  display: inline-block;
  font-weight: bold;
}

.fsu,
.fsu:visited {
  color: var(--fsu);
  display: inline-block;
  font-weight: bold;
}

html { scrollbar-gutter: stable; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  width: 100%;
  background: transparent;
  backdrop-filter: blur(14px);
}

.site-nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 8px 24px;
  box-sizing: border-box;
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  word-spacing: normal;
}

.nav-links {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 28px;
}

.site-nav a,
.site-nav a:visited {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--soft);
  text-decoration: none;
}

.nav-links a + a::before {
  content: "";
  position: absolute;
  left: -14px;
  top: calc(50% - 1px);
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: var(--muted);
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 7px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.22s ease;
}

.site-nav a:hover,
.site-nav a:focus-visible { color: var(--accent); }

.site-nav a:hover::after,
.site-nav a:focus-visible::after { transform: scaleX(1); }

@media (prefers-reduced-motion: reduce) {
  .site-nav a::after { transition: none; }
}

.site-nav a:focus-visible,
.skip-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 12px;
  z-index: 100;
  padding: 12px 16px;
  background: var(--bg);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 5px;
  transform: translateY(-160%);
}

.skip-link:focus { transform: none; }

#main-content,
#contact { scroll-margin-top: 85px; }

@media (max-width: 600px) {
  .site-nav { gap: 8px; padding: 8px 16px; font-size: 0.72rem; }
  .nav-links { gap: 12px; }
  .nav-links a + a::before { left: -6px; }
}

/* bordered box with a label sitting in its top edge (// whoami, // ama, ...) */
.category {
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 22px 18px 8px;
  margin-bottom: 26px;
  position: relative;
}

.category-label {
  position: absolute;
  top: -9px;
  left: 14px;
  padding: 0 8px;
  background-color: var(--bg);
  font-size: 0.74em;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.idx {
  color: var(--faint);
  margin-right: 6px;
  font-size: 0.85em;
}

.desc {
  font-size: 0.78em;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.5;
}

/* theme toggle: icon-only, built by js/theme.js. Both icons are always in the
   button; the body class decides which one is showing. */
#theme-toggle {
  grid-column: 3;
  justify-self: end;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  cursor: pointer;
  background: transparent;
  color: var(--text);
  border: 0;
  border-radius: 50%;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

#theme-toggle:hover {
  color: var(--accent);
  border-color: currentColor;
}

#theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

#theme-toggle svg {
  grid-area: 1 / 1;
  width: 14px;
  height: 14px;
  transition: transform 0.35s ease, opacity 0.2s ease;
}

#theme-toggle .icon-sun { opacity: 0; transform: rotate(-90deg) scale(0.5); }
#theme-toggle .icon-moon { opacity: 1; transform: none; }
body.dark-mode #theme-toggle .icon-sun { opacity: 1; transform: none; }
body.dark-mode #theme-toggle .icon-moon { opacity: 0; transform: rotate(90deg) scale(0.5); }

#theme-toggle:active svg { transform: scale(0.85); }

/* theme switch: js/theme.js swaps the class inside a view transition, so the
   browser crossfades one snapshot of the whole page and everything lands at once.
   (Per-element colour transitions made nested text trail behind the background.) */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.28s;
  animation-timing-function: ease;
}

@media (prefers-reduced-motion: reduce) {
  #theme-toggle svg { transition: none; }
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
}
body {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 820px;
  padding: 40px 24px;
  box-sizing: border-box;
}

.archive-heading.container { padding-bottom: 0; text-align: left; }
.archive-heading .namebar { margin-bottom: 0; font-family: 'DM Mono', ui-monospace, monospace; }

@media (max-width: 700px) {
  .container { text-align: center; }
  .container .section { margin: 0 auto; }
}
@media (min-width: 701px) {
  .container { text-align: left; }
}


/* name header. The 19px inset is the .category box's 1px border + 18px padding,
   so the heading sits on the same vertical line as the text inside the boxes
   below it. Effect is progressive: without JS the plain name is already there. */
.namebar {
  cursor: default;
  margin: 0 0 24px;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.3;
}

/* role line under the name; pulls up into the namebar's bottom margin */
.tagline {
  margin: -18px 0 24px;
  font-size: 0.85rem;
  color: var(--muted);
  text-wrap: balance;
}

/* --muted is too faint on the dark background for a line meant to be read */
body.dark-mode .tagline { color: #8c8c8c; }

@media (min-width: 701px) {
  .namebar,
  .tagline { padding-left: 19px; }
}

.name {
  position: relative;
  display: inline-block;
  white-space: pre;
  color: var(--accent);
}

body.dark-mode .name {
  text-shadow: 0 0 14px rgba(111, 207, 111, 0.45);
}

.name.scrambling { opacity: 0.9; }

/* rgb-split ghosts, only visible during the periodic glitch */
.name::before,
.name::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  white-space: pre;
  opacity: 0;
  pointer-events: none;
  text-shadow: none;
}

.name::before { color: #ff4d6d; }
.name::after { color: #4dd2ff; }

.name.glitch::before { animation: glitch-a 0.3s steps(2, end) 2; }
.name.glitch::after { animation: glitch-b 0.3s steps(2, end) 2; }

@keyframes glitch-a {
  0%, 100% { opacity: 0; }
  25% { opacity: 0.8; transform: translate(-3px, -1px); clip-path: inset(0 0 58% 0); }
  55% { opacity: 0.8; transform: translate(2px, 1px); clip-path: inset(62% 0 0 0); }
  80% { opacity: 0; }
}

@keyframes glitch-b {
  0%, 100% { opacity: 0; }
  25% { opacity: 0.8; transform: translate(3px, 1px); clip-path: inset(0 0 62% 0); }
  55% { opacity: 0.8; transform: translate(-2px, -1px); clip-path: inset(55% 0 0 0); }
  80% { opacity: 0; }
}

/* thin text-cursor bar rather than a terminal block */
.caret {
  display: inline-block;
  width: 2px;
  height: 1.15em;
  margin-left: 0.15em;
  vertical-align: -0.2em;
  background-color: var(--accent);
  animation: caret-blink 1.1s linear infinite;
}

body.dark-mode .caret {
  box-shadow: 0 0 8px rgba(111, 207, 111, 0.6);
}

@keyframes caret-blink {
  0%, 49.9% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .name.glitch::before,
  .name.glitch::after,
  .caret { animation: none; }
}

.project-footer { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px; box-sizing: border-box; width: 100%; margin-top: 32px; padding: 24px 0; border-top: 1px solid var(--border); font-family: 'DM Mono', ui-monospace, monospace; font-size: 12px; color: var(--muted); }
.project-footer a { text-decoration: none; }
.footer-credit { grid-column: 1; }
.footer-note { grid-column: 2; text-align: center; }
.footer-note.footer-wide { grid-column: 1 / -1; }
.social-links { grid-column: 3; justify-self: end; display: flex; gap: 4px; }
.project-footer .social-links a, .project-footer .social-links a:visited { display: inline-flex; align-items: center; justify-content: center; width: 32px; min-height: 44px; color: var(--soft); }
.project-footer .social-links a:hover { color: var(--text); }
.project-footer .social-links a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.social-links svg { display: block; width: 16px; height: 16px; }
@media (max-width: 650px) { .project-footer { grid-template-columns: 1fr; } .footer-credit, .footer-note, .social-links { grid-column: 1; } }
