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

:root {
  --text-high: rgba(255, 255, 255, 0.9);
  --text-mid: rgba(255, 255, 255, 0.65);
  --text-low: rgba(255, 255, 255, 0.38);
  --text-link: #4ade80;
  --divider: rgba(255, 255, 255, 0.08);
  --hover-bg: rgba(255, 255, 255, 0.07);
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  transition: background-color 0.2s ease;
}

/* ── Outer layout: nav | main column ─────────────────────────────────── */
.page-layout {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 1.25rem;
  width: 100%;
  max-width: 1440px;
  padding: 1.5rem;
}

/* ── Shared panel base ───────────────────────────────────────────────── */
.side-panel {
  border-radius: 1rem;
  outline: 5px solid var(--panel-border, #0d0d17);
  background-color: var(--info-bg, #2a2a3e);
  padding: 1.25rem;
  font-family: system-ui, sans-serif;
  color: var(--text-high);
  transition:
    background-color 0.2s ease,
    outline-color 0.2s ease,
    color 0.2s ease;
}

.side-panel .section-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-low);
  margin-bottom: 0.5rem;
  display: block;
}

.side-panel .divider {
  height: 1px;
  background: var(--divider);
  margin: 1rem 0;
}

/* ── Left nav panel ──────────────────────────────────────────────────── */
#nav-panel {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: 1.5rem;
  align-self: flex-start;
}

#nav-panel .tree {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

#nav-panel .tree ul {
  list-style: none;
  padding-left: 1rem;
  margin-top: 0.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

#nav-panel details > summary {
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-mid);
  padding: 0.3rem 0.4rem;
  border-radius: 0.4rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  user-select: none;
  transition:
    background 0.12s,
    color 0.12s;
}

#nav-panel details > summary::before {
  content: "▶";
  font-size: 0.55rem;
  color: var(--text-low);
  transition: transform 0.15s;
  flex-shrink: 0;
}

#nav-panel details[open] > summary::before {
  transform: rotate(90deg);
}

#nav-panel details > summary:hover {
  background: var(--hover-bg);
  color: var(--text-high);
}

#nav-panel .tree a {
  display: block;
  font-size: 0.8rem;
  color: var(--text-link);
  text-decoration: none;
  padding: 0.28rem 0.4rem;
  border-radius: 0.4rem;
  transition: background 0.12s;
}

#nav-panel .tree a:hover {
  background: var(--hover-bg);
}

#nav-panel .tree > li > a {
  font-size: 0.82rem;
  color: var(--text-mid);
}

#nav-panel .tree > li > a:hover {
  color: var(--text-high);
}

/* ── Main column ─────────────────────────────────────────────────────── */
.main-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ── Top row: logo + bio ─────────────────────────────────────────────── */
.top-row {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 1.25rem;
}

/* ── Logo panel ──────────────────────────────────────────────────────── */
#panel {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 1rem;
  outline: 5px solid var(--panel-border, #0d0d17);
  transition: outline-color 0.2s ease;
}

#panel::after,
#site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("../background.jpeg");
  background-repeat: repeat;
  background-size: auto;
  opacity: 0.8;
  z-index: 0;
}

#panel::after {
  pointer-events: none;
}

#logo-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5% 5%;
}

#logo-wrap::before {
  content: "";
  position: absolute;
  inset: -30px;
  background: radial-gradient(
    ellipse 52% 44% at 50% 50%,
    rgba(28, 28, 28, 0.97) 0%,
    rgba(22, 22, 22, 0.85) 45%,
    rgba(15, 15, 15, 0.4) 70%,
    transparent 100%
  );
  pointer-events: none;
}

img {
  position: relative;
  max-width: min(800px, 100%);
  height: auto;
}

/* ── Right column: bio + theme ───────────────────────────────────────── */
.right-col {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ── Info panel ──────────────────────────────────────────────────────── */
#info-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
}

#info-panel h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-high);
  margin-bottom: 0.2rem;
}

