/*
Theme Name: Soft N Blog
Author: kajjoo
Description: 네이버 블로그 느낌의 깔끔한 워드프레스 블로그 테마
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
License: GPL v2 or later
Text Domain: soft-n-blog
*/

:root {
  --bg: #f5f6f8;
  --paper: #ffffff;
  --text: #222;
  --muted: #777;
  --line: #e5e8eb;
  --green: #03c75a;
  --green-dark: #02a64b;
  --soft-green: #effaf4;
  --max: 1080px;
}

:root[data-theme="dark"] {
  --bg: #111827;
  --paper: #182234;
  --text: #f3f4f6;
  --muted: #aab2c0;
  --line: #2d3748;
  --green: #34d399;
  --green-dark: #6ee7b7;
  --soft-green: rgba(52, 211, 153, .12);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.8;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--green-dark); text-decoration: underline; }
.site-top {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 16px rgba(15, 23, 42, .04);
}
.top-inner, .blog-wrap, .footer-inner {
  width: min(var(--max), calc(100% - 28px));
  margin: 0 auto;
}
.top-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 50px;
  gap: 18px;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}
.top-actions nav {
  min-width: 0;
}
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
}
.theme-toggle:hover {
  border-color: var(--green);
  color: var(--green-dark);
}
.site-title {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -.04em;
}
.site-title a::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  background: var(--green);
  border-radius: 50%;
  vertical-align: 2px;
}
.site-desc {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.menu {
  display: flex;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: #555;
  font-size: 14px;
  font-weight: 600;
}
.menu a {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
}
.blog-cover {
  margin: 18px auto 0;
  padding: 28px;
  background: linear-gradient(135deg, #e9fff3, #fff);
  border: 1px solid #d9f5e6;
  border-radius: 8px;
}
:root[data-theme="dark"] .blog-cover {
  background: linear-gradient(135deg, rgba(52, 211, 153, .12), #182234);
  border-color: #254537;
}
.blog-cover h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 38px);
  line-height: 1.25;
  letter-spacing: -.05em;
}
.blog-cover p {
  margin: 8px 0 0;
  color: #557062;
}
.blog-wrap {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 14px;
  padding: 18px 0 52px;
}
.soft-n-sidebar-right .blog-sidebar {
  order: 2;
}
.soft-n-sidebar-right .post-list,
.soft-n-sidebar-right .blog-wrap > section {
  order: 1;
}
.soft-n-no-sticky .site-top {
  position: static;
}
.blog-sidebar {
  display: grid;
  gap: 12px;
  align-self: start;
}
.side-box, .post-box, .article-box {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.side-box {
  padding: 14px;
}
.profile-box {
  text-align: center;
}
.profile-avatar {
  width: 78px;
  height: 78px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: var(--soft-green);
  border: 1px solid #d2f3df;
  display: grid;
  place-items: center;
  color: var(--green-dark);
  font-weight: 900;
  font-size: 24px;
}
.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.side-box h3 {
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.side-box ul {
  margin: 0;
  padding-left: 18px;
}
.post-list {
  display: grid;
  gap: 12px;
}
.post-box {
  padding: 20px 22px;
}
.post-box.has-thumb {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.post-thumb img,
.post-thumb-placeholder {
  width: 150px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--soft-green);
}
.post-thumb-placeholder {
  display: grid;
  place-items: center;
  color: var(--green-dark);
  font-weight: 900;
}
.post-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}
.post-cat {
  color: var(--green-dark);
  font-weight: 800;
}
.post-title {
  margin: 8px 0 8px;
  font-size: 23px;
  line-height: 1.35;
  letter-spacing: -.04em;
}
.post-excerpt {
  margin: 0 0 12px;
  color: #555;
}
.read-more {
  display: inline-flex;
  padding: 6px 11px;
  color: var(--green-dark);
  background: var(--soft-green);
  border: 1px solid #d2f3df;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
.ad-slot {
  clear: both;
  width: 100%;
  max-width: 100%;
  margin: 12px 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  text-align: center;
  overflow: hidden;
}
.ad-slot ins {
  display: block !important;
  max-width: 100%;
  margin: 0 auto;
}
.ad-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}
.auto-ad-content {
  margin: 14px 0;
}
.auto-ad-sidebar {
  margin: 10px 0;
}
.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
.article-box {
  padding: 30px;
}
.article-title {
  margin: 0 0 10px;
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1.22;
  letter-spacing: -.06em;
}
.article-content {
  font-size: 16px;
}
.article-content h2 {
  margin-top: 36px;
  padding-left: 10px;
  border-left: 4px solid var(--green);
  font-size: 24px;
  letter-spacing: -.04em;
}
.article-content h3 {
  margin-top: 28px;
  font-size: 20px;
}
.article-content p {
  margin: 15px 0;
}
.article-content blockquote {
  margin: 22px 0;
  padding: 16px 18px;
  background: #fafafa;
  border-left: 4px solid #b7e7cc;
  color: #555;
}
.site-footer {
  padding: 28px 0;
  background: var(--paper);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}
.top-button {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 60;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--green-dark);
  box-shadow: 0 10px 24px rgba(15, 23, 42, .14);
  cursor: pointer;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: .2s ease;
}
.top-button.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.top-button:hover {
  background: var(--soft-green);
}
@media (max-width: 820px) {
  .top-inner { align-items: center; flex-direction: row; gap: 10px; padding: 8px 0; }
  .top-actions { width: auto; min-width: 0; justify-content: flex-end; }
  .menu { overflow-x: auto; width: auto; max-width: 100%; padding-bottom: 2px; }
  .blog-wrap { grid-template-columns: 1fr; }
  .blog-sidebar { order: 2; }
  .post-box.has-thumb { grid-template-columns: 96px minmax(0, 1fr); gap: 12px; }
  .post-thumb img, .post-thumb-placeholder { width: 96px; }
}

@media (max-width: 640px) {
  body {
    font-size: 14px;
    line-height: 1.72;
  }

  .top-inner,
  .blog-wrap,
  .footer-inner,
  .blog-cover {
    width: min(100% - 20px, var(--max));
  }

  .site-title {
    font-size: 18px;
  }

  .site-desc {
    display: none;
  }

  .top-actions {
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
  }

  .menu {
    gap: 8px;
    width: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .menu a {
    display: inline-flex;
    min-height: 30px;
    align-items: center;
    padding: 0 8px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 999px;
  }

  .theme-toggle {
    flex: 0 0 auto;
    height: 30px;
    min-width: 36px;
  }

  .blog-cover {
    margin-top: 10px;
    padding: 20px;
  }

  .blog-cover h1 {
    font-size: 24px;
  }

  .blog-cover p {
    font-size: 13px;
  }

  .blog-wrap {
    gap: 12px;
    padding-top: 12px;
  }

  .post-box,
  .article-box,
  .side-box {
    border-radius: 10px;
  }

  .post-box {
    padding: 17px;
  }

  .post-box.has-thumb {
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 11px;
  }

  .post-thumb img,
  .post-thumb-placeholder {
    width: 82px;
    border-radius: 7px;
  }

  .post-title {
    font-size: 19px;
    line-height: 1.35;
  }

  .post-excerpt {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .article-box {
    padding: 22px 18px;
  }

  .article-title {
    font-size: 28px;
  }

  .article-content {
    font-size: 15px;
  }

  .article-content h2 {
    font-size: 22px;
  }

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

  .ad-slot {
    margin: 14px 0;
    padding: 10px;
    min-height: 80px;
  }

  .top-button {
    right: 14px;
    bottom: 14px;
    width: 42px;
    height: 42px;
    font-size: 12px;
  }
}

@media (max-width: 430px) {
  .post-box.has-thumb {
    grid-template-columns: 1fr;
  }

  .post-thumb img,
  .post-thumb-placeholder {
    width: 100%;
    aspect-ratio: 16 / 9;
  }

  .read-more {
    width: 100%;
    justify-content: center;
  }
}

/* Stable responsive layout overrides */
.blog-wrap > section,
.post-box > div,
.article-box {
  min-width: 0;
}

.post-title,
.article-title,
.post-excerpt,
.article-content {
  overflow-wrap: anywhere;
}

@media (min-width: 961px) {
  .blog-wrap {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 16px;
  }

  .soft-n-sidebar-right .blog-wrap {
    grid-template-columns: minmax(0, 1fr) 220px;
  }

  .soft-n-sidebar-right .blog-sidebar {
    order: 2;
  }

  .soft-n-sidebar-right .blog-wrap > section {
    order: 1;
  }
}

@media (max-width: 960px) {
  .top-inner,
  .blog-wrap,
  .footer-inner,
  .blog-cover {
    width: min(100% - 24px, var(--max));
  }

  .blog-wrap {
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 12px;
  }

  .soft-n-sidebar-right .blog-wrap {
    grid-template-columns: minmax(0, 1fr) 180px;
  }

  .side-box {
    padding: 12px;
  }

  .post-box {
    padding: 18px;
  }

  .article-box {
    padding: 24px;
  }
}

@media (max-width: 760px) {
  .top-inner {
    min-height: 48px;
    flex-wrap: wrap;
  }

  .site-branding,
  .top-inner > div:first-child {
    max-width: 46%;
    min-width: 0;
  }

  .site-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .top-actions {
    flex: 1;
    justify-content: flex-end;
    min-width: 0;
  }

  .top-actions nav {
    min-width: 0;
    max-width: calc(100vw - 150px);
  }

  .menu {
    max-width: 100%;
    overflow-x: auto;
    gap: 6px;
  }

  .blog-wrap,
  .soft-n-sidebar-right .blog-wrap {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .blog-wrap > section {
    order: 1;
  }

  .blog-sidebar,
  .soft-n-sidebar-right .blog-sidebar {
    order: 2;
  }

  .blog-sidebar {
    grid-template-columns: 1fr;
  }

  .post-box.has-thumb {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .post-thumb img,
  .post-thumb-placeholder {
    width: 88px;
  }
}

@media (max-width: 520px) {
  .top-inner,
  .blog-wrap,
  .footer-inner,
  .blog-cover {
    width: min(100% - 16px, var(--max));
  }

  .top-inner {
    gap: 6px;
  }

  .top-inner > div:first-child {
    max-width: 42%;
  }

  .top-actions nav {
    max-width: calc(100vw - 132px);
  }

  .menu a {
    min-height: 28px;
    padding: 0 7px;
    font-size: 12px;
  }

  .theme-toggle {
    min-width: 32px;
    height: 28px;
    padding: 0 7px;
  }

  .post-box {
    padding: 15px;
  }

  .post-title {
    font-size: 18px;
  }

  .post-box.has-thumb {
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 10px;
  }

  .post-thumb img,
  .post-thumb-placeholder {
    width: 74px;
    aspect-ratio: 1 / 1;
  }

  .article-box {
    padding: 20px 15px;
  }

  .article-title {
    font-size: 25px;
  }
}

@media (max-width: 380px) {
  .post-box.has-thumb {
    grid-template-columns: 1fr;
  }

  .post-thumb img,
  .post-thumb-placeholder {
    width: 100%;
    aspect-ratio: 16 / 9;
  }
}
