/* 업무 자동화 노트 — 기본 스타일
   밝은 테마가 기본, 다크 테마는 prefers-color-scheme 과 [data-theme] 둘 다 지원. */

:root {
  color-scheme: light;
  --bg: #fbfcfd;
  --surface: #ffffff;
  --surface-soft: #f3f5f8;
  --surface-strong: #eef1f5;
  --text: #151b23;
  --text-soft: #39434f;
  --muted: #66707c;
  --line: #e2e7ed;
  --line-strong: #cfd6df;
  --accent: #1b5fd1;
  --accent-hover: #154ba8;
  --accent-soft: #e9f0fc;
  --code-bg: #f4f6f9;
  --code-border: #e1e6ed;
  --header-bg: rgba(251, 252, 253, 0.88);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.045);
  --shadow-hover: 0 2px 4px rgba(16, 24, 40, 0.05), 0 14px 32px rgba(16, 24, 40, 0.08);
  --content: 720px;
  --wrap: 1080px;
  --radius: 14px;
  --font-sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    "Apple SD Gothic Neo", "Nanum Gothic", "Malgun Gothic", "Noto Sans KR", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Nanum Gothic Coding", "Liberation Mono",
    Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1117;
    --surface: #131a23;
    --surface-soft: #18212c;
    --surface-strong: #1d2734;
    --text: #e7edf5;
    --text-soft: #c2ccd9;
    --muted: #8e9aaa;
    --line: #25303c;
    --line-strong: #354250;
    --accent: #79aaff;
    --accent-hover: #9dc0ff;
    --accent-soft: #16263d;
    --code-bg: #0f1620;
    --code-border: #25303c;
    --header-bg: rgba(13, 17, 23, 0.86);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.22);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.35), 0 16px 36px rgba(0, 0, 0, 0.3);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1117;
  --surface: #131a23;
  --surface-soft: #18212c;
  --surface-strong: #1d2734;
  --text: #e7edf5;
  --text-soft: #c2ccd9;
  --muted: #8e9aaa;
  --line: #25303c;
  --line-strong: #354250;
  --accent: #79aaff;
  --accent-hover: #9dc0ff;
  --accent-soft: #16263d;
  --code-bg: #0f1620;
  --code-border: #25303c;
  --header-bg: rgba(13, 17, 23, 0.86);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.22);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.35), 0 16px 36px rgba(0, 0, 0, 0.3);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.75;
  letter-spacing: -0.01em;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

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

a:hover {
  color: var(--accent-hover);
}

img,
svg {
  max-width: 100%;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.3;
  letter-spacing: -0.02em;
  overflow-wrap: break-word;
}

p {
  margin: 0;
}

ul,
ol {
  margin: 0;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 0 0 8px 8px;
  background: var(--accent);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
}

.skip-link:focus {
  top: 0;
  color: #ffffff;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- 헤더 ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  backdrop-filter: saturate(160%) blur(12px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand:hover {
  color: var(--text);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
}

.brand-name {
  overflow: hidden;
  font-size: 15.5px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.site-nav > a {
  padding: 7px 11px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14.5px;
  font-weight: 550;
  white-space: nowrap;
}

.site-nav > a:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.site-nav > a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-left: 4px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.theme-toggle:hover {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--text);
}

.icon-sun,
.icon-moon {
  display: none;
}

.icon-moon {
  display: block;
}

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

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

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

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

/* ---------- 홈 ---------- */

