/*
Theme Name: Pragmatic Log
Theme URI: https://pragmaticlog.com/
Author: Pragmatic Log
Description: Minimal editorial theme for Pragmatic Development Notes.
Version: 0.1.7
Text Domain: pragmaticlog
*/

:root {
  color-scheme: light;
  --primary: #c46f56;
  --primary-active: #954832;
  --accent-teal: #5db8a6;
  --accent-amber: #e8a55a;
  --canvas: #faf9f5;
  --surface-soft: #f5f0e8;
  --surface-card: #efe9de;
  --surface-dark: #181715;
  --surface-dark-elevated: #252320;
  --hairline: #e6dfd8;
  --ink: #141413;
  --body: #3d3d3a;
  --muted: #6c6a64;
  --muted-soft: #8e8b82;
  --on-dark: #faf9f5;
  --on-dark-soft: #a09d96;
  --shadow: 0 8px 24px rgba(20, 20, 19, 0.045);
  --sans: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Segoe UI", sans-serif;
  --serif: "AppleMyungjo", "Nanum Myeongjo", "Noto Serif KR", serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--canvas);
  color: var(--body);
  font-family: var(--sans);
  line-height: 1.65;
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-width: 320px;
  padding-top: 68px;
  background: var(--canvas);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

.site-bar {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 20;
  height: 68px;
  border-bottom: 1px solid var(--hairline);
  background: var(--canvas);
  backface-visibility: hidden;
  contain: paint;
  transform: translate3d(0, 0, 0);
}

.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  width: 100%;
  height: 4px;
  background: rgba(196, 111, 86, 0.16);
  overflow: hidden;
  pointer-events: none;
}

.admin-bar .site-bar,
.admin-bar .reading-progress {
  top: 32px;
}

.reading-progress span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--primary);
  transform: scaleX(var(--reading-progress, 0));
  transform-origin: left center;
  will-change: transform;
}

.bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 48px));
  height: 100%;
  margin: 0 auto;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 11px;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: 0;
  white-space: nowrap;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-dark);
  object-fit: cover;
  box-shadow: inset 0 0 0 1px rgba(250, 249, 245, 0.12);
}

.brand-short {
  display: none;
}

.nav {
  display: inline-flex;
  align-items: center;
  gap: 26px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 15px;
  font-weight: 750;
}

.nav-menu {
  display: inline-flex;
  align-items: center;
  gap: 26px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-menu li {
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-menu li::marker {
  content: none;
}

.nav a[aria-current="page"],
.nav .current-menu-item > a {
  color: var(--primary-active);
}

.search-link {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  color: var(--ink);
  background: transparent;
}

.search-link svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
}

.home-kicker {
  border-bottom: 1px solid var(--hairline);
  background:
    linear-gradient(90deg, rgba(245, 240, 232, 0.78), rgba(250, 249, 245, 0) 64%),
    var(--canvas);
}

.home-kicker-inner {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 18px 0;
}

.kicker {
  margin: 0;
  color: var(--primary-active);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-main {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: clamp(30px, 4.5vw, 48px) 0 64px;
}

.section-head {
  margin-bottom: 14px;
}

.section-head h1,
.section-head h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(22px, 1.8vw, 28px);
  line-height: 1.2;
  letter-spacing: 0;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.post-card {
  display: grid;
  grid-template-columns: 1fr;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--canvas);
  box-shadow: var(--shadow);
}

.post-card-media img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--surface-card);
}

