/* LibRat mockup
   Shared chrome (header, footer, layout) is the same on every page so it can
   be split into html/template partials later.
   Dark colors are duplicated: once for prefers-color-scheme, once for the
   manual toggle (data-theme). Keep the two blocks in sync. */

/* Palette lives only in this block. Light, then the same dark tokens twice:
   once for the manual toggle, once for prefers-color-scheme. Keep those two
   dark blocks identical so a later palette swap is one edit. */

:root {
  color-scheme: light;
  --font-sans: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Noto Sans CJK KR", sans-serif;
  --font-mono: "D2Coding", "Cascadia Mono", "Noto Sans Mono CJK KR", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --bg: #f3f0e8;
  --surface: #fffcf8;
  --surface-2: #f6f1e8;
  --text: #221f1b;
  --text-muted: #5c564c;
  --border: #e3dbd0;
  --border-strong: #cfc4b4;
  --accent: #0e5c56;
  --accent-line: #0e5c56;
  --librat-accent: var(--accent-line);
  --link: #0c564f;
  --on-accent: #f4fffc;
  /* Paper-tone code (option A). Swap back to #f4efe6 for the lighter tint. */
  --code-bg: #ebe5d9;
  --code-text: #241f1a;
  --code-border: #e0d6c8;
  --ad-bg: #f7f2e8;
  --selection: #d3ebe6;
  --input-border: #8f8576;
  --sep: #8a8275;
  --danger: #a8372c;
  --on-danger: #ffffff;
  --shadow: 0 1px 2px rgb(34 31 27 / 0.06);
  --radius: 10px;
  --img-filter: none;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #2a2724;
  --surface: #332f2b;
  --surface-2: #3c3833;
  --text: #e3ddd4;
  --text-muted: #b7aea2;
  --border: #4a453f;
  --border-strong: #615b53;
  --accent: #2a8178;
  --accent-line: #5fb3a8;
  --librat-accent: var(--accent-line);
  --link: #9ed9d0;
  --on-accent: #f4fffc;
  --code-bg: #221f1c;
  --code-text: #e6e0d6;
  --code-border: #3d3934;
  --ad-bg: #302c28;
  --selection: #2c4c48;
  --input-border: #857d72;
  --sep: #8a8275;
  --danger: #b4483b;
  --on-danger: #ffffff;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.28);
  --img-filter: brightness(0.86);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #2a2724;
    --surface: #332f2b;
    --surface-2: #3c3833;
    --text: #e3ddd4;
    --text-muted: #b7aea2;
    --border: #4a453f;
    --border-strong: #615b53;
    --accent: #2a8178;
    --accent-line: #5fb3a8;
    --librat-accent: var(--accent-line);
    --link: #9ed9d0;
    --on-accent: #f4fffc;
    --code-bg: #221f1c;
    --code-text: #e6e0d6;
    --code-border: #3d3934;
    --ad-bg: #302c28;
    --selection: #2c4c48;
    --input-border: #857d72;
    --sep: #8a8275;
    --danger: #b4483b;
    --on-danger: #ffffff;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.28);
    --img-filter: brightness(0.86);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-padding-top: 1rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.75;
  text-rendering: optimizeLegibility;
  word-break: keep-all;
  overflow-wrap: break-word;
}

img {
  max-width: 100%;
}

a {
  color: var(--link);
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

::selection {
  background: var(--selection);
  color: var(--text);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  background: var(--accent);
  color: var(--on-accent);
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  text-decoration: none;
}

.skip-link:focus {
  top: 0.75rem;
}

.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;
}

.shell {
  width: min(1120px, calc(100% - 2.5rem));
  margin-inline: auto;
}

.site-header {
  position: relative;
  background: var(--surface);
  border-top: 4px solid var(--accent);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  padding-block: 0.95rem 0.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.brand-mark {
  display: block;
  width: 2.4rem;
  height: 2.4rem;
  flex: none;
  color: var(--text);
}

.brand-mark svg {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-name {
  display: block;
  color: var(--text);
  line-height: 0;
}

.brand-name svg {
  display: block;
  height: 1.15rem;
  width: auto;
}

.brand-tag {
  display: block;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.3;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: none;
}

.search-open {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  flex: none;
}

.icon-btn svg {
  display: block;
}

.theme-toggle .icon-sun,
.search-toggle .icon-close {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: none;
  }

  :root:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: block;
  }
}

