/* ==========================================================================
   요망진살림 — 공통 디자인 시스템 (index.html / story-list.php / story-view.php 공용)
   ========================================================================== */

@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.css');

:root {
  --color-bg: #fffdf7;
  --color-surface: #ffffff;
  --color-hero: #f6c945;
  --color-hero-dark: #e9b923;
  --color-ink: #201b13;
  --color-ink-soft: #756b5a;
  --color-ink-faint: #a89d89;
  --color-border: #ece4d2;
  --color-accent-red: #e3542c;
  --color-tag: #a67c1f;
  --color-btn-dark: #201b13;
  --color-placeholder-a: #efe2c3;
  --color-placeholder-b: #e6d5a8;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-pill: 999px;
  --shadow-card: 0 2px 10px rgba(32, 27, 19, 0.06);
  --max-width: 1120px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Malgun Gothic', system-ui, sans-serif;
  background: var(--color-bg);
  color: var(--color-ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

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

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
  position: sticky;
  top: 0;
  z-index: 50;
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 68px;
}

.site-logo {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.site-logo span { color: var(--color-hero-dark); }

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

.site-nav a {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--color-ink-soft);
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.site-nav a:hover,
.site-nav a.active {
  color: var(--color-ink);
  border-bottom-color: var(--color-hero);
}
.site-nav a.nav-story {
  color: var(--color-hero-dark);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  padding: 7px 14px;
  font-size: 13px;
  color: var(--color-ink-faint);
  background: var(--color-surface);
}
.search-box input {
  border: none;
  outline: none;
  font-size: 13px;
  font-family: inherit;
  width: 120px;
  background: transparent;
}

.btn-subscribe-mini {
  background: var(--color-hero);
  color: var(--color-ink);
  font-weight: 700;
  font-size: 13.5px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  border: none;
}

/* ---------- Layout: hero + ranking ---------- */
.top-section {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 20px;
  margin: 28px auto 0;
}

.hero-card {
  background: linear-gradient(135deg, var(--color-hero), var(--color-hero-dark));
  border-radius: var(--radius-lg);
  padding: 40px 44px;
  color: var(--color-ink);
  min-height: 230px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
}

.hero-crumb {
  font-size: 12.5px;
  color: rgba(32,27,19,0.6);
  font-weight: 600;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  background: rgba(255,255,255,0.55);
  color: var(--color-ink);
  font-size: 12.5px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  width: fit-content;
}

.hero-title {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.3;
  margin: 0;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  font-size: 14.5px;
  color: rgba(32,27,19,0.72);
  margin: 0;
}

.btn-dark {
  background: var(--color-btn-dark);
  color: #fff;
  font-weight: 700;
  font-size: 13.5px;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  border: none;
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ranking-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 22px 22px;
}

.ranking-title {
  font-size: 14px;
  font-weight: 800;
  margin: 0 0 2px;
}
.ranking-meta {
  font-size: 11.5px;
  color: var(--color-ink-faint);
  margin: 0 0 14px;
}

.ranking-list { display: flex; flex-direction: column; gap: 12px; }
.ranking-item { display: flex; align-items: center; gap: 12px; }
.ranking-num {
  font-size: 13px;
  font-weight: 800;
  color: var(--color-ink-faint);
  width: 14px;
}
.ranking-thumb {
  width: 40px; height: 40px;
  border-radius: 9px;
  background: repeating-linear-gradient(45deg, var(--color-placeholder-a), var(--color-placeholder-a) 6px, var(--color-placeholder-b) 6px, var(--color-placeholder-b) 12px);
  flex-shrink: 0;
}
.ranking-info { min-width: 0; }
.ranking-name { font-size: 13px; font-weight: 700; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ranking-desc { font-size: 11px; color: var(--color-ink-faint); margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ranking-price { font-size: 12.5px; font-weight: 700; margin: 0; }

/* ---------- Category tabs ---------- */
.category-tabs {
  display: flex;
  gap: 8px;
  margin: 26px 0 0;
  flex-wrap: wrap;
}
.category-tab {
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  font-size: 13.5px;
  font-weight: 700;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-ink-soft);
}
.category-tab.active {
  background: var(--color-ink);
  color: #fff;
  border-color: var(--color-ink);
}

/* ---------- Section heading ---------- */
.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 40px 0 18px;
}
.section-heading h2 {
  font-size: 19px;
  font-weight: 800;
  margin: 0 0 4px;
}
.section-heading p {
  font-size: 12.5px;
  color: var(--color-ink-faint);
  margin: 0;
}
.section-heading .more-link {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-ink-soft);
}

/* ---------- Product grid ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.product-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.product-thumb {
  aspect-ratio: 4 / 3;
  background: repeating-linear-gradient(45deg, var(--color-placeholder-a), var(--color-placeholder-a) 10px, var(--color-placeholder-b) 10px, var(--color-placeholder-b) 20px);
  background-size: cover;
  background-position: center;
}

.product-body { padding: 16px 18px 18px; }
.product-name { font-size: 15px; font-weight: 800; margin: 0 0 4px; }
.product-desc { font-size: 12.5px; color: var(--color-ink-faint); margin: 0 0 10px; }

.product-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.price-group { display: flex; align-items: baseline; gap: 6px; }
.price-original { font-size: 12px; color: var(--color-ink-faint); text-decoration: line-through; }
.price-discount { font-size: 13px; font-weight: 800; color: var(--color-accent-red); }
.price-final { font-size: 15px; font-weight: 800; }

.btn-buy {
  background: var(--color-btn-dark);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  border: none;
  white-space: nowrap;
}

.product-comment {
  border-top: 1px dashed var(--color-border);
  padding-top: 12px;
}
.comment-label { font-size: 11px; color: var(--color-ink-faint); font-weight: 700; margin: 0 0 6px; }
.comment-tags { font-size: 12px; color: var(--color-tag); font-weight: 700; margin: 0 0 6px; }
.comment-text { font-size: 12.5px; color: var(--color-ink-soft); margin: 0; line-height: 1.55; }

/* ---------- 살림스토리 section ---------- */
.story-section { margin-top: 44px; }

.story-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.story-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}

