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

:root {
  --border: rgba(0,0,0,0.08);
  --off: #f7f7f6;
  --muted: #888;
  --light: #bbb;
  --max: 760px;
}

html { font-size: 16px; }
body { font-family: 'Inter', system-ui, sans-serif; background: #fff; color: #111; -webkit-font-smoothing: antialiased; display: flex; flex-direction: column; min-height: 100vh; }
a { text-decoration: none; color: inherit; }

/* TOP BAR */
.top-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 14px 32px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.top-brand {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.2px;
  white-space: nowrap;
  
}

.top-search {
  
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  background: var(--off);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--muted);
  width: 460px;
  cursor: text;
}

.top-search svg, .top-search kbd {
  cursor: text;
}

.top-search input {
  
  border: none;
  background: none;
  font-size: 13px;
  color: #111;
  font-family: 'Inter', sans-serif;
  outline: none;
}
.top-search input::placeholder { color: var(--muted); }

kbd {
  font-size: 11px;
  color: var(--light);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: 'Inter', sans-serif;
}

.top-login {
  
  background: #2563EB;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: 8px;
  white-space: nowrap;
  transition: opacity .12s;
}
.top-login:hover { opacity: .85; }

/* HERO */
.hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: 56px 24px 40px;
  text-align: center;
}

.hero-title {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.8px;
  line-height: 1.2;
  margin-bottom: 16px;
  color: #111;
}

.hero-sub {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.7;
  max-width: 560px;
  margin: 0 auto;
}

/* MAIN */
.site-main { max-width: var(--max); width: 100%; margin: 0 auto; padding: 0 24px; flex: 1; }

/* TABS */
.feed-tabs {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  border-bottom: 1px solid var(--border);
}

