/* ---------------------------------------------------------------
   Yuvraaj Bhatter — personal site
   Minimalist personal publication x technical journal x slightly
   retro developer aesthetic. Near-black ground, one muted blue
   accent, editorial type, flat surfaces, restrained motion. One
   fixed dark palette -- no theme switching, no glow/blur, no
   gradients beyond the fine background grid.
   --------------------------------------------------------------- */

:root {
  --bg: #0b0b0c;
  --bg-raised: #131315;
  --bg-inset: #101012;

  --ink: #e9e6df;
  --ink-soft: #9d998f;
  --ink-faint: #837e72;

  --border: #26262a;
  --border-soft: #1a1a1c;

  --accent: #5b9df9;
  --accent-ink: #cfe1fc;
  --accent-dim: rgba(91, 157, 249, 0.1);
  --accent-line: rgba(91, 157, 249, 0.32);

  /* A small, muted "toy" palette -- used sparingly for personality on
     specific content (tags, ratings, book covers, list rhythm), never
     for nav/links/active states, which stay blue-only so wayfinding
     is unambiguous. Desaturated + dark-calibrated, not neon. */
  --toy-violet: #a78bfa;
  --toy-violet-line: rgba(167, 139, 250, 0.4);
  --toy-amber: #dcae5c;
  --toy-amber-line: rgba(220, 174, 92, 0.4);
  --toy-teal: #6bc4a6;
  --toy-teal-line: rgba(107, 196, 166, 0.4);

  --font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  --width-text: 760px;
  --width-wide: 1020px;

  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2.25rem;
  --sp-7: 3.5rem;
  --sp-8: 5rem;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --dur: 180ms;

  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* Signature visual motif: a fine, almost-invisible technical grid
   fixed behind the whole page, fading toward the edges. */
.grid-motif {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 75% 55% at 50% 0%, #000 25%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse 75% 55% at 50% 0%, #000 25%, transparent 72%);
}

/* Always width-wide, on every page -- the header/nav live in this same
   container, and having it change width from page to page (it used to
   be narrower on text-only pages) made the navbar visibly resize as
   you clicked around. Individual prose blocks (.post-body, .page-lede,
   etc.) cap their own reading width in ch units, so this doesn't
   blow out line length. */
.page-wrap {
  max-width: var(--width-wide);
  margin: 0 auto;
  padding: var(--sp-6) var(--sp-5) var(--sp-8);
  position: relative;
  z-index: 1;
}

/* The light ("origami") theme predates this wide/narrow distinction
   and uses one flat width everywhere, matching its original design. */
html[data-theme="light"] .grid-motif {
  display: none;
}

h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--dur) var(--ease);
}

a:hover {
  color: var(--accent-ink);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@keyframes terminal-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* ---------- Header ---------- */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4) var(--sp-5);
  padding-bottom: var(--sp-5);
  margin-bottom: var(--sp-7);
  border-bottom: 1px solid var(--border);
}

/* Static identity block on the homepage, above the bio -- plain, no
   link, no hover/animation (the navbar's home link is the animated
   face logo instead, see .nav-face). */
.home-identity {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}

.home-identity-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  object-fit: cover;
  flex-shrink: 0;
}

.home-identity-name {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink);
  letter-spacing: -0.005em;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.72rem;
}

.site-nav a {
  display: inline-block;
  position: relative;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  padding: 0.5rem 0.65rem;
  border: 2.5px solid transparent;
  transition: color var(--dur) var(--ease);
}

.site-nav a::after {
  content: '';
  position: absolute;
  left: 0.65rem;
  right: 0.65rem;
  bottom: 0.32rem;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur) var(--ease);
}

.site-nav a:hover {
  color: var(--ink);
}

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

.site-nav a[aria-current="page"] {
  color: var(--accent);
}

.site-nav a[aria-current="page"]::after {
  transform: scaleX(1);
}

/* ---------- Navbar face (see renderNavFace) ---------- */

.nav-face {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  color: var(--ink-faint);
  outline: none;
}

.nav-face-svg {
  width: 30px;
  height: auto;
  overflow: visible;
}

.nav-face .nav-face__eyes,
.nav-face .nav-face__eye-lid,
.nav-face .nav-face__mouth-left,
.nav-face .nav-face__mouth-right,
.nav-face .nav-face__nose,
.nav-face .nav-face__pupil {
  animation: nav-face-eyes 1s 0.3s forwards;
}

.nav-face .nav-face__eye-lid,
.nav-face .nav-face__pupil {
  animation-duration: 4s;
  animation-delay: 1.3s;
  animation-iteration-count: infinite;
}

.nav-face .nav-face__eye-lid { animation-name: nav-face-eye-lid; }
.nav-face .nav-face__mouth-left { animation-name: nav-face-mouth-left; }
.nav-face .nav-face__mouth-right { animation-name: nav-face-mouth-right; }
.nav-face .nav-face__nose { animation-name: nav-face-nose; }
.nav-face .nav-face__pupil { animation-name: nav-face-pupil; }

@keyframes nav-face-eye-lid {
  0%, 40%, 45%, 100% { transform: translateY(0); }
  42.5% { transform: translateY(17.5px); }
}

@keyframes nav-face-eyes {
  from { transform: translateY(112.5px); }
  to { transform: translateY(15px); }
}

@keyframes nav-face-pupil {
  0%, 37.5%, 40%, 45%, 87.5%, 100% { stroke-dashoffset: 0; transform: translate(0, 0); }
  12.5%, 25%, 62.5%, 75% { transform: translate(-35px, 0); }
  42.5% { stroke-dashoffset: 35; transform: translate(0, 17.5px); }
}

@keyframes nav-face-mouth-left {
  from, 50% { stroke-dashoffset: -102; }
  to { stroke-dashoffset: 0; }
}

@keyframes nav-face-mouth-right {
  from, 50% { stroke-dashoffset: 102; }
  to { stroke-dashoffset: 0; }
}

@keyframes nav-face-nose {
  from { transform: translate(0, 0); }
  to { transform: translate(0, 22.5px); }
}

/* ---------- Theme toggle (built on Shoelace's <sl-switch>) ---------- */

