:root {
  --filter-width: 248px;
  --paper: #f2eee5;
  --paper-deep: #e8e1d4;
  --ink: #1d211d;
  --ink-muted: #66675f;
  --line: #cec6b7;
  --red: #b4452d;
  --red-soft: #ead2c8;
  --green: #233b31;
  --white: #fbfaf6;
  --serif: "Pretendard Variable", Pretendard, -apple-system,
    BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo", "Noto Sans KR",
    "Malgun Gothic", sans-serif;
  --sans: "Pretendard Variable", Pretendard, -apple-system,
    BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo", "Noto Sans KR",
    "Malgun Gothic", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
}

body {
  font-family: var(--sans);
}

button,
input,
select {
  font: inherit;
}

button,
select {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}

.shell {
  display: grid;
  grid-template-columns:
    var(--filter-width) minmax(330px, 420px)
    minmax(480px, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 220ms ease;
}

.filters {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 30px 25px 24px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.025)),
    var(--green);
  color: #f3eee3;
  scrollbar-width: thin;
  min-width: 0;
  overflow-x: hidden;
  opacity: 1;
  transition: opacity 140ms ease;
}

.filters-toggle {
  position: fixed;
  z-index: 12;
  top: 50%;
  left: calc(var(--filter-width) - 1px);
  display: grid;
  place-items: center;
  width: 24px;
  height: 54px;
  padding: 0;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 9px 9px 0;
  background: var(--paper);
  color: var(--green);
  box-shadow: 3px 0 10px rgba(29, 33, 29, 0.08);
  cursor: pointer;
  transform: translateY(-50%);
  transition:
    left 220ms ease,
    background 120ms ease,
    color 120ms ease;
}

.filters-toggle span {
  font-size: 21px;
  line-height: 1;
}

.filters-toggle:hover {
  background: var(--red);
  color: var(--white);
}

body.filters-collapsed .shell {
  grid-template-columns: 0 minmax(330px, 420px) minmax(480px, 1fr);
}

body.filters-collapsed .filters {
  visibility: hidden;
  padding-right: 0;
  padding-left: 0;
  opacity: 0;
  pointer-events: none;
}

body.filters-collapsed .filters-toggle {
  left: 0;
}

.brand {
  padding-bottom: 31px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.eyebrow {
  margin: 0 0 16px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: #c8bfae;
}

.brand h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 48px;
  font-weight: 500;
  line-height: 0.82;
  letter-spacing: -0.07em;
}

.brand-note {
  margin: 22px 0 0;
  color: #c8c5ba;
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.75;
}

.filter-section {
  padding: 24px 0 0;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.filter-section h2 {
  margin: 0 0 12px;
  color: #aaa99f;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.text-button {
  margin: -4px 0 8px;
  padding: 3px 0;
  border: 0;
  background: transparent;
  color: #aaa99f;
  font-size: 10px;
  cursor: pointer;
}

.text-button:hover {
  color: #fff;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid rgba(255, 255, 255, 0.24);
}

.segmented button {
  min-height: 35px;
  padding: 7px 3px;
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.17);
  background: transparent;
  color: #bab9b1;
  font-size: 11px;
  cursor: pointer;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: #eee8db;
  color: var(--green);
  font-weight: 700;
}

.category-list,
.gallery-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-chip {
  padding: 7px 9px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: #cecbc0;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.filter-chip span {
  margin-left: 4px;
  color: #8f938a;
  font-variant-numeric: tabular-nums;
}

.filter-chip:hover {
  border-color: rgba(255, 255, 255, 0.5);
  color: #fff;
}

.filter-chip.active {
  border-color: var(--red-soft);
  background: var(--red-soft);
  color: #5a2117;
}

.filter-chip.active span {
  color: #8a4e41;
}

.archive-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 28px;
  padding-top: 19px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  color: #9ca097;
  font-size: 10px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #b9c16f;
  box-shadow: 0 0 0 3px rgba(185, 193, 111, 0.1);
}

.catalog {
  min-height: 100vh;
  border-right: 1px solid var(--line);
  background: var(--paper-deep);
}

.catalog-toolbar {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  gap: 8px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(232, 225, 212, 0.94);
  backdrop-filter: blur(12px);
}

.search {
  display: flex;
  flex: 1;
  align-items: center;
  min-width: 0;
  height: 42px;
  border-bottom: 1px solid var(--ink);
}

.search-mark {
  margin-right: 8px;
  font-family: var(--serif);
  font-size: 23px;
  transform: rotate(-20deg);
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
}

.search input::placeholder {
  color: #7d7b73;
}

kbd {
  padding: 2px 6px;
  border: 1px solid #beb5a5;
  background: rgba(255, 255, 255, 0.3);
  color: #756f65;
  font-family: var(--serif);
  font-size: 11px;
}

.sort-control select {
  height: 42px;
  padding: 0 25px 0 10px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--paper);
  font-size: 11px;
  cursor: pointer;
}

.result-heading {
  display: flex;
  justify-content: space-between;
  padding: 17px 18px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-muted);
  font-size: 10px;
  letter-spacing: 0.03em;
}

.result-heading p {
  margin: 0;
}

#activeFilter {
  color: var(--red);
}

.post-list {
  min-height: calc(100vh - 150px);
}

.post-card {
  position: relative;
  display: block;
  width: 100%;
  padding: 19px 20px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 140ms ease, padding-left 140ms ease;
}

.post-card::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: var(--red);
  content: "";
  transform: scaleY(0);
  transition: transform 140ms ease;
}

.post-card:hover {
  padding-left: 25px;
  background: rgba(255, 255, 255, 0.32);
}

.post-card.active {
  background: var(--white);
}

