:root {
  color-scheme: light;
  --bg: #f3f1ec;
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --panel-soft: #f8f7f4;
  --text: #222222;
  --muted: #68635c;
  --faint: #9a948c;
  --line: rgba(34, 34, 34, .10);
  --line-strong: rgba(34, 34, 34, .16);
  --accent: #3f3a34;
  --accent-soft: rgba(63, 58, 52, .075);
  --green: #5f8f67;
  --orange: #c89045;
  --red: #c96f62;
  --shadow: 0 18px 50px rgba(35, 31, 26, .09);
  --radius: 16px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.dark-mode {
  color-scheme: dark;
  --bg: #151515;
  --panel: #1e1e1e;
  --panel-strong: #222222;
  --panel-soft: #191919;
  --text: #eeeeea;
  --muted: #aaa49c;
  --faint: #77716a;
  --line: rgba(255, 255, 255, .09);
  --line-strong: rgba(255, 255, 255, .14);
  --accent: #e5e0d7;
  --accent-soft: rgba(229, 224, 215, .075);
  --shadow: 0 18px 60px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
}
a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.page-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 26px;
  position: relative;
}

.intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 22px;
}
.eyebrow {
  margin: 0 0 8px;
  font: 600 .75rem/1 var(--mono);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .13em;
}
h1 {
  margin: 0;
  font-size: clamp(2.35rem, 5.6vw, 4.7rem);
  line-height: .95;
  letter-spacing: -.055em;
}
.mini-bio {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.4vw, 1.25rem);
}
.links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 285px;
}
.links a, .links button, .preview-links a {
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
  border-radius: 10px;
  padding: 10px 13px;
  font: 700 .82rem/1 var(--mono);
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
  cursor: pointer;
}
.links button { min-width: 42px; }
.links a:hover, .links button:hover, .preview-links a:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 70%, var(--line));
  background: var(--accent-soft);
}

.explorer {
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  }
.window-bar {
  height: 46px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-strong);
}
.traffic { display: flex; gap: 7px; }
.traffic span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: block;
}
.traffic span:nth-child(1) { background: var(--red); }
.traffic span:nth-child(2) { background: var(--orange); }
.traffic span:nth-child(3) { background: var(--green); }
.path {
  color: var(--faint);
  font: 500 .78rem/1 var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.workspace {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  min-height: min(650px, calc(100vh - 210px));
}
.sidebar {
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel-soft) 75%, transparent);
  padding: 16px 10px 14px;
  overflow: auto;
}
.sidebar-title {
  padding: 0 8px 11px;
  font: 700 .72rem/1 var(--mono);
  color: var(--faint);
  letter-spacing: .12em;
}
.file-tree { display: grid; gap: 2px; }
.tree-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  font: 500 .84rem/1 var(--mono);
  text-align: left;
  cursor: pointer;
  transition: background .14s ease, color .14s ease, transform .14s ease;
}
.tree-row:hover { background: var(--accent-soft); color: var(--text); }
.tree-row.active { background: var(--accent-soft); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.tree-row .chev { width: 13px; display: inline-flex; color: var(--faint); transition: transform .16s ease; }
.tree-row.folder[data-open="true"] .chev { transform: rotate(90deg); }
.tree-icon { width: 22px; display: inline-flex; justify-content: center; color: var(--accent); }
.tree-row.folder .tree-icon { color: var(--orange); }

.preview {
  padding: clamp(24px, 5vw, 56px);
  overflow: auto;
}
.preview-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 10px;
  color: var(--muted);
  background: var(--panel-soft);
  font: 600 .75rem/1 var(--mono);
}
.preview-title {
  margin: 0 0 14px;
  font-size: clamp(2.1rem, 5vw, 4.4rem);
  line-height: .95;
  letter-spacing: -.055em;
  max-width: 780px;
}
.preview-body {
  max-width: 760px;
  color: var(--muted);
  font-size: clamp(1.03rem, 1.7vw, 1.25rem);
  line-height: 1.65;
  margin: 0 0 24px;
}
.preview-list {
  list-style: none;
  padding: 0;
  margin: 0 0 28px;
  display: grid;
  gap: 10px;
  max-width: 790px;
}
.preview-list li {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  background: var(--panel-soft);
}
.preview-list li::before {
  content: "›";
  color: var(--accent);
  font-weight: 800;
  margin-right: 10px;
}
.preview-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.preview-code {
  margin-top: 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-soft);
  font: 500 .82rem/1.8 var(--mono);
  color: var(--muted);
  overflow: auto;
}
.preview-code b { color: var(--accent); font-weight: 600; }

.footer {
  padding: 18px 2px 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--faint);
  font: 500 .78rem/1.4 var(--mono);
}

@media (max-width: 860px) {
  .intro { align-items: flex-start; flex-direction: column; }
  .links { justify-content: flex-start; min-width: 0; }
  .workspace { grid-template-columns: 1fr; min-height: 0; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); max-height: 315px; }
}
@media (max-width: 560px) {
  .page-shell { width: min(100% - 18px, 1120px); padding-top: 16px; }
  .intro { margin-bottom: 14px; }
  h1 { font-size: clamp(2.45rem, 14vw, 4rem); }
  .mini-bio { font-size: .98rem; }
  .window-bar { height: 42px; padding-inline: 12px; }
  .preview { padding: 22px; }
  .preview-title { font-size: 2.25rem; }
  .preview-body { font-size: 1rem; }
  .links a, .links button, .preview-links a { padding: 9px 11px; font-size: .76rem; }
  .footer { flex-direction: column; }
}

/* Expandable right-panel detail rows */
.preview-list .detail-item {
  padding: 0;
  overflow: hidden;
}
.detail-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  font: 600 .95rem/1.4 var(--sans);
  cursor: pointer;
}
.detail-toggle:hover { background: var(--accent-soft); }
.detail-arrow {
  color: var(--accent);
  font-weight: 900;
  transition: transform .16s ease;
  display: inline-flex;
  width: 14px;
  justify-content: center;
}
.detail-item.open .detail-arrow { transform: rotate(90deg); }
.detail-body {
  display: none;
  padding: 0 16px 14px 38px;
  color: var(--muted);
  line-height: 1.65;
  font-size: .96rem;
}
.detail-item.open .detail-body { display: block; }
.preview-list li::before { content: none; }
