:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #edf2f8;
  --text: #101720;
  --muted: #5e6b7c;
  --dim: #7b8796;
  --line: rgba(47, 59, 75, 0.16);
  --line-strong: #1e67c8;
  --accent: #1e67c8;
  --accent-soft: rgba(30, 103, 200, 0.08);
  --shadow: rgba(39, 53, 73, 0.1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #05070b;
  --panel: #070a10;
  --panel-soft: #0b1018;
  --text: #f8fbff;
  --muted: #9aa7ba;
  --dim: #687386;
  --line: rgba(154, 167, 186, 0.16);
  --line-strong: #6aa7ff;
  --accent: #6aa7ff;
  --accent-soft: rgba(106, 167, 255, 0.07);
  --shadow: rgba(0, 0, 0, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", "Segoe UI", sans-serif;
  font-size: 16px;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input {
  color: var(--text);
}

.site-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 760px);
  gap: 54px;
  width: min(1080px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 64px 0 48px;
}

.site-sidebar,
.site-main {
  min-width: 0;
}

.site-sidebar {
  padding-top: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  color: var(--text);
}

.brand:hover {
  text-decoration: none;
}

.brand span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--accent);
  background: var(--panel);
  font-size: 12px;
  font-weight: 750;
}

.brand strong {
  font-size: 17px;
}

.sidebar-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 8px;
  margin-top: 22px;
}

.sidebar-search input,
.archive-controls input,
.archive-controls select {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: 0;
  background: var(--panel-soft);
}

.sidebar-search input {
  padding: 0 11px;
}

.sidebar-search input:focus,
.archive-controls input:focus,
.archive-controls select:focus {
  border-color: var(--line-strong);
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.icon-button:hover {
  background: var(--accent-soft);
}

.site-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 22px;
}

.site-nav a {
  min-height: 27px;
  border-radius: 5px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 650;
  line-height: 27px;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--accent);
  text-decoration: none;
}

.site-nav .folder-link::before {
  content: "›";
  display: inline-block;
  width: 14px;
  color: var(--accent);
  font-size: 19px;
  vertical-align: -1px;
}

.home-terminal {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(210px, 0.82fr);
  overflow: visible;
  min-height: 198px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel);
}

.terminal-version {
  position: absolute;
  z-index: 1;
  top: 0;
  left: 14px;
  display: flex;
  gap: 7px;
  margin: 0;
  padding: 0 7px;
  transform: translateY(-52%);
  background: var(--panel);
  color: var(--accent);
  font-size: 12px;
}

.terminal-version span {
  color: var(--muted);
}

.terminal-main {
  display: flex;
  min-height: 198px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 25px 18px 16px;
  text-align: center;
}

.terminal-main h1 {
  margin: 0 0 10px;
  font-size: 21px;
  line-height: 1.2;
}

.terminal-profile {
  width: 58px;
  height: 58px;
  border: 1px solid rgba(106, 167, 255, 0.48);
  border-radius: 8px;
  background: #020305;
  object-fit: cover;
}

.terminal-accent,
.terminal-path {
  margin: 0;
}

.terminal-accent {
  margin-top: 10px;
  color: var(--accent);
  font-weight: 650;
}

.terminal-path {
  margin-top: 3px;
  color: var(--muted);
  font-size: 14px;
}

.terminal-side {
  padding: 18px 15px 13px;
  border-left: 1px solid var(--line-strong);
  background: var(--panel);
}

.terminal-side h2 {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 14px;
}

.terminal-side p {
  margin: 3px 0;
  font-size: 14px;
  line-height: 1.35;
}

.terminal-side hr,
.home-archive hr {
  height: 1px;
  margin: 9px 0;
  border: 0;
  background: var(--line);
}

.terminal-news-item {
  color: var(--text);
  font-weight: 700;
}

.home-archive,
.content-panel {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  box-shadow: 0 18px 48px var(--shadow);
}

.home-archive {
  margin-top: 32px;
  padding: 17px 19px 20px;
}

.home-archive-kicker {
  margin: 0;
  font-weight: 700;
}

.home-archive-kicker span {
  color: var(--accent);
}

.home-archive > hr {
  margin: 14px 0 28px;
}

.home-archive h2 {
  margin: 0;
  font-size: 18px;
}

.post-list {
  margin-top: 12px;
}

.post-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: baseline;
  gap: 12px;
  min-height: 43px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
}

.post-row:hover {
  background: var(--accent-soft);
  text-decoration: none;
}

