/* ============================================================
   Goldiverse Theme — Main Stylesheet
   Design: Calm Authority — Finance Blog
   ============================================================ */

/* ─── Reset & Base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --accent: #1B3A5C;
  --accent-mid: #2B5A8C;
  --accent-light: #3D7ABF;
  --accent-wash: rgba(27, 58, 92, 0.06);
  --accent-border: rgba(27, 58, 92, 0.14);
  --highlight: #C4862B;
  --highlight-wash: rgba(196, 134, 43, 0.08);
  --highlight-border: rgba(196, 134, 43, 0.2);
  --text: #1C1C28;
  --text-secondary: #3A3A52;
  --muted: #6B7084;
  --muted-light: #9197A6;
  --border: #E4E6EC;
  --border-light: #EDEEF2;
  --bg: #F7F7FA;
  --bg-warm: #FAFAF8;
  --white: #FFFFFF;
  --shadow-xs: 0 1px 2px rgba(28,28,40,0.04);
  --shadow-sm: 0 1px 4px rgba(28,28,40,0.06), 0 1px 2px rgba(28,28,40,0.04);
  --shadow-md: 0 4px 16px rgba(28,28,40,0.07), 0 1px 4px rgba(28,28,40,0.04);
  --shadow-lg: 0 8px 32px rgba(28,28,40,0.09);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.35s cubic-bezier(0, 0, 0.2, 1);
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --content-width: 760px;
  --wide-width: 1100px;
  --header-height: 64px;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16.5px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

a { color: var(--accent-mid); text-decoration: none; transition: color 0.2s var(--ease); }
a:hover { color: var(--accent-light); }

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


/* ─── Layout ─── */
.site-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.content-area {
  flex: 1;
  width: 100%;
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 0 24px;
}

.content-narrow {
  max-width: var(--content-width);
  margin: 0 auto;
}


/* ─── Header ─── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  transition: all 0.3s var(--ease);
}

.site-header.scrolled {
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 0 24px;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo a {
  font-size: 1.25em;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.site-logo .logo-accent {
  color: var(--highlight);
}

/* Navigation */
.main-nav ul {
  list-style: none;
  display: flex;
  gap: 8px;
  align-items: center;
}

.main-nav a {
  display: block;
  padding: 8px 16px;
  font-size: 0.9em;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: 8px;
  transition: all 0.2s var(--ease);
}

.main-nav a:hover,
.main-nav .current-menu-item a {
  color: var(--accent);
  background: var(--accent-wash);
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text);
}

.menu-toggle svg {
  width: 24px;
  height: 24px;
}


/* ─── Breadcrumb ─── */
.breadcrumb {
  padding: 16px 0;
  font-size: 0.82em;
  color: var(--muted);
}

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

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

.breadcrumb .sep {
  margin: 0 6px;
  opacity: 0.4;
}


/* ─── Single Post ─── */
.post-header {
  padding: 32px 0 24px;
}

.post-category {
  display: inline-block;
  font-size: 0.78em;
  font-weight: 700;
  color: var(--highlight);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.post-title {
  font-size: 2em;
  font-weight: 800;
  line-height: 1.3;
  color: var(--text);
  letter-spacing: -0.025em;
  margin-bottom: 16px;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.85em;
  color: var(--muted);
}

.post-meta time {
  font-weight: 500;
}

.post-meta .reading-time {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent-mid);
  font-weight: 600;
  font-size: 0.95em;
}

.post-meta .reading-time::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%232B5A8C' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 6v6l4 2'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  flex-shrink: 0;
}

.post-content-wrap {
  background: var(--white);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 48px;
  margin-bottom: 48px;
}

/* Post body typography */
.post-content-wrap h2 {
  font-size: 1.45em;
  font-weight: 800;
  margin-top: 56px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--accent-wash);
  position: relative;
  letter-spacing: -0.02em;
  color: var(--text);
}

.post-content-wrap h2::before {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 40px;
  height: 2px;
  background: var(--highlight);
  border-radius: 1px;
}

.post-content-wrap h3 {
  font-size: 1.18em;
  font-weight: 700;
  margin-top: 36px;
  margin-bottom: 14px;
  color: var(--text);
}

.post-content-wrap h4 {
  font-size: 1.05em;
  font-weight: 700;
  margin-top: 28px;
  margin-bottom: 10px;
  color: var(--text-secondary);
}

.post-content-wrap p {
  margin-bottom: 1.15em;
  color: var(--text-secondary);
  line-height: 1.82;
}

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


/* ─── Archive / Home ─── */
.archive-header {
  padding: 48px 0 32px;
}

.archive-title {
  font-size: 1.8em;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.archive-desc {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.95em;
}

.posts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  padding-bottom: 48px;
}

.post-card {
  background: var(--white);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: all 0.3s var(--ease);
  border: 1px solid var(--border-light);
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-border);
}

.post-card a {
  text-decoration: none;
  color: inherit;
  display: flex;
  gap: 0;
}

.post-card-image {
  flex: 0 0 280px;
  overflow: hidden;
}

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

.post-card:hover .post-card-image img {
  transform: scale(1.04);
}

.post-card-content {
  flex: 1;
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.post-card-category {
  font-size: 0.75em;
  font-weight: 700;
  color: var(--highlight);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.post-card-title {
  font-size: 1.15em;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}

.post-card-excerpt {
  font-size: 0.88em;
  color: var(--muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-date {
  margin-top: 12px;
  font-size: 0.8em;
  color: var(--muted-light);
}


/* ─── Pagination ─── */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 32px 0 64px;
}

.pagination a,
.pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  font-size: 0.9em;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text-secondary);
  transition: all 0.2s var(--ease);
}

.pagination a:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-wash);
}

