/* [kirocrew 2026-09-29] Theme B — minimal list / reading layout.
   Scoped to body.theme-b; uses the site's theme tokens so light/dark both work.
   Roll back: remove this <link> in views/layout/head.php and restore the backed-up templates. */

body.theme-b {
  --b-read: 720px;
  --b-wide: 1080px;
  --b-soft: color-mix(in srgb, var(--ink) 4%, var(--bg));
  background: var(--bg);
  color: var(--ink);
}

/* ---------- shell: no permanent sidebar; it becomes a drawer ---------- */
.theme-b .b-shell {
  display: block !important;
  min-height: 100vh;
}

.theme-b .soft-sidebar {
  position: fixed !important;
  inset: 0 auto 0 0;
  z-index: 80;
  width: min(320px, calc(100vw - 40px)) !important;
  height: 100vh;
  overflow-y: auto;
  transform: translateX(-102%);
  transition: transform 200ms ease;
  background: var(--panel);
  border-right: 1px solid var(--line);
  box-shadow: none;
  visibility: hidden;
  transition: transform 200ms ease, visibility 0s linear 200ms;
}

body.theme-b.sidebar-open .soft-sidebar {
  transform: translateX(0);
  visibility: visible;
  box-shadow: var(--shadow);
  transition: transform 200ms ease;
}

.theme-b .mobile-scrim {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  background: rgba(15, 23, 42, 0.35);
}

body.theme-b.sidebar-open .mobile-scrim {
  display: block;
}

.theme-b .soft-sidebar-head [data-sidebar-close] {
  display: inline-flex !important;
}

/* ---------- header ---------- */
.b-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}