.hero {
  padding: 58px 0 40px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0 0 18px;
  font-size: clamp(2.05rem, 4.4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.035em;
}

.hero-desc {
  max-width: 620px;
  color: var(--text-soft);
  font-size: 18px;
  line-height: 1.7;
}

.post-list-section {
  padding-bottom: 24px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 0 18px;
  border-top: 1px solid var(--line);
}

.section-head h2 {
  font-size: 20px;
  font-weight: 750;
}

.section-count {
  color: var(--muted);
  font-size: 13.5px;
  white-space: nowrap;
}

.post-list {
  display: grid;
  gap: 14px;
}

.post-card {
  padding: 25px 28px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.post-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.post-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 13px;
}

.post-card-title {
  margin: 0 0 9px;
  font-size: 21px;
  font-weight: 750;
  letter-spacing: -0.025em;
}

.post-card-title a {
  color: var(--text);
}

.post-card-title a:hover {
  color: var(--accent);
}

.post-card-desc {
  margin: 0 0 14px;
  color: var(--text-soft);
  font-size: 15.5px;
  line-height: 1.68;
}

/* ---------- 태그 ---------- */

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tag {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 550;
  line-height: 1.6;
}

.tag:hover {
  border-color: var(--line-strong);
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---------- 페이지 머리 ---------- */

.page-header {
  padding: 52px 0 32px;
}

.page-header h1 {
  margin: 0 0 12px;
  font-size: clamp(1.8rem, 3.6vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.page-desc {
  max-width: 660px;
  color: var(--text-soft);
  font-size: 16.5px;
}

.page-back {
  margin: 30px 0 0;
}

/* ---------- 글 ---------- */

.post,
.page,
.not-found {
  width: 100%;
  max-width: 768px;
  margin: 0 auto;
  padding: 50px 24px 0;
}

.post-header {
  margin-bottom: 34px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}

.post-header h1 {
  margin: 14px 0 16px;
  font-size: clamp(1.9rem, 4vw, 2.55rem);
  font-weight: 800;
  letter-spacing: -0.035em;
}

.post-lead {
  margin: 0 0 16px;
  color: var(--text-soft);
  font-size: 17.5px;
  line-height: 1.68;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.post-body {
  max-width: var(--content);
  margin: 0 auto;
  color: var(--text-soft);
  font-size: 17px;
  line-height: 1.82;
}

.post-body > *:first-child {
  margin-top: 0;
}

.post-body p {
  margin: 0 0 1.35em;
}

.post-body h2 {
  margin: 2.5em 0 0.75em;
  padding: 0;
  color: var(--text);
  font-size: 1.45rem;
  font-weight: 750;
  line-height: 1.38;
  scroll-margin-top: 88px;
}

.post-body h3 {
  margin: 2.05em 0 0.55em;
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.45;
  scroll-margin-top: 88px;
}

.post-body h4 {
  margin: 1.7em 0 0.5em;
  color: var(--text);
  font-size: 1.02rem;
  font-weight: 700;
}

.post-body ul,
.post-body ol {
  margin: 0 0 1.45em;
  padding-left: 1.4em;
}

.post-body li {
  margin: 0.38em 0;
  padding-left: 0.15em;
}

.post-body li > ul,
.post-body li > ol {
  margin: 0.35em 0 0.4em;
}

.post-body strong {
  color: var(--text);
  font-weight: 700;
}

.post-body em {
  font-style: italic;
}

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

.post-body a:hover {
  color: var(--accent-hover);
  text-decoration-thickness: 2px;
}

.post-body blockquote {
  margin: 1.8em 0;
  padding: 15px 20px;
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  background: var(--surface-soft);
  color: var(--text-soft);
}

.post-body blockquote p {
  margin: 0;
}

.post-body hr {
  margin: 2.4em 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.post-body code {
  padding: 0.12em 0.38em;
  border: 1px solid var(--code-border);
  border-radius: 5px;
  background: var(--code-bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.88em;
  word-break: break-word;
}

.post-body pre {
  margin: 1.8em 0;
  padding: 18px 20px;
  overflow-x: auto;
  border: 1px solid var(--code-border);
  border-radius: 12px;
  background: var(--code-bg);
  line-height: 1.65;
  -webkit-overflow-scrolling: touch;
}

.post-body pre code {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--text);
  font-size: 13.5px;
  word-break: normal;
  white-space: pre;
}

/* ---------- 표 ---------- */

.table-wrap {
  margin: 1.8em 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  line-height: 1.6;
  word-break: keep-all;
}

.table-wrap.is-wide table {
  min-width: 560px;
}

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

.table-wrap th {
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 650;
  white-space: nowrap;
}

.table-wrap tbody tr:last-child td {
  border-bottom: 0;
}

.table-wrap tbody tr:hover {
  background: color-mix(in srgb, var(--surface-soft) 55%, transparent);
}

/* ---------- FAQ ---------- */

.faq {
  margin-top: 2.8em;
  padding-top: 0.4em;
  border-top: 1px solid var(--line);
}

.faq h2 {
  margin-top: 1.6em;
}

.faq h3 {
  display: flex;
  gap: 8px;
  margin-top: 1.75em;
  font-size: 1.06rem;
}

.faq h3::before {
  content: "Q.";
  flex: 0 0 auto;
  color: var(--accent);
  font-weight: 800;
}

.faq h3 + p {
  margin-left: 26px;
}

/* ---------- 글 하단 ---------- */

.post-footer {
  max-width: var(--content);
  margin: 48px auto 0;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

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

.post-nav-link {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}

.post-nav-link:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
  color: var(--text);
}

.post-nav-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.post-nav-title {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.45;
}

.back-link {
  display: inline-block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.back-link:hover {
  color: var(--accent);
}

/* ---------- 페이지네이션 ---------- */

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

a.page-link:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
  color: var(--text);
}

.page-link.is-current {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  font-weight: 650;
}

.page-prev {
  margin-right: 6px;
  font-size: 13.5px;
}

.page-next {
  margin-left: 6px;
  font-size: 13.5px;
}

/* ---------- 404 / 빈 상태 ---------- */

.not-found {
  padding-top: 90px;
  padding-bottom: 60px;
  text-align: center;
}

.not-found h1 {
  margin: 0 0 14px;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 800;
}

.not-found p {
  max-width: 480px;
  margin: 0 auto 22px;
  color: var(--text-soft);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 9px;
  background: var(--accent);
  color: #ffffff;
  font-size: 14.5px;
  font-weight: 650;
}

.button:hover {
  background: var(--accent-hover);
  color: #ffffff;
}

.empty-state {
  padding: 44px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

/* ---------- 푸터 ---------- */

.site-footer {
  margin-top: 72px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
}

.footer-grid {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-top: 36px;
  padding-bottom: 26px;
}

.footer-title {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}

.footer-desc {
  max-width: 430px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.65;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding-top: 4px;
}

.footer-nav a {
  color: var(--muted);
  font-size: 13.5px;
  white-space: nowrap;
}

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

.footer-bottom {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px 24px;
  padding-top: 18px;
  padding-bottom: 30px;
  border-top: 1px solid var(--line);
}

.footer-bottom p {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.footer-bottom p:last-child {
  max-width: 520px;
  text-align: right;
}

/* ---------- 좁은 화면 ---------- */

@media (max-width: 700px) {
  body {
    font-size: 16.5px;
  }

  .wrap {
    padding: 0 18px;
  }

  .header-inner {
    min-height: 60px;
    gap: 8px;
  }

  .site-nav {
    gap: 0;
  }

  .site-nav > a {
    padding: 6px 8px;
    font-size: 14px;
  }

  .theme-toggle {
    margin-left: 2px;
  }

  .hero {
    padding: 40px 0 30px;
  }

  .hero-desc {
    font-size: 16.5px;
  }

  .post-card {
    padding: 21px 20px 20px;
  }

  .post-card-title {
    font-size: 19px;
  }

  .post,
  .page,
  .not-found {
    padding: 38px 18px 0;
  }

  .post-header {
    margin-bottom: 28px;
    padding-bottom: 22px;
  }

  .post-lead {
    font-size: 16px;
  }

  .post-body {
    font-size: 16.5px;
    line-height: 1.8;
  }

  .post-body h2 {
    margin-top: 2.1em;
    font-size: 1.32rem;
  }

  .post-body h3 {
    font-size: 1.1rem;
  }

  .post-body pre {
    padding: 15px 16px;
    border-radius: 10px;
  }

  .post-body pre code {
    font-size: 12.5px;
  }

  .table-wrap {
    border-radius: 10px;
  }

  .table-wrap th,
  .table-wrap td {
    padding: 9px 11px;
    font-size: 13.5px;
  }

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

  .footer-grid {
    flex-direction: column;
    gap: 18px;
    padding-top: 28px;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 6px;
  }

  .footer-bottom p:last-child {
    max-width: none;
    text-align: left;
  }

  .page-header {
    padding: 38px 0 26px;
  }
}

@media (max-width: 430px) {
  .brand {
    gap: 7px;
    font-size: 14px;
  }

  .brand-mark {
    width: 26px;
    height: 26px;
    flex-basis: 26px;
  }

  .brand-name {
    max-width: 96px;
    font-size: 14px;
  }

  .site-nav {
    gap: 0;
  }

  .site-nav > a {
    padding: 6px 6px;
    font-size: 13px;
  }

  .pagination {
    gap: 5px;
  }

  .page-link {
    min-width: 35px;
    height: 36px;
    padding: 0 10px;
    font-size: 13.5px;
  }

  .page-prev,
  .page-next {
    padding: 0 9px;
    font-size: 12.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

@media print {
  .site-header,
  .site-footer,
  .post-nav,
  .pagination,
  .theme-toggle,
  .skip-link {
    display: none;
  }

  body {
    background: #ffffff;
    color: #000000;
    font-size: 12pt;
  }

  .post,
  .page {
    max-width: none;
    padding: 0;
  }

  .post-body a {
    color: #000000;
  }
}