.site-header-right {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

/* Shoelace exposes sizing via these custom properties (see their
   sl-switch docs) rather than needing to fight the component's own
   box model. */
.theme-toggle {
  --width: 58px;
  --height: 30px;
  --thumb-size: 24px;
  flex-shrink: 0;
}

/* The "control" part is the track. Shoelace's default theme draws a
   visible border on it (the "black border" this replaces) -- removed
   in favor of an inset groove shadow so the ball reads as sitting in
   a socket. */
.theme-toggle::part(control) {
  background-color: var(--bg);
  border: none;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.3), inset 0 -1px 0 rgba(255, 255, 255, 0.06);
  transition: box-shadow var(--dur) var(--ease);
}

.theme-toggle:hover::part(control) {
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.3), inset 0 -1px 0 rgba(255, 255, 255, 0.06), 0 0 0 1px var(--accent-line);
}

.theme-toggle:focus-visible::part(control) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* A small glossy 3D ball -- a plain white marble in dark mode, a
   shiny red ball once checked (the light/"toy" theme). The state
   lives entirely in the ball, no icon needed. Position/sliding is
   left entirely to Shoelace; only appearance (background/shadow) is
   overridden here so it can't fight the library's own transform. */
.theme-toggle::part(thumb) {
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.35) 22%, rgba(255, 255, 255, 0) 45%),
    radial-gradient(circle at 70% 78%, rgba(0, 0, 0, 0.18) 0%, rgba(0, 0, 0, 0) 55%),
    radial-gradient(circle at 40% 35%, #ffffff 0%, #f1f1f1 45%, #d6d6d6 80%, #bcbcbc 100%);
  border: none;
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.08);
  transition: background 320ms var(--ease);
}

.theme-toggle[checked]::part(thumb) {
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.4) 20%, rgba(255, 255, 255, 0) 42%),
    radial-gradient(circle at 68% 80%, rgba(0, 0, 0, 0.25) 0%, rgba(0, 0, 0, 0) 55%),
    radial-gradient(circle at 40% 35%, #ff6b5e 0%, #e8392a 45%, #b8241a 80%, #8a170f 100%);
}

.theme-toggle[checked]::part(control) {
  box-shadow: inset 0 2px 4px rgba(43, 36, 24, 0.3);
}

/* Disable the browser's default cross-fade so only our circular
   clip-path reveal (driven from JS) is visible during the swap. */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

/* ---------- Intro / bio ---------- */

.intro {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--ink);
  margin: 0 0 var(--sp-7);
  padding-left: var(--sp-5);
  border-left: 2px solid var(--accent-line);
}

.intro p {
  margin: 0 0 0.85em;
}

.intro p:last-child {
  margin-bottom: 0;
}

.intro a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-underline-offset: 3px;
}

.intro a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* ---------- Home layout ---------- */

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: var(--sp-7);
  align-items: start;
}

@media (max-width: 780px) {
  .home-grid {
    grid-template-columns: 1fr;
    gap: var(--sp-6);
  }
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  position: sticky;
  top: var(--sp-5);
}

@media (max-width: 780px) {
  .sidebar {
    position: static;
  }
}

/* ---------- Stream (mixed posts + notes) ---------- */

.stream {
  display: flex;
  flex-direction: column;
}

.stream-item {
  position: relative;
  padding: var(--sp-5) 0 var(--sp-5) var(--sp-4);
  border-bottom: 1px solid var(--border-soft);
  border-left: 2px solid var(--row-color-dim, var(--border));
  transition: border-color var(--dur) var(--ease);
}

.stream-item:first-child {
  padding-top: 0;
}

.stream-item:nth-child(3n+1) { --row-color-dim: var(--toy-violet-line); --row-color: var(--toy-violet); }
.stream-item:nth-child(3n+2) { --row-color-dim: var(--toy-amber-line); --row-color: var(--toy-amber); }
.stream-item:nth-child(3n+3) { --row-color-dim: var(--toy-teal-line); --row-color: var(--toy-teal); }

.stream-item:hover {
  border-left-color: var(--row-color);
}

.stream-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--sp-2);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.stream-kind {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-weight: 500;
  color: var(--ink-faint);
}

.source-badge {
  padding: 0.1rem 0.5rem;
  border-radius: 3px;
  border: 1px dashed var(--border);
  color: var(--ink-faint);
  font-size: 0.68rem;
  text-transform: none;
  letter-spacing: 0;
}

.origin-callout {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-faint);
  margin: -0.75rem 0 var(--sp-5);
}

.stream-title {
  margin: 0 0 0.4rem;
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.3;
}

.stream-title a {
  color: var(--ink);
  text-decoration: none;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0% 1px;
  transition: color var(--dur) var(--ease), background-size var(--dur) var(--ease);
}

.stream-title a:hover {
  color: var(--ink);
  background-size: 100% 1px;
}

/* Stretched-link pattern: the title is still the visible/accessible
   link, but its ::after covers the whole card so clicking or hovering
   anywhere on the tile works, not just the title text. */
.stream-title a::after {
  content: '';
  position: absolute;
  inset: 0;
}

.stream-excerpt {
  margin: 0;
  color: var(--ink-soft);
  font-weight: 400;
  max-width: 62ch;
}

/* ---------- Widgets ---------- */

.widget {
  border-top: 1px solid var(--border);
  padding-top: var(--sp-4);
}

.widget-title {
  margin: 0 0 var(--sp-4);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
}

.widget-title a {
  color: var(--ink-faint);
  text-decoration: none;
  transition: color var(--dur) var(--ease);
}

.widget-title a:hover {
  color: var(--accent);
}

.github-repo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.github-repo {
  font-size: 0.85rem;
}

.github-repo-name {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  transition: color var(--dur) var(--ease);
}

.github-repo-name:hover {
  color: var(--accent);
}

/* Stands in for a project logo -- only shown in the light-mode Projects
   page grid (see html[data-theme="light"] .github-repo-list--page). */
.github-repo-tile {
  display: none;
}

.github-repo-art {
  width: 55%;
  height: 55%;
  transition: transform 0.3s var(--bounce);
}

.github-repo:hover .github-repo-art {
  transform: scale(1.08) rotate(-3deg);
}

/* Optional real screenshot (content/projects.json "image") -- hidden
   until hover, when it crossfades over the abstract art to give an
   actual preview instead of decoration. */
.github-repo-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.github-repo:hover .github-repo-preview {
  opacity: 1;
}

