/* ==========================================================================
   Persona Pro (v2.0.0) - Professional Editorial Journal Stylesheet
   ========================================================================== */

:root {
  /* Light Mode: Warm Linen & Deep Charcoal */
  --bg-app: #fbfaf7;
  --bg-sidebar: #fbfaf7;
  --bg-surface: #ffffff;
  --bg-hover: #f2efe7;
  --bg-subtle: #f7f5ed;

  --border-subtle: rgba(28, 25, 23, 0.08);
  --border-divider: rgba(28, 25, 23, 0.12);
  --border-card: rgba(28, 25, 23, 0.09);

  --text-main: #181715;
  --text-body: #47443e;
  --text-muted: #7d796f;
  --text-ghost: #aca79c;

  --accent: #181715;
  --accent-primary: #1e40af;
  --badge-bg: rgba(30, 64, 175, 0.08);
  --badge-text: #1e40af;

  --sidebar-w: 260px;
  --stream-w: 720px;

  --font-sans: "Pretendard", -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
  --font-mono: "Fira Code", monospace;

  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(28, 25, 23, 0.04);
  --shadow-md: 0 4px 16px -2px rgba(28, 25, 23, 0.06);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  /* Dark Mode: Sage Eye-Care */
  --bg-app: #18221e;
  --bg-sidebar: #18221e;
  --bg-surface: #202d28;
  --bg-hover: #293a33;
  --bg-subtle: #1c2722;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-divider: rgba(255, 255, 255, 0.12);
  --border-card: rgba(255, 255, 255, 0.09);

  --text-main: #f3f7f5;
  --text-body: #c5d6ce;
  --text-muted: #829a8f;
  --text-ghost: #566c62;

  --accent: #f3f7f5;
  --accent-primary: #34d399;
  --badge-bg: rgba(52, 211, 153, 0.15);
  --badge-text: #34d399;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px -2px rgba(0, 0, 0, 0.35);
}

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

html {
  font-size: 16px;
  line-height: 1.6;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
button { font-family: inherit; border: none; background: none; cursor: pointer; }

/* Master 2-Column Framework */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Left Sidebar */
.app-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 3.25rem 1.85rem 2.5rem 1.85rem;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  overflow-y: auto;
  transition: transform 0.25s var(--ease), background-color 0.25s var(--ease);
}

.brand-header {
  margin-bottom: 2.75rem;
}

.brand-avatar-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--text-main);
  color: var(--bg-surface);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--text-main);
  line-height: 1.25;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.live-dot {
  width: 7px;
  height: 7px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
}

.brand-bio-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  line-height: 1.45;
}

/* 1-Click Email Pill */
.sidebar-contact-line {
  margin-top: 1rem;
}

.sidebar-email-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.74rem;
  color: var(--text-body);
  font-family: var(--font-mono);
  padding: 0.3rem 0.65rem;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.sidebar-email-copy-btn:hover {
  border-color: var(--border-divider);
  color: var(--text-main);
  transform: translateY(-1px);
}

.sidebar-email-copy-btn.is-copied {
  color: #10b981;
  border-color: #10b981;
  background-color: var(--bg-surface);
}

/* Sidebar Menu */
.sidebar-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 2.5rem;
}

.menu-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-ghost);
  padding-left: 0.6rem;
  margin-bottom: 0.6rem;
}

.sidebar-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.52rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.sidebar-btn:hover {
  background-color: var(--bg-hover);
  color: var(--text-main);
}

.sidebar-btn.active {
  background-color: var(--bg-surface);
  color: var(--text-main);
  font-weight: 600;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

.btn-counter {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.12rem 0.48rem;
  border-radius: var(--radius-full);
  background-color: var(--bg-hover);
  color: var(--text-muted);
}

.sidebar-btn.active .btn-counter {
  background-color: var(--bg-subtle);
  color: var(--text-main);
}

/* Sidebar Footer */
.sidebar-footer {
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
}

.theme-mode-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.55rem 0.85rem;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.theme-mode-btn:hover {
  color: var(--text-main);
  border-color: var(--border-divider);
  transform: translateY(-1px);
}

/* Right Main Viewport */
.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3.75rem 2.5rem 6rem 2.5rem;
}