.post-card.active::before {
  transform: scaleY(1);
}

.post-card-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: #77756e;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.post-title {
  display: block;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.42;
  letter-spacing: -0.025em;
}

.post-excerpt {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 8px;
  color: #64645e;
  font-family: var(--serif);
  font-size: 12px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.post-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 11px;
}

.mini-tag {
  padding: 3px 6px;
  background: #d8d0c2;
  color: #5e5a52;
  font-size: 9px;
}

.empty-list {
  padding: 72px 35px;
  color: var(--ink-muted);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.7;
  text-align: center;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 18px;
  border-top: 1px solid var(--line);
  color: var(--ink-muted);
  font-size: 11px;
}

.pagination button {
  padding: 7px 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.pagination button:disabled {
  opacity: 0.3;
  cursor: default;
}

.reader {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background:
    radial-gradient(circle at 90% 5%, rgba(180, 69, 45, 0.06), transparent 24%),
    var(--paper);
  scrollbar-width: thin;
}

.reader-empty {
  display: grid;
  align-content: center;
  min-height: 100%;
  padding: 12%;
}

.reader-number {
  margin: 0 0 16px;
  color: var(--red);
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.15em;
}

.reader-empty h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(45px, 5vw, 78px);
  font-weight: 400;
  line-height: 0.96;
  letter-spacing: -0.06em;
}

.reader-empty > p:last-child {
  margin: 28px 0 0;
  color: var(--ink-muted);
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.8;
}

.reader-content {
  width: min(960px, 100%);
  margin: 0 auto;
  padding:
    clamp(44px, 7vw, 92px)
    clamp(32px, 5vw, 72px)
    110px;
}

.reader-header {
  padding-bottom: 28px;
  border-bottom: 1px solid var(--ink);
}

.reader-meta {
  margin-bottom: 20px;
  color: var(--red);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.reader-header h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(30px, 3.3vw, 52px);
  font-weight: 500;
  line-height: 1.18;
  letter-spacing: -0.045em;
  word-break: keep-all;
}

.reader-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 22px;
}

.reader-categories span {
  padding: 5px 8px;
  border: 1px solid var(--line);
  color: #5c5a54;
  font-size: 10px;
}

.reader-body {
  padding-top: 34px;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.95;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.reader-body p {
  margin: 0 0 1.15em;
}

.reader-body h1,
.reader-body h2,
.reader-body h3 {
  margin: 1.8em 0 0.65em;
  font-family: var(--serif);
  line-height: 1.35;
}

.reader-body h1 {
  font-size: 1.7em;
}

.reader-body h2 {
  font-size: 1.45em;
}

.reader-body h3 {
  font-size: 1.2em;
}

.reader-body blockquote {
  margin: 1.5em 0;
  padding: 0 0 0 18px;
  border-left: 3px solid var(--red);
  color: #585952;
}

.reader-body pre {
  overflow-x: auto;
  padding: 17px;
  background: var(--green);
  color: #f1eddf;
  font-family: Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
}

.reader-body code {
  padding: 0.12em 0.28em;
  background: #ded7ca;
  font-family: Consolas, monospace;
  font-size: 0.86em;
}

.reader-body pre code {
  padding: 0;
  background: transparent;
}

.reader-body a {
  color: var(--red);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.reader-body img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 80vh;
  margin: 28px auto;
  border: 1px solid var(--line);
}

.reader-body hr {
  width: 45px;
  margin: 42px 0;
  border: 0;
  border-top: 2px solid var(--red);
}

.reader-footer {
  margin-top: 60px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.reader-footer a {
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.reader-footer a:hover {
  color: var(--red);
}

.mobile-back {
  display: none;
}

.loading-card {
  height: 142px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(
    100deg,
    transparent 20%,
    rgba(255, 255, 255, 0.4) 45%,
    transparent 70%
  );
  background-size: 200% 100%;
  animation: loading 1.2s infinite linear;
}

@keyframes loading {
  from {
    background-position: 180% 0;
  }
  to {
    background-position: -20% 0;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1050px) {
  :root {
    --filter-width: 220px;
  }

  .shell {
    grid-template-columns: var(--filter-width) minmax(330px, 390px) 1fr;
  }

  body.filters-collapsed .shell {
    grid-template-columns: 0 minmax(330px, 390px) 1fr;
  }

  .reader-content {
    padding-right: 40px;
    padding-left: 40px;
  }
}

@media (max-width: 800px) {
  .shell {
    display: block;
  }

  .filters {
    position: static;
    width: 100%;
    height: auto;
    padding: 22px 20px;
  }

  .filters-toggle,
  body.filters-collapsed .filters-toggle {
    top: 17px;
    right: 16px;
    left: auto;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    background: var(--green);
    color: var(--white);
    transform: none;
  }

  body.filters-collapsed .filters {
    display: none;
  }

  .brand {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding-bottom: 20px;
  }

  .brand h1 {
    font-size: 39px;
  }

  .brand-note,
  .eyebrow {
    display: none;
  }

  .filter-section {
    padding-top: 17px;
  }

  .category-list {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 5px;
  }

  .filter-chip {
    flex: 0 0 auto;
  }

  .archive-note {
    display: none;
  }

  .catalog {
    border-right: 0;
  }

  .reader {
    position: fixed;
    z-index: 20;
    inset: 0;
    display: none;
    height: 100dvh;
  }

  body.reader-open .reader {
    display: block;
  }

  .reader-content {
    padding: 70px 25px 70px;
  }

  .mobile-back {
    position: fixed;
    z-index: 2;
    top: 16px;
    left: 16px;
    display: block;
    padding: 8px 10px;
    border: 1px solid var(--line);
    background: rgba(242, 238, 229, 0.94);
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
