@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+KR:wght@500;600;700&family=Noto+Sans+KR:wght@400;500;600;700&display=swap');

:root {
  --ink: #172820;
  --muted: #5d6b62;
  --paper: #f6f7f3;
  --line: #d7ddd6;
  --accent: #4367ef;
}

*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: 1.5rem;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--muted) 38%, transparent) transparent;
}
* {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--muted) 38%, transparent) transparent;
}
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--muted) 34%, transparent);
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--muted) 52%, transparent);
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-corner {
  background: transparent;
}
[hidden] { display: none !important; }
html.booting .intro,
html.booting .journal,
html.booting .reader { display: none !important; }
html.booting #boot-loader {
  display: flex;
}
#boot-loader {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20;
  background: var(--paper);
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
html, body {
  min-height: 100svh;
}
body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Noto Sans KR', 'Apple SD Gothic Neo', sans-serif;
  font-size: 16px;
  line-height: 1.7;
}
button, input {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}
a { color: inherit; text-decoration: none; }

main {
  flex: 1;
  width: min(1180px, calc(100% - 2.4rem));
  margin-inline: auto;
  display: flex;
  flex-direction: column;
}
body.is-reading main,
body.is-browsing main {
  width: min(1600px, calc(100% - 2rem));
}

.intro:not([hidden]) {
  flex: 1;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 0;
}
.intro h1 {
  margin: 0;
  position: relative;
  display: inline-block;
  font-family: 'Noto Serif KR', serif;
  font-weight: 600;
  font-size: clamp(3.2rem, 11vw, 8.2rem);
  line-height: 1.05;
  letter-spacing: -0.06em;
  white-space: nowrap;
}
.intro h1 .title-measure {
  display: flex;
  align-items: baseline;
  gap: 0.28em;
  visibility: hidden;
  pointer-events: none;
}
.intro h1 .title-live {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: baseline;
  gap: 0.28em;
}
.intro h1 .title-fixed {
  flex: 0 0 auto;
}
.intro h1 .title-word-slot {
  flex: 0 0 auto;
  white-space: nowrap;
}
.intro h1 .title-word { color: var(--accent); }