.tab {
  padding: 14px 0;
  margin-right: 24px;
  font-size: 13px;
  color: var(--muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all .12s;
}
.tab:hover { color: #111; }
.tab.active { color: #111; border-bottom-color: #111; }

/* ARTICLES */
.article-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 20px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
  transition: opacity .12s;
}
.article-row:hover { opacity: 0.68; }

.article-thumb {
  width: 80px;
  height: 62px;
  border-radius: 8px;
  background: var(--off);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.article-body { min-width: 0; flex: 1; display: flex; flex-direction: column; align-items: flex-start; }

.article-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1.3;
  margin-bottom: 8px;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  color: #111;
}

.article-meta {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}
.meta-sep { opacity: 0.3; }

.badge {
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  background: var(--off);
  color: #555;
  border: 1px solid var(--border);
}

.lock-icon { display:inline-flex; align-items:center; opacity:1; }
.no-posts { padding: 40px 0; color: var(--muted); font-size: 14px; }

/* PAGINATION */
.pagination { display: grid;
  grid-template-columns: 1fr auto 1fr; align-items: center; justify-content: center; gap: 16px; padding: 36px 0; }
.pagination .older-posts, .pagination .newer-posts { font-size: 13px; color: var(--muted); border: 1px solid var(--border); padding: 8px 18px; border-radius: 6px; transition: all .12s; }
.pagination .older-posts:hover, .pagination .newer-posts:hover { color: #111; background: var(--off); }
.pagination .page-number { font-size: 12px; color: var(--light); }

/* SINGLE POST */
.post-container { padding: 48px 0 80px; max-width: var(--max); margin: 0 auto; }
.post-tag-label { display: inline-block; font-size: 11px; font-weight: 500; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--border); padding: 3px 10px; border-radius: 20px; margin-bottom: 16px; }
.post-title { font-size: 30px; font-weight: 600; letter-spacing: -0.5px; line-height: 1.25; margin-bottom: 14px; }
.post-meta { display: grid;
  grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.post-feature-image { margin: 28px 0; border-radius: 10px; overflow: hidden; }
.post-feature-image img { width: 100%; height: auto; display: block; }

/* CONTENT */
.gh-content { font-size: 16px; line-height: 1.75; color: #1a1a1a; margin-top: 32px; }
.gh-content h2 { font-size: 22px; font-weight: 600; margin: 36px 0 14px; }
.gh-content h3 { font-size: 18px; font-weight: 500; margin: 28px 0 10px; }
.gh-content p { margin-bottom: 20px; }
.gh-content ul, .gh-content ol { margin: 0 0 20px 24px; }
.gh-content li { margin-bottom: 6px; }
.gh-content blockquote { border-left: 3px solid var(--border); margin: 24px 0; padding: 8px 20px; color: var(--muted); font-style: italic; }
.gh-content img { max-width: 100%; border-radius: 8px; margin: 20px 0; }
.gh-content a { text-decoration: underline; text-underline-offset: 3px; }
.gh-content hr { border: none; border-top: 1px solid var(--border); margin: 40px 0; }
.kg-width-wide { margin: 20px -60px; }
.kg-width-full { margin: 20px -120px; }
.kg-image, .kg-gallery-image img { max-width: 100%; height: auto; border-radius: 8px; }
.kg-gallery-container { display: grid;
  grid-template-columns: 1fr auto 1fr; flex-wrap: wrap; gap: 8px; margin: 20px 0; }

/* CAPTIONS */
.kg-image-card,
.kg-gallery-card,
.kg-embed-card {
  margin: 20px 0;
}
.kg-image-card img,
.kg-gallery-card img,
.gh-content .kg-image-card img {
  margin: 0;
}
figcaption,
.kg-image-card figcaption,
.kg-gallery-card figcaption,
.kg-embed-card figcaption {
  font-size: 13px;
  font-style: italic;
  color: var(--muted);
  text-align: center;
  margin-top: 6px;
  margin-bottom: 0;
  line-height: 1.4;
}

/* PAYWALL */
.paywall { margin-top: 40px; padding-top: 40px; border-top: 1px solid var(--border); }
.paywall-box { background: var(--off); border: 1px solid var(--border); border-radius: 12px; padding: 36px; text-align: center; max-width: 400px; margin: 0 auto; }
.paywall-box h3 { font-size: 20px; font-weight: 600; margin-bottom: 10px; }
.paywall-box p { font-size: 14px; color: var(--muted); margin-bottom: 24px; }
.paywall-btn { display: inline-block; background: #111; color: #fff; padding: 11px 26px; border-radius: 8px; font-size: 14px; font-weight: 500; }
.paywall-btn:hover { opacity: .8; }
.paywall-login { display: block; font-size: 12px; color: var(--muted); margin-top: 12px; }

/* FOOTER */
.site-footer { width: 100%; padding: 24px; border-top: 1px solid var(--border); font-size: 12px; color: var(--light); text-align: center; }

/* BACK / FEED HEADER */
.back-link { font-size: 13px; color: var(--muted); }
.back-link:hover { color: #111; }
.feed-header { padding: 36px 0 0; }
.feed-title { font-size: 22px; font-weight: 600; margin-bottom: 4px; }
.feed-desc { font-size: 14px; color: var(--muted); }
.page-container { padding: 48px 0 80px; }

@media (max-width: 600px) {
  .article-thumb { width: 80px !important; height: 60px !important; }
  .top-search { display: none; }
  .hero-title { font-size: 24px; }
  .post-title { font-size: 22px; }
  .kg-width-wide, .kg-width-full { margin: 20px 0; }
  .top-bar {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    gap: 12px;
  }
  .top-bar > div:last-child {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }
}
.top-login { justify-self: end; }
kbd { display: none; }
.top-search input { text-align: center; }

/* Bigger thumbnails */
.article-thumb {
  width: 120px !important;
  height: 90px !important;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}
.article-thumb-empty { background: var(--off); }

/* Comments */
.comments-section { margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--border); }

/* Post title prominent */
.post-title { font-size: 32px; font-weight: 700; letter-spacing: -0.6px; line-height: 1.2; margin-bottom: 12px; }
.post-meta { margin-bottom: 24px; }

/* Tab fixes */
.feed-tabs { justify-content: flex-start; }
.tab { font-weight: 500; width: auto; padding-bottom: 12px; }
.tab.active { border-bottom: 2px solid #111; width: auto; }
.tab { width: fit-content; }

/* Tab complete reset */
.feed-tabs { display: flex !important; justify-content: flex-start !important; gap: 0 !important; }
.tab { flex: none !important; width: auto !important; min-width: 0 !important; margin-right: 24px !important; text-align: left !important; }
.pagination .page-number { display: none; }

.top-account { display:flex; align-items:center; justify-content:center; color:#111; opacity:0.7; transition:opacity .15s; border:1.5px solid rgba(0,0,0,0.15); border-radius:50%; width:34px; height:34px; }
.top-account:hover { opacity:1; }

/* Account dropdown */
.top-account-wrap { position: relative; display: flex; align-items: center; }
.top-account { display:flex; align-items:center; justify-content:center; color:#111; opacity:0.7; transition:opacity .15s; border:1.5px solid rgba(0,0,0,0.15); border-radius:50%; width:34px; height:34px; background:none; cursor:pointer; padding:0; }
.top-account:hover { opacity:1; }

.account-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.13);
  min-width: 260px;
  z-index: 1000;
  overflow: hidden;
}

.account-dropdown-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
}

.account-dropdown-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #e8e8e8;
  color: #444;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.account-dropdown-name { font-size: 15px; font-weight: 700; color: #111; }
.account-dropdown-email { font-size: 13px; color: #888; margin-top: 2px; }
.account-dropdown-divider { height: 1px; background: rgba(0,0,0,0.07); }

.account-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  font-size: 15px;
  color: #111;
  text-decoration: none;
  transition: background .1s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
}
.account-dropdown-item:hover { background: #f7f7f6; }

/* Dark mode toggle */
.account-dropdown-darkmode { justify-content: space-between; }
.dm-toggle { width: 36px; height: 20px; border-radius: 10px; background: #ddd; position: relative; transition: background .2s; flex-shrink: 0; }
.dm-toggle.active { background: #111; }
.dm-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; position: absolute; top: 2px; left: 2px; transition: transform .2s; }
.dm-toggle.active .dm-thumb { transform: translateX(16px); }

/* Dark mode styles */
html[data-theme="dark"] body { background: #0f0f0f; color: #e8e8e8; }
html[data-theme="dark"] .top-bar { background: #0f0f0f; border-color: rgba(255,255,255,0.08); }
html[data-theme="dark"] .top-brand { color: #e8e8e8; }
html[data-theme="dark"] .top-search { background: #1a1a1a; border-color: rgba(255,255,255,0.1); color: #888; }
html[data-theme="dark"] .top-search input { color: #e8e8e8; }
html[data-theme="dark"] .article-row { border-color: rgba(255,255,255,0.08); color: #e8e8e8; }
html[data-theme="dark"] .article-row * { color: #e8e8e8; }
html[data-theme="dark"] .article-row:hover { opacity: 0.7; }
html[data-theme="dark"] .article-title { color: #e8e8e8 !important; }
html[data-theme="dark"] .article-thumb { background-color: #1a1a1a; }
html[data-theme="dark"] .feed-tabs { border-color: rgba(255,255,255,0.08); }
html[data-theme="dark"] .tab { color: #666; }
html[data-theme="dark"] .tab.active { color: #e8e8e8; border-bottom-color: #e8e8e8; }
html[data-theme="dark"] .hero-title { color: #e8e8e8; }
html[data-theme="dark"] .hero-sub { color: #666; }
html[data-theme="dark"] .site-footer { color: #444; border-color: rgba(255,255,255,0.08); }
html[data-theme="dark"] .account-dropdown { background: #1a1a1a; border-color: rgba(255,255,255,0.1); }
html[data-theme="dark"] .account-dropdown-name { color: #e8e8e8; }
html[data-theme="dark"] .account-dropdown-item { color: #e8e8e8; }
html[data-theme="dark"] .account-dropdown-item:hover { background: #222; }
html[data-theme="dark"] .account-dropdown-divider { background: rgba(255,255,255,0.08); }
html[data-theme="dark"] .gh-content { color: #d0d0d0; }
html[data-theme="dark"] .gh-content h2, html[data-theme="dark"] .gh-content h3 { color: #e8e8e8; }
html[data-theme="dark"] .post-tag-label { color: #888; border-color: rgba(255,255,255,0.1); }
html[data-theme="dark"] .back-link { color: #666; }
html[data-theme="dark"] .lang-btn { background: #1a1a1a; color: #666; }
html[data-theme="dark"] .lang-btn.active { background: #e8e8e8; color: #111; }
html[data-theme="dark"] .lang-toggle { border-color: rgba(255,255,255,0.1); }
html[data-theme="dark"] .top-account { color: #e8e8e8; border-color: rgba(255,255,255,0.2); }

html[data-theme="dark"] .meta-date { color: #888; }
html[data-theme="dark"] .meta-author { color: #888; }

html[data-theme="dark"] h1 { color: #e8e8e8; }
html[data-theme="dark"] h2 { color: #e8e8e8; }
html[data-theme="dark"] h3 { color: #e8e8e8; }
html[data-theme="dark"] p { color: #d0d0d0; }