.stream-wrapper {
  width: 100%;
  max-width: var(--stream-w);
}

.stream-header-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 2.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-divider);
}

.stream-section-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-main);
}

.stream-total-counter {
  font-size: 0.78rem;
  color: var(--text-ghost);
  font-weight: 600;
  font-family: var(--font-mono);
}

/* Stream Post Rows */
.stream-container {
  display: flex;
  flex-direction: column;
}

.article-row {
  padding: 2.15rem 0;
  border-bottom: 1px solid var(--border-subtle);
  transition: all 0.2s ease;
}

.article-row:first-child { padding-top: 0; }
.article-row:last-child { border-bottom: none; }

.article-layout-grid {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2.25rem;
}

.article-text-content {
  flex: 1;
  min-width: 0;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-bottom: 0.55rem;
}

.meta-tag-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.5rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background-color: var(--badge-bg);
  color: var(--badge-text);
}

.meta-dot {
  color: var(--text-ghost);
  font-size: 0.7rem;
}

.article-title {
  font-size: 1.32rem;
  font-weight: 700;
  line-height: 1.42;
  letter-spacing: -0.028em;
  margin-bottom: 0.55rem;
  color: var(--text-main);
}

.article-title a {
  transition: color 0.15s ease;
}

.article-row:hover .article-title a {
  color: var(--accent-primary);
}

.article-excerpt {
  font-size: 0.92rem;
  line-height: 1.68;
  color: var(--text-body);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Polished 16:10 Thumbnail */
.article-thumb-anchor {
  flex-shrink: 0;
  width: 185px;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background-color: var(--bg-hover);
  border: 1px solid var(--border-card);
  box-shadow: var(--shadow-sm);
}

.article-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease);
}

.article-row:hover .article-thumb-img {
  transform: scale(1.04);
}

/* Article Detail View */
.detail-view-container {
  width: 100%;
  max-width: var(--stream-w);
}

.detail-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 2.25rem;
  transition: all 0.15s ease;
}

.detail-back-btn:hover {
  color: var(--text-main);
  transform: translateX(-3px);
}

.detail-header-block {
  margin-bottom: 2.5rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.detail-meta-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.detail-h1 {
  font-size: 2.35rem;
  font-weight: 800;
  line-height: 1.26;
  letter-spacing: -0.035em;
  margin-bottom: 1rem;
}

.detail-lead-p {
  font-size: 1.12rem;
  line-height: 1.72;
  color: var(--text-body);
}

.detail-media-banner {
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 3.5rem;
  border: 1px solid var(--border-card);
  box-shadow: var(--shadow-md);
}

.detail-media-banner img {
  width: 100%;
  height: auto;
  max-height: 540px;
  object-fit: cover;
}

/* Content Typography & Embeds */
.detail-prose,
.gh-content {
  font-size: 1.06rem;
  line-height: 1.88;
  color: var(--text-main);
  word-break: keep-all;
  overflow-wrap: break-word;
}

.detail-prose > * + *,
.gh-content > * + * {
  margin-top: 1.85rem;
}

.detail-prose h2,
.gh-content h2 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-top: 3.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border-divider);
}

.detail-prose h3,
.gh-content h3 {
  font-size: 1.28rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
}

.detail-prose blockquote,
.gh-content blockquote {
  font-size: 1.1rem;
  line-height: 1.68;
  padding: 1.35rem 1.75rem;
  margin: 2.5rem 0;
  border-left: 3px solid var(--accent-primary);
  background-color: var(--bg-surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  border-top: 1px solid var(--border-card);
  border-right: 1px solid var(--border-card);
  border-bottom: 1px solid var(--border-card);
  box-shadow: var(--shadow-sm);
}

/* Natural Images */
.gh-content img,
.detail-prose img,
.kg-image-card img,
.kg-image {
  width: 100% !important;
  height: auto !important;
  max-width: 100% !important;
  object-fit: contain !important;
  border-radius: var(--radius-sm);
  margin: 1.75rem 0;
}

/* Responsive 16:9 YouTube */
.gh-content iframe,
.gh-content video,
.detail-prose iframe,
.detail-prose video,
.kg-embed-card iframe,
.kg-video-card video {
  width: 100% !important;
  max-width: 100% !important;
  aspect-ratio: 16 / 9 !important;
  height: auto !important;
  border-radius: var(--radius-sm);
  border: none;
  margin: 2.25rem 0;
  background-color: var(--bg-hover);
}

.kg-embed-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin: 2rem 0;
}