.github-repo-desc {
  margin: 0.3rem 0 0;
  color: var(--ink-soft);
  font-weight: 400;
}

.github-repo-meta {
  margin-top: 0.3rem;
  color: var(--ink-faint);
  font-size: 0.72rem;
  font-family: var(--font-mono);
}

.github-repo-list--page {
  gap: var(--sp-5);
}

.github-repo-list--page .github-repo {
  padding-bottom: var(--sp-5);
  padding-left: var(--sp-4);
  border-bottom: 1px solid var(--border-soft);
  border-left: 2px solid var(--row-color-dim, var(--border));
  transition: border-color var(--dur) var(--ease);
}

.github-repo-list--page .github-repo:nth-child(3n+1) { --row-color-dim: var(--toy-violet-line); --row-color: var(--toy-violet); }
.github-repo-list--page .github-repo:nth-child(3n+2) { --row-color-dim: var(--toy-amber-line); --row-color: var(--toy-amber); }
.github-repo-list--page .github-repo:nth-child(3n+3) { --row-color-dim: var(--toy-teal-line); --row-color: var(--toy-teal); }

.github-repo-list--page .github-repo:hover {
  border-left-color: var(--row-color);
}

.github-repo-list--page .github-repo-name {
  font-size: 1rem;
}

/* First (most-recently-pushed) project reads as "selected work" --
   larger type, more air, a quiet accent flag -- everything after it
   stays quiet and list-like. */
.github-repo-list--page .github-repo--featured {
  padding-bottom: var(--sp-6);
  border-bottom: 1px solid var(--border);
  border-left: none;
  position: relative;
  padding-left: var(--sp-4);
}

.github-repo-list--page .github-repo--featured::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.3rem;
  bottom: var(--sp-6);
  width: 2px;
  background: var(--accent-line);
}

.github-repo-list--page .github-repo--featured .github-repo-name {
  font-size: 1.4rem;
  font-family: var(--font-serif);
  font-weight: 600;
}

.github-repo-list--page .github-repo--featured .github-repo-desc {
  font-size: 1rem;
  margin-top: 0.5rem;
  max-width: 60ch;
}

.widget-footer {
  margin: var(--sp-4) 0 0;
  font-size: 0.78rem;
  font-family: var(--font-mono);
}

.view-all-wrap {
  margin: var(--sp-6) 0 0;
}

.view-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.82rem;
  text-decoration: none;
  color: var(--ink-soft);
  padding: 0.6rem 0;
  border-top: 1px solid var(--border);
  transition: color var(--dur) var(--ease), gap var(--dur) var(--ease);
}

.view-all-btn:hover {
  color: var(--accent);
  gap: 0.6rem;
}

/* ---------- Project detail modal (see renderProjectModal) ---------- */

.project-modal[hidden] {
  display: none;
}

.project-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-5);
}

.project-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.project-modal-panel {
  position: relative;
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--card-bg, var(--bg-raised));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: var(--sp-6);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.project-modal-panel h2 {
  margin: 0 var(--sp-6) var(--sp-2) 0;
  font-size: 1.5rem;
  color: var(--ink);
}

.project-modal-tag {
  display: inline-block;
  margin: 0 0 var(--sp-4);
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.project-modal-tag[hidden] {
  display: none;
}

.project-modal-desc {
  color: var(--ink-soft);
  line-height: 1.5;
  margin: 0 0 var(--sp-4);
}

.project-modal-meta {
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  margin: 0 0 var(--sp-5);
}

.project-modal-close {
  position: absolute;
  top: var(--sp-4);
  right: var(--sp-4);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink-soft);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.project-modal-close:hover {
  color: var(--ink);
  border-color: var(--accent-line);
}

html[data-theme="light"] .project-modal-panel {
  border: 3px solid var(--border);
  border-radius: 20px;
  box-shadow: 8px 8px 0 var(--purple);
}

html[data-theme="light"] .project-modal-close {
  border-width: 2px;
  font-weight: 700;
}

html[data-theme="light"] .project-modal-tag {
  border-width: 2px;
  font-family: var(--sans);
  font-weight: 700;
}

/* ---------- Page chrome ---------- */

.page-title {
  font-size: clamp(1.9rem, 1.55rem + 1.5vw, 2.5rem);
  font-weight: 600;
  margin: 0 0 var(--sp-3);
  color: var(--ink);
}

.page-lede {
  color: var(--ink-soft);
  font-weight: 400;
  margin: 0 0 var(--sp-7);
  max-width: 62ch;
}

/* ---------- Live embeds (see api/substack-feed.js, api/bookshelf.js) ---------- */

.substack-embed {
  margin: 0 0 var(--sp-7);
}

.feed-status {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin: 0;
}

li.feed-status {
  list-style: none;
}

.page-updated {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-faint);
  margin: -0.5rem 0 var(--sp-6);
}

.page-body :first-child {
  margin-top: 0;
}

.page-body h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: var(--sp-7) 0 var(--sp-3);
  color: var(--ink);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border-soft);
}

.page-body ul {
  padding-left: 1.2rem;
}

.page-body li {
  margin-bottom: var(--sp-2);
  color: var(--ink-soft);
}

/* ---------- About: terminal window ---------- */

.terminal {
  background: var(--bg-inset);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.terminal a {
  color: var(--accent-ink);
}

.terminal a:hover {
  color: var(--accent);
}

.terminal strong {
  color: var(--ink);
  font-weight: 600;
}

.terminal::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.02) 0px,
    rgba(255, 255, 255, 0.02) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  mix-blend-mode: overlay;
}

.terminal-titlebar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.65rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--ink-faint);
  position: relative;
}

.terminal-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  opacity: 0.85;
}

