/* ── Reset & Base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --text: #3a2d5c;
  --text-muted: #7b6b99;
  --radius: 14px;
  --nav-height: 56px;
  --max-width: 1100px;

  /* Pastel palette — Alloverse-inspired */
  --bg: #f5eef8;
  --bg-warm: #f8eef5;
  --accent-pink: #e8b4d8;
  --accent-lilac: #c9b3e8;
  --accent-lavender: #d4c5f0;
  --accent-sky: #b8d4f0;
  --accent-mint: #b8e8d4;
  --accent-peach: #f0d4b8;

  /* Category accent colors — softer pastels */
  --cat-company: #d47a9c;
  --cat-employment: #6bc9a8;
  --cat-active: #7baee8;
  --cat-gamejam: #d4a84b;
  --cat-legacy: #b0a8b8;

  /* Semantic colors */
  --heading-gradient-from: var(--text);
  --heading-gradient-to: #6b4d9e;
  --link-color: #6b4d9e;
  --link-underline: rgba(107, 77, 158, 0.3);
  --border-subtle: rgba(100, 60, 140, 0.06);
  --border-light: rgba(100, 60, 140, 0.08);
  --border-medium: rgba(100, 60, 140, 0.1);
  --surface-hover: rgba(100, 60, 140, 0.08);
  --surface-active: rgba(100, 60, 140, 0.12);
  --tag-bg: rgba(100, 60, 140, 0.07);
  --tag-hover-bg: rgba(100, 60, 140, 0.15);
  --cube-shadow: rgba(100, 60, 140, 0.15);
  --cube-shadow-hover: rgba(100, 60, 140, 0.25);
  --cube-text: #2a1e4a;
  --cube-text-muted: #5a4a7a;
  --code-bg: rgba(100, 60, 140, 0.08);
  --pre-bg: #2a1e3a;
  --pre-text: #e8ddf0;
  --bg-gradient-1: rgba(200, 160, 220, 0.3);
  --bg-gradient-2: rgba(220, 180, 200, 0.25);
  --bg-gradient-3a: rgba(245, 238, 248, 1);
  --bg-gradient-3b: rgba(240, 230, 245, 1);
  --visit-text: rgba(58, 45, 92, 0.5);
  --visit-bg: rgba(255, 255, 255, 0.6);
  --visit-hover-bg: rgba(255, 255, 255, 0.9);
  --pedestal-bg: rgba(100, 60, 140, 0.1);
  --initials-bg: rgba(100, 60, 140, 0.12);
  --wall-mix: white;
}

[data-theme="dark"] {
  --wall-mix: #1a1226;
  --text: #e0d8ec;
  --text-muted: #9b8cb8;
  --bg: #1a1226;
  --bg-warm: #1e1428;
  --accent-lilac: #7a6aa0;
  --heading-gradient-from: #e0d8ec;
  --heading-gradient-to: #b89cdf;
  --link-color: #b89cdf;
  --link-underline: rgba(184, 156, 223, 0.3);
  --border-subtle: rgba(180, 160, 220, 0.08);
  --border-light: rgba(180, 160, 220, 0.1);
  --border-medium: rgba(180, 160, 220, 0.15);
  --surface-hover: rgba(180, 160, 220, 0.1);
  --surface-active: rgba(180, 160, 220, 0.15);
  --tag-bg: rgba(180, 160, 220, 0.1);
  --tag-hover-bg: rgba(180, 160, 220, 0.2);
  --cube-shadow: rgba(0, 0, 0, 0.3);
  --cube-shadow-hover: rgba(0, 0, 0, 0.5);
  --cube-text: #e0d8ec;
  --cube-text-muted: #b0a0cc;
  --code-bg: rgba(180, 160, 220, 0.12);
  --pre-bg: #120e1c;
  --pre-text: #d8ccec;
  --bg-gradient-1: rgba(80, 40, 120, 0.3);
  --bg-gradient-2: rgba(100, 50, 80, 0.2);
  --bg-gradient-3a: rgba(26, 18, 38, 1);
  --bg-gradient-3b: rgba(22, 16, 34, 1);
  --visit-text: rgba(200, 190, 220, 0.6);
  --visit-bg: rgba(30, 22, 45, 0.7);
  --visit-hover-bg: rgba(40, 30, 60, 0.9);
  --pedestal-bg: rgba(180, 160, 220, 0.12);
  --initials-bg: rgba(180, 160, 220, 0.15);
  --cat-company: #e899b8;
  --cat-employment: #7eddb8;
  --cat-active: #8ec4f0;
  --cat-gamejam: #e8c46b;
  --cat-legacy: #c0b8cc;
}