.site-header:has(.search-open:checked) .search-toggle .icon-search {
  display: none;
}

.site-header:has(.search-open:checked) .search-toggle .icon-close {
  display: block;
}

.search {
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  min-height: 2.25rem;
  padding-right: 0.15rem;
}

.search input {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.92rem;
  padding: 0.3rem 0.85rem;
  width: 12rem;
  min-width: 0;
}

.search input::placeholder {
  color: var(--text-muted);
}

.search .icon-btn {
  border: 0;
  background: transparent;
  width: 2rem;
  height: 2rem;
}

.search-open:focus-visible + .search-toggle,
.icon-btn:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

.site-nav {
  padding-bottom: 0.45rem;
}

.site-nav ul {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem 1.05rem;
  list-style: none;
  margin: 0;
  padding: 0 0 0.15rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

.site-nav a {
  display: inline-block;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 0.15rem 0;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

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

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 2.75rem;
  align-items: start;
  padding-block: 1.75rem 3rem;
}

.layout > * {
  min-width: 0;
}

.page-head {
  margin-bottom: 0.4rem;
}

.eyebrow {
  margin: 0;
  color: var(--link);
  font-size: 0.82rem;
  font-weight: 700;
}

.page-head h1,
.post-header h1 {
  margin: 0.15rem 0 0.35rem;
  font-size: clamp(1.7rem, 3vw, 2.15rem);
  line-height: 1.3;
  letter-spacing: -0.02em;
  font-weight: 750;
}

.lede,
.page-head p {
  margin: 0;
  color: var(--text-muted);
}

.post-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
}

.post-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "title"
    "kicker"
    "excerpt"
    "stats";
  row-gap: 0.15rem;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--border);
}

/* Thumbnail only when the post body has an image. No empty slot otherwise. */
.post-item:has(.thumb) {
  grid-template-columns: minmax(0, 1fr) 6rem;
  column-gap: 1.25rem;
  grid-template-areas:
    "title thumb"
    "kicker thumb"
    "excerpt thumb"
    "stats thumb";
}

.thumb {
  grid-area: thumb;
  align-self: start;
  justify-self: end;
  display: block;
  width: 6rem;
  height: 6rem;
  margin-top: 0.15rem;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: var(--img-filter);
}

.post-item .kicker {
  grid-area: kicker;
  margin: 0;
}

.post-item h2 {
  grid-area: title;
  margin: 0;
  font-size: 1.18rem;
  line-height: 1.4;
  letter-spacing: -0.015em;
  font-weight: 700;
}

.post-item h2 a {
  color: var(--text);
  text-decoration: none;
}

.post-item h2 a:hover {
  color: var(--link);
  text-decoration: underline;
}

.excerpt {
  grid-area: excerpt;
  margin: 0.2rem 0 0;
  color: var(--text-muted);
  font-size: 0.98rem;
}

.cat {
  color: var(--link);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
}

.cat:hover {
  text-decoration: underline;
}

.post-stats {
  grid-area: stats;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.65rem;
  margin: 0.35rem 0 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.post-stats time {
  color: var(--text-muted);
  font-size: inherit;
  font-weight: 400;
  font-family: inherit;
}

.post-stats .meta-end {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  white-space: nowrap;
}

.post-stats .meta-end .sep {
  margin: 0;
}

.sep {
  color: var(--sep);
  margin: 0 0.15rem;
  font-weight: 400;
}

/* List emoji stay gray. Direct child only, so .meta-end .views keeps full contrast. */
.post-stats > span:not(.meta-end) {
  filter: grayscale(1);
  opacity: 0.9;
}

.tree-note {
  margin: -0.15rem 0 0.5rem;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  font-size: 0.9375rem;
  line-height: 1.6;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1rem 0.85rem;
}

.panel h2 {
  margin: 0 0 0.55rem;
  font-size: 0.92rem;
  line-height: 1.4;
}

.tree,
.tree ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tree ul {
  margin: 0.15rem 0 0.25rem 0.45rem;
  padding-left: 0.55rem;
  border-left: 1px solid var(--border);
}

.tree li + li {
  margin-top: 0.12rem;
}

.tree summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  cursor: pointer;
  list-style: none;
  padding: 0.18rem 0;
}