.terminal-dot--red { background: #d9736a; }
.terminal-dot--yellow { background: #d9b366; }
.terminal-dot--green { background: #7fb87a; }

.terminal-path {
  margin-left: var(--sp-2);
}

.terminal-body {
  padding: var(--sp-6) var(--sp-6) var(--sp-7);
  position: relative;
}

@media (max-width: 560px) {
  .terminal-body {
    padding: var(--sp-5) var(--sp-4) var(--sp-6);
  }
}

.terminal-h1 {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
  color: var(--accent);
  margin: 0 0 var(--sp-6);
}

.terminal-cursor {
  display: inline-block;
  width: 0.5em;
  height: 1em;
  margin-left: 0.15em;
  background: var(--accent);
  animation: terminal-blink 1s steps(1) infinite;
  vertical-align: text-bottom;
}

/* ---------- Interactive terminal input (see renderInteractiveTerminal) ---------- */

.terminal-log {
  margin-top: var(--sp-6);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--ink-soft);
  max-height: 260px;
  overflow-y: auto;
}

.terminal-log-cmd {
  color: var(--ink);
}

.terminal-input-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  cursor: text;
}

.terminal-prompt {
  color: var(--accent);
  flex-shrink: 0;
  white-space: nowrap;
}

.terminal-cmd-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--ink);
  font: inherit;
  caret-color: var(--accent);
  padding: 0;
  min-width: 0;
}

.terminal .page-body h2 {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  margin: var(--sp-6) 0 var(--sp-4);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border);
}

.terminal .page-body h2::before {
  content: '[ ';
  color: var(--ink-faint);
}

.terminal .page-body h2::after {
  content: ' ]';
  color: var(--ink-faint);
}

.terminal .page-body ul {
  list-style: none;
  padding-left: 0;
}

.terminal .page-body li {
  padding-left: var(--sp-4);
  position: relative;
  color: var(--ink-soft);
}

.terminal .page-body li::before {
  content: '>';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 500;
}

/* ---------- Single post ---------- */

.post {
  border-top: 1px solid var(--border);
  padding-top: var(--sp-6);
}

.post-title {
  font-size: clamp(1.7rem, 1.35rem + 1.6vw, 2.3rem);
  font-weight: 600;
  margin: 0 0 var(--sp-3);
  line-height: 1.2;
  color: var(--ink);
}

.post-meta {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.78rem;
  color: var(--ink-faint);
  margin-bottom: var(--sp-6);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
}

.tag {
  display: inline-block;
  border: 1px solid var(--tag-line, var(--border));
  border-radius: 3px;
  padding: 0.08rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--ink-soft);
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.tag:nth-of-type(3n+1) { --tag-line: var(--toy-violet-line); }
.tag:nth-of-type(3n+2) { --tag-line: var(--toy-amber-line); }
.tag:nth-of-type(3n+3) { --tag-line: var(--toy-teal-line); }

.tag:nth-of-type(3n+1):hover { color: var(--toy-violet); border-color: var(--toy-violet); }
.tag:nth-of-type(3n+2):hover { color: var(--toy-amber); border-color: var(--toy-amber); }
.tag:nth-of-type(3n+3):hover { color: var(--toy-teal); border-color: var(--toy-teal); }

.post-body {
  max-width: 68ch;
}

.post-body h2 {
  font-size: 1.35rem;
  font-weight: 600;
  margin: var(--sp-7) 0 var(--sp-3);
  color: var(--ink);
}

.post-body h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: var(--sp-6) 0 var(--sp-2);
  color: var(--ink);
}

.post-body p {
  margin: 0 0 var(--sp-4);
  color: var(--ink);
}

.post-body ul,
.post-body ol {
  padding-left: 1.3rem;
  margin: 0 0 var(--sp-4);
}

.post-body li {
  margin-bottom: var(--sp-2);
}

.post-body blockquote {
  margin: var(--sp-5) 0;
  padding: 0.25rem 0 0.25rem var(--sp-5);
  border-left: 2px solid var(--accent-line);
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--ink-soft);
}

.post-body pre {
  background: var(--bg-raised);
  color: var(--ink);
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent-line);
  border-radius: 6px;
  padding: var(--sp-4) var(--sp-4);
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.55;
}

.post-body code {
  font-family: var(--font-mono);
  background: var(--bg-raised);
  color: var(--ink);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  font-size: 0.85em;
  font-weight: 400;
}

.post-body pre code {
  background: none;
  border: none;
  color: inherit;
  padding: 0;
  font-weight: 400;
}

.post-body img {
  max-width: 100%;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.post-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--sp-7) 0;
}

.post-nav {
  margin-top: var(--sp-7);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.85rem;
}

/* ---------- Bookshelf: cover grid ---------- */

.shelf-heading {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  margin: var(--sp-7) 0 var(--sp-5);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border);
}

.shelf-heading:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.cover-grid {
  list-style: none;
  margin: 0 0 var(--sp-4);
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: var(--sp-5) var(--sp-4);
}

.cover-card {
  display: flex;
  flex-direction: column;
}

.cover-card--purple, .cover-card--orange { --shelf-color: var(--toy-violet); --shelf-line: var(--toy-violet-line); }
.cover-card--pink, .cover-card--yellow { --shelf-color: var(--toy-amber); --shelf-line: var(--toy-amber-line); }
.cover-card--teal, .cover-card--green { --shelf-color: var(--toy-teal); --shelf-line: var(--toy-teal-line); }

.cover-img {
  width: 100%;
  max-width: 140px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--shelf-line, var(--border));
  background: var(--bg-raised);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.cover-card:hover .cover-img {
  border-color: var(--shelf-color, var(--accent-line));
  transform: translateY(-2px);
}

.cover-caption {
  margin-top: var(--sp-3);
  font-size: 0.82rem;
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  max-width: 140px;
}

.cover-caption strong {
  color: var(--ink);
  font-weight: 500;
  font-size: 0.88rem;
}

.bookshelf-author {
  color: var(--ink-faint);
  font-weight: 400;
}

.stars {
  color: var(--toy-amber);
  letter-spacing: 0.05em;
  font-size: 0.78rem;
}

.bookshelf-date {
  color: var(--ink-faint);
  font-weight: 400;
  font-size: 0.74rem;
  font-family: var(--font-mono);
}

/* Bookshelf widget in the homepage sidebar */

.bookshelf-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.bookshelf-item {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  font-size: 0.85rem;
}

.bookshelf-cover {
  border-radius: 3px;
  border: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-raised);
  object-fit: cover;
}

.bookshelf-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.bookshelf-info strong {
  font-weight: 500;
  color: var(--ink);
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: var(--sp-8);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--ink-faint);
  font-size: 0.85rem;
  font-weight: 400;
}

.social-links {
  display: flex;
  justify-content: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}