#info-panel .subtitle {
  font-size: 0.8rem;
  color: var(--text-low);
}

#info-panel p {
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text-mid);
}

#info-panel a {
  display: block;
  font-size: 0.82rem;
  color: var(--text-link);
  text-decoration: none;
  margin-bottom: 0.25rem;
}

#info-panel a:hover {
  text-decoration: underline;
}

#content-panel a {
  color: var(--text-link);
  text-decoration: none;
}

#content-panel a:hover {
  text-decoration: underline;
}

#info-panel > div {
  margin-bottom: 0;
}

/* ── Content panel ───────────────────────────────────────────────────── */
#content-panel {
  padding: 2rem;
  display: flex;
  flex-direction: column;
}

#li-embed {
  display: block;
  max-width: 100%;
}

#li-quote {
  margin: 0 15%;
  font-style: italic;
}

#li-quote.collapsed {
  max-height: 7.4375rem; /* ~5 lines at 0.85rem / 1.75 line-height */
  overflow: hidden;
  position: relative;
}

#li-quote.collapsed::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4rem;
  background: linear-gradient(transparent, var(--info-bg, #2a2a3e));
  pointer-events: none;
}

#li-read-more {
  margin-left: 15%;
  margin-top: 0.75rem;
  background: none;
  border: 1px solid var(--panel-border, #0d0d17);
  border-radius: 0.4rem;
  color: var(--text-mid);
  font-size: 0.8rem;
  padding: 0.3rem 1rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

#li-read-more:hover {
  color: var(--text-high);
  border-color: var(--text-mid);
}

#content-panel p {
  font-size: 0.85rem;
  line-height: 1.75;
  color: var(--text-mid);
  margin-bottom: 1rem;
}

/* ── Site header ─────────────────────────────────────────────────────── */
#site-header {
  align-self: stretch;
  position: relative;
  height: 200px;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
}

/* Inner container mirrors .page-layout so the logo tracks the nav column */
#header-inner {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 1.5rem;
  position: relative;
  z-index: 2;
}

#site-header::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to left,
    rgba(10, 10, 20, 0.97) 0%,
    rgba(10, 10, 20, 0.82) 30%,
    rgba(10, 10, 20, 0.25) 65%,
    transparent 100%
  );
  z-index: 1;
  pointer-events: none;
}

#header-bottom-blend {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2.5rem;
  background: linear-gradient(to top, var(--bg, #1a1a2e), transparent);
  pointer-events: none;
  z-index: 3;
}

#header-logo-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Circular dark vignette behind the logo to help it stand out */
#header-logo-wrap::before {
  content: "";
  position: absolute;
  inset: -30px;
  background: radial-gradient(
    ellipse 55% 70% at 50% 50%,
    rgba(10, 10, 20, 0.88) 0%,
    rgba(10, 10, 20, 0.55) 50%,
    transparent 100%
  );
  pointer-events: none;
}

#header-logo {
  position: relative;
  width: 220px;
  height: auto;
}

/* ── Nav active link ─────────────────────────────────────────────────── */
#nav-panel .tree a.active {
  color: var(--text-high);
  font-weight: 600;
  background: var(--hover-bg);
}

/* ── Project pages ───────────────────────────────────────────────────── */
.project-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.project-header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-high);
  margin-bottom: 0.25rem;
}

.project-header .tagline {
  font-size: 0.85rem;
  color: var(--text-low);
}

.github-link,
.render-open-btn {
  font-family: system-ui, sans-serif;
  color: var(--text-link);
  border: 1.5px solid currentColor;
  flex-shrink: 0;
  transition: opacity 0.12s;
}

.github-link:hover,
.render-open-btn:hover {
  opacity: 0.72;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.github-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  text-decoration: none;
  border-radius: 0.4rem;
  padding: 0.3rem 0.75rem;
  white-space: nowrap;
}

.project-body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 1rem;
}

.project-section h3 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-low);
  margin-bottom: 0.5rem;
}