.tree summary::-webkit-details-marker {
  display: none;
}

.tree summary::marker {
  content: "";
}

.tree-label {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 0.35rem;
}

.twist {
  width: 0.4rem;
  height: 0.4rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  flex: none;
  margin-top: -0.15rem;
}

details[open] > summary .twist {
  transform: rotate(45deg);
  margin-top: -0.05rem;
}

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

.tree a:hover,
.tree a[aria-current="page"] {
  color: var(--link);
}

.tree a[aria-current="page"] {
  font-weight: 750;
}

.tree-leaf {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.18rem 0 0.18rem 0.75rem;
}

.count {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.crumbs {
  margin: 0 0 0.35rem;
}

.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.88rem;
}

.crumbs li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
}

.crumbs li:not(:last-child)::after {
  content: "/";
  color: var(--sep);
}

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

.crumbs a:hover {
  color: var(--link);
  text-decoration: underline;
}

.crumbs [aria-current="page"] {
  color: var(--text);
  font-weight: 700;
}

.side-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.side-links li {
  padding: 0.35rem 0;
  border-top: 1px solid var(--border);
}

.side-links li:first-child {
  border-top: 0;
}

.side-links a {
  color: var(--text);
  text-decoration: none;
}

.side-links a:hover {
  color: var(--link);
  text-decoration: underline;
}

.rss-blurb {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.rss-blurb a {
  font-weight: 700;
}

/* Ad units. Sizes live in this stylesheet, not an inline <style>, because
   style.css is render-blocking in <head> and the push() call runs after it.
   Google's fixed-size responsive example uses a class plus media queries and
   no data-ad-format (https://support.google.com/adsense/answer/9183363).
   An unfilled unit is hidden per https://support.google.com/adsense/answer/10762946.
   :has() also folds the wrapper. Without :has(), the ins still disappears
   and the wrapper may keep its reserved box. */

ins.adsbygoogle[data-ad-status="unfilled"] {
  display: none !important;
}

.ad-rect {
  position: relative;
  align-self: center;
  width: 300px;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  box-shadow: 0 0 0 1px var(--border);
  overflow: visible;
}

.ad-side-size {
  display: block;
  width: 300px;
  height: 250px;
}

.ad-rect:has(.adsbygoogle[data-ad-status="filled"])::before,
.ad-leaderboard:has(.adsbygoogle[data-ad-status="filled"])::before,
.post-body .google-auto-placed:has(> ins.adsbygoogle[data-ad-status="filled"])::before {
  content: "광고";
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.04em;
}

.ad-rect:has(.adsbygoogle[data-ad-status="filled"])::before {
  position: absolute;
  left: 0;
  bottom: calc(100% + 0.3rem);
}

.ad-rect:has(.adsbygoogle[data-ad-status="unfilled"]) {
  display: none;
}

/* The sidebar column is 300px from 861px up, so the unit fits there.
   Below that the shell is one column, calc(100% - 1.5rem), and a classic
   scrollbar makes the column innerWidth - 39px. The 300px unit fits from
   339px up; narrower than that it is omitted. */
@media (max-width: 338px) {
  .ad-rect {
    display: none;
  }
}

.ad-leaderboard {
  margin: 40px 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.ad-leaderboard:has(.adsbygoogle[data-ad-status="filled"])::before {
  display: block;
  margin-bottom: 0.3rem;
}

.ad-leaderboard:has(.adsbygoogle[data-ad-status="unfilled"]) {
  display: none;
}

/* Fixed-size responsive article unit. Sizes follow the measured column.
   Headless Chrome here has a 15px classic scrollbar, so the column is
   innerWidth - 39px while the sidebar is hidden, and innerWidth - 399px
   once the 300px sidebar and 2.75rem gap return at 861px. The review's
   343 / 500 / 752 / 1112 cuts assumed no scrollbar and overflowed by up
   to 15px on this layout. The cuts below are the viewports where the
   creative's used width first fits inside the column:
   320×100 from 359, 468×60 from 507 and again from 867 (861–866 is still
   462–467px wide), 728×90 from 767–860 and from 1127. */
.ad-post-size {
  display: block;
  width: 320px;
  height: 100px;
}

@media (min-width: 507px) and (max-width: 860px) {
  .ad-post-size {
    width: 468px;
    height: 60px;
  }
}

@media (min-width: 767px) and (max-width: 860px) {
  .ad-post-size {
    width: 728px;
    height: 90px;
  }
}

@media (min-width: 867px) {
  .ad-post-size {
    width: 468px;
    height: 60px;
  }
}

@media (min-width: 1127px) {
  .ad-post-size {
    width: 728px;
    height: 90px;
  }
}

@media (max-width: 358px) {
  .ad-leaderboard {
    display: none;
  }
}

/* Auto ads insert this wrapper in the article. Its inline style sets width,
   height, clear, and text-align, not margin, so the gap is set here and the
   ins (which has inline margin:auto) is left alone. */
.post-body .google-auto-placed {
  margin-top: 28px;
  margin-bottom: 28px;
}

.post-body .google-auto-placed:has(> ins.adsbygoogle[data-ad-status="filled"])::before {
  display: block;
  margin-bottom: 0.3rem;
  text-align: left;
}

.post-body .google-auto-placed:has(> ins.adsbygoogle[data-ad-status="unfilled"]) {
  display: none;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 1.25rem;
}

.pager ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-width: 0;
  list-style: none;
  margin: 0;
  padding: 0;
}

.pager a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  min-height: 2.4rem;
  padding: 0 0.55rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}