.social-link {
  color: var(--ink-faint);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.social-link:hover {
  color: var(--accent);
  border-color: var(--accent-line);
}

.footer-note {
  margin: 0 0 var(--sp-2);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.footer-meta {
  margin: 0;
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.78rem;
}

.footer-meta a {
  color: var(--ink-faint);
}

.footer-meta a:hover {
  color: var(--accent);
}

/* ---------- Small screens ---------- */

@media (max-width: 480px) {
  .page-wrap {
    padding: var(--sp-5) var(--sp-4) var(--sp-7);
  }

  .site-header {
    margin-bottom: var(--sp-6);
  }

  .site-nav ul {
    gap: 0;
  }

  .site-nav a {
    padding: 0.5rem 0.5rem;
  }

  .intro {
    font-size: 1.15rem;
    padding-left: var(--sp-4);
  }

  .terminal-titlebar {
    font-size: 0.68rem;
  }

  .terminal-path {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* =================================================================
   LIGHT THEME ("origami") -- the original warm-beige, chunky-outline,
   sticker-shadow design, preserved in full and scoped under
   html[data-theme="light"] so it can be toggled at runtime instead of
   discarded. Ported mechanically from the pre-refinement stylesheet;
   this section intentionally duplicates rather than shares rules with
   the dark theme above, since the two are different visual systems,
   not a palette swap of one another.
   ================================================================= */

html[data-theme="light"] {
  --bg: #f6f1e4;
  --card-bg: #fffdf7;
  --card-bg-2: #efe7d3;
  --ink: #2b2418;
  --ink-soft: #5c5240;
  --ink-faint: #8a8066;
  --border: #2b2418;

  --purple: #6b46c1;
  --pink: #c23f74;
  --teal: #157f73;
  --yellow: #b3860c;
  --orange: #c1591f;
  --green: #2f8f5b;
  --blue: #3b5bdb;

  --serif: 'Poppins', ui-rounded, system-ui, sans-serif;
  --sans: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, 'Liberation Mono', monospace;
  --bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  color-scheme: light;
}

html[data-theme="light"] body {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

html[data-theme="light"] .page-wrap {
  max-width: var(--width-wide);
  margin: 0 auto;
  padding: var(--sp-6) 1.5rem 3rem;
  position: relative;
  z-index: 1;
}

html[data-theme="light"] h1,
html[data-theme="light"] h2,
html[data-theme="light"] h3,
html[data-theme="light"] .home-identity-name,
html[data-theme="light"] .widget-title,
html[data-theme="light"] .page-title,
html[data-theme="light"] .stream-title,
html[data-theme="light"] .post-title {
  font-family: var(--serif);
  font-weight: 600;
}

html[data-theme="light"] a {
  color: var(--purple);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  transition: color 0.15s var(--bounce);
}

html[data-theme="light"] a:hover {
  color: var(--pink);
}

html[data-theme="light"] .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes pop-in__light {

  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }

}

html[data-theme="light"] .site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4) var(--sp-5);
  padding-bottom: var(--sp-5);
  margin-bottom: var(--sp-7);
  border-bottom: 1px solid var(--border);
}

html[data-theme="light"] .nav-face {
  color: var(--blue);
}

html[data-theme="light"] .home-identity-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: var(--yellow);
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 2px 2px 0 var(--blue);
}

html[data-theme="light"] .home-identity-name {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--blue);
}

html[data-theme="light"] .site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.72rem;
}

html[data-theme="light"] .site-nav a {
  display: inline-block;
  text-decoration: none;
  color: var(--ink-soft);
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  border: 2.5px solid transparent;
  transition: transform 0.18s var(--bounce), background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

html[data-theme="light"] .site-nav li:nth-child(6n+1) a:hover,
html[data-theme="light"] .site-nav li:nth-child(6n+1) a[aria-current="page"] { background: rgba(107, 70, 193, 0.14); border-color: var(--purple); color: var(--purple); }

html[data-theme="light"] .site-nav li:nth-child(6n+2) a:hover,
html[data-theme="light"] .site-nav li:nth-child(6n+2) a[aria-current="page"] { background: rgba(194, 63, 116, 0.14); border-color: var(--pink); color: var(--pink); }

html[data-theme="light"] .site-nav li:nth-child(6n+3) a:hover,
html[data-theme="light"] .site-nav li:nth-child(6n+3) a[aria-current="page"] { background: rgba(21, 127, 115, 0.14); border-color: var(--teal); color: var(--teal); }

html[data-theme="light"] .site-nav li:nth-child(6n+4) a:hover,
html[data-theme="light"] .site-nav li:nth-child(6n+4) a[aria-current="page"] { background: rgba(193, 89, 31, 0.14); border-color: var(--orange); color: var(--orange); }

html[data-theme="light"] .site-nav li:nth-child(6n+5) a:hover,
html[data-theme="light"] .site-nav li:nth-child(6n+5) a[aria-current="page"] { background: rgba(179, 134, 12, 0.16); border-color: var(--yellow); color: var(--yellow); }

html[data-theme="light"] .site-nav li:nth-child(6n+6) a:hover,
html[data-theme="light"] .site-nav li:nth-child(6n+6) a[aria-current="page"] { background: rgba(47, 143, 91, 0.14); border-color: var(--green); color: var(--green); }

html[data-theme="light"] .site-nav a:hover,
html[data-theme="light"] .site-nav a[aria-current="page"] {
  transform: translateY(-2px);
}

html[data-theme="light"] .site-nav a::after {
  content: none;
}

html[data-theme="light"] .intro {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 2.5rem;
  padding: 1.25rem 1.5rem;
  background: var(--card-bg);
  border: 3px solid var(--border);
  border-radius: 20px;
  box-shadow: 6px 6px 0 var(--blue);
  max-width: none;
}

html[data-theme="light"] .intro p {
  margin: 0 0 0.85em;
}

html[data-theme="light"] .intro p:last-child {
  margin-bottom: 0;
}

html[data-theme="light"] .intro a {
  text-decoration: underline;
  text-decoration-color: var(--pink);
}

html[data-theme="light"] .home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 680px) {
html[data-theme="light"] .home-grid {
    grid-template-columns: 1fr;
  }
}

html[data-theme="light"] .sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: sticky;
  top: 1.5rem;
}

@media (max-width: 680px) {
html[data-theme="light"] .sidebar {
    position: static;
  }
}