.project-section p,
.project-section li {
  font-size: 0.85rem;
  line-height: 1.65;
  color: var(--text-mid);
  margin-bottom: 0.3rem;
}

.project-section ul {
  list-style: disc;
  padding-left: 1.4rem;
}

.project-section a {
  color: var(--text-link);
  text-decoration: none;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.25rem;
}

.tag {
  font-size: 0.72rem;
  font-family: monospace;
  color: var(--text-mid);
  border: 1px solid var(--divider);
  border-radius: 0.25rem;
  padding: 0.15rem 0.45rem;
}

.renders-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

.renders-row--2 {
  grid-template-columns: repeat(2, 1fr);
}

.render-card--span2 {
  grid-column: span 2;
}

.render-card--light-bg {
  background: #fff;
  border-radius: 0.5rem;
  overflow: hidden;
}

.render-placeholder {
  border-radius: 0.5rem;
  border: 1.5px dashed var(--divider);
  min-height: 6rem;
}

.render-card img {
  width: 100%;
  height: auto;
  border-radius: 0.5rem;
  display: block;
}

.renders-row--2 .render-card img {
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.render-card .render-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-low);
  text-align: center;
  margin-top: 0.4rem;
}

/* ── Render card footer (label + action button) ──────────────────────── */
.render-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.4rem;
}

.render-foot .render-label {
  margin-top: 0;
}

.render-open-btn {
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  background: none;
  border-radius: 0.3rem;
  padding: 0.15rem 0.55rem;
  cursor: pointer;
}

.render-center {
  display: flex;
  justify-content: center;
  margin-top: 0.75rem;
}

.render-open-btn--lg {
  font-size: 0.82rem;
  padding: 0.3rem 0.75rem;
  border-radius: 0.4rem;
}

/* ── Video modal ──────────────────────────────────────────────────────── */
.video-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.video-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  cursor: pointer;
}

.video-modal__box {
  position: relative;
  z-index: 1;
  width: min(90vw, 960px);
}

.video-modal__video {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 0.5rem;
}

.video-modal__close {
  position: absolute;
  top: -1.75rem;
  right: 0;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.65);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  line-height: 1;
  transition: color 0.12s;
}

.video-modal__close:hover {
  color: #fff;
}

.video-modal__caption {
  margin-top: 0.6rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}

/* ── Admin login button ──────────────────────────────────────────────── */
#nav-login-btn {
  display: block;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-mid);
  border: 1px solid var(--divider);
  border-radius: 0.4rem;
  padding: 0.45rem 0;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}

#nav-login-btn:hover {
  background: var(--hover-bg);
  color: var(--text-high);
}

/* ── Theme swatch picker ─────────────────────────────────────────────── */
#picker-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding-top: 0.25rem;
}

#swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.swatch {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  border: 2.5px solid transparent;
  cursor: pointer;
  transition:
    transform 0.12s ease,
    border-color 0.12s ease;
  outline: none;
  padding: 0;
  flex-shrink: 0;
}

.swatch:hover {
  transform: scale(1.15);
}
.swatch.active {
  border-color: rgba(255, 255, 255, 0.75);
}

/* ── Hamburger button ────────────────────────────────────────────────── */
#nav-toggle {
  display: none;
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 600;
  background: var(--info-bg, #2a2a3e);
  border: none;
  border-radius: 0.5rem;
  outline: 2.5px solid var(--panel-border, #0d0d17);
  padding: 0.5rem 0.55rem;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  transition:
    background-color 0.2s ease,
    outline-color 0.2s ease;
}

#nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-high, rgba(255, 255, 255, 0.9));
  border-radius: 2px;
  transition:
    transform 0.22s ease,
    opacity 0.15s ease;
}

#nav-toggle.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

#nav-toggle.open span:nth-child(2) {
  opacity: 0;
}

#nav-toggle.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ── Mobile nav drawer ───────────────────────────────────────────────── */
#nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 490;
}

#nav-overlay.nav-open {
  display: block;
}