.pagination .current {
  background: var(--accent);
  color: var(--white);
  border-color: var(--accent);
}


/* ─── Footer ─── */
.site-footer {
  background: var(--text);
  color: rgba(255, 255, 255, 0.6);
  padding: 48px 0;
  margin-top: auto;
}

.footer-inner {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.footer-logo {
  font-size: 1.1em;
  font-weight: 800;
  color: var(--white);
}

.footer-logo .logo-accent {
  color: var(--highlight);
}

.footer-links {
  display: flex;
  gap: 24px;
  list-style: none;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.85em;
  transition: color 0.2s var(--ease);
}

.footer-links a:hover {
  color: var(--white);
}

.footer-copy {
  font-size: 0.82em;
  text-align: center;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  max-width: var(--wide-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
}


/* ─── 404 / Search ─── */
.error-page,
.search-page {
  text-align: center;
  padding: 80px 24px;
}

.error-page h1 {
  font-size: 4em;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 16px;
}

.search-form {
  display: flex;
  max-width: 480px;
  margin: 24px auto;
  gap: 8px;
}

.search-form input[type="search"] {
  flex: 1;
  padding: 12px 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 0.95em;
  background: var(--white);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s var(--ease);
}

.search-form input[type="search"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

.search-form button {
  padding: 12px 24px;
  background: var(--accent);
  color: var(--white);
  border: none;
  border-radius: var(--r-sm);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s var(--ease);
}

.search-form button:hover {
  background: var(--accent-mid);
}


/* ─── Scroll animations ─── */
.fade-up {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out);
  animation: fadeUpFallback 0.5s var(--ease-out) 1.5s forwards;
}

.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
  animation: none;
}

/* Fallback: if JS never adds .visible, CSS animation kicks in after 1.5s */
@keyframes fadeUpFallback {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* ─── Back to top ─── */
.back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--white);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.3s var(--ease);
  z-index: 90;
}

.back-to-top.show {
  opacity: 1;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--accent-mid);
  transform: translateY(-2px);
}

.back-to-top svg {
  width: 20px;
  height: 20px;
}


/* ─── Reading progress bar ─── */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--highlight), var(--accent-mid));
  z-index: 101;
  width: 0%;
  transition: width 0.1s linear;
}


/* ─── Responsive ─── */
@media (max-width: 768px) {
  body { font-size: 15.5px; }

  .header-inner { height: 56px; }
  .site-logo a { font-size: 1.1em; }

  .main-nav {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    padding: 24px;
    z-index: 99;
  }

  .main-nav.open { display: block; }

  .main-nav ul {
    flex-direction: column;
    gap: 4px;
  }

  .main-nav a {
    font-size: 1.05em;
    padding: 14px 16px;
  }

  .menu-toggle { display: block; }

  .post-title { font-size: 1.55em; }

  .post-content-wrap {
    padding: 28px 20px;
    border-radius: var(--r-md);
  }

  .post-content-wrap h2 { font-size: 1.25em; margin-top: 40px; }
  .post-content-wrap h3 { font-size: 1.08em; }

  /* Archive cards stack vertically */
  .post-card a {
    flex-direction: column;
  }

  .post-card-image {
    flex: none;
    height: 200px;
  }

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

  .post-card-title { font-size: 1.05em; }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }

  .footer-links { justify-content: center; }

  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
  }

  .archive-header { padding: 32px 0 20px; }
  .archive-title { font-size: 1.4em; }
}

@media (max-width: 480px) {
  .post-content-wrap {
    padding: 24px 16px;
  }

  .post-title { font-size: 1.35em; }
}


/* ─── More Posts (글 하단 목록) ─── */
.more-posts {
  margin-top: 16px;
  margin-bottom: 48px;
  background: var(--white);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 36px 40px;
}

.more-posts-title {
  font-size: 1.15em;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--accent-wash);
  position: relative;
}

.more-posts-title::before {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 32px;
  height: 2px;
  background: var(--highlight);
  border-radius: 1px;
}

.more-posts-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.more-posts-item {
  border-bottom: 1px solid var(--border-light);
}

.more-posts-item:last-child {
  border-bottom: none;
}

.more-posts-item a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 4px;
  text-decoration: none;
  color: var(--text-secondary);
  transition: all 0.2s var(--ease);
  border-radius: 6px;
}

.more-posts-item a:hover {
  color: var(--accent);
  background: var(--accent-wash);
  padding-left: 12px;
  padding-right: 12px;
}

.more-posts-item-title {
  font-weight: 600;
  font-size: 0.93em;
  line-height: 1.4;
  flex: 1;
}

.more-posts-item-date {
  font-size: 0.8em;
  color: var(--muted-light);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Pagination */
.more-posts-pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.more-posts-page-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 0.85em;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s var(--ease);
}

.more-posts-page-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-wash);
}

.more-posts-page-btn.current {
  background: var(--accent);
  color: var(--white);
  border-color: var(--accent);
}

@media (max-width: 768px) {
  .more-posts {
    padding: 28px 20px;
    border-radius: var(--r-md);
  }

  .more-posts-item a {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 12px 4px;
  }

  .more-posts-item-date {
    font-size: 0.78em;
  }
}