/* Register key custom properties as <color> so they can be animated */
@property --text { syntax: '<color>'; inherits: true; initial-value: #3a2d5c; }
@property --text-muted { syntax: '<color>'; inherits: true; initial-value: #7b6b99; }
@property --bg { syntax: '<color>'; inherits: true; initial-value: #f5eef8; }
@property --heading-gradient-from { syntax: '<color>'; inherits: true; initial-value: #3a2d5c; }
@property --heading-gradient-to { syntax: '<color>'; inherits: true; initial-value: #6b4d9e; }
@property --link-color { syntax: '<color>'; inherits: true; initial-value: #6b4d9e; }
@property --cube-text { syntax: '<color>'; inherits: true; initial-value: #2a1e4a; }
@property --cube-text-muted { syntax: '<color>'; inherits: true; initial-value: #5a4a7a; }
@property --wall-mix { syntax: '<color>'; inherits: true; initial-value: #ffffff; }
@property --pre-bg { syntax: '<color>'; inherits: true; initial-value: #2a1e3a; }
@property --pre-text { syntax: '<color>'; inherits: true; initial-value: #e8ddf0; }
@property --bg-gradient-1 { syntax: '<color>'; inherits: true; initial-value: rgba(200, 160, 220, 0.3); }
@property --bg-gradient-2 { syntax: '<color>'; inherits: true; initial-value: rgba(220, 180, 200, 0.25); }
@property --bg-gradient-3a { syntax: '<color>'; inherits: true; initial-value: rgba(245, 238, 248, 1); }
@property --bg-gradient-3b { syntax: '<color>'; inherits: true; initial-value: rgba(240, 230, 245, 1); }
@property --visit-text { syntax: '<color>'; inherits: true; initial-value: rgba(58, 45, 92, 0.5); }
@property --visit-bg { syntax: '<color>'; inherits: true; initial-value: rgba(255, 255, 255, 0.6); }

html.theme-transition {
  transition: --text 0.4s ease, --text-muted 0.4s ease, --bg 0.4s ease,
              --heading-gradient-from 0.4s ease, --heading-gradient-to 0.4s ease,
              --link-color 0.4s ease, --cube-text 0.4s ease, --cube-text-muted 0.4s ease,
              --wall-mix 0.4s ease, --pre-bg 0.4s ease, --pre-text 0.4s ease,
              --bg-gradient-1 0.4s ease, --bg-gradient-2 0.4s ease,
              --bg-gradient-3a 0.4s ease, --bg-gradient-3b 0.4s ease,
              --visit-text 0.4s ease, --visit-bg 0.4s ease;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 0%, var(--bg-gradient-1) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, var(--bg-gradient-2) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, var(--bg-gradient-3a) 0%, var(--bg-gradient-3b) 100%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ── Navigation ── */
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: var(--nav-height);
}

.nav-logo {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.nav-links {
  display: flex;
  gap: 24px;
}

.nav-links a {
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--text);
}

/* ── Main ── */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px 80px;
}

/* ── Footer ── */
.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 24px;
  border-top: 1px solid var(--border-medium);
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ── Hero section ── */
.hero {
  padding: 80px 0 60px;
}

.hero h1 {
  font-size: 2.8rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--heading-gradient-from) 0%, var(--heading-gradient-to) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 560px;
  line-height: 1.65;
}

.socials {
  display: flex;
  gap: 16px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.socials a {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: color 0.2s;
}

.social-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.socials a:hover {
  color: var(--text);
}

/* ── Section headers ── */
/* ── Home page: portfolio + sidebar layout ── */
.home-content {
  display: flex;
  gap: 40px;
  align-items: flex-start;
}

.home-portfolio {
  flex: 1;
  min-width: 0;
}

.home-sidebar {
  flex: 0 0 280px;
  padding-top: 48px;
}

.home-sidebar .section-header {
  margin-top: 0;
}

@media (max-width: 900px) {
  .home-content {
    flex-direction: column;
  }
  .home-sidebar {
    flex: none;
    width: 100%;
    padding-top: 0;
  }
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 48px 0 20px;
}

.section-header h2 {
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.section-header a {
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: color 0.2s;
}

.section-header a:hover {
  color: var(--text);
}

/* ── Hex Grid — flex rows with 3-2-3-2 pattern ── */
/*
  Each .hex-row is a flex row of cubes. Offset rows shift right by
  half a cube width. Bleed cubes extend past the container edges.
  Hex tiling overlap: rows pull up by H*0.25 to interlock vertically.
*/
.hex-grid {
  --grid-cube-size: 150px;
  --hex-gap: 12px;
  --hex-w: calc(var(--grid-cube-size) * 1.732);
  --hex-h: calc(var(--grid-cube-size) * 2);
  --hex-row-overlap: calc(var(--hex-h) * 0.25 - var(--hex-gap) * 0.5);

  /* Full-bleed: break out of the max-width main container */
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  overflow: hidden;
  padding: 10px 0;
}

/* When inside sidebar layout, don't break out; let rows wrap naturally */
.home-portfolio .hex-grid {
  width: 100%;
  margin-left: 0;
  --grid-cube-size: 130px;
}

.home-portfolio .hex-row {
  flex-wrap: wrap;
}

.home-portfolio .hex-row--offset {
  /* No offset when wrapping — bleed cubes are hidden */
}

.home-portfolio .hex-row + .hex-row {
  margin-top: calc(-1 * var(--hex-row-overlap));
}

.home-portfolio .iso-cube--bleed {
  display: none;
}

.hex-row {
  display: flex;
  justify-content: center;
  gap: var(--hex-gap);
}

.hex-row + .hex-row {
  margin-top: calc(-1 * var(--hex-row-overlap));
}

/* Bleed cubes — decorative, extend past edges */
.iso-cube--bleed {
  opacity: 0.3;
  pointer-events: none;
  flex-shrink: 0;
}

/* Filtered state: collapse hidden cubes, flex recenters the rest */
.iso-cube.cube-hidden {
  width: 0 !important;
  height: 0 !important;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

/* ── Isometric Cube Card ── */
/*
  Each card is an isometric "room" you look down into:
  - Left wall: project name
  - Right wall: tagline
  - Floor: icon on pedestal
  The hex shape emerges from the three rhombus faces.
*/
.iso-cube {
  --cube-size: var(--grid-cube-size, 120px);
  --wall-color: var(--card-color, #c9b3e8);
  --wall-light: color-mix(in srgb, var(--wall-color) 40%, var(--wall-mix));
  --wall-left: color-mix(in srgb, var(--wall-color) 70%, var(--wall-mix));
  --wall-right: color-mix(in srgb, var(--wall-color) 55%, var(--wall-mix));
  --floor-color: color-mix(in srgb, var(--wall-color) 30%, var(--wall-mix));

  position: relative;
  width: calc(var(--cube-size) * 1.732);
  height: calc(var(--cube-size) * 2);
  flex-shrink: 0;
  text-decoration: none;
  color: var(--text);
  display: block;
  transition: transform 0.3s ease, filter 0.3s ease, opacity 0.3s ease, width 0.4s ease, height 0.4s ease, margin 0.4s ease;
  filter: drop-shadow(0 4px 12px var(--cube-shadow));
}

.iso-cube-link {
  position: absolute;
  inset: 0;
  text-decoration: none;
  color: inherit;
  display: block;
}

.iso-cube:hover {
  transform: translateY(-6px);
  filter: drop-shadow(0 12px 24px var(--cube-shadow-hover));
}

/* All three faces use clip-path for precise isometric geometry.
   Container coords: top (50%,0), UL (0,25%), LL (0,75%),
   bottom (50%,100%), LR (100%,75%), UR (100%,25%), center (50%,50%) */
.iso-face {
  position: absolute;
  inset: 0;
}

/* Left wall: top → UL → LL → center */
.iso-left-wall {
  background: var(--wall-left);
  clip-path: polygon(50% 0%, 0% 25%, 0% 75%, 50% 50%);
}

/* Right wall: top → center → LR → UR */
.iso-right-wall {
  background: var(--wall-right);
  clip-path: polygon(50% 0%, 50% 50%, 100% 75%, 100% 25%);
}

/* Floor: center → LL → bottom → LR */
.iso-floor {
  background: var(--floor-color);
  clip-path: polygon(50% 50%, 0% 75%, 50% 100%, 100% 75%);
}

/* Subtle inner edges where faces meet */
.iso-left-wall {
  border-right: 1px solid var(--border-subtle);
}

/* Text content inside walls — sits naturally on the skewed surface */
.iso-wall-content {
  position: absolute;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 8px 10px;
}

/* Position text within the left wall parallelogram */
.iso-left-wall .iso-wall-content {
  left: 4%;
  top: 10%;
  width: 44%;
  height: 55%;
  transform: skewY(-30deg);
  transform-origin: top left;
}

/* Position text within the right wall parallelogram. */
.iso-right-wall .iso-wall-content {
  right: 4%;
  top: 10%;
  width: 44%;
  height: 55%;
  transform: skewY(30deg);
  transform-origin: top right;
  justify-content: flex-start;
  overflow: hidden;
}

/* Content inside walls */
.iso-name {
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
  color: var(--cube-text);
}

.iso-type {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cube-text-muted);
  margin-top: 3px;
}

.iso-tagline {
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--cube-text-muted);
}

/* ── Scrolling credits on right wall ── */
.iso-credits-track {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
}

.iso-credits-inner {
  display: flex;
  flex-direction: column;
  width: 100%;
  /* Push text down past the clip-path diagonal. In the skewed coordinate
     space, the top-left of the wall-content is above the clip boundary
     by ~25% of cube height. This margin compensates. */
  padding-top: calc(var(--cube-size, 150px) * 0.5);
}

.iso-credits-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 20px;
}

.iso-credits-inner.is-scrolling {
  animation: credits-scroll var(--credits-duration, 8s) linear infinite;
}

.iso-cube:hover .iso-credits-inner.is-scrolling {
  animation-play-state: paused;
}

@keyframes credits-scroll {
  0%, 10% {
    transform: translateY(0);
  }
  90%, 100% {
    transform: translateY(var(--scroll-distance, -50px));
  }
}

.iso-screenshot {
  width: 100%;
  border-radius: 4px;
  object-fit: cover;
  max-height: 60px;
  opacity: 0.85;
}

/* Icon/logo on the floor — centered at 50%, 68% (middle of floor diamond) */
.iso-icon-wrapper {
  position: absolute;
  left: 50%;
  top: 62%;
  transform: translateX(-50%) translateY(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.iso-pedestal {
  width: 16px;
  height: 8px;
  background: var(--pedestal-bg);
  border-radius: 50%;
  margin-top: 2px;
}

.iso-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px var(--cube-shadow));
  border-radius: 6px;
}

.iso-initials {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--initials-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text);
}

/* Priority visual emphasis (all cubes same size for hex alignment) */
.iso-cube.priority-1 .iso-name {
  font-size: 1rem;
  font-weight: 800;
}

.iso-cube.priority-1 .iso-logo,
.iso-cube.priority-1 .iso-initials {
  width: 44px;
  height: 44px;
  font-size: 1rem;
}

.iso-cube.priority-2 .iso-name {
  font-size: 0.92rem;
  font-weight: 700;
}

/* ── Category legend ── */
.category-legend {
  display: flex;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 12px;
  transition: background 0.2s, color 0.2s, opacity 0.2s;
  font-family: inherit;
}

.legend-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.legend-item--active {
  background: var(--surface-active);
  color: var(--text);
}

.legend-item--dimmed {
  opacity: 0.4;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* ── Portfolio page header ── */
.portfolio-page-header {
  padding: 60px 0 32px;
}

.portfolio-page-header h1 {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--heading-gradient-from) 0%, var(--heading-gradient-to) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.portfolio-page-header p {
  color: var(--text-muted);
  font-size: 1.05rem;
}

/* ── Blog feed ── */
.blog-post {
  padding: 40px 0;
  border-bottom: 1px solid var(--border-light);
}

.blog-post:last-of-type {
  border-bottom: none;
}

.blog-post-header {
  margin-bottom: 20px;
}

.blog-post-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-bottom: 8px;
}

.blog-post-header a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}

.blog-post-header a:hover {
  color: var(--link-color);
}

/* ── Wiki / Blog ── */
.wiki-page-header {
  padding: 60px 0 32px;
}

.wiki-page-header h1 {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--heading-gradient-from) 0%, var(--heading-gradient-to) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.wiki-page-header p {
  color: var(--text-muted);
  font-size: 1.05rem;
}

/* Recent posts list */
.post-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.post-item {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}

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

.post-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.post-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  transition: color 0.2s;
}

.post-title:hover {
  color: var(--link-color);
}

.post-tags {
  display: flex;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.tag {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--tag-bg);
  padding: 2px 8px;
  border-radius: 10px;
  transition: background 0.2s, color 0.2s;
  text-decoration: none;
}

.tag:hover {
  background: var(--tag-hover-bg);
  color: var(--text);
}

/* Topic tree */
.topic-tree {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.topic-tree a {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--border-subtle);
  padding: 6px 14px;
  border-radius: 12px;
  transition: background 0.2s, color 0.2s;
}

.topic-tree a:hover {
  background: var(--tag-hover-bg);
  color: var(--text);
}

.topic-count {
  font-size: 0.75rem;
  opacity: 0.6;
  margin-left: 4px;
}

/* Single article page */
.article-header {
  padding: 60px 0 24px;
  max-width: 680px;
}

.article-header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 12px;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.article-breadcrumb {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.article-breadcrumb a {
  color: var(--text-muted);
  transition: color 0.2s;
}

.article-breadcrumb a:hover {
  color: var(--text);
}

.article-breadcrumb .sep {
  margin: 0 6px;
  opacity: 0.4;
}

/* Prose content */
.prose {
  max-width: 680px;
  font-size: 1.05rem;
  line-height: 1.75;
}

.prose p {
  margin-bottom: 1.25em;
}

.prose h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-top: 2em;
  margin-bottom: 0.75em;
  letter-spacing: -0.02em;
}

.prose h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 1.75em;
  margin-bottom: 0.5em;
}

.prose a {
  color: var(--link-color);
  text-decoration: underline;
  text-decoration-color: var(--link-underline);
  text-underline-offset: 2px;
  transition: text-decoration-color 0.2s;
}

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

.prose ul, .prose ol {
  margin-bottom: 1.25em;
  padding-left: 1.5em;
}

.prose li {
  margin-bottom: 0.4em;
}

.prose blockquote {
  border-left: 3px solid var(--accent-lilac);
  padding-left: 1em;
  color: var(--text-muted);
  margin: 1.5em 0;
  font-style: italic;
}

.prose code {
  font-size: 0.9em;
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
}

.prose pre {
  background: var(--pre-bg);
  color: var(--pre-text);
  padding: 16px 20px;
  border-radius: var(--radius);
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 1.5em 0;
  font-size: 0.85rem;
  line-height: 1.6;
}

.prose pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  color: inherit;
}

.prose img {
  max-width: 100%;
  border-radius: var(--radius);
  margin: 1.5em 0;
  border: 1px solid var(--border-medium);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

.prose hr {
  border: none;
  border-top: 1px solid var(--border-medium);
  margin: 2em 0;
}

/* Wiki page list (non-dated pages grouped by section) */
.wiki-section {
  margin-bottom: 32px;
}

.wiki-section h3 {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.wiki-section ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wiki-section a {
  font-size: 0.95rem;
  color: var(--text);
  padding: 6px 0;
  display: block;
  transition: color 0.2s;
}

.wiki-section a:hover {
  color: var(--link-color);
}

/* ── Portfolio wiki page hero ── */
.portfolio-hero {
  max-width: 680px;
  margin-bottom: 24px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.portfolio-hero-logo {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px var(--cube-shadow));
}

.portfolio-hero-tagline {
  flex: 1;
  min-width: 200px;
  font-size: 1.1rem;
  color: var(--text-muted);
  line-height: 1.5;
  align-self: center;
}

.portfolio-hero-screenshots {
  width: 100%;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.portfolio-hero-screenshots img {
  max-width: 100%;
  border-radius: var(--radius);
  max-height: 300px;
  object-fit: cover;
}

/* ── Wiki layout (main + sidebar) ── */
.wiki-layout {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 48px;
  align-items: start;
}

.wiki-main {
  min-width: 0;
}

.wiki-sidebar {
  position: sticky;
  top: calc(var(--nav-height) + 24px);
  max-height: calc(100vh - var(--nav-height) - 48px);
  overflow-y: auto;
}

.wiki-sidebar h3 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.wiki-sidebar-section {
  margin-bottom: 16px;
}

.wiki-sidebar-section h4 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  opacity: 0.7;
  margin-bottom: 4px;
}

.wiki-sidebar-section ul {
  list-style: none;
}

.wiki-sidebar-section a {
  font-size: 0.85rem;
  color: var(--text);
  display: block;
  padding: 3px 0;
  transition: color 0.2s;
}

.wiki-sidebar-section a:hover {
  color: var(--link-color);
}

/* ── Portfolio visit link ── */
.iso-visit {
  position: absolute;
  bottom: 6%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--visit-text);
  background: var(--visit-bg);
  padding: 2px 8px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
  text-decoration: none;
  pointer-events: auto;
}

.iso-visit:hover {
  color: var(--text);
  background: var(--visit-hover-bg);
}

/* ── Theme toggle ── */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  color: var(--text-muted);
  transition: color 0.2s, background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }

/* ── Responsive ── */
@media (max-width: 960px) {
  .hex-grid {
    --grid-cube-size: 130px;
  }

  .wiki-layout {
    grid-template-columns: 1fr;
  }

  .wiki-sidebar {
    position: static;
    max-height: none;
    border-top: 1px solid var(--border-light);
    padding-top: 24px;
  }
}

@media (max-width: 700px) {
  .hero h1 {
    font-size: 2rem;
  }

  /* 3-2 → 2-1 on narrow: hide last real item in each row */
  .hex-narrow-hide {
    display: none;
  }

  .hex-grid {
    --grid-cube-size: 140px;
  }

  .category-legend {
    gap: 12px;
  }
}