html[data-theme="light"] .stream {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

html[data-theme="light"] .stream-item {
  padding: 1.1rem 1.25rem;
  background: var(--card-bg);
  border: 3px solid var(--border);
  border-radius: 18px;
  box-shadow: 5px 5px 0 var(--shadow-1);
  animation: pop-in__light 0.5s var(--bounce) both;
  transition: transform 0.2s var(--bounce), box-shadow 0.2s var(--bounce);
}

html[data-theme="light"] .stream-item:nth-child(6n+1) { --shadow-1: var(--purple); }

html[data-theme="light"] .stream-item:nth-child(6n+2) { --shadow-1: var(--pink); }

html[data-theme="light"] .stream-item:nth-child(6n+3) { --shadow-1: var(--teal); }

html[data-theme="light"] .stream-item:nth-child(6n+4) { --shadow-1: var(--orange); }

html[data-theme="light"] .stream-item:nth-child(6n+5) { --shadow-1: var(--yellow); }

html[data-theme="light"] .stream-item:nth-child(6n+6) { --shadow-1: var(--green); }

html[data-theme="light"] .stream-item:nth-child(1) { animation-delay: 0.03s; }

html[data-theme="light"] .stream-item:nth-child(2) { animation-delay: 0.08s; }

html[data-theme="light"] .stream-item:nth-child(3) { animation-delay: 0.13s; }

html[data-theme="light"] .stream-item:nth-child(4) { animation-delay: 0.18s; }

html[data-theme="light"] .stream-item:nth-child(5) { animation-delay: 0.23s; }

html[data-theme="light"] .stream-item:nth-child(n+6) { animation-delay: 0.28s; }

html[data-theme="light"] .stream-item:hover {
  transform: translate(-3px, -3px) rotate(-0.4deg);
  box-shadow: 8px 8px 0 var(--shadow-1);
}

html[data-theme="light"] .stream-meta {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

html[data-theme="light"] .stream-kind {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  border: 2px solid var(--border);
  font-weight: 800;
  color: var(--card-bg);
}

html[data-theme="light"] .stream-item--post .stream-kind { background: var(--yellow); }

html[data-theme="light"] .source-badge {
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  border: 1.5px dashed var(--ink-faint);
  color: var(--ink-faint);
  font-size: 0.68rem;
  text-transform: none;
  letter-spacing: 0;
}

html[data-theme="light"] .origin-callout {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-faint);
  margin: -0.75rem 0 1.5rem;
}

html[data-theme="light"] .stream-title {
  margin: 0 0 0.4rem;
  font-size: 1.35rem;
  line-height: 1.3;
}

html[data-theme="light"] .stream-title a {
  color: var(--ink);
  text-decoration: none;
}

html[data-theme="light"] .stream-title a:hover {
  color: var(--pink);
}

html[data-theme="light"] .stream-excerpt {
  margin: 0;
  color: var(--ink-soft);
  font-weight: 600;
}

html[data-theme="light"] .widget {
  background: var(--card-bg);
  border: 3px solid var(--border);
  border-radius: 20px;
  padding: 1.2rem 1.3rem;
  box-shadow: 5px 5px 0 var(--shadow-2);
  transition: transform 0.2s var(--bounce), box-shadow 0.2s var(--bounce);
}

html[data-theme="light"] .widget:hover {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 var(--shadow-2);
}

html[data-theme="light"] .github-widget { --shadow-2: var(--orange); }

html[data-theme="light"] .bookshelf-widget { --shadow-2: var(--teal); }

html[data-theme="light"] .widget-title {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
  font-family: var(--serif);
  font-weight: 600;
}

html[data-theme="light"] .widget-title a {
  color: var(--ink);
  text-decoration: none;
}

html[data-theme="light"] .widget-title a:hover {
  color: var(--pink);
}

html[data-theme="light"] .github-repo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

html[data-theme="light"] .github-repo {
  font-size: 0.85rem;
}

html[data-theme="light"] .github-repo-name {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}

html[data-theme="light"] .github-repo-name:hover {
  color: var(--pink);
}

html[data-theme="light"] .github-repo-desc {
  margin: 0.2rem 0 0;
  color: var(--ink-soft);
  font-weight: 600;
}

html[data-theme="light"] .github-repo-meta {
  margin-top: 0.2rem;
  color: var(--ink-faint);
  font-size: 0.78rem;
  font-weight: 700;
}

/* Projects page only, light mode only: a 2-up grid of bordered
   "logo" tiles with a caption below, inspired by app-icon style
   project showcases -- reusing the site's own chunky-outline,
   sticker-shadow language instead of copying the reference 1:1.
   Everywhere else (dark mode, the homepage widget) keeps the plain
   list -- see the shared .github-repo-tile{display:none} default. */
html[data-theme="light"] .github-repo-list--page {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.75rem 1.5rem;
}

@media (max-width: 640px) {
  html[data-theme="light"] .github-repo-list--page {
    grid-template-columns: 1fr;
  }
}

html[data-theme="light"] .github-repo-list--page .github-repo {
  padding: 0;
  border: none;
}

html[data-theme="light"] .github-repo-list--page .github-repo:nth-child(3n+1) { --tile-color: var(--purple); }
html[data-theme="light"] .github-repo-list--page .github-repo:nth-child(3n+2) { --tile-color: var(--pink); }
html[data-theme="light"] .github-repo-list--page .github-repo:nth-child(3n+3) { --tile-color: var(--teal); }

html[data-theme="light"] .github-repo-list--page .github-repo-name {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  font-size: 1rem;
}

html[data-theme="light"] .github-repo-list--page .github-repo-tile {
  display: flex;
  position: relative;
  overflow: hidden;
  align-items: center;
  justify-content: center;
  height: 150px;
  border: 3px solid var(--border);
  border-radius: 20px;
  background: var(--card-bg);
  box-shadow: 6px 6px 0 var(--tile-color);
  transition: transform 0.2s var(--bounce), box-shadow 0.2s var(--bounce);
}

html[data-theme="light"] .github-repo-list--page .github-repo:hover .github-repo-tile {
  transform: translate(-3px, -3px);
  box-shadow: 9px 9px 0 var(--tile-color);
}

html[data-theme="light"] .github-repo-list--page .github-repo-label {
  font-family: var(--sans);
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--ink);
}

html[data-theme="light"] .github-repo-list--page .github-repo-desc {
  font-size: 0.85rem;
  margin: 0.4rem 0 0;
}