.post-card-body {
  min-width: 0;
  padding: 18px 20px;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.meta-row .category {
  display: inline-grid;
  min-width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: var(--primary-active);
  color: var(--on-dark);
  font-size: 12px;
  font-weight: 900;
}

.post-card h2 {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  margin: 10px 0 8px;
  color: var(--ink);
  font-size: clamp(19px, 1.45vw, 23px);
  font-weight: 850;
  line-height: 1.25;
  letter-spacing: 0;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.post-card p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  margin: 0;
  color: var(--body);
  font-size: 14px;
  line-height: 1.55;
  word-break: keep-all;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 15px;
  max-height: 24px;
  margin: 12px 0 0;
  padding: 0;
  overflow: hidden;
  list-style: none;
}

.tag-list a {
  color: var(--primary-active);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.site-footer {
  border-top: 1px solid var(--hairline);
  color: var(--muted-soft);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 30px 0;
  gap: 24px;
  font-size: 14px;
}

.article-hero {
  position: relative;
  overflow: hidden;
  background: var(--surface-dark-elevated);
  color: var(--on-dark);
  isolation: isolate;
}

.article-hero::before {
  position: absolute;
  inset: 0;
  z-index: -2;
  content: "";
  background-image: var(--featured-image);
  background-size: cover;
  background-position: center;
  filter: grayscale(0.18) saturate(0.8);
  transform: scale(1.04);
}

.article-hero::after {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  background: rgba(24, 23, 21, 0.52);
}

.article-hero-inner {
  width: min(1320px, calc(100% - 48px));
  margin: 0 auto;
  padding: clamp(42px, 4vw, 64px) 0 clamp(44px, 4.4vw, 68px);
}

.article-eyebrow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 0 0 22px;
  color: rgba(250, 249, 245, 0.86);
  font-size: clamp(15px, 1vw, 18px);
  font-weight: 800;
  letter-spacing: 0;
}

.article-eyebrow a,
.article-eyebrow span:first-child {
  color: var(--accent-amber);
}

.article-title {
  max-width: 1080px;
  margin: 0;
  color: var(--on-dark);
  font-family: var(--serif);
  font-size: clamp(32px, 2.85vw, 42px);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.article-summary {
  max-width: 760px;
  margin: 22px 0 0;
  color: rgba(250, 249, 245, 0.9);
  font-size: clamp(15px, 0.95vw, 17px);
  font-weight: 650;
  line-height: 1.72;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.page-header {
  border-bottom: 1px solid var(--hairline);
  background: var(--surface-soft);
}

.page-header-inner {
  width: min(860px, calc(100% - 48px));
  margin: 0 auto;
  padding: clamp(48px, 6vw, 82px) 0 clamp(42px, 5vw, 72px);
}

.page-title {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(33px, 3.2vw, 50px);
  font-weight: 800;
  line-height: 1.16;
  letter-spacing: 0;
  word-break: keep-all;
}

.page-layout {
  width: min(860px, calc(100% - 48px));
  margin: 0 auto;
  padding: clamp(48px, 6vw, 76px) 0 112px;
}

.page-content {
  max-width: 760px;
}

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 760px) 250px;
  gap: clamp(56px, 7vw, 126px);
  width: min(1320px, calc(100% - 48px));
  margin: 0 auto;
  padding: clamp(62px, 7vw, 104px) 0 120px;
  align-items: start;
}

.article-content {
  min-width: 0;
}

.article-content p {
  margin: 0 0 30px;
  font-size: clamp(16px, 0.95vw, 17px);
  line-height: 1.84;
  letter-spacing: 0;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.article-content strong {
  font-weight: 900;
}

.article-content code {
  border-radius: 5px;
  background: rgba(20, 20, 19, 0.06);
  padding: 0.08em 0.28em;
  font-family: "SFMono-Regular", "Cascadia Code", "Fira Code", Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.article-content pre {
  overflow-x: auto;
  margin: 28px 0 42px;
  padding: 18px;
  border-radius: 8px;
  background: var(--surface-dark);
  color: var(--on-dark);
  line-height: 1.62;
}

.article-content pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  white-space: pre;
}

.article-content .mermaid {
  overflow-x: auto;
  margin: 28px 0 42px;
  padding: 22px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--surface-card);
  color: var(--ink);
  text-align: center;
}

.article-content .mermaid svg {
  display: inline-block;
  max-width: 100%;
  height: auto;
}

.article-content .mermaid-error {
  background: var(--surface-dark);
  color: var(--on-dark);
  text-align: left;
  white-space: pre;
}

.article-content ul,
.article-content ol {
  margin: 0 0 30px;
  padding-left: 1.25em;
  font-size: clamp(15px, 0.9vw, 17px);
  line-height: 1.82;
  word-break: keep-all;
}

.article-content ul:not(.article-tags):not(.tag-list):not(.tags) li + li,
.article-content ol li + li {
  margin-top: 8px;
}

.article-content h2 {
  margin: 66px 0 18px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(25px, 1.9vw, 30px);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: 0;
  word-break: keep-all;
  scroll-margin-top: 116px;
}

.article-content h3 {
  margin: 46px 0 16px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(21px, 1.4vw, 24px);
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: 0;
}

.article-content figure,
.article-content table {
  margin: 28px 0 42px;
}

.article-content figure img {
  border-radius: 8px;
}

.article-content table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.55;
}

.article-content .wp-block-table {
  overflow-x: auto;
}

.article-content th,
.article-content td {
  padding: 15px 17px;
  border-bottom: 1px solid var(--hairline);
  text-align: left;
  vertical-align: top;
}

.article-content th {
  color: var(--primary-active);
  font-weight: 900;
  background: var(--surface-soft);
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 0 0 76px;
  padding: 0;
  list-style: none;
  line-height: 1.5;
}