.pager a[aria-current="page"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.pager a:hover {
  border-color: var(--link);
}

.pager .pager-step {
  padding: 0 0.85rem;
  color: var(--link);
  font-weight: 700;
}

.pager .pager-step.is-disabled {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  min-height: 2.4rem;
  padding: 0 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-weight: 700;
  opacity: 0.5;
}

.pager li.gap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1rem;
  min-height: 2.4rem;
  color: var(--sep);
  user-select: none;
}

@media (max-width: 600px) {
  .pager li.edge,
  .pager li.gap {
    display: none;
  }

  .pager {
    gap: 0.5rem 0.75rem;
  }
}

.pager-status {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.post-header {
  margin-bottom: 1.1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.post-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.4rem;
  align-items: baseline;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.post-kicker time {
  margin-left: 0.5rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--border-strong);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

@media (max-width: 340px) {
  .post-kicker time {
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
  }
}

.post-body {
  font-size: 1.05rem;
  line-height: 1.85;
}

/* Auto ads may insert ins.adsbygoogle and cross-origin iframes in the
   article. Images stay capped by the global img rule. ins and iframe are
   not given a width or height here, so a creative can use the column it
   lands in instead of being squeezed to a thumbnail. */

.post-body h2 {
  margin: 2rem 0 0.6rem;
  font-size: 1.32rem;
  line-height: 1.4;
  letter-spacing: -0.015em;
}

.post-body h3 {
  margin: 1.6rem 0 0.45rem;
  font-size: 1.12rem;
  line-height: 1.45;
}

.post-body h4 {
  margin: 1.3rem 0 0.35rem;
  font-size: 1.02rem;
  line-height: 1.45;
}

.post-body p {
  margin: 0.8rem 0;
}

.post-figure {
  margin: 1rem 0 1.2rem;
}

.post-figure > a {
  display: block;
  border-radius: var(--radius);
  cursor: zoom-in;
}

.post-figure > a:focus-visible {
  outline-offset: 3px;
}

.post-figure img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  margin-inline: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  filter: var(--img-filter);
}

.post-figure figcaption {
  margin-top: 0.4rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.post-body ul,
.post-body ol {
  margin: 0.6rem 0 1rem;
  padding-left: 1.25rem;
}

.post-body li + li {
  margin-top: 0.35rem;
}

.post-body code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--code-bg);
  color: var(--code-text);
  border: 1px solid var(--code-border);
  padding: 0.08em 0.35em;
  border-radius: 4px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.codeblock {
  margin: 1rem 0 1.2rem;
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--code-bg);
}