.story-thumb {
  aspect-ratio: 16 / 10;
  background: repeating-linear-gradient(45deg, var(--color-placeholder-a), var(--color-placeholder-a) 10px, var(--color-placeholder-b) 10px, var(--color-placeholder-b) 20px);
  background-size: cover;
  background-position: center;
}

.story-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.story-cat {
  font-size: 11px;
  font-weight: 800;
  color: var(--color-hero-dark);
  letter-spacing: 0.02em;
}
.story-title { font-size: 15.5px; font-weight: 800; margin: 0; line-height: 1.4; }
.story-excerpt {
  font-size: 12.5px;
  color: var(--color-ink-faint);
  margin: 0;
  line-height: 1.6;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.story-date { font-size: 11.5px; color: var(--color-ink-faint); }

.story-empty {
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  color: var(--color-ink-faint);
  font-size: 13.5px;
}

/* ---------- Newsletter ---------- */
.newsletter-box {
  margin-top: 44px;
  background: linear-gradient(135deg, var(--color-hero), var(--color-hero-dark));
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.newsletter-copy h3 { font-size: 17px; font-weight: 800; margin: 0 0 6px; }
.newsletter-copy p { font-size: 13px; margin: 0; color: rgba(32,27,19,0.72); }

.newsletter-form { display: flex; gap: 8px; }
.newsletter-form input {
  border: none;
  border-radius: var(--radius-pill);
  padding: 11px 18px;
  font-size: 13px;
  font-family: inherit;
  width: 220px;
  outline: none;
}
.newsletter-form button {
  background: var(--color-btn-dark);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  padding: 11px 20px;
  font-weight: 700;
  font-size: 13px;
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 56px;
  border-top: 1px solid var(--color-border);
  padding: 28px 0 40px;
}
.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-logo { font-size: 15px; font-weight: 800; margin: 0 0 8px; }
.footer-desc {
  font-size: 12px;
  color: var(--color-ink-faint);
  max-width: 480px;
  line-height: 1.6;
  margin: 0;
}
.footer-links { display: flex; gap: 18px; }
.footer-links a { font-size: 12.5px; color: var(--color-ink-soft); font-weight: 600; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .top-section { grid-template-columns: 1fr; }
  .product-grid, .story-grid { grid-template-columns: repeat(2, 1fr); }
  .site-nav { display: none; }
}
@media (max-width: 560px) {
  .product-grid, .story-grid { grid-template-columns: 1fr; }
  .newsletter-box { flex-direction: column; align-items: flex-start; }
  .newsletter-form { width: 100%; }
  .newsletter-form input { flex: 1; width: auto; }
}

/* ---------- Story detail / list page extras ---------- */
.page-header {
  padding: 40px 0 8px;
}
.page-header h1 { font-size: 26px; font-weight: 800; margin: 0 0 6px; }
.page-header p { font-size: 13.5px; color: var(--color-ink-faint); margin: 0; }

.breadcrumb {
  font-size: 12.5px;
  color: var(--color-ink-faint);
  margin: 20px 0 0;
}
.breadcrumb a { font-weight: 600; color: var(--color-ink-soft); }

.story-detail {
  max-width: 760px;
  margin: 0 auto;
  padding: 36px 24px 80px;
}
.story-detail .story-cat { display: block; margin-bottom: 10px; }
.story-detail h1 {
  font-size: 27px;
  font-weight: 800;
  line-height: 1.4;
  margin: 0 0 12px;
}
.story-detail .meta {
  font-size: 12.5px;
  color: var(--color-ink-faint);
  margin: 0 0 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--color-border);
}
.story-detail .cover {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: var(--radius-lg);
  background: repeating-linear-gradient(45deg, var(--color-placeholder-a), var(--color-placeholder-a) 12px, var(--color-placeholder-b) 12px, var(--color-placeholder-b) 24px);
  background-size: cover;
  background-position: center;
  margin-bottom: 28px;
}
.story-detail .content {
  font-size: 15.5px;
  line-height: 1.9;
  color: var(--color-ink);
}
.story-detail .content p { margin: 0 0 20px; }
.story-detail .content img { border-radius: var(--radius-md); margin: 20px 0; }

.story-nav-back {
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
}