figcaption {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.5rem;
}

/* Koenig Cards */
.kg-card { margin: 2.75rem 0; width: 100%; }
.kg-width-wide {
  position: relative;
  width: min(100vw - 3rem, 860px);
  margin-left: calc(50% - min(100vw - 3rem, 860px) / 2);
  margin-right: calc(50% - min(100vw - 3rem, 860px) / 2);
}
.kg-width-full {
  position: relative;
  width: min(100vw - 2rem, 1020px);
  margin-left: calc(50% - min(100vw - 2rem, 1020px) / 2);
  margin-right: calc(50% - min(100vw - 2rem, 1020px) / 2);
}

.kg-bookmark-card { width: 100%; }
.kg-bookmark-container {
  display: flex;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background-color: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}
.kg-bookmark-container:hover {
  border-color: var(--border-divider);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.kg-bookmark-content {
  flex: 1;
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.kg-bookmark-title {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}
.kg-bookmark-description {
  font-size: 0.84rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.kg-bookmark-thumbnail { width: 165px; flex-shrink: 0; }
.kg-bookmark-thumbnail img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

/* Code Blocks */
.detail-prose pre,
.gh-content pre {
  position: relative;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.6;
  box-shadow: var(--shadow-sm);
}

.code-copy-btn {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-xs);
  background-color: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  transition: all 0.15s ease;
}

/* Tables */
.detail-prose table,
.gh-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 2.5rem 0;
  font-size: 0.92rem;
}
.detail-prose th,
.detail-prose td,
.gh-content th,
.gh-content td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
}
.detail-prose th,
.gh-content th {
  font-weight: 700;
  color: var(--text-main);
  border-bottom: 2px solid var(--border-divider);
}

/* Adjacent Navigator */
.detail-adjacent-nav {
  margin-top: 4.5rem;
  padding-top: 2.25rem;
  border-top: 1px solid var(--border-divider);
}
.adjacent-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
.adjacent-card {
  padding: 1.35rem;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: all 0.2s ease;
}
.adjacent-card:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-divider);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.adjacent-card.prev { grid-column: 1; text-align: left; }
.adjacent-card.next { grid-column: 2; text-align: right; }
.adjacent-dir-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.adjacent-post-title {
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-main);
}

/* Comments Section */
.detail-comments-section {
  margin-top: 4.5rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border-divider);
}
.comments-header { margin-bottom: 1.5rem; }
.comments-title {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
}
.comments-container { margin-top: 1rem; }

/* More Stories */
.detail-more-stories {
  margin-top: 4.5rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border-divider);
}
.more-stories-title {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  color: var(--text-main);
}

/* Mobile Responsive */
.mobile-header-dock {
  display: none;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  padding: 0 1.25rem;
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
}

.mobile-brand-title a {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.025em;
  color: var(--text-main);
}

.mobile-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  color: var(--text-main);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-card);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.mobile-icon-btn:active {
  transform: scale(0.95);
  background-color: var(--bg-hover);
}

@media (max-width: 860px) {
  .app-wrapper { flex-direction: column; }
  .mobile-header-dock { display: flex; }
  .app-sidebar {
    position: fixed;
    top: 58px;
    left: 0;
    bottom: 0;
    width: 260px;
    transform: translateX(-100%);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
    z-index: 120;
  }
  .app-sidebar.is-open { transform: translateX(0); }
  .app-main { padding: 2.25rem 1.25rem 4rem 1.25rem; }
  .adjacent-grid { grid-template-columns: 1fr; }
  .adjacent-card.prev,
  .adjacent-card.next {
    grid-column: auto;
    text-align: left;
  }
}

@media (max-width: 600px) {
  .article-layout-grid {
    flex-direction: column-reverse;
    gap: 1.25rem;
  }
  .article-thumb-anchor {
    width: 100%;
    aspect-ratio: 16 / 9;
  }
  .detail-h1 { font-size: 1.95rem; }
}
