/* K-디펜스 블로그 스타일. 긴 글을 읽는 곳이라 기기 설정(밝게·어둡게)을 따른다.
   머리 띠는 첫 화면과 같은 밤색이고, 강조색은 금색 하나다. 글꼴은 사이트에 올린 Pretendard. */

@import url("/fonts/pretendard/pretendardvariable-dynamic-subset.css");

:root {
  --bg: #f7f8fc;
  --surface: #ffffff;
  --text: #161a2b;
  --muted: #586078;
  --line: #e2e5ef;
  --accent: #8a6411;
  --accent-bg: #fbf3df;
  --gold: #f3c75b;
  --night: #0b0e18;
  --radius: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1220;
    --surface: #151a2c;
    --text: #e9ebf3;
    --muted: #a3a9be;
    --line: #262d45;
    --accent: #f3c75b;
    --accent-bg: rgba(243, 199, 91, 0.1);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0e1220;
  --surface: #151a2c;
  --text: #e9ebf3;
  --muted: #a3a9be;
  --line: #262d45;
  --accent: #f3c75b;
  --accent-bg: rgba(243, 199, 91, 0.1);
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.85;
  letter-spacing: -0.008em;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--accent);
  text-underline-offset: 3px;
}

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

/* ── 머리 ─────────────────────────────────────── */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(11, 14, 24, 0.9);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(222, 228, 255, 0.08);
}

.top .inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #eef0f7;
  font-weight: 800;
  font-size: 17px;
  text-decoration: none;
  white-space: nowrap;
}

.brand img {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

.top nav {
  margin-left: auto;
  display: flex;
  gap: 18px;
  font-size: 15px;
}

.top nav a {
  color: #b7bcd0;
  text-decoration: none;
  white-space: nowrap;
}

.top nav a:hover,
.top nav a[aria-current="page"] {
  color: #eef0f7;
}

.top .cta {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--gold);
  color: #1c1505;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .top nav .opt {
    display: none;
  }
}

/* ── 글 ─────────────────────────────────────── */

.article {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

.crumbs {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 18px;
}

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

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

.article h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 46px);
  line-height: 1.22;
  font-weight: 800;
  letter-spacing: -0.035em;
}

.byline {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.cover {
  margin: 28px 0 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
}

.answer {
  margin: 32px 0 0;
  padding: 24px 26px;
  border-radius: var(--radius);
  background: var(--accent-bg);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}

.article .answer h2 {
  margin: 0 0 8px;
  font-size: 18px;
  border: 0;
  padding: 0;
  color: var(--accent);
}

.answer p {
  margin: 0;
}

.answer ul {
  margin: 14px 0 0;
}

.toc {
  margin: 32px 0 0;
  padding: 20px 24px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 16px;
}

.toc strong {
  display: block;
  margin-bottom: 6px;
}

.toc ol {
  margin: 0;
  padding-left: 20px;
}

.toc li + li {
  margin-top: 2px;
}

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

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

.article h2 {
  margin: 64px 0 14px;
  font-size: clamp(25px, 3.4vw, 31px);
  line-height: 1.3;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.article h3 {
  margin: 36px 0 8px;
  font-size: 21px;
  line-height: 1.4;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.article p,
.article ul,
.article ol {
  margin: 0 0 18px;
}

.article ul,
.article ol {
  padding-left: 24px;
}

.article li + li {
  margin-top: 6px;
}

.article strong {
  font-weight: 700;
}

.def {
  margin: 0 0 20px;
  padding: 2px 0 2px 18px;
  border-left: 3px solid var(--accent);
  color: var(--text);
}

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

table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  font-size: 16px;
  line-height: 1.6;
}

caption {
  caption-side: bottom;
  text-align: left;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--muted);
}

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

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

th {
  font-weight: 700;
  background: color-mix(in srgb, var(--line) 45%, transparent);
}

@media (max-width: 560px) {
  table {
    font-size: 15px;
  }

  th,
  td {
    padding: 10px 11px;
  }
}

td.num {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

figure {
  margin: 28px 0;
}

figure img {
  border-radius: 12px;
  border: 1px solid var(--line);
}

figcaption {
  margin-top: 10px;
  font-size: 14px;
  color: var(--muted);
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.cards img {
  background: #fff;
}

.cards span {
  display: block;
  text-align: center;
  font-size: 14px;
  margin-top: 6px;
}

@media (max-width: 560px) {
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.split {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: start;
  margin: 28px 0;
}

.split img {
  border-radius: 18px;
}

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

  .split img {
    max-width: 240px;
  }
}

.routine {
  list-style: none;
  padding: 0 !important;
  counter-reset: r;
}

.routine li {
  counter-increment: r;
  position: relative;
  padding: 16px 18px 16px 62px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.routine li + li {
  margin-top: 10px !important;
}

.routine li::before {
  content: counter(r);
  position: absolute;
  left: 16px;
  top: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--night);
  color: var(--gold);
  font-weight: 800;
  font-size: 15px;
}

.routine b {
  display: block;
}

.routine time {
  color: var(--accent);
  font-weight: 700;
  font-size: 15px;
}

.qa h3 {
  margin-top: 28px;
}

.refs {
  font-size: 15px;
  color: var(--muted);
}

.refs li {
  overflow-wrap: anywhere;
}

/* 함께 읽으면 좋은 글 (tool/blog/blog.py 가 넣는다) */
.related {
  margin: 56px 0 0;
}

.related h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.related ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.related li {
  border-bottom: 1px solid var(--line);
}

.related a {
  display: block;
  padding: 14px 2px;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

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

.author {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin: 56px 0 0;
  padding: 22px 24px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 16px;
}

.author img {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  flex: none;
}

.author p {
  margin: 4px 0 0;
  color: var(--muted);
}

.promo {
  margin: 28px 0 0;
  padding: 30px 28px;
  border-radius: var(--radius);
  color: #eef0f7;
  background:
    linear-gradient(90deg, rgba(11, 14, 24, 0.95) 40%, rgba(11, 14, 24, 0.5)),
    url("/img/home-hero-sm.webp") 70% 40% / cover no-repeat;
}

.promo h2 {
  margin: 0;
  font-size: 24px;
  color: #eef0f7;
}

.promo p {
  margin: 8px 0 0;
  color: #c9cddd;
}

.promo .stores {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.promo .stores a {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid rgba(222, 228, 255, 0.2);
  color: #eef0f7;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.2s, border-color 0.2s;
}

.promo .stores a:first-child {
  background: var(--gold);
  border-color: var(--gold);
  color: #1c1505;
}

.promo .stores a:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
}

/* ── 블로그 목록 ─────────────────────────────────── */

.list {
  max-width: 1080px;
  margin: 0 auto;
  padding: 48px 20px 88px;
}

.list h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 48px);
  letter-spacing: -0.035em;
  font-weight: 800;
}

.list .intro {
  margin: 12px 0 0;
  color: var(--muted);
  max-width: 36em;
}

.posts {
  list-style: none;
  padding: 0;
  margin: 40px 0 0;
  display: grid;
  gap: 20px;
}

.posts a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s;
}

.posts a:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}

.posts img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 1200 / 630;
}

.posts .body {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.posts h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.35;
  letter-spacing: -0.025em;
}

.posts p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.posts time {
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 760px) {
  .posts a {
    grid-template-columns: 1fr;
  }
}

/* ── 발 ───────────────────────────────────────── */

.foot {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.foot .inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 20px 40px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 28px;
}

.foot nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}

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

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

.foot p {
  margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
