/* ============================================================
   BLOG — restyled "code editor" window (light / editorial)
   ============================================================ */

.code-window {
  max-width: 62rem;
  margin: 2rem auto 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 34px 80px -44px rgba(58, 56, 47, 0.55);
  overflow: hidden;
}

/* title bar */
.win-bar {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
}
.win-dots {
  display: flex;
  gap: 0.45rem;
}
.win-dots i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: block;
}
.win-dots .r {
  background: #e0695f;
}
.win-dots .y {
  background: #ddb84e;
}
.win-dots .g {
  background: #76bf6b;
}
.win-name {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--muted);
}

/* body: explorer + editor */
.win-body {
  display: grid;
  grid-template-columns: 13rem 1fr;
  height: 23rem;
}
.explorer {
  border-right: 1px solid var(--line);
  padding: 1.1rem 0.85rem;
}
.explorer-title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.9rem;
}
.folder {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0;
  user-select: none;
}
.folder .caret {
  display: inline-block;
  transition: transform 0.25s var(--ease);
  color: var(--muted);
}
.file-list {
  list-style: none;
  margin: 0.1rem 0 0.8rem 0.9rem;
  overflow: hidden;
  max-height: 20rem;
  opacity: 1;
  transition:
    max-height 0.32s var(--ease),
    opacity 0.32s var(--ease),
    margin-bottom 0.32s var(--ease);
}
.file-list.collapsed {
  max-height: 0;
  opacity: 0;
  margin-bottom: 0;
}
/* root-level file (e.g. CLAUDE.md), aligned with the folder rows */
.file-list.rootlist {
  margin-left: 0;
}
.file-list.rootlist li {
  padding-left: 0;
}
.file-list li {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--muted);
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
  cursor: pointer;
  transition:
    color 0.2s var(--ease),
    background 0.2s var(--ease);
}
.file-list li:hover {
  color: var(--text);
}
.file-list li.active {
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 15%, transparent);
}

/* editor */
.editor {
  padding: 1.7rem 1.9rem;
  overflow-y: auto;
  min-height: 0;
}
.project-preview.hidden {
  display: none;
}
.editor h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--step-1);
  letter-spacing: -0.01em;
  margin-bottom: 1rem;
}
.editor h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--step-0);
  color: var(--accent);
  margin: 1.5rem 0 0.4rem;
}
.editor h2 + h3 {
  margin-top: 0.4rem;
}
.editor p {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 1.2rem;
}
.editor-link {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  width: fit-content;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--text);
  text-decoration: none;
  padding: 0.35rem 0;
  transition: color 0.25s var(--ease);
}
/* project files: links sit inline in a row */
[id^="project-"] .editor-link {
  display: inline-flex;
  width: auto;
  margin-right: 1.6rem;
}
.editor-link .ext {
  color: var(--muted);
  transition: color 0.25s var(--ease);
}
.editor-link:hover,
.editor-link:hover .ext {
  color: var(--contrast);
}

/* status bar */
.win-status {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 1rem;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}
.win-status .left-status,
.win-status .right-status {
  display: flex;
  gap: 1.2rem;
}
.win-status .branch {
  color: var(--accent);
}

@media (max-width: 720px) {
  .win-body {
    display: block;
    height: auto;
  }
  .explorer {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  /* the title becomes a tap-to-expand toggle */
  .explorer-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    margin-bottom: 0;
  }
  .explorer-title::after {
    content: "▾";
    color: var(--muted);
    transition: transform 0.25s var(--ease);
  }
  .explorer:not(.open) .explorer-title::after {
    transform: rotate(-90deg);
  }
  .explorer:not(.open) .folder,
  .explorer:not(.open) .file-list {
    display: none;
  }
  .explorer.open .folder {
    margin-top: 0.9rem;
  }
  .editor {
    max-height: 60vh;
  }
}

/* trim the status bar progressively on narrow screens */
@media (max-width: 600px) {
  .win-status .branch,
  .win-status .cursor-pos {
    display: none;
  }
}
@media (max-width: 400px) {
  .win-status .file-name {
    display: none;
  }
}