html[data-theme="light"] .github-repo-list--page .github-repo-meta {
  display: inline-block;
  width: fit-content;
  margin-top: 0.5rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  border: 2px solid var(--border);
  font-size: 0.68rem;
}

/* The dark theme gives the first (featured) project special
   treatment -- bigger type, an accent bar. The light grid treats
   every tile the same, so that styling is reset here. */
html[data-theme="light"] .github-repo-list--page .github-repo--featured {
  padding-bottom: 0;
  padding-left: 0;
  border-bottom: none;
  position: static;
}

html[data-theme="light"] .github-repo-list--page .github-repo--featured::before {
  content: none;
}

html[data-theme="light"] .github-repo-list--page .github-repo--featured .github-repo-desc {
  max-width: none;
}

html[data-theme="light"] .widget-footer {
  margin: 0.9rem 0 0;
  font-size: 0.82rem;
  font-weight: 800;
}

html[data-theme="light"] .view-all-wrap {
  margin: 2rem 0 0;
  text-align: center;
}

html[data-theme="light"] .view-all-btn {
  display: inline-block;
  font-weight: 800;
  font-size: 0.9rem;
  text-decoration: none;
  color: var(--ink);
  background: var(--card-bg);
  padding: 0.65rem 1.5rem;
  border: 3px solid var(--border);
  border-radius: 999px;
  box-shadow: 4px 4px 0 var(--purple);
  transition: transform 0.18s var(--bounce), box-shadow 0.18s var(--bounce);
}

html[data-theme="light"] .view-all-btn:hover {
  transform: translateY(-2px);
  box-shadow: 6px 6px 0 var(--purple);
}

html[data-theme="light"] .page-title {
  font-size: 2.2rem;
  margin: 0 0 0.5rem;
  color: var(--purple);
}

html[data-theme="light"] .page-lede {
  color: var(--ink-soft);
  font-weight: 700;
  margin: 0 0 2rem;
}

html[data-theme="light"] .page-updated {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--ink-faint);
  margin: -0.5rem 0 2rem;
}

html[data-theme="light"] .page-body :first-child {
  margin-top: 0;
}

html[data-theme="light"] .page-body h2 {
  font-size: 1.3rem;
  margin: 2rem 0 0.75rem;
  color: var(--pink);
}

html[data-theme="light"] .page-body ul {
  padding-left: 1.3rem;
}

html[data-theme="light"] .page-body li {
  margin-bottom: 0.5rem;
  font-weight: 700;
}

html[data-theme="light"] .terminal {
  background: #050409;
  color: #f0ede4;
  border: 2.5px solid var(--border);
  border-radius: 14px;
  box-shadow: 6px 6px 0 #3ee2c7;
  overflow: hidden;
  position: relative;
}

html[data-theme="light"] .terminal a {
  color: #b9a3ff;
}

html[data-theme="light"] .terminal a:hover {
  color: #f2a6c4;
}

html[data-theme="light"] .terminal strong {
  color: #ffffff;
}

html[data-theme="light"] .terminal::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.03) 0px,
    rgba(255, 255, 255, 0.03) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  mix-blend-mode: overlay;
}

html[data-theme="light"] .terminal-titlebar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 2px solid var(--border);
  font-family: var(--mono);
  font-size: 0.78rem;
  color: #8b8578;
  position: relative;
}

html[data-theme="light"] .terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