.subject-menu {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 2.2rem;
  margin-top: 3.5rem;
}
.subject-menu a {
  position: relative;
  display: inline-block;
  font-family: 'Noto Serif KR', serif;
  font-size: clamp(1.6rem, 4vw, 2.8rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  padding: 0.2rem 0 0.35rem;
  color: var(--ink);
}
.subject-menu a:after {
  content: '';
  position: absolute;
  left: 0;
  right: 100%;
  bottom: 0.1rem;
  height: 2px;
  background: var(--subject-color, var(--accent));
}
.subject-menu a:hover:after,
.subject-menu a:focus-visible:after,
.subject-menu a.active:after,
.subject-menu a.selected:after {
  right: 0;
}
.admin-link {
  display: inline-block;
  margin-top: 2.4rem;
  color: var(--muted);
  font-size: 0.82rem;
}
.admin-link:hover { color: var(--accent); }
.credit {
  position: fixed;
  right: 1.6rem;
  bottom: 1.35rem;
  z-index: 3;
  margin: 0;
  color: var(--ink);
  opacity: 0.32;
  font-family: 'Noto Serif KR', serif;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  pointer-events: none;
}
.credit span {
  font-style: italic;
}

.journal:not([hidden]) {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
  padding: 1.5rem 0 6rem;
}
.journal-col {
  min-width: 0;
  max-width: 44rem;
}
.back-home {
  margin-bottom: 2.2rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.section-heading h2 {
  margin: 0;
  font-family: 'Noto Serif KR', serif;
  font-size: clamp(2rem, 5vw, 3.4rem);
  letter-spacing: -0.05em;
  outline: none;
}
.section-heading h2 span {
  display: block;
  margin-top: 0.45rem;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  color: var(--muted);
}
.search-box {
  margin: 2rem 0 0.5rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--line);
}
.search-box label {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.search-box input {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0.35rem 0;
  outline: none;
  font-size: 1.2rem;
}

.articles {
  display: flex;
  flex-direction: column;
  margin-top: 2.2rem;
  border-top: 1px solid var(--line);
}
.article-row {
  display: grid;
  grid-template-columns: 7.2rem minmax(0, 1fr);
  gap: 0.35rem 2rem;
  align-items: start;
  padding: 1.35rem 0;
  border-bottom: 1px solid var(--line);
  color: inherit;
}
.article-row time {
  padding-top: 0.38rem;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.article-copy {
  min-width: 0;
}
.article-row h3 {
  margin: 0;
  font-family: 'Noto Serif KR', serif;
  font-size: 1.28rem;
  line-height: 1.4;
  letter-spacing: -0.03em;
  font-weight: 600;
}
.article-row p {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.65;
}
.empty {
  margin-top: 3rem;
  color: var(--muted);
}

.reader:not([hidden]) {
  display: grid;
  grid-template-columns: 5.5rem 200px minmax(0, 1fr) 400px;
  gap: 1.8rem;
  align-items: start;
  padding: 1.5rem 0 4rem;
}
.reader-col { min-width: 0; }
.reader-rail {
  position: sticky;
  top: 1.5rem;
  max-height: calc(100svh - 3rem);
  overflow: auto;
  z-index: 2;
}
#reader-cats a,
#journal-cats a {
  display: block;
  padding: 0.42rem 0;
  font-family: 'Noto Serif KR', serif;
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: -0.04em;
  color: var(--muted);
  transition: color 0.16s ease;
}
#reader-cats a:hover,
#journal-cats a:hover,
#reader-cats a.is-current,
#journal-cats a.is-current {
  color: var(--accent);
}
.rail-label {
  margin: 0 0 0.85rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
}
#reader-index a {
  display: block;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  transition: color 0.16s ease;
}
#reader-index a:hover,
#reader-index a.is-current {
  color: var(--ink);
}
.rail-date {
  display: block;
  font-size: 0.72rem;
  margin-bottom: 0.2rem;
}
.rail-title {
  display: block;
  font-size: 0.88rem;
  line-height: 1.45;
}
#reader-toc a {
  display: block;
  padding: 0.38rem 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
  cursor: pointer;
  word-break: keep-all;
  overflow-wrap: break-word;
  transition: color 0.16s ease;
}
#reader-toc a:hover { color: var(--ink); }
#reader-toc a.level-1 { font-weight: 600; color: var(--ink); }
#reader-toc a.level-3 { padding-left: 0.75rem; font-size: 0.78rem; }
#reader-toc a.is-active { color: var(--accent); }
.body h1,
.body h2,
.body h3 {
  scroll-margin-top: 1.4rem;
}
.body h1.is-target,
.body h2.is-target,
.body h3.is-target {
  color: var(--accent);
}
#reader-content h1 {
  margin: 0 0 1.2rem;
  font-family: 'Noto Serif KR', serif;
  font-size: clamp(1.9rem, 4.4vw, 2.7rem);
  line-height: 1.32;
  letter-spacing: -0.04em;
}
.body {
  word-break: keep-all;
  font-size: 1.05rem;
  line-height: 1.9;
}
.body > p:first-child {
  font-size: 1.12rem;
  color: var(--ink);
}
.body p {
  margin: 0 0 1.25rem;
}
.body h2, .body h3 {
  margin: 2.4rem 0 0.85rem;
  font-family: 'Noto Serif KR', serif;
  letter-spacing: -0.03em;
  line-height: 1.4;
}
.body h2 { font-size: 1.4rem; }
.body h3 { font-size: 1.15rem; color: #2a332e; }
.body ul, .body ol {
  margin: 0 0 1.25rem;
  padding-left: 1.25rem;
}
.body ul ul, .body ol ol, .body ul ol, .body ol ul {
  margin: 0.4rem 0 0.2rem;
}
.body li { margin: 0.35rem 0; }
.body blockquote {
  margin: 0 0 1.4rem;
  padding: 0.2rem 0 0.2rem 1.1rem;
  border-left: 2px solid var(--accent);
  color: var(--muted);
}
.body blockquote p { margin: 0; }
.body hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.4rem 0;
}
.body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
.body img {
  display: block;
  max-width: 100%;
  height: auto;
}
.body figure.md-image {
  margin: 0 0 2rem;
}
.body figure.md-image img {
  width: 100%;
  border-radius: 8px;
  background: #e8ebe4;
}
.body figcaption {
  margin-top: 0.6rem;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}
.body .md-table {
  overflow-x: auto;
  margin: 0 0 1.8rem;
}
.body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  line-height: 1.6;
}
.body th,
.body td {
  border-bottom: 1px solid var(--line);
  padding: 0.75rem 0.9rem 0.75rem 0;
  text-align: left;
  vertical-align: top;
  overflow-wrap: break-word;
}
.body td br {
  display: block;
  content: "";
  margin: 0.45em 0 0;
}
.body th {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.body td:first-child {
  width: 28%;
  font-weight: 600;
  padding-right: 1.2rem;
}
.body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

@media (max-width: 1100px) {
  body.is-reading main,
  body.is-browsing main {
    width: min(1180px, calc(100% - 2.4rem));
  }
  .reader:not([hidden]),
  .journal:not([hidden]) {
    grid-template-columns: 1fr;
  }
  .reader-rail { display: none; }
}
@media (max-width: 720px) {
  .subject-menu { gap: 0.2rem 1.4rem; }
  .article-row {
    grid-template-columns: 1fr;
    gap: 0.28rem;
  }
  .article-row time { padding-top: 0; }
}
