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

:root {
  --text: #2d2d2d;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --bg: #faf9f8;
  --card-bg: #fffdf7;
  --accent: #FFA833;
}

body {
  font-family: 'Inconsolata', monospace;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  padding: 2rem 1rem;
  font-size: 15px;
}

.container {
  max-width: 900px;
  margin: 0 auto;
}

/* Header and Navigation */
header {
  margin-bottom: 1.0rem;
  padding: 1rem 0;
}

header nav {
  display: flex;
  gap: 2rem;
  align-items: center;
  justify-content: center;
}

header nav a {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 1.5rem;
  transition: color 0.2s, background 0.2s;
  position: relative;
  padding: 0.25rem 0.4rem;
}

header nav a:hover {
  color: white;
  background: var(--text);
}

header nav a.active {
  color: var(--accent);
}

header nav a.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
}

/* Main content box */
main {
  margin-bottom: 2rem;
}

/* Typography */
h1 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.75rem;
  color: var(--text);
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  color: var(--text);
}

h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

p {
  margin-bottom: 1rem;
  color: var(--text);
}

a {
  color: var(--text-muted);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 5px;
  transition: color 0.2s, background 0.2s;
}

a:hover {
  color: #ffffff;
  background: var(--text);
  text-decoration: none;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* Lists */
ul, ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.5rem;
}

/* Code */
code {
  font-family: 'Inconsolata', monospace;
  font-size: 0.9em;
  background: var(--bg);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  border: 1px solid var(--border);
}

pre {
  background: var(--bg);
  padding: 1.25rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow-x: auto;
  margin-bottom: 1.25rem;
}

pre code {
  background: none;
  padding: 0;
  border: none;
}

/* Shared box style */
.about-box,
.info-box,
.project-card,
.timeline-item,
.post-list a,
footer {
  background: var(--card-bg);
  border: 2.5px solid var(--border);
  border-radius: 6px;
  border-color: #888888;
}

/* Post List - Each post in a box */
.post-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.post-list li {
  margin: 0;
}

.post-list a {
  display: flex;
  align-items: stretch;
  overflow: hidden;
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s;
}

.post-preview-content {
  flex: 1;
  padding: 1.25rem;
  min-width: 0;
}

.post-preview-img {
  width: 140px;
  flex-shrink: 0;
}

.post-preview-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.post-list a:hover,
.project-card:hover,
.timeline-item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.post-list h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
  color: var(--text);
}