html[data-theme="light"] .terminal-dot--red { background: #ff5f56; }

html[data-theme="light"] .terminal-dot--yellow { background: #ffbd2e; }

html[data-theme="light"] .terminal-dot--green { background: #27c93f; }

html[data-theme="light"] .terminal-path {
  margin-left: 0.5rem;
}

html[data-theme="light"] .terminal-body {
  padding: 1.75rem 2rem 2.25rem;
  position: relative;
}

@media (max-width: 560px) {
html[data-theme="light"] .terminal-body {
    padding: 1.25rem 1.25rem 1.75rem;
  }
}

html[data-theme="light"] .terminal-h1 {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #3ee2c7;
  margin: 0 0 1.5rem;
}

html[data-theme="light"] .terminal-cursor {
  display: inline-block;
  width: 0.5em;
  height: 1em;
  margin-left: 0.15em;
  background: #3ee2c7;
  animation: terminal-blink 1s steps(1) infinite;
  vertical-align: text-bottom;
}

html[data-theme="light"] .terminal-log {
  color: #b8b3a4;
}

html[data-theme="light"] .terminal-log-cmd {
  color: #f0ede4;
}

html[data-theme="light"] .terminal-input-line {
  border-top: 2px solid var(--border);
}

html[data-theme="light"] .terminal-prompt {
  color: #3ee2c7;
}

html[data-theme="light"] .terminal-cmd-input {
  color: #f0ede4;
  caret-color: #3ee2c7;
}

html[data-theme="light"] .terminal .page-body h2 {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 1rem;
  color: #3ee2c7;
  margin: 2rem 0 1rem;
}

html[data-theme="light"] .terminal .page-body h2::before {
  content: '[ ';
  color: #8b8578;
}

html[data-theme="light"] .terminal .page-body h2::after {
  content: ' ]';
  color: #8b8578;
}

html[data-theme="light"] .terminal .page-body ul {
  list-style: none;
  padding-left: 0;
}

html[data-theme="light"] .terminal .page-body li {
  padding-left: 1.3rem;
  position: relative;
}

html[data-theme="light"] .terminal .page-body li::before {
  content: '>';
  position: absolute;
  left: 0;
  color: #3ee2c7;
  font-family: var(--mono);
  font-weight: 700;
}

html[data-theme="light"] .post {
  background: var(--card-bg);
  border: 3px solid var(--border);
  border-radius: 20px;
  padding: 2rem 2rem 1.5rem;
  box-shadow: 7px 7px 0 var(--purple);
}

@media (max-width: 560px) {
html[data-theme="light"] .post {
    padding: 1.5rem 1.25rem 1rem;
  }
}

html[data-theme="light"] .post-title {
  font-size: 2.1rem;
  margin: 0 0 0.6rem;
  line-height: 1.2;
  color: var(--purple);
}

html[data-theme="light"] .post-meta {
  font-family: var(--sans);
  font-weight: 800;
  font-size: 0.8rem;
  color: var(--ink-faint);
  margin-bottom: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

html[data-theme="light"] .tag {
  display: inline-block;
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 0.1rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--card-bg);
  transition: transform 0.15s var(--bounce);
}

html[data-theme="light"] .tag:hover {
  transform: scale(1.08) rotate(-2deg);
}

html[data-theme="light"] .tag:nth-of-type(3n+1) { background: var(--yellow); }

html[data-theme="light"] .tag:nth-of-type(3n+2) { background: var(--teal); }

html[data-theme="light"] .tag:nth-of-type(3n+3) { background: var(--pink); }

html[data-theme="light"] .post-body h2 {
  font-size: 1.4rem;
  margin: 2rem 0 0.75rem;
  color: var(--pink);
}

html[data-theme="light"] .post-body h3 {
  font-size: 1.15rem;
  margin: 1.75rem 0 0.6rem;
  color: var(--teal);
}

html[data-theme="light"] .post-body p {
  margin: 0 0 1.1rem;
}

html[data-theme="light"] .post-body ul,
html[data-theme="light"] .post-body ol {
  padding-left: 1.4rem;
  margin: 0 0 1.1rem;
}

html[data-theme="light"] .post-body li {
  margin-bottom: 0.5rem;
}

html[data-theme="light"] .post-body blockquote {
  margin: 1.25rem 0;
  padding: 0.5rem 1.25rem;
  border-left: 5px solid var(--pink);
  background: rgba(194, 63, 116, 0.08);
  border-radius: 0 12px 12px 0;
  color: var(--ink-soft);
}

html[data-theme="light"] .post-body pre {
  background: #06050c;
  color: #f4f1ff;
  border: 3px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  font-size: 0.85rem;
  box-shadow: 4px 4px 0 var(--teal);
}

html[data-theme="light"] .post-body code {
  font-family: var(--mono);
  background: var(--yellow);
  color: var(--card-bg);
  border-radius: 5px;
  padding: 0.1rem 0.4rem;
  font-size: 0.85em;
  font-weight: 700;
}

html[data-theme="light"] .post-body pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-weight: 400;
}

html[data-theme="light"] .post-body hr {
  border: none;
  border-top: 3px dashed var(--border);
  margin: 2rem 0;
}

html[data-theme="light"] .post-nav {
  margin-top: 2.5rem;
  font-family: var(--sans);
  font-weight: 800;
  font-size: 0.9rem;
}

html[data-theme="light"] .shelf-heading {
  margin-top: 2.5rem;
}

html[data-theme="light"] .cover-grid {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1.75rem;
}

html[data-theme="light"] .cover-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

html[data-theme="light"] .cover-img {
  width: 100%;
  max-width: 140px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 10px;
  border: 3px solid var(--border);
  background: var(--card-bg-2);
  box-shadow: 4px 4px 0 var(--shadow-3);
  transition: transform 0.2s var(--bounce), box-shadow 0.2s var(--bounce);
}

html[data-theme="light"] .cover-card:hover .cover-img {
  transform: translate(-3px, -3px) rotate(-2deg);
  box-shadow: 7px 7px 0 var(--shadow-3);
}

html[data-theme="light"] .cover-card--purple { --shadow-3: var(--purple); }

html[data-theme="light"] .cover-card--pink { --shadow-3: var(--pink); }

html[data-theme="light"] .cover-card--teal { --shadow-3: var(--teal); }

html[data-theme="light"] .cover-card--orange { --shadow-3: var(--orange); }

html[data-theme="light"] .cover-card--yellow { --shadow-3: var(--yellow); }

html[data-theme="light"] .cover-card--green { --shadow-3: var(--green); }

html[data-theme="light"] .cover-caption {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

html[data-theme="light"] .cover-caption strong {
  color: var(--ink);
  font-size: 0.9rem;
}

html[data-theme="light"] .bookshelf-author {
  color: var(--ink-faint);
  font-weight: 700;
}

html[data-theme="light"] .stars {
  color: var(--yellow);
  letter-spacing: 0.05em;
}

html[data-theme="light"] .bookshelf-date {
  color: var(--ink-faint);
  font-weight: 700;
  font-size: 0.78rem;
}

html[data-theme="light"] .bookshelf-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

html[data-theme="light"] .bookshelf-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  font-size: 0.85rem;
}

html[data-theme="light"] .bookshelf-cover {
  border-radius: 6px;
  border: 2px solid var(--border);
  box-shadow: 3px 3px 0 var(--yellow);
  flex-shrink: 0;
  background: var(--card-bg-2);
  object-fit: cover;
  transition: transform 0.2s var(--bounce);
}

html[data-theme="light"] .bookshelf-item:hover .bookshelf-cover {
  transform: rotate(-4deg) scale(1.08);
}

html[data-theme="light"] .bookshelf-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

html[data-theme="light"] .site-footer {
  margin-top: 3.5rem;
  padding-top: 1.75rem;
  border-top: 4px solid var(--border);
  text-align: center;
  color: var(--ink-faint);
  font-size: 0.85rem;
  font-weight: 700;
}

html[data-theme="light"] .social-links {
  display: flex;
  justify-content: center;
  gap: 0.85rem;
  margin-bottom: 1.1rem;
}

html[data-theme="light"] .social-link {
  color: var(--bg);
  background: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2.5px solid var(--border);
  transition: transform 0.25s var(--bounce), background 0.2s ease, box-shadow 0.2s ease;
}

html[data-theme="light"] .social-link:nth-child(4n+1):hover { background: var(--purple); }

html[data-theme="light"] .social-link:nth-child(4n+2):hover { background: var(--pink); }

html[data-theme="light"] .social-link:nth-child(4n+3):hover { background: var(--teal); }

html[data-theme="light"] .social-link:nth-child(4n+4):hover { background: var(--orange); }

html[data-theme="light"] .social-link:hover {
  transform: translateY(-4px) rotate(-8deg) scale(1.1);
  color: var(--bg);
}

html[data-theme="light"] .footer-note {
  margin: 0 0 0.35rem;
}

html[data-theme="light"] .footer-meta {
  margin: 0;
  font-family: var(--sans);
  font-weight: 800;
  font-size: 0.8rem;
}

html[data-theme="light"] .footer-meta a {
  color: var(--ink-faint);
}

html[data-theme="light"] .footer-meta a:hover {
  color: var(--pink);
}