.post-row strong {
  min-width: 0;
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-row span,
.post-row time {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.content-panel {
  padding: 20px;
}

.panel-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.panel-header h1,
.series-header h1 {
  margin: 3px 0 0;
  font-size: 28px;
  line-height: 1.2;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.command-button,
.archive-controls button {
  display: inline-grid;
  min-height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.command-button {
  padding: 0 12px;
}

.command-button:hover,
.archive-controls button:hover {
  border-color: var(--line-strong);
  text-decoration: none;
}

.archive-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px 58px;
  gap: 8px;
  margin: 16px 0 8px;
}

.archive-controls input,
.archive-controls select {
  padding: 0 10px;
}

.archive-controls button {
  padding: 0 10px;
}

.search-result,
.empty-state {
  color: var(--muted);
  font-size: 14px;
}

.info-panel {
  padding: 20px;
}

.info-banner,
.series-cover,
.post-body img {
  display: block;
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #020305;
}

.info-banner {
  aspect-ratio: 3 / 1;
  object-fit: cover;
}

.info-copy {
  padding-top: 18px;
}

.info-copy h1 {
  margin: 0;
  font-size: 18px;
}

.info-copy p {
  margin: 12px 0 0;
}

.account-links {
  font-weight: 650;
}

.breadcrumbs {
  display: flex;
  gap: 8px;
  align-items: baseline;
  overflow: hidden;
  margin-bottom: 23px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.breadcrumbs > :last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.post-header {
  margin-bottom: 28px;
}

.post-header h1 {
  margin: 0;
  font-size: clamp(27px, 4vw, 36px);
  line-height: 1.3;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.post-body {
  padding: 24px 20px 30px;
  font-size: 16px;
  line-height: 1.85;
}

.post-body p,
.series-body p {
  margin: 0;
}

.post-body .content-break,
.series-body .content-break {
  height: 1.85em;
}

.post-body h1,
.post-body h2,
.post-body h3,
.series-body h1,
.series-body h2,
.series-body h3 {
  margin: 0;
  line-height: 1.35;
}

.post-body blockquote {
  margin: 0;
  padding-left: 16px;
  border-left: 2px solid var(--accent);
  color: var(--muted);
}

.post-body pre {
  overflow: auto;
  padding: 16px;
  border-radius: 6px;
  background: var(--panel-soft);
}

.post-body img {
  margin: 6px 0;
}

.series-header {
  padding-bottom: 16px;
}

.series-cover {
  margin-top: 4px;
  aspect-ratio: 16 / 9;
  object-fit: contain;
}

.series-body {
  margin-top: 18px;
  line-height: 1.8;
}

.series-posts {
  margin-top: 32px;
}

.series-posts h2 {
  margin: 0;
  font-size: 18px;
}

.compact-panel {
  max-width: 520px;
}

@media (max-width: 1040px) {
  .site-shell {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 32px;
    width: calc(100% - 32px);
    padding-top: 40px;
  }

  .site-sidebar {
    padding-top: 18px;
  }
}

@media (max-width: 760px) {
  .site-shell {
    display: block;
    width: min(100% - 24px, 760px);
    padding: 18px 0 34px;
  }

  .site-sidebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "brand tools" "nav nav";
    gap: 12px 16px;
    padding: 0 0 18px;
  }

  .brand {
    grid-area: brand;
  }

  .sidebar-tools {
    grid-area: tools;
    grid-template-columns: 34px;
    margin: 0;
  }

  .sidebar-search {
    display: none;
  }

  .site-nav {
    grid-area: nav;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 2px 16px;
    margin: 0;
  }

  .site-nav a {
    font-size: 14px;
  }

  .home-terminal {
    grid-template-columns: minmax(0, 1fr);
  }

  .terminal-main {
    min-height: 188px;
  }

  .terminal-side {
    border-top: 1px solid var(--line-strong);
    border-left: 0;
  }

  .home-archive {
    margin-top: 22px;
    padding: 16px 14px;
  }

  .home-archive > hr {
    margin-bottom: 21px;
  }

  .post-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .post-row span {
    display: none;
  }

  .post-row strong {
    line-height: 1.45;
    white-space: normal;
  }

  .content-panel {
    padding: 16px 14px;
  }

  .archive-controls {
    grid-template-columns: minmax(0, 1fr) 110px;
  }

  .archive-controls button {
    grid-column: 1 / -1;
  }

  .post-header h1 {
    font-size: 27px;
  }

  .post-body {
    padding: 19px 15px 24px;
  }
}