.article-tags li {
  display: inline-flex;
  margin: 0;
  padding: 0;
}

.article-tags a {
  display: inline;
  color: var(--primary-active);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.5;
  white-space: nowrap;
}

.article-rule {
  height: 1px;
  margin: 76px 0 44px;
  background: var(--hairline);
}

.author-card {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  max-width: 760px;
  margin: 0 auto;
  padding: 34px 40px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--surface-card);
  box-shadow: var(--shadow);
}

.author-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--surface-dark);
  object-fit: cover;
  box-shadow: inset 0 0 0 1px rgba(250, 249, 245, 0.12);
}

.author-card .author-title {
  margin: 0 0 10px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 28px;
  font-weight: 850;
  line-height: 1.25;
  letter-spacing: 0;
}

.author-card p {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.75;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.toc {
  position: sticky;
  top: 104px;
  padding: 7px 0 7px 28px;
  border-left: 1px solid var(--hairline);
}

.toc a {
  display: block;
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 650;
  line-height: 1.4;
  transition: color 160ms ease;
}

.toc a.active {
  color: var(--accent-teal);
  font-weight: 900;
}

.not-found {
  min-height: 48vh;
}

@media (max-width: 920px) {
  .article-layout {
    display: block;
    width: calc(100% - 48px);
    padding-top: 62px;
  }

  .toc {
    display: none;
  }
}

@media (max-width: 860px) {
  .post-grid {
    grid-template-columns: 1fr;
  }

  .post-card {
    grid-template-columns: 190px minmax(0, 1fr);
  }

  .post-card-media img {
    height: 100%;
    min-height: 158px;
  }
}

@media (max-width: 560px) {
  body {
    padding-top: 64px;
  }

  .site-bar {
    height: 64px;
  }

  .bar-inner,
  .home-kicker-inner,
  .site-main,
  .footer-inner {
    width: calc(100% - 40px);
  }

  .brand {
    font-size: 18px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand-full {
    display: none;
  }

  .brand-short {
    display: inline;
  }

  .nav a:not(.search-link) {
    display: none;
  }

  .home-kicker-inner {
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .site-main {
    padding-top: 28px;
    padding-bottom: 50px;
  }

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

  .post-card-media img {
    height: auto;
    min-height: 0;
    aspect-ratio: 16 / 9;
  }

  .post-card h2 {
    font-size: 21px;
  }

  .post-card p {
    font-size: 14px;
  }

  .article-hero-inner {
    width: calc(100% - 40px);
    padding-top: 48px;
    padding-bottom: 48px;
  }

  .article-title {
    font-size: 34px;
    line-height: 1.22;
    word-break: keep-all;
  }

  .article-summary {
    margin-top: 28px;
    font-size: 19px;
    line-height: 1.75;
  }

  .article-layout {
    width: calc(100% - 40px);
    padding-top: 62px;
    padding-bottom: 92px;
  }

  .article-content p {
    margin-bottom: 32px;
    font-size: 19px;
    line-height: 1.88;
  }

  .article-content ul,
  .article-content ol {
    font-size: 18px;
    line-height: 1.82;
  }

  .article-content h2 {
    margin-top: 64px;
    font-size: 34px;
  }

  .article-content h3 {
    font-size: 24px;
  }

  .article-content .wp-block-table {
    margin: 24px -2px 38px;
    overflow-x: visible;
  }

  .article-content table {
    min-width: 0;
    table-layout: fixed;
    font-size: 12px;
    line-height: 1.45;
  }

  .article-content th,
  .article-content td {
    padding: 9px 7px;
    overflow-wrap: anywhere;
    word-break: normal;
  }

  .article-content code {
    white-space: normal;
  }

  .article-rule {
    margin-top: 58px;
  }

  .article-tags {
    gap: 7px 14px;
    margin-bottom: 76px;
    line-height: 1.45;
  }

  .article-tags a {
    font-size: 14px;
    line-height: 1.45;
  }

  .author-card {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 18px;
    align-items: center;
    padding: 24px 26px;
  }

  .author-avatar {
    width: 64px;
    height: 64px;
  }

  .author-card .author-title {
    margin-bottom: 7px;
    font-size: 24px;
    line-height: 1.22;
  }

  .author-card p {
    font-size: 16px;
    line-height: 1.62;
  }

  .footer-inner {
    display: block;
  }

  .footer-inner p + p {
    margin-top: 6px;
  }
}

@media screen and (max-width: 782px) {
  .admin-bar .site-bar,
  .admin-bar .reading-progress {
    top: 46px;
  }
}