.post-date {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.post-summary {
  display: block;
  color: var(--text);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

/* Project Cards - Grid layout */
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 1.5rem;
  max-width: 1350px;
  width: calc(100vw - 2rem);
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s;
}

.project-grid.loaded {
  opacity: 1;
}

.project-card {
  padding: 1.5rem;
  transition: border-color 0.2s, transform 0.2s;
  display: flex;
  flex-direction: column;
}

.project-card.featured {
  grid-column: span 2;
}

.project-card.featured .slideshow {
  height: auto;
  aspect-ratio: 18 / 9;
}

.project-card h3 {
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.project-card p {
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.project-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 1rem;
}

.slideshow {
  position: relative;
  height: 200px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.slideshow img,
.slideshow video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  margin-bottom: 0;
  border-radius: 0;
  transition: opacity 0.4s;
}

.slideshow img.active,
.slideshow video.active {
  opacity: 1;
}

.slideshow-dots {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
  pointer-events: none;
}
.slideshow-dots-inner {
  display: flex;
  gap: 6px;
  align-items: center;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 99px;
  padding: 5px 8px;
  pointer-events: all;
}

.dot {
  cursor: pointer;
  user-select: none;
  width: 8.75px;
  height: 8.75px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transition: background 0.3s;
}

.dot.active {
  background: #ffffff;
}

/* Lightbox nav arrows */
.lb-prev, .lb-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 3rem;
  line-height: 1;
  padding: 0.5rem 1.25rem;
  cursor: pointer;
  transition: color 0.15s;
  user-select: none;
  z-index: 1;
}

.lb-prev:hover, .lb-next:hover { color: white; }
.lb-prev { left: 0; }
.lb-next { right: 0; }
.lb-prev[hidden], .lb-next[hidden] { display: none; }

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.lightbox.active {
  display: flex;
}

.lightbox img,
.lightbox video {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 6px;
  cursor: default;
}

@media (max-width: 768px) {
  .project-grid {
    grid-template-columns: 1fr;
  }

  .project-card.featured {
    grid-column: span 1;
  }

  .slideshow-arrow { font-size: 1.75rem; padding: 0.5rem 0.75rem; }
  .toc-list { columns: 1; }
}

/* Footer */
footer {
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 640px) {
  body {
    padding: 1rem 0.75rem;
  }

  footer {
    padding: 1.25rem;
  }

  h1 {
    font-size: 1.75rem;
  }

  header nav {
    gap: 1.25rem;
  }

  header nav a { font-size: 1.2rem; }
  .tab-button { padding: 0.75rem 1rem; }
  .post-list a { flex-direction: column; }
  .post-preview-img { width: 100%; height: 160px; }
  .back-to-top { bottom: 1rem; right: 0.75rem; padding: 0.5rem 0.9rem; }
  .toc-title { font-size: 0.8rem; }
}

/* Collapsible sections */
details {
  margin-bottom: 0.75rem;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
}

details[open] {
  border-color: #888888;
}

details summary {
  padding: 0.75rem 1rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  list-style: none;
  transition: color 0.2s;
}

details summary::-webkit-details-marker {
  display: none;
}

details summary::before {
  content: '\25B6';
  font-size: 0.6em;
  display: inline-block;
  margin-right: 0.6rem;
  transition: transform 0.2s;
  vertical-align: middle;
}

details[open] summary::before {
  transform: rotate(90deg);
}

details[open] summary {
  border-bottom: 1px solid var(--border);
  color: var(--accent);
}

details > ul,
details > ol {
  padding: 1rem 1.25rem;
  margin-bottom: 0;
}

details > ul > li:last-child,
details > ol > li:last-child {
  margin-bottom: 0;
}

details > table {
  margin: 0.75rem 1rem;
  width: calc(100% - 2rem);
}

details > p,
details > blockquote {
  margin: 0.75rem 1rem;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.85rem;
}

th {
  background: var(--text);
  color: var(--card-bg);
  font-weight: 600;
  text-align: left;
  padding: 0.6rem 0.75rem;
}

td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

tbody tr:hover {
  background: rgba(255, 168, 51, 0.06);
}

/* Blockquotes */
blockquote {
  border-left: 3px solid var(--accent);
  margin: 1rem 0;
  padding: 0.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

blockquote p {
  margin: 0;
  color: var(--text-muted);
}

/* Task lists (checklist) */
.contains-task-list {
  list-style: none;
  padding-left: 0;
}

details > .contains-task-list {
  padding: 1rem 1.25rem;
  columns: 2;
  column-gap: 1.5rem;
}

.contains-task-list .contains-task-list {
  padding-left: 1.25rem;
  margin-top: 0.15rem;
  columns: 1;
}

.task-list-item {
  padding-left: 1.6rem;
  position: relative;
  margin-bottom: 0.35rem;
  break-inside: avoid;
}

.task-list-item-checkbox {
  position: absolute;
  left: 0;
  top: 0.25em;
  appearance: none;
  -webkit-appearance: none;
  width: 1em;
  height: 1em;
  border: 2px solid #aaa;
  border-radius: 3px;
  background: transparent;
  cursor: default;
  margin: 0;
}

.task-list-item-checkbox:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.task-list-item-checkbox:checked::after {
  content: '\2713';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.75em;
  line-height: 1;
  color: white;
  font-weight: bold;
}

/* Info box */
.info-box {
  padding: 1.25rem;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.info-box p {
  margin: 0;
}

/* About box */
.about-box {
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.about-box h2 {
  margin-top: 0;
  font-size: 1.1rem;
}

.about-box p {
  font-size: 1.0rem;
  color: var(--text);
}

/* Hero split layout */
.hero {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  margin-bottom: 1.5rem;
  background: var(--card-bg);
  border: 2.5px solid #888888;
  border-radius: 6px;
  overflow: hidden;
  min-height: 280px;
}

.hero-text {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.85rem;
}

.hero-text h1 {
  margin: 0;
  font-size: 1.9rem;
  line-height: 1.15;
}

.hero-role {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.88rem;
  margin: 0;
  letter-spacing: 0.02em;
}

.hero-bio {
  font-size: 0.9rem;
  color: var(--text);
  margin: 0;
  line-height: 1.55;
}

.hero-links {
  font-size: 0.88rem;
  margin: 0;
}

.hero-render {
  position: relative;
  border-left: 2.5px solid #888888;
  overflow: hidden;
}

.hero-caption {
  position: absolute;
  bottom: 0.5rem;
  right: 0.6rem;
  font-size: 0.65rem;
  color: rgba(255,255,255,0.55);
  pointer-events: none;
  user-select: none;
}

.hero-caption a {
  color: inherit;
  text-decoration: underline;
  pointer-events: all;
}

.hero-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 768px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: unset;
  }

  .hero-render {
    border-left: none;
    border-top: 2.5px solid #888888;
    aspect-ratio: 16 / 7;
  }

  .hero-img {
    position: static;
    width: 100%;
    height: 100%;
    display: block;
  }
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  justify-content: center;
}

.tab-button {
  background: none;
  border: none;
  padding: 1rem 2rem;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
  font-family: inherit;
  flex: 1;
}

.tab-button:hover {
  color: var(--text);
}

.tab-button.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Timeline for life/experience */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.timeline-item {
  padding: 1.25rem;
  transition: border-color 0.2s, transform 0.2s;
}

.timeline-item h3 {
  margin: 0 0 0.25rem 0;
  font-size: 1.1rem;
}

.timeline-item .role {
  color: var(--text);
  font-weight: 500;
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.timeline-item .date {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.timeline-item p {
  color: var(--text);
  font-size: 0.9rem;
  margin-bottom: 0;
}

/* Image compare slider */
.img-compare {
  position: relative;
  overflow: hidden;
  cursor: crosshair;
}

.img-compare .ic-right {
  width: 100%;
  display: block;
}

.img-compare .ic-left {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  clip-path: inset(0 50% 0 0);
}

.img-compare .ic-line {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 100%;
  background: var(--accent);
  box-shadow: 0 0 6px rgba(0,0,0,0.4);
  pointer-events: none;
}

.img-compare .ic-label {
  position: absolute;
  bottom: 8px;
  font-size: 0.8em;
  color: white;
  text-shadow: 0 0 5px #111;
  pointer-events: none;
  background: rgba(0,0,0,0.35);
  padding: 2px 7px;
  border-radius: 3px;
}

.img-compare .ic-label-left { left: 8px; }
.img-compare .ic-label-right { right: 8px; }

/* Table of Contents */
.toc {
  background: var(--card-bg);
  border: 2px solid var(--accent);
  border-radius: 6px;
  padding: 0.75rem 1rem 0.65rem;
  margin: 1.5rem 0;
}

.toc-title {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  columns: 2;
  column-gap: 1.5rem;
}


.toc-list li {
  margin: 0;
  break-inside: avoid;
}

.toc-list a {
  display: block;
  padding: 0.18rem 0;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  line-height: 1.4;
  transition: color 0.15s;
}

.toc-list a::before {
  content: '→ ';
  color: var(--accent);
  font-size: 0.8em;
}

.toc-list a:hover {
  color: var(--text);
  background: none;
}

.toc-list a.toc-active {
  color: var(--accent);
}

/* Back to top */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--card-bg);
  border: 2px solid var(--accent);
  border-radius: 6px;
  color: var(--accent);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, background 0.2s, color 0.2s;
  z-index: 200;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--accent);
  color: white;
}