.codeblock figcaption {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.4rem 0.85rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--code-border);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.codeblock pre {
  margin: 0;
  padding: 0.9rem 1rem 1rem;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.6;
}

.codeblock code {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
  color: var(--code-text);
}

.table-wrap {
  overflow-x: auto;
  max-width: 100%;
  margin: 1rem 0 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.post-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  line-height: 1.5;
}

.post-body caption {
  text-align: left;
  font-weight: 700;
  padding: 0.7rem 0.85rem 0;
}

.post-body th,
.post-body td {
  text-align: left;
  vertical-align: top;
  padding: 0.55rem 0.85rem;
  border-top: 1px solid var(--border);
  word-break: keep-all;
}

.post-body th {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.post-body thead th {
  background: var(--surface-2);
}

.post-body tbody th {
  color: var(--text);
  font-size: 0.95rem;
  white-space: nowrap;
}

.reactions {
  margin-top: 1.6rem;
  padding-top: 0.4rem;
}

.reactions h2 {
  margin: 0 0 0.55rem;
  font-size: 0.95rem;
}

.reaction-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.reaction-list button {
  min-height: 2.75rem;
  min-width: 4.4rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
}

.reaction-list button:hover {
  border-color: var(--link);
}

.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1.4rem;
}

.post-nav a {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-height: 4.6rem;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.post-nav a:hover {
  border-color: var(--link);
}

.post-nav span {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.post-nav strong {
  font-weight: 650;
  line-height: 1.4;
}

.post-nav .next {
  grid-column: 2;
  text-align: right;
}

.comments {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.comments h2 {
  margin: 0 0 0.4rem;
  font-size: 1.25rem;
}

.policy {
  margin: 0 0 0.9rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.comment-form {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1.2rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.comment-form label {
  display: grid;
  gap: 0.3rem;
  font-weight: 700;
  font-size: 0.92rem;
}

.comment-form .optional {
  color: var(--text-muted);
  font-weight: 500;
}

.comment-form input,
.comment-form textarea,
.admin-form input,
.admin-form textarea,
.admin-form select {
  width: 100%;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  background: var(--bg);
  color: inherit;
  font: inherit;
  padding: 0.55rem 0.7rem;
}

.comment-form textarea {
  resize: vertical;
  min-height: 7rem;
  line-height: 1.6;
}

.comment-form button,
.admin-form button,
.admin-nav button {
  justify-self: start;
  min-height: 2.7rem;
  padding: 0.4rem 1rem;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.comment-form button:hover,
.admin-form button:hover,
.admin-nav button:hover {
  filter: brightness(1.08);
}

.comment-list,
.comment-list ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.comment {
  padding: 0.95rem 0;
  border-top: 1px solid var(--border);
}

.comment header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  align-items: baseline;
}

.comment-actions {
  display: inline-flex;
  gap: 0.35rem;
  margin-left: auto;
}

.comment-actions a,
.comment-actions button,
.confirm-actions a,
.confirm-actions button {
  font: inherit;
  font-size: 0.82rem;
  min-height: 2rem;
  padding: 0.1rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}

.comment-actions a[aria-expanded="true"] {
  border-color: var(--link);
  color: var(--link);
}

.confirm-box {
  margin-top: 0.75rem;
  padding: 0.8rem 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg);
}

.confirm-box p {
  margin: 0 0 0.55rem;
  font-size: 0.92rem;
}

.confirm-box label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.88rem;
  font-weight: 700;
}

.confirm-box input,
.confirm-box textarea {
  font: inherit;
  font-weight: 400;
  width: min(100%, 36rem);
  min-height: 2.4rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  background: var(--surface);
  color: inherit;
}

.confirm-box textarea {
  display: block;
  min-height: 6rem;
  line-height: 1.6;
}

.confirm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
}

.confirm-actions .danger {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--on-danger);
  font-weight: 700;
}

.empty {
  padding: 0.5rem 0 1rem;
  max-width: 36rem;
}

.empty-art {
  width: min(280px, 100%);
  height: auto;
  color: var(--text-muted);
  margin: 0.4rem 0 0.8rem;
}

.empty h1 {
  margin-bottom: 0.4rem;
}

.comment header strong {
  font-size: 0.98rem;
}

.comment time {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.comment-lock {
  margin: 0.8rem 0 0.4rem;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.badge {
  display: inline-block;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.72rem;
  font-weight: 750;
  line-height: 1.5;
}

.comment > p {
  margin: 0.35rem 0 0;
  white-space: pre-wrap;
}

.comment.is-deleted > p {
  color: var(--text-muted);
}

.reply-box {
  margin-top: 0.7rem;
}

.reply-box summary {
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--link);
}

.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.notice {
  margin: 0 0 0.9rem;
  padding: 0.7rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
}

.notice.is-bad {
  border-color: var(--danger);
}

.comment-list .replies {
  margin: 0.7rem 0 0;
  padding: 0.15rem 0 0.15rem 0.9rem;
  border-left: 2px solid var(--accent-line);
}

.replies .comment {
  border-top: 0;
  padding: 0.35rem 0;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 1.4rem 0 2rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.footer-inner {
  display: grid;
  gap: 0.35rem;
}

.footer-brand {
  margin: 0;
  color: var(--text);
  font-weight: 750;
  font-size: 1rem;
}

.site-footer p {
  margin: 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding-top: 1.25rem;
  }

  .sidebar {
    order: 2;
  }
}

@media (min-width: 861px) {
  .search-toggle {
    display: none;
  }
}

@media (max-width: 860px) {
  .shell {
    width: min(1120px, calc(100% - 1.5rem));
  }

  .header-bar {
    flex-wrap: wrap;
    align-items: center;
    padding-block: 0.4rem;
    gap: 0.6rem;
  }

  .brand-tag {
    display: none;
  }

  .brand-mark {
    width: 1.85rem;
    height: 1.85rem;
  }

  .brand-name svg {
    height: 1rem;
  }

  .header-tools {
    display: contents;
  }

  .brand {
    margin-right: auto;
  }

  .search-toggle,
  .theme-toggle,
  .header-tools > a.icon-btn {
    order: 2;
  }

  .search-toggle {
    display: inline-flex;
  }

  .icon-btn {
    width: 2.5rem;
    height: 2.5rem;
  }

  .search {
    display: none;
    position: static;
    order: 3;
    flex: 1 0 100%;
    width: auto;
    margin: 0.1rem 0 0.35rem;
    border-radius: 999px;
    border-color: var(--input-border);
    background: var(--surface-2);
    box-shadow: none;
  }

  .search input {
    flex: 1;
    width: auto;
    font-size: 1rem;
  }

  .site-header:has(.search-open:checked) .search {
    display: flex;
  }

  .site-header:has(.search-open:checked) .search-toggle {
    background: var(--selection);
    border-color: var(--accent-line);
    color: var(--link);
  }

  .site-nav ul {
    scrollbar-width: none;
    padding-right: 1.5rem;
    -webkit-mask-image: linear-gradient(90deg, black calc(100% - 1.5rem), transparent);
    mask-image: linear-gradient(90deg, black calc(100% - 1.5rem), transparent);
  }

  .site-nav ul::-webkit-scrollbar {
    display: none;
  }

  .site-nav {
    padding-bottom: 0.25rem;
  }

  .site-nav a {
    font-size: 0.88rem;
  }

  .post-item:has(.thumb) {
    grid-template-columns: minmax(0, 1fr) 4.5rem;
    column-gap: 0.75rem;
    grid-template-areas:
      "title thumb"
      "kicker thumb"
      "excerpt thumb"
      "stats stats";
  }

  .thumb {
    width: 4.5rem;
    height: 4.5rem;
    margin-top: 0.2rem;
  }

  .post-item:has(.thumb) .excerpt {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }

  .post-nav {
    grid-template-columns: 1fr;
  }

  .post-nav .next {
    grid-column: auto;
    text-align: left;
  }
}

@media (min-width: 600px) {
  .comment-form {
    grid-template-columns: 1fr 1fr;
  }

  .comment-form label[for="body"],
  .comment-form button {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

/* Phase-1 reactions are POST forms. display:contents keeps the mockup flex row. */
.reaction-list form {
  display: contents;
}

.admin-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem 1.2rem;
  padding: 0.85rem 0;
}

.admin-title {
  font-weight: 750;
  color: var(--text);
  text-decoration: none;
}

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.9rem;
}

.admin-nav a {
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
}

.admin-nav a[aria-current="page"] {
  color: var(--link);
}

.admin-nav form {
  margin: 0;
}

.admin-nav button {
  min-height: 2.2rem;
  padding: 0.15rem 0.75rem;
  font-size: 0.88rem;
}

.admin-main {
  padding: 1.3rem 0 3rem;
}

.admin-main h1 {
  margin: 0 0 0.8rem;
  font-size: 1.45rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
  margin: 0 0 1rem;
}

.filters a[aria-current="page"] {
  font-weight: 750;
}

.table-scroll {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.admin-table th,
.admin-table td {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--surface-2);
}

.admin-form {
  display: grid;
  gap: 0.75rem;
  margin: 0 0 1.2rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.admin-form label {
  display: grid;
  gap: 0.3rem;
  font-weight: 700;
  font-size: 0.92rem;
}

.admin-form .row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.admin-form button.danger,
button.danger {
  background: var(--danger);
  color: var(--on-danger);
}

.preview {
  margin: 0 0 1.2rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}

.preview h2 {
  margin: 0 0 0.6rem;
  font-size: 1rem;
  color: var(--text-muted);
}

.queue {
  display: grid;
  gap: 1rem;
}

.queue article {
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.queue header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
  align-items: baseline;
}

.queue .body {
  white-space: pre-wrap;
  margin: 0.4rem 0 0.8rem;
}

.queue .ai-draft {
  margin: 0 0 0.8rem;
  padding: 0.6rem 0.7rem;
  background: var(--bg);
  border-radius: 8px;
  white-space: pre-wrap;
}

.muted {
  color: var(--text-muted);
  font-size: 0.9rem;
}

@media (max-width: 700px) {
  .admin-table th:nth-child(4),
  .admin-table td:nth-child(4),
  .admin-table th:nth-child(6),
  .admin-table td:nth-child(6) {
    display: none;
  }
}

/* review-phase2-v1-patch.css */

:root {
  --danger-fg: #a8372c;
}

:root[data-theme="dark"] {
  --danger-fg: #e0867a;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --danger-fg: #e0867a;
  }
}

.comment-form :is(input, textarea),
.confirm-box :is(input, textarea),
.admin-form :is(input, textarea, select) {
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.5;
}

.comment-form textarea,
.confirm-box textarea {
  line-height: 1.6;
}

:is(input, textarea, select)[aria-invalid="true"] {
  border-color: var(--danger-fg);
  box-shadow: inset 3px 0 0 var(--danger-fg);
}

:is(input, textarea, select):disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.comment-form button:disabled,
.admin-form button:disabled,
.confirm-box button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: none;
}

#post-body {
  font-family: var(--font-mono);
  line-height: 1.6;
  tab-size: 2;
  min-height: 22rem;
  resize: vertical;
}

@media (min-width: 861px) {
  #post-body {
    font-size: 0.9rem;
  }
}

.notice {
  font-size: 0.95rem;
  line-height: 1.6;
  border-left-width: 4px;
}

.notice.is-bad {
  border-color: var(--danger-fg);
}

.admin-nav {
  gap: 0.2rem 0.6rem;
}

.admin-nav a {
  padding: 0.4rem 0.35rem;
  box-shadow: inset 0 -2px 0 transparent;
}

.admin-nav a[aria-current="page"] {
  box-shadow: inset 0 -2px 0 var(--accent-line);
}

.admin-nav a:hover {
  box-shadow: inset 0 -2px 0 var(--border-strong);
}

.admin-nav a[aria-current="page"]:hover {
  box-shadow: inset 0 -2px 0 var(--accent-line);
}

.admin-nav button {
  margin-left: 0.4rem;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--input-border);
  font-weight: 650;
}

.admin-nav button:hover {
  background: var(--surface-2);
  filter: none;
}

.filters a {
  display: inline-flex;
  align-items: center;
  min-height: 2.2rem;
  padding: 0 0.8rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
}

.filters a:hover {
  border-color: var(--link);
}

.filters a[aria-current="page"] {
  border-color: var(--accent-line);
  background: var(--surface);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

.admin-main p.row > a {
  display: inline-flex;
  align-items: center;
  min-height: 2.6rem;
  padding: 0 1rem;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  text-decoration: none;
}

.admin-main p.row > a:hover {
  filter: brightness(1.08);
}

.admin-form > .muted {
  margin: -0.45rem 0 0.1rem;
}

.admin-form > h2 {
  margin: 0;
  font-size: 1.05rem;
}

.queue .admin-form {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
}

.queue .admin-form .row {
  gap: 0.6rem;
}

.queue time {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.admin-form button.danger {
  background: transparent;
  color: var(--danger-fg);
  border: 1px solid var(--danger-fg);
}

.admin-form button.danger:hover {
  background: var(--surface-2);
  filter: none;
}

.confirm-actions .danger {
  background: var(--danger);
  color: var(--on-danger);
  border-color: var(--danger);
}

@media (min-width: 861px) {
  form.admin-form[action^="/admin/categories/"]:not([action$="/delete"]) {
    grid-template-columns: 2fr 2fr 2.4fr 5rem auto;
    align-items: end;
    gap: 0.75rem;
    margin-bottom: 0.3rem;
  }

  form.admin-form[action^="/admin/categories/"]:not([action$="/delete"]) .row {
    align-self: end;
  }

  form.admin-form[action$="/delete"] {
    justify-items: end;
    margin: 0 0 1rem;
    padding: 0 0.2rem;
    border: 0;
    background: none;
  }

  form.admin-form[action$="/delete"] button {
    min-height: 2rem;
    padding: 0.1rem 0.7rem;
    font-size: 0.85rem;
  }
}

.admin-main:has(#admin-pw) {
  width: min(24rem, calc(100% - 1.5rem));
  padding-top: 2.4rem;
}

.admin-main:has(#admin-pw) h1 {
  font-size: 1.1rem;
  text-align: center;
}

@media (pointer: coarse) {
  .comment-actions a,
  .confirm-actions a,
  .confirm-actions button {
    display: inline-flex;
    align-items: center;
    min-height: 2.5rem;
  }

  .reply-box summary {
    padding-block: 0.55rem;
  }
}

.table-scroll:focus-visible {
  outline-offset: -2px;
}

@media (min-width: 861px) {
  .admin-form:has(#post-body) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .admin-form:has(#post-body) > * {
    grid-column: 1 / -1;
  }

  .admin-form:has(#post-body) > label:has(select) {
    grid-column: auto;
  }
}

.badge {
  padding: 0 0.4rem;
  border: 1px solid var(--accent-line);
  border-radius: 4px;
  background: transparent;
  color: var(--link);
  font-size: 0.75rem;
  font-weight: 650;
  line-height: 1.5;
}

.admin-tag {
  margin-left: 0.55rem;
  padding-left: 0.55rem;
  border-left: 1px solid var(--sep);
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 650;
}

.brand:has(.admin-tag) {
  align-items: center;
}

.login-brand {
  display: grid;
  justify-items: center;
  gap: 0.55rem;
  margin: 0 0 1.4rem;
  color: var(--text);
}

.login-brand .brand-mark {
  width: 3.6rem;
  height: 3.6rem;
}

.login-brand .brand-name svg {
  height: 1.35rem;
}

.login-brand p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.admin-main:has(#admin-pw) {
  margin-inline: auto;
}

.row-meta {
  display: none;
}

@media (max-width: 700px) {
  .admin-table .row-meta {
    display: block;
    margin-top: 0.15rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.4;
  }
}

/* review-phase3-v1: images stay at their origin size, rules use the theme
   line, header cells are shaded, and a keyboard focus on a scroller is visible. */
.post-body hr {
  height: 0;
  margin: 2rem 0;
  border: 0;
  border-top: 1px solid var(--border-strong);
}

.post-body table:not(:has(thead)) > tbody > tr:first-child > td,
.post-body td:has(> b:only-child) {
  background: var(--surface-2);
  font-weight: 700;
}

.post-body tbody > tr:first-child > :is(td, th) {
  border-top: 0;
}

.table-wrap:focus-visible,
.codeblock pre:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: -2px;
}

.codeblock pre {
  tab-size: 4;
  white-space: pre;
  overscroll-behavior-x: contain;
}