.b-header-inner {
  max-width: var(--b-wide);
  margin: 0 auto;
  height: 64px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.b-logo {
  flex: 0 0 auto;
  color: var(--ink);
  font-family: Georgia, "Nanum Myeongjo", "AppleMyungjo", serif;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.b-nav {
  display: flex;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.b-nav::-webkit-scrollbar {
  display: none;
}

.b-nav a {
  flex: 0 0 auto;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.b-nav a:hover,
.b-nav a:focus-visible {
  color: var(--ink);
  background: var(--b-soft);
  outline: none;
}

.b-nav a.active {
  color: var(--ink);
}

.b-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.b-icon-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

.b-search {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--b-soft);
  color: var(--muted);
}

.b-search input {
  width: 150px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

.b-chip {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.b-theme {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.b-theme .theme-button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

/* ---------- main column ---------- */
.theme-b .b-main {
  max-width: var(--b-wide);
  margin: 0 auto;
  padding: 0 20px 64px !important;
}

.b-page,
.b-article {
  max-width: var(--b-read);
  margin: 0 auto;
}

.b-intro {
  padding: 48px 0 28px;
  border-bottom: 1px solid var(--line);
}

.b-intro h1 {
  margin: 0;
  font-size: clamp(28px, 4.2vw, 38px);
  line-height: 1.3;
  letter-spacing: -0.03em;
  font-weight: 800;
}

.b-intro p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.b-intro-sm {
  padding-top: 28px;
}

.b-intro-sm h1 {
  font-size: clamp(24px, 3.4vw, 32px);
}

.b-tabs {
  display: flex;
  gap: 20px;
  padding: 16px 0 0;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--line);
}

.b-tabs a {
  flex: 0 0 auto;
  padding-bottom: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

.b-tabs a.active,
.b-tabs a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.b-crumb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 28px;
  color: var(--muted);
  font-size: 13px;
}

.b-crumb a {
  color: var(--muted);
  text-decoration: none;
}

.b-crumb a:hover {
  color: var(--ink);
}

/* ---------- list ---------- */
.b-list {
  display: flex;
  flex-direction: column;
}

.b-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}

.b-item.has-pic {
  grid-template-columns: minmax(0, 1fr) 120px;
}

.b-label {
  font-style: normal;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}

.b-item h2 {
  margin: 6px 0 8px;
  font-size: 20px;
  line-height: 1.45;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.b-item:hover h2 {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.b-item p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.b-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  color: color-mix(in srgb, var(--muted) 80%, var(--bg));
  font-size: 13px;
}

.b-pic {
  width: 120px;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--b-soft);
}

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

.b-more {
  display: flex;
  justify-content: center;
  padding: 28px 0 0;
}

.b-more a {
  padding: 10px 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.b-empty {
  padding: 40px 0;
  color: var(--muted);
}

/* ---------- article ---------- */
.b-article-head h1 {
  margin: 14px 0 0;
  font-size: clamp(26px, 4vw, 36px);
  line-height: 1.35;
  letter-spacing: -0.03em;
  font-weight: 800;
}

.b-article-head .b-meta {
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.b-share {
  margin-left: auto;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.b-toc {
  margin: 24px 0 8px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--b-soft);
}

.b-toc summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
}

.b-toc nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.b-toc nav a {
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}

.b-toc nav a[data-level="3"] {
  display: none; /* keep the TOC short: h2 only */
}

.b-toc nav a:hover {
  color: var(--accent);
}

.b-body {
  font-size: 17px;
  line-height: 1.85;
  color: var(--ink);
}

.b-body h2 {
  margin: 2.2em 0 0.7em;
  font-size: 1.4em;
  line-height: 1.4;
  letter-spacing: -0.02em;
  scroll-margin-top: 84px;
}

.b-body h3 {
  margin: 1.8em 0 0.6em;
  font-size: 1.15em;
  scroll-margin-top: 84px;
}

.b-body p,
.b-body ul,
.b-body ol {
  margin: 0 0 1.1em;
}

.b-body ul,
.b-body ol {
  padding-left: 1.3em;
}

.b-body li {
  margin: 0.3em 0;
}

.b-body a {
  color: var(--accent);
}

.b-body img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

.b-body .table-wrap {
  margin: 1.2em 0;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.b-body table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.6;
}

.b-body th,
.b-body td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.b-body th {
  background: var(--b-soft);
  font-weight: 700;
}

.b-body pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--b-soft);
  font-size: 14px;
  line-height: 1.6;
}

.b-body blockquote {
  margin: 1.2em 0;
  padding: 4px 0 4px 16px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.b-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 32px 0 0;
}

.b-tags a {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--b-soft);
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.b-feedback {
  margin: 36px 0 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  text-align: center;
}

.b-feedback form {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
}

.b-feedback button {
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.b-feedback button.active {
  border-color: var(--accent);
  color: var(--accent);
}

.b-feedback-status {
  flex-basis: 100%;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.b-related {
  margin-top: 48px;
}

.b-related > h2 {
  margin: 0;
  padding-bottom: 6px;
  font-size: 18px;
  border-bottom: 2px solid var(--ink);
}

/* ---------- footer ---------- */
.b-footer {
  border-top: 1px solid var(--line);
  margin-top: 40px;
  color: var(--muted);
  font-size: 13px;
}

.b-footer-inner,
.b-footer-bottom {
  max-width: var(--b-wide);
  margin: 0 auto;
  padding: 28px 20px 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 18px;
}

.b-footer-inner p {
  margin: 8px 0 0;
  max-width: 36em;
  line-height: 1.6;
}

.b-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.b-footer nav a {
  color: var(--muted);
  text-decoration: none;
}

.b-footer nav a:hover {
  color: var(--ink);
}

.b-footer-bottom {
  padding-bottom: 36px;
}

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .b-nav {
    display: none;
  }
}

@media (max-width: 640px) {
  .b-header-inner {
    height: 56px;
    gap: 10px;
    padding: 0 14px;
  }

  .b-logo {
    font-size: 18px;
  }

  .b-search input {
    width: 90px;
  }

  .b-theme {
    display: none;
  }

  .theme-b .b-main {
    padding: 0 16px 48px !important;
  }

  .b-intro {
    padding: 32px 0 22px;
  }

  .b-item {
    padding: 20px 0;
    gap: 14px;
  }

  .b-item.has-pic {
    grid-template-columns: minmax(0, 1fr) 84px;
  }

  .b-pic {
    width: 84px;
  }

  .b-item h2 {
    font-size: 18px;
  }

  .b-body {
    font-size: 16px;
    line-height: 1.8;
  }
}

@media (max-width: 400px) {
  .b-search {
    display: none;
  }
}
