/*
Theme Name: StoryNet
Description: Custom magazine-style theme for story/content sites (grid + list layout, category badges, colored header).
Version: 1.4
*/

:root {
  --primary: #a8432a;
  --primary-dark: #8a3620;
  --text: #222222;
  --muted: #6b7280;
  --badge-bg: #e9e9ea;
  --badge-text: #4b5563;
  --border: #ececec;
  --max-width: 1200px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background: #fff;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.thumb { display: block; }

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

/* Top thin accent bar */
.top-bar {
  background: var(--primary-dark);
  height: 6px;
}

/* Header */
.site-header {
  background: var(--primary);
  padding: 14px 0;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.site-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #fff;
}
.logo-badge {
  background: #fff;
  color: var(--primary);
  font-weight: 800;
  font-size: 22px;
  border-radius: 10px;
  padding: 8px 14px;
  line-height: 1;
}
.logo-text-title {
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
}
.logo-text-tagline {
  font-size: 11px;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.85);
  text-transform: uppercase;
  font-weight: 600;
}
.main-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}
.main-nav ul {
  list-style: none;
  display: flex;
  gap: 26px;
  margin: 0;
  padding: 0;
}
.main-nav a {
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  opacity: 0.95;
}
.main-nav a:hover { opacity: 1; text-decoration: underline; }
.search-toggle-wrap {
  position: relative;
}
.search-icon {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}
.search-icon svg { display: block; }
.search-popover {
  display: none;
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 12px 30px -8px rgba(0,0,0,0.25);
  padding: 8px;
  gap: 6px;
  width: 260px;
  z-index: 50;
}
.search-popover.open {
  display: flex;
}
.search-popover input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
}
.search-popover input:focus {
  outline: none;
  border-color: var(--primary);
}
.search-popover button[type="submit"] {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0 12px;
  cursor: pointer;
  font-size: 15px;
}

/* Content wrap */
.content-wrap { padding: 32px 0 60px; }

/* Featured grid — first N posts, 2 columns, large image */
.featured-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin-bottom: 36px;
}
@media (max-width: 760px) { .featured-grid { grid-template-columns: 1fr; } }

/* Standard grid — 4 columns */
.post-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 28px;
  margin-bottom: 36px;
}
@media (max-width: 980px) { .post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .post-grid { grid-template-columns: 1fr; } }

.post-card .thumb {
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 12px;
  aspect-ratio: 16/10;
}
.post-card .thumb img { width: 100%; height: 100%; object-fit: cover; }

.category-badge {
  display: inline-block;
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 3px;
  margin-bottom: 10px;
}
.post-card.is-featured .category-badge,
.post-list-item.is-featured .category-badge {
  background: var(--primary);
  color: #fff;
}

.post-card h2, .post-list-item h2 {
  font-size: 18px;
  line-height: 1.35;
  font-weight: 700;
  margin: 0 0 8px;
}
.post-card.is-featured h2 a,
.post-list-item.is-featured h2 a { color: var(--primary); }

.post-meta {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}
.post-excerpt {
  color: #444;
  font-size: 14.5px;
  line-height: 1.6;
}

/* List layout — image left, content right */
.post-list {
  border-top: 1px solid var(--border);
}
.post-list-item {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  padding: 26px 0;
  border-bottom: 1px solid var(--border);
}
@media (max-width: 640px) { .post-list-item { grid-template-columns: 1fr; } }
.post-list-item .thumb {
  border-radius: 6px;
  overflow: hidden;
  aspect-ratio: 16/10;
}
.post-list-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-list-item .category-label {
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  display: inline-block;
}
.post-list-item.is-grey .category-label { color: var(--muted); }

/* Category archive */
.archive-title {
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 10px 0 34px;
}
.archive-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 40px;
  align-items: start;
}
@media (max-width: 860px) { .archive-layout { grid-template-columns: 1fr; } }

.post-grid-2col {
  grid-template-columns: repeat(2, 1fr) !important;
}
@media (max-width: 640px) { .post-grid-2col { grid-template-columns: 1fr !important; } }

.sidebar-box {
  margin-bottom: 34px;
}
.sidebar-box:last-child {
  margin-bottom: 0;
}
.sidebar-title {
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
}
.sidebar-divider {
  width: 40px;
  height: 2px;
  background: var(--border);
  margin: 14px 0 18px;
}

.sidebar-post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-link-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sidebar-link-list li {
  border-bottom: 1px solid var(--border);
}
.sidebar-link-list li:last-child {
  border-bottom: none;
}
.sidebar-link-list a {
  display: block;
  padding: 11px 2px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--primary);
}
.sidebar-link-list a:hover {
  text-decoration: underline;
}
.sidebar-link-list li.current-cat > a,
.sidebar-link-list li.current_page_item > a {
  color: var(--text);
  font-weight: 700;
}
.sidebar-post {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.sidebar-post .thumb {
  width: 64px;
  height: 64px;
  border-radius: 6px;
  overflow: hidden;
}
.sidebar-post .thumb img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-post h4 {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 600;
}
.sidebar-post h4 a { color: var(--primary); }

/* Single post: share row, author box, more-from-author */
.share-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 36px 0 30px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.share-row a {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.share-row a:hover {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.author-box {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 18px;
  align-items: flex-start;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}
.author-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #22c55e;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.author-name {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.author-bio {
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
  margin: 0;
}

.more-from-author {
  margin-top: 10px;
  padding-top: 30px;
}
.section-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 22px;
}

/* Footer */
.site-footer {
  background: var(--primary);
  color: rgba(255,255,255,0.85);
  padding: 26px 0;
  text-align: center;
  font-size: 13px;
}
.footer-nav {
  list-style: none;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 26px;
  margin: 0 0 14px;
  padding: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 13px;
  font-weight: 600;
}
.footer-nav a { color: rgba(255,255,255,0.9); }
.footer-nav a:hover { color: #fff; text-decoration: underline; }
.footer-copyright { color: rgba(255,255,255,0.85); }