/* ── Responsive: reflow bio + theme below logo before logo shrinks ───── */
@media (max-width: 1260px) {
  .top-row {
    flex-direction: column;
  }

  .right-col {
    width: 100%;
  }
}

@media (max-width: 600px) {
  #nav-toggle {
    display: flex;
  }

  #nav-panel {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 260px;
    z-index: 500;
    border-radius: 0 1rem 1rem 0;
    overflow-y: auto;
    padding-top: 4rem;
    transform: translateX(-100%);
    transition:
      transform 0.25s ease,
      background-color 0.2s ease,
      outline-color 0.2s ease;
  }

  #nav-panel.nav-open {
    transform: translateX(0);
  }
}

/* ── Blog listing ────────────────────────────────────────────────────── */
.blog-list {
  display: flex;
  flex-direction: column;
  margin-top: 1.25rem;
}

.blog-card {
  display: grid;
  grid-template-columns: 7rem 1fr;
  grid-template-rows: auto auto;
  column-gap: 1.25rem;
  row-gap: 0.2rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--divider);
  text-decoration: none;
  transition: background 0.12s;
  border-radius: 0.4rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.blog-card:first-child { border-top: 1px solid var(--divider); }

.blog-card:hover { background: var(--hover-bg); }

.blog-card__date {
  grid-row: 1 / 3;
  grid-column: 1;
  font-size: 0.72rem;
  color: var(--text-low);
  font-variant-numeric: tabular-nums;
  padding-top: 0.15rem;
}

.blog-card__title {
  grid-row: 1;
  grid-column: 2;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-link);
}

.blog-card__desc {
  grid-row: 2;
  grid-column: 2;
  font-size: 0.82rem;
  color: var(--text-mid);
  line-height: 1.5;
}

.blog-empty {
  font-size: 0.85rem;
  color: var(--text-mid);
  margin-top: 1rem;
}

/* ── Blog post body ───────────────────────────────────────────────────── */
.blog-post-content {
  margin-top: 1.5rem;
  width: 100%;
}

.blog-post-content h1,
.blog-post-content h2,
.blog-post-content h3 {
  font-weight: 600;
  color: var(--text-high);
  margin: 1.5rem 0 0.5rem;
  line-height: 1.3;
}

.blog-post-content h1 { font-size: 1.25rem; }
.blog-post-content h2 { font-size: 1.05rem; }
.blog-post-content h3 { font-size: 0.9rem; }

.blog-post-content p {
  font-size: 0.875rem;
  line-height: 1.75;
  color: var(--text-mid);
  margin-top: 1rem;
  margin-bottom: 0.9rem;
  text-indent: 2em;
}

.blog-post-content a {
  color: var(--text-link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.blog-post-content ul,
.blog-post-content ol {
  padding-left: 1.4rem;
  margin-bottom: 0.9rem;
}

.blog-post-content li {
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--text-mid);
  margin-bottom: 0.2rem;
}

.blog-post-content code {
  font-family: 'Courier New', monospace;
  font-size: 0.85em;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--divider);
  border-radius: 0.25rem;
  padding: 0.1em 0.35em;
  color: var(--text-link);
}

.blog-post-content pre {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--divider);
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}

.blog-post-content pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-mid);
  font-size: 0.82rem;
}

.blog-post-content blockquote {
  border-left: 3px solid var(--text-link);
  margin: 0 0 1rem;
  padding: 0.25rem 0 0.25rem 1rem;
  color: var(--text-mid);
  font-style: italic;
}

.blog-post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  display: block;
}

/* JS-rendered tooltip, appended to <body> to escape stacking contexts */
#swatch-tip {
  position: fixed;
  background: rgba(0, 0, 0, 0.82);
  color: rgba(255, 255, 255, 0.92);
  font-family: system-ui, sans-serif;
  font-size: 0.7rem;
  font-weight: 500;
  white-space: nowrap;
  padding: 0.2rem 0.5rem;
  border-radius: 0.3rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
  z-index: 9999;
}
