/* ==============================
   Product Hunt Short - Global Styles (Responsive)
   ============================== */

:root{
  --bg:#f9fafb;
  --text:#111827;
  --gray:#6b7280;
  --card:#ffffff;
  --accent:#ff6154;
  --accent-from:#ff6154;
  --accent-to:#ff8a7f;
  --border:#e5e7eb;
  --radius:12px;
  --shadow-sm:0 2px 4px rgba(0,0,0,.04);
  --shadow-md:0 4px 12px rgba(0,0,0,.06);
  font-family:'Inter',sans-serif;
}

/* Base */
*{box-sizing:border-box}
html,body{height:100%;overflow-x:hidden;max-width:100vw}
html{scroll-behavior:smooth}
body{
  margin:0;min-height:100vh;display:flex;flex-direction:column;
  background:var(--bg);color:var(--text);
  font-family:'Inter',system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  line-height:1.55;
  padding-bottom:72px; /* space for fixed footer on desktop */
  -webkit-text-size-adjust:100%;
}
a{color:inherit;text-decoration:none}
a:hover{text-decoration:underline}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:8px}

/* Reduce motion */
@media (prefers-reduced-motion:reduce){
  *{animation-duration:0.001ms !important;animation-iteration-count:1 !important;transition-duration:0.001ms !important;scroll-behavior:auto !important}
}

/* ========== NAVBAR ========== */
.navbar{
  position:sticky;top:0;z-index:50;background:rgba(255,255,255,0.7);
  border-bottom:1px solid var(--border);
  padding:14px 24px;backdrop-filter:blur(10px);
}
.nav-container{
  max-width:1120px;margin:0 auto;
  display:flex;align-items:center;justify-content:space-between;gap:12px;
}
.logo{font-size:20px;font-weight:700;color:var(--accent);margin:0;flex:0 0 auto}
.subtitle{color:var(--gray);font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* NAV on small widths */
@media (max-width:768px){
  .nav-container{flex-direction:column;align-items:flex-start;gap:6px}
  .subtitle{font-size:13px;max-width:100%}
}

/* ========== FEED LIST ========== */
.feed{
  flex:1;max-width:800px;margin:32px auto;padding:0 16px;
  display:grid;grid-template-columns:1fr;gap:14px;
}
.card{
  background:var(--card);border:1px solid var(--border);border-radius:var(--radius);
  padding:14px;box-shadow:var(--shadow-sm);transition:all .25s ease;
}
.card:hover{
  box-shadow:var(--shadow-md);
  transform:translateY(-2px);
}

/* Horizontal by default (desktop/tablet) */
.feed-card{display:flex;align-items:flex-start;gap:12px;min-height:120px;padding:16px !important;}
.feed-thumb{
  flex:0 0 60px;height:60px;border-radius:10px;overflow:hidden;
  border:1px solid var(--border);background:#fff
}
.feed-thumb img{
  width:100%;
  height:100%;
  display:block;
  object-fit:contain;  /* كان cover */
  object-position:center;
  background:#fff;
  border-radius:12px;
}
.feed-thumb-placeholder{
  width:60px;height:60px;display:grid;place-items:center;border-radius:10px;
  background:#f3f4f6;border:1px dashed var(--border);font-size:20px;color:#9ca3af
}
.content{flex:1;min-width:0;display:flex;flex-direction:column}

.title-row{display:flex;align-items:baseline;justify-content:space-between;gap:10px}
.name{
  margin:0;font-size:17px;font-weight:700;line-height:1.3;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.votes{color:var(--gray);font-size:13px;flex:0 0 auto}
.tagline{margin:4px 0 0;color:var(--gray);font-size:13px;line-height:1.4;}
.desc{margin:8px 0 0;font-size:14px;line-height:1.6;color:var(--text);}
.actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:auto;padding-top:12px}

/* Buttons */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  padding:8px 12px;border-radius:10px;font-size:14px;font-weight:600;
  white-space:nowrap;border:1px solid var(--border);background:#fff;color:var(--text);
  text-decoration:none;transition:all .2s ease
}
.btn:hover{filter:brightness(.98);text-decoration:none;transform:translateY(-1px);box-shadow:0 4px 8px rgba(0,0,0,0.1)}
.btn.primary{background:linear-gradient(135deg,var(--accent-from),var(--accent-to));color:#fff;border-color:var(--accent-from)}
.btn.primary:hover{filter:brightness(.98);transform:translateY(-1px);box-shadow:0 6px 16px rgba(255,97,84,0.35)}

/* Button variants */
.btn.ghost{background:#fff;border-color:var(--border);color:var(--text)}
.btn.compact{padding:6px 10px;font-size:13px;border-radius:9px}

/* Social Buttons */
.btn-twitter{background:#000;color:#fff;border-color:#000}
.btn-twitter:hover{background:#1a1a1a;border-color:#1a1a1a;box-shadow:0 4px 12px rgba(0,0,0,0.25);transform:translateY(-2px)}
.btn-linkedin{background:#0a66c2;color:#fff;border-color:#0a66c2}
.btn-linkedin:hover{background:#004182;border-color:#004182;box-shadow:0 4px 12px rgba(10,102,194,0.35);transform:translateY(-2px)}

/* ========== PROJECT PAGE ========== */
.project-page{background:var(--bg);color:var(--text)}
.container{max-width:1120px;margin:32px auto;padding:0 16px;flex:1}
.grid{display:grid;grid-template-columns:5fr 2fr;gap:24px}
@media (max-width:1024px){.grid{grid-template-columns:3fr 2fr}}
@media (max-width:880px){.grid{grid-template-columns:1fr}}

.project-page article.card{display:block}
.project-page article.card .section{margin-bottom:16px}

.hero-head{display:flex;align-items:center;gap:12px;min-width:0}
.project-page .section-hero .title{font-size:clamp(1.2rem,1rem + .9vw,1.5rem)}
.project-page .section-hero .hero{padding-top:34px;padding-bottom:28px;text-align:left}
.title,.project-title{
  margin:0;font-size:22px;font-weight:700;line-height:1.2;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis
}
.thumb.small img{width:34px;height:34px;border-radius:10px;object-fit:cover}
.project-tagline{margin:6px 0 0;color:#555;font-size:17px;font-weight:500}

.pills{
  display:flex;gap:8px;margin-top:10px;margin-bottom:8px;overflow-x:auto;white-space:nowrap;scrollbar-width:thin;
  -webkit-overflow-scrolling:touch;
}
.pill{
  display:inline-flex;align-items:center;padding:6px 14px;border-radius:14px;
  background:#f4f4f5;border:1px solid #eee;font-size:13px;color:#555;flex:0 0 auto
}

.section-summary .label{font-size:12px;text-transform:uppercase;letter-spacing:.08em;color:var(--gray);font-weight:700;margin-bottom:6px}
.section-summary .summary{font-size:16.5px;line-height:1.65;color:#444;max-width:650px;display:block;margin-bottom:18px}

.section-actions .row{display:flex;gap:8px;overflow-x:auto;flex-wrap:nowrap;margin-top:12px;-webkit-overflow-scrolling:touch}

/* Gallery */
.section-gallery .gallery{
  overflow:hidden;border-radius:20px;border:1px solid var(--border);
  max-width:780px;margin:0 auto;background:#ffffff;width:100%;box-sizing:border-box;box-shadow:0 8px 24px rgba(0,0,0,0.04)
}
@media (max-width:768px){
  .section-gallery .gallery{
    max-width:100% !important;
  }
}
.section-gallery .gallery-main{
  background:#fafafa;display:flex;align-items:center;justify-content:center;
  height:auto;min-height:220px
}
.section-gallery .gallery-main img,
.section-gallery .gallery-main video{width:100%;height:auto;max-height:420px;object-fit:cover;border-radius:16px}
.section-gallery .thumbs{
  display:flex;gap:8px;overflow-x:auto;padding:10px;border-top:1px solid var(--border);justify-content:center;
  -webkit-overflow-scrolling:touch
}
.section-gallery .thumbs button{
  height:56px;width:96px;border-radius:10px;border:1px solid var(--border);overflow:hidden;background:#fff;flex:0 0 auto
}
.section-gallery .thumbs button.active{outline:2px solid var(--accent)}

/* Ensure thumbnail images fit within their buttons */
.section-gallery .thumbs button img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

/* Sidebar vote/nav */
.side-vote .vote-box{
  display:flex;align-items:center;justify-content:center;flex-direction:column;gap:8px;
  padding:16px;border:1px solid var(--border);border-radius:var(--radius);background:var(--card);box-shadow:var(--shadow-sm)
}
.side-vote .caret{display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:10px;border:1px solid var(--border);font-weight:700}
.side-vote .votes{font-weight:700}
.side-vote .vote-box.tight{padding:12px;gap:10px;border-radius:10px}
.rank-badge{
  font-size:.9rem;font-weight:700;color:var(--text);background:#f7f8fc;border:1px solid var(--border);
  border-radius:999px;padding:4px 10px;line-height:1;white-space:nowrap
}
.project-page .side-vote .rank-badge{background:#fff;border:1px solid #eee;padding:4px 10px;font-size:14px;border-radius:12px}
.project-page .side-vote .votes-chip{font-size:13px;border-radius:10px;padding:2px 8px}
.vote-row{display:flex;align-items:center;gap:8px}
.votes-chip{
  display:inline-flex;align-items:center;gap:6px;background:#f7f7fa;border:1px solid var(--border);
  border-radius:8px;padding:2px 8px;line-height:1;color:var(--text)
}
.votes-chip strong{font-weight:800}
.btn.sm{padding:6px 10px;font-size:.9rem;border-radius:10px}

.side-vote .nav-box{margin-top:12px;padding:10px}
.proj-nav-minimal{display:flex;justify-content:center;align-items:center;gap:10px}
.proj-nav-minimal .btn.compact{padding:4px 10px;font-size:1rem}
.proj-nav-index{font-size:.95rem;color:var(--gray);font-weight:600}
.side-vote .nav-box nav .btn{padding:4px 10px}
.side-vote .nav-box span{
  font-size:1.05rem;font-weight:600;background:#f7f7fa;color:#222;border-radius:8px;padding:6px 12px;
  min-width:66px;text-align:center;box-shadow:0 1px 2px 0 #0001;letter-spacing:.4px
}
.side-vote .card,.side-vote .vote-box{margin-bottom:18px}
.side-vote .vote-box:last-child,.side-vote .card:last-child{margin-bottom:0}

/* ========== DATE BANNER (centered & aligned with feed width) ========== */
.date-banner{
  background:#fff;
  border-bottom:1px solid var(--border);
  padding:14px 0;
}
.date-banner-inner{
  max-width:980px; /* نفس عرض .feed */
  width:100%;
  margin:0 auto;
  padding:0 16px; /* نفس padding .feed */
  display:flex;
  justify-content:center;
  align-items:center;
  text-align:center;
}
.date-banner .date-text{
  font-size:15px;color:var(--gray);margin:0;
}
.date-banner .date-text strong{color:var(--text);font-weight:600}

/* ========== FOOTER ========== */
footer,.site-footer{
  position:fixed;left:0;right:0;bottom:0;z-index:40;
  text-align:center;padding:14px calc(10px + env(safe-area-inset-right)) 14px calc(10px + env(safe-area-inset-left));
  color:var(--gray);font-size:14px;border-top:1px solid var(--border);background:#fff;
}
.project-page footer{position:fixed;left:0;right:0;bottom:0;z-index:40;text-align:center;padding:14px calc(10px + env(safe-area-inset-right)) 14px calc(10px + env(safe-area-inset-left));color:var(--gray);font-size:14px;border-top:1px solid var(--border);background:#fff;}

/* ========== RESPONSIVE BREAKPOINTS ========== */

/* Tablet tweaks */
@media (max-width:1024px){
  .feed{gap:16px}
  .name{font-size:18px}
  .desc{font-size:15px}
}

/* Stack feed cards vertically on narrow screens */
@media (max-width:768px){
  .card{padding:12px}
  .feed-card{
    flex-direction:column;align-items:flex-start;gap:10px;min-height:auto
  }
  .feed-thumb,
  .feed-thumb img,
  .feed-thumb-placeholder{
    width:100%;height:auto;max-height:220px;border-radius:10px
  }
  .content{width:100%;margin-top:4px}

  .title-row{flex-direction:column;align-items:flex-start;gap:4px}
  .name{white-space:normal;font-size:18px}
  .votes{font-size:12.5px}

  /* Gallery heights smaller on phones/tablets (mobile -10%) */
  .section-gallery .gallery-main{height:288px}

  /* Mobile thumbnails: keep height, halve width */
  .section-gallery .thumbs{
    display:flex !important;
    justify-content:center !important;
    gap:6px !important;
    padding:2px !important;
    overflow:hidden !important;
    width:100% !important;
    max-width:100% !important;
    box-sizing:border-box !important;
  }
  .section-gallery .thumbs button{
    width:48px !important;           /* نصف 96px */
    min-width:48px !important;
    max-width:48px !important;
    height:56px !important;          /* نفس الارتفاع الأصلي */
    display:block !important;
    flex:0 0 auto !important;
    outline-offset:0 !important;
  }
  /* Show up to 5 thumbs on mobile */
  .section-gallery .thumbs button:nth-child(n+6){ display:none !important; }
}

/* Phone optimizations */
@media (max-width:640px){
  .feed{gap:14px}
  .name{font-size:17px}
  .desc{font-size:14.5px}
  .title,.project-title{font-size:clamp(16px,4.6vw,18px)}
  .title,.project-title{
    white-space:normal;
    display:-webkit-box;
    -webkit-box-orient:vertical;
    -webkit-line-clamp:2;
    line-clamp:2;
    overflow:hidden;
    overflow-wrap:anywhere;
    word-break:break-word;
  }
  .section-summary .summary{font-size:15.5px;line-height:1.8}

  /* Extra small phones: keep height, slightly smaller width */
  .section-gallery .thumbs button{ width:44px !important; height:56px !important; }
  .actions{gap:6px}
  .btn{padding:8px 10px;font-size:13.5px}

  /* Footer becomes non-fixed to avoid covering content on very small screens */
  footer,.site-footer{position:static;border-top:none;padding:12px 10px}
  body{padding-bottom:16px}

  /* Top 5 hero: mobile-friendly layout */
  .top5-hero-grid{ grid-template-columns:1fr !important; }
  .top5-hero-img{ min-height:180px !important; }
  .top5-hero-img img{ height:180px !important; object-fit:contain !important; }
  .top5-hero-content{ padding:14px !important; }
  .top5-hero .rank-chip{ padding:4px 10px !important; font-size:.9rem !important; }
  .top5-hero h2{ font-size:1.25rem !important; }
  .top5-hero .btn.primary{ width:100%; justify-content:center; }
}

/* Very small devices */
@media (max-width:420px){
  .navbar{padding:12px 16px}
  .logo{font-size:18px}
  .subtitle{font-size:12.5px}
  .btn{font-size:13px;padding:7px 10px}
  .feed{margin:24px auto}
  /* Extra small devices (mobile -10%) */
  .section-gallery .gallery-main{height:234px}
}

/* ===== Utilities: muted text + multi-line clamp ===== */
.muted{ color: var(--gray); }
.line-clamp-1{
  display:-webkit-box;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:1;
  overflow:hidden;
  line-clamp:1; /* non-standard, for linters */
}
.line-clamp-2{
  display:-webkit-box;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
  overflow:hidden;
  line-clamp:2;
}
.line-clamp-3{
  display:-webkit-box;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:3;
  overflow:hidden;
  line-clamp:3;
}

/* ===== Promoted card ===== */
.card.promoted{
  border:2px solid #ffd6d2;position:relative;background:linear-gradient(180deg,#fff,#fff9f8);
}
.promoted-badge{
  position:absolute;top:-10px;left:12px;background:var(--accent);color:#fff;font-size:12px;font-weight:700;
  padding:4px 8px;border-radius:999px;box-shadow:0 2px 6px rgba(0,0,0,.08);
}
.card.promoted .tagline{margin-top:4px}

/* Final spacing on project page */
.project-page .container{padding-bottom:80px}

/* ===== Mobile image tuning inside feed card ===== */
@media (max-width:768px){
  .feed-thumb{
    width:100%;
    height:auto;
    max-height:120px;
    display:flex;align-items:center;justify-content:center;
    background:#fff;border-radius:14px;padding:8px; /* تصغير الصورة داخل الإطار */
  }
  .feed-thumb img{
    width:100%;
    height:auto;
    max-height:100px;
    object-fit:contain;object-position:center;border-radius:10px;background:#fff;
  }
  
  /* تصغير الصورة الرئيسية في صفحة المشروع */
  .section-gallery .gallery-main img,
  .section-gallery .gallery-main video{
    width:100% !important;
    max-width:100% !important;
    height:100% !important;
    object-fit:contain !important;
  }
  
  /* إخفاء التاغز بعد الثاني على الموبايل فقط */
  .pills .pill:nth-child(n+3){
    display:none;
  }
}

/* ===== About page (mobile-first) ===== */
.about-card{padding:24px}
.about-hero{display:flex;flex-direction:column;gap:6px;margin-bottom:8px}
.about-title{margin:0;font-size:26px;font-weight:800;line-height:1.2}
.about-sub{margin:0;color:var(--gray);font-size:15px}
.about-body p{margin:10px 0;font-size:16px;line-height:1.75;color:var(--text)}
.about-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:16px}

/* Prevent buttons overlap with fixed footer on About page */
body:has(.about-card){ padding-bottom:140px !important; }
.about-card{ margin-bottom:100px; }

@media (max-width:768px){
  .about-card{padding:16px}
  .about-title{font-size:22px}
  .about-sub{font-size:14.5px}
  .about-body p{font-size:15.5px;line-height:1.8}
  .about-actions .btn{flex:1 1 100%; justify-content:center; padding:12px 14px;}
}

@media (max-width:640px){
  .about-hero, .about-body, .about-actions { text-align: left; }
}


html[data-theme="dark"]{
  --bg:#0b1220;
  --text:#e5e7eb;
  --gray:#94a3b8;
  --card:#0f172a;
  --accent:#ff6154;
  --accent-from:#ff6154;
  --accent-to:#ff8a7f;
  --border:#1f2937;
  --shadow-sm:0 2px 8px rgba(0,0,0,0.35);
  --shadow-md:0 8px 24px rgba(0,0,0,0.45);
}
html[data-theme="dark"] .navbar{background:rgba(15,23,42,0.85);border-bottom-color:var(--border);backdrop-filter:blur(10px)}
html[data-theme="dark"] .card{background:var(--card);border-color:var(--border);box-shadow:var(--shadow-sm)}
html[data-theme="dark"] .btn{background:#0b1220;border-color:var(--border);color:var(--text)}
/* Ensure social buttons stay readable in dark mode */
html[data-theme="dark"] .btn-twitter{
  background:#000 !important;
  border-color:#000 !important;
  color:#fff !important;
}
html[data-theme="dark"] .btn-linkedin{
  background:#0a66c2 !important;
  border-color:#0a66c2 !important;
  color:#fff !important;
}
html[data-theme="dark"] .btn.primary{background:var(--accent);color:#fff;border-color:var(--accent)}
html[data-theme="dark"] .date-banner{background:var(--card);border-bottom-color:var(--border)}
html[data-theme="dark"] footer,.site-footer{background:var(--card);border-top-color:var(--border);color:var(--gray)}
.theme-toggle{display:inline-flex;align-items:center;justify-content:center;gap:0;border-radius:999px;padding:0;border:1px solid var(--border);background:#f3f4f6;color:#111;width:36px;height:36px}
html[data-theme="dark"] .theme-toggle{background:#0b1220;color:var(--text)}
html[data-theme="dark"] [style*="color:#111827"]{color:var(--text) !important}
html[data-theme="dark"] [style*="color:#374151"]{color:#cbd5e1 !important}
html[data-theme="dark"] [style*="color:#4b5563"]{color:#9ca3af !important}
html[data-theme="dark"] [style*="color:#6b7280"]{color:#94a3b8 !important}
html[data-theme="dark"] [style*="background:#fff"]{background:var(--card) !important}
html[data-theme="dark"] [style*="background:#f9fafb"]{background:#0b1220 !important}
html[data-theme="dark"] .feed-thumb{border-color:var(--border);background:#0b1220}
html[data-theme="dark"] .feed-thumb-placeholder{background:#0f172a;border-color:var(--border);color:#6b7280}
html[data-theme="dark"] .section-gallery .gallery{background:#0f172a;border-color:var(--border)}
html[data-theme="dark"] .section-gallery .thumbs button{background:#0b1220;border-color:var(--border)}
html[data-theme="dark"] .pill{background:#0f172a;border-color:var(--border);color:var(--text)}
html[data-theme="dark"] .rank-badge{background:#0b1220;border-color:var(--border);color:var(--text)}
html[data-theme="dark"] .votes-chip{background:#0f172a;border-color:var(--border);color:var(--text)}

html[data-theme="dark"] .project-page .project-tagline{color:#94a3b8 !important}
html[data-theme="dark"] .project-page .pill{background:#0f172a;border-color:var(--border);color:var(--text)}
html[data-theme="dark"] .project-page .section-summary .summary{color:#cbd5e1}
html[data-theme="dark"] .project-page .section-gallery .gallery{background:#0f172a;box-shadow:0 8px 24px rgba(0,0,0,0.45)}
html[data-theme="dark"] .project-page .side-vote .rank-badge{background:#0b1220;border-color:var(--border);color:var(--text)}
html[data-theme="dark"] .project-page footer{color:#94a3b8}

.nav-actions{flex:1;display:flex;justify-content:flex-end;align-items:center;gap:24px}
.nav-links{display:flex;gap:16px;align-items:center}
.nav-link{color:inherit;text-decoration:none;font-size:.95rem;font-weight:500;display:inline-flex;gap:6px;align-items:center}
.nav-link:hover{text-decoration:none;opacity:.9}

/* modernized nav pills */
.nav-links.nav-modern .nav-link{gap:8px;padding:8px 10px;border-radius:10px;border:1px solid transparent;transition:background .2s ease,opacity .2s ease}
.nav-links.nav-modern .nav-link svg{width:18px;height:18px;opacity:.9}
.nav-links.nav-modern .nav-link:hover{background:#f3f4f6;opacity:1}
html[data-theme="dark"] .nav-links.nav-modern .nav-link:hover{background:rgba(255,255,255,0.06)}

.top5-hero{overflow:hidden;padding:0}
.top5-hero-grid{display:grid;grid-template-columns:1.2fr 1fr;gap:0;align-items:stretch}
.top5-hero-img{background:#f8fafc;display:flex;align-items:center;justify-content:center;min-height:260px}
.top5-hero-img img{width:100%;height:100%;object-fit:contain;max-height:360px}
.top5-hero-content{padding:20px 22px;display:flex;flex-direction:column;gap:12px}
.rank-chip{background:linear-gradient(135deg,var(--accent-from),var(--accent-to));color:#fff;font-weight:800;border-radius:999px;padding:6px 12px}
.top5-hero h2{margin:0;font-size:clamp(1.25rem,1rem + 1.4vw,1.8rem);font-weight:800;line-height:1.2}

/* Top 5 header */
.top5-header{display:flex;flex-direction:column;gap:6px;align-items:flex-start}
.top5-title{margin:0;font-weight:800;font-size:clamp(1.4rem,1.1rem + 1.2vw,1.9rem)}
.top5-sub{margin:0;color:var(--gray);font-size:1rem}
.stat-chips{display:flex;gap:8px;flex-wrap:wrap;margin-top:4px}
.stat-chip{display:inline-flex;align-items:center;border-radius:999px;padding:6px 10px;background:#f3f4f6;border:1px solid var(--border);font-size:.85rem;font-weight:600;color:#111}
html[data-theme="dark"] .stat-chip{background:#0f172a;border-color:var(--border);color:var(--text)}

.top5-list-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:16px;margin-top:16px}
.top5-mini-card{display:flex;gap:14px;align-items:flex-start}
.thumb-square{flex:0 0 72px;height:72px;border-radius:12px;background:#f3f4f6;display:flex;align-items:center;justify-content:center;overflow:hidden}
.thumb-square img{width:100%;height:100%;object-fit:contain}
.mini-card-content{flex:1 1 auto;min-width:0}
.mini-card-head{display:flex;align-items:center;gap:8px;margin-bottom:4px}
.badge-rank{background:#111827;color:#fff;border-radius:999px;padding:2px 10px;font-size:.8rem;font-weight:800}
.mini-card-title{margin:0;font-size:1.1rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mini-card-actions{margin-top:10px;gap:8px}

h1,.title,.project-title{font-size:clamp(1.25rem,1.05rem + 1.2vw,1.8rem);font-weight:800}
.feed .name{font-size:clamp(1rem,.95rem + .4vw,1.125rem)}

img[data-skeleton]{background:linear-gradient(100deg,#f3f4f6 20%,#e5e7eb 40%,#f3f4f6 60%);background-size:200% 100%;animation:skeleton-shimmer 1.2s ease-in-out infinite}
img[data-skeleton].loaded{animation:none;background:none;transition:opacity .25s ease;opacity:1}
@keyframes skeleton-shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}

html[data-theme="dark"] .top5-hero-img{background:#0f172a}

/* ===== NEW TOP 5 RANKING DESIGN ===== */

/* Hero Header */
.top5-hero-header{
  background:linear-gradient(135deg, #fff4ed 0%, #ffe9e5 50%, #ffd6d2 100%);
  border-radius:20px;
  padding:48px 32px;
  text-align:center;
  margin-bottom:32px;
  border:none;
  box-shadow:0 8px 32px rgba(255,97,84,0.15);
  position:relative;
  overflow:hidden;
}
.top5-hero-header::before{
  content:'';
  position:absolute;
  top:-50%;
  right:-20%;
  width:400px;
  height:400px;
  background:radial-gradient(circle, rgba(255,97,84,0.1) 0%, transparent 70%);
  border-radius:50%;
}
.top5-hero-header-content{
  position:relative;
  z-index:1;
}
.top5-hero-title{
  margin:0 0 12px;
  font-size:clamp(2rem, 5vw, 3rem);
  font-weight:900;
  color:#ff6154;
  letter-spacing:-0.02em;
  line-height:1.1;
}
.top5-hero-date{
  margin:0 0 8px;
  font-size:clamp(1.1rem, 2.5vw, 1.4rem);
  font-weight:700;
  color:#111827;
}
.top5-hero-subtitle{
  margin:0;
  font-size:clamp(0.95rem, 2vw, 1.1rem);
  color:#6b7280;
  font-weight:500;
}

/* Ranking Container */
.top5-ranking-container{
  display:flex;
  flex-direction:column;
  gap:24px;
  margin-bottom:32px;
}

/* Ranking Card Base */
.top5-ranking-card{
  position:relative;
  padding:0;
  overflow:hidden;
  border-width:2px;
  transition:all 0.3s ease;
  box-shadow:0 4px 20px rgba(0,0,0,0.08);
}
.top5-ranking-card:hover{
  transform:translateY(-4px);
  box-shadow:0 12px 40px rgba(0,0,0,0.15);
}

/* Winner Badge */
.top5-winner-badge{
  position:absolute;
  top:20px;
  right:20px;
  z-index:10;
  background:linear-gradient(135deg, #ff6154 0%, #ff8a7f 100%);
  color:#ffffff;
  font-size:0.85rem;
  font-weight:800;
  padding:8px 16px;
  border-radius:20px;
  box-shadow:0 4px 16px rgba(255,97,84,0.4);
  text-transform:uppercase;
  letter-spacing:0.5px;
  animation:pulse-glow 2s ease-in-out infinite;
}
@keyframes pulse-glow{
  0%, 100%{ box-shadow:0 4px 16px rgba(255,97,84,0.4); }
  50%{ box-shadow:0 6px 24px rgba(255,97,84,0.7); }
}

/* Rank Badge */
.top5-rank-badge-wrapper{
  position:absolute;
  top:20px;
  left:20px;
  z-index:10;
}
.top5-rank-badge{
  font-size:clamp(1.5rem, 3vw, 2rem);
  font-weight:900;
  padding:12px 20px;
  border-radius:16px;
  box-shadow:0 4px 16px rgba(0,0,0,0.2);
  letter-spacing:-0.02em;
  line-height:1;
}

/* Card Content Layout */
.top5-card-content{
  display:flex;
  flex-direction:row;
  align-items:stretch;
  gap:0;
  min-height:200px;
}
.top5-card-image{
  flex:0 0 280px;
  background:linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:32px;
  position:relative;
}
.top5-card-image img{
  width:100%;
  height:auto;
  max-height:180px;
  object-fit:contain;
  border-radius:12px;
}
.top5-card-info{
  flex:1;
  padding:32px;
  display:flex;
  flex-direction:column;
  gap:12px;
  background:#ffffff;
}
.top5-card-title{
  margin:0;
  font-size:clamp(1.4rem, 2.5vw, 1.8rem);
  font-weight:800;
  line-height:1.2;
  color:#111827;
}
.top5-card-title a{
  color:inherit;
  text-decoration:none;
}
.top5-card-title a:hover{
  color:var(--accent);
  text-decoration:none;
}
.top5-card-description{
  margin:0;
  font-size:1rem;
  line-height:1.6;
  color:#6b7280;
  display:-webkit-box;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
  overflow:hidden;
}
.top5-card-meta{
  display:flex;
  align-items:center;
  gap:12px;
  margin-top:auto;
}
.top5-votes{
  font-size:0.95rem;
  font-weight:700;
  color:#6b7280;
  display:inline-flex;
  align-items:center;
  gap:4px;
}
.top5-card-actions{
  margin-top:8px;
}
.top5-btn{
  padding:12px 24px;
  font-size:1rem;
  font-weight:700;
  border-radius:12px;
}

/* Rank Colors */
.rank-gold{
  border-color:#ffd700;
  background:linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}
.rank-gold .top5-rank-badge{
  background:linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
  color:#111827;
  border:2px solid #fbbf24;
}
.rank-gold .top5-card-image{
  background:linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}

.rank-silver{
  border-color:#c0c0c0;
  background:linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}
.rank-silver .top5-rank-badge{
  background:linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
  color:#111827;
  border:2px solid #9ca3af;
}
.rank-silver .top5-card-image{
  background:linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.rank-bronze{
  border-color:#cd7f32;
  background:linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}
.rank-bronze .top5-rank-badge{
  background:linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color:#ffffff;
  border:2px solid #b45309;
}
.rank-bronze .top5-card-image{
  background:linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

.rank-default{
  border-color:#e5e7eb;
  background:#ffffff;
}
.rank-default .top5-rank-badge{
  background:linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
  color:#ffffff;
  border:2px solid #374151;
}
.rank-default .top5-card-image{
  background:linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
}

/* Footer Action */
.top5-footer-action{
  text-align:center;
  margin-top:16px;
  padding:32px 0;
}
.btn-large{
  padding:16px 40px;
  font-size:1.1rem;
  font-weight:700;
  border-radius:14px;
  box-shadow:0 6px 24px rgba(255,97,84,0.25);
}
.btn-large:hover{
  transform:translateY(-2px);
  box-shadow:0 10px 32px rgba(255,97,84,0.35);
}

/* Responsive Design */
@media (max-width:768px){
  .top5-hero-header{
    padding:32px 20px;
    margin-bottom:24px;
  }
  .top5-ranking-container{
    gap:20px;
  }
  .top5-card-content{
    flex-direction:column;
    min-height:auto;
  }
  .top5-card-image{
    flex:0 0 auto;
    width:100%;
    min-height:200px;
    padding:24px;
  }
  .top5-card-image img{
    max-height:160px;
  }
  .top5-card-info{
    padding:24px 20px;
  }
  .top5-rank-badge-wrapper{
    top:16px;
    left:16px;
  }
  .top5-rank-badge{
    font-size:1.3rem;
    padding:8px 16px;
  }
  .top5-winner-badge{
    top:16px;
    right:16px;
    font-size:0.75rem;
    padding:6px 12px;
  }
  .top5-card-title{
    font-size:1.3rem;
  }
  .top5-btn{
    width:100%;
    justify-content:center;
  }
  .btn-large{
    width:100%;
    padding:14px 32px;
  }
}

@media (max-width:480px){
  .top5-hero-header{
    padding:24px 16px;
    border-radius:16px;
  }
  .top5-card-image{
    min-height:160px;
    padding:20px;
  }
  .top5-card-image img{
    max-height:120px;
  }
  .top5-card-info{
    padding:20px 16px;
    gap:10px;
  }
  .top5-rank-badge{
    font-size:1.1rem;
    padding:6px 12px;
  }
  .top5-winner-badge{
    font-size:0.7rem;
    padding:5px 10px;
    top:12px;
    right:12px;
  }
  .top5-rank-badge-wrapper{
    top:12px;
    left:12px;
  }
  /* Stack badges vertically on very small screens */
  .rank-gold .top5-rank-badge::before,
  .rank-silver .top5-rank-badge::before,
  .rank-bronze .top5-rank-badge::before{
    display:none;
  }
}

/* Dark Mode Support */
html[data-theme="dark"] .top5-hero-header{
  background:linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  box-shadow:0 8px 32px rgba(0,0,0,0.4);
}
html[data-theme="dark"] .top5-hero-title{
  color:#ff8a7f;
}
html[data-theme="dark"] .top5-hero-date{
  color:#e5e7eb;
}
html[data-theme="dark"] .top5-hero-subtitle{
  color:#94a3b8;
}
html[data-theme="dark"] .top5-card-info{
  background:#0f172a;
}
html[data-theme="dark"] .top5-card-title{
  color:#e5e7eb;
}
html[data-theme="dark"] .top5-card-description{
  color:#94a3b8;
}
html[data-theme="dark"] .top5-votes{
  color:#94a3b8;
}
html[data-theme="dark"] .rank-gold{
  background:linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-color:#fbbf24;
}
html[data-theme="dark"] .rank-gold .top5-card-image{
  background:linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}
html[data-theme="dark"] .rank-silver{
  background:linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-color:#9ca3af;
}
html[data-theme="dark"] .rank-silver .top5-card-image{
  background:linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}
html[data-theme="dark"] .rank-bronze{
  background:linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-color:#f59e0b;
}
html[data-theme="dark"] .rank-bronze .top5-card-image{
  background:linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}
html[data-theme="dark"] .rank-default{
  background:#0f172a;
  border-color:#374151;
}
html[data-theme="dark"] .rank-default .top5-card-image{
  background:linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}
html[data-theme="dark"] .top5-winner-badge{
  background:linear-gradient(135deg, #ff6154 0%, #ff8a7f 100%);
  box-shadow:0 4px 16px rgba(255,97,84,0.6);
}
html[data-theme="dark"] .top5-votes{
  background:rgba(148,163,184,0.15);
  color:#94a3b8;
}
html[data-theme="dark"] .top5-ranking-card:hover .top5-votes{
  background:rgba(255,97,84,0.25);
  color:#ff8a7f;
}

/* ===== HOME PAGE HERO SECTION ===== */
.hero-wrap{
  background:linear-gradient(180deg, #fff4ef 0%, #ffffff 60%);
}
.hero{
  text-align:center;
  padding:72px 20px 56px;
  max-width:980px;
  margin:0 auto 0;
  border-radius:24px;
  box-shadow:0 8px 32px rgba(0,0,0,0.02);
}
.hero-container{ max-width:820px; margin:0 auto; }
.hero-title{
  font-size:clamp(34px, 5vw, 46px);
  font-weight:900;
  color:#1a1a1a;
  margin:0 0 12px;
  line-height:1.15;
  letter-spacing:-0.02em;
}
.hero-subtitle{
  font-size:clamp(15px, 2.5vw, 18px);
  color:#666;
  margin:20px 0 16px;
  line-height:1.55;
}
.hero-ctas{ display:flex; gap:14px; justify-content:center; flex-wrap:wrap; margin-top:28px; }
.hero-ctas .btn{ padding-left:16px; padding-right:16px; }
.hero-ctas .btn.ghost{ border-color:#eaeaea; }
.hero-meta{ margin-top:12px; }
.hero .pill{ opacity:.9; font-size:12px; }
.social-proof{ display:flex; gap:20px; justify-content:center; flex-wrap:wrap; margin-top:30px; margin-bottom:16px; color:#777; font-size:0.9rem; }
.sp-item{ display:inline-flex; align-items:center; gap:6px; }

/* Dark mode for hero */
html[data-theme="dark"] .hero h1{
  color:#e5e7eb;
}
html[data-theme="dark"] .hero p{
  color:#94a3b8;
}
html[data-theme="dark"] .hero-date span{
  background:#0f172a;
  border-color:#374151;
  color:#ff8a7f;
}
html[data-theme="dark"] .hero-wrap{ background:linear-gradient(180deg, rgba(255,97,84,0.08) 0%, rgba(15,23,42,0) 60%); }

/* Feed heading and Top 3 badge helpers */
.feed-heading{ max-width:980px; margin:0 auto 8px; padding:0 16px; }
.feed-heading h2{ margin:0; font-size:1.25rem; font-weight:800; }
.feed-heading p{ margin:4px 0 0; color:var(--gray); font-size:.95rem; }
.meta-row{ margin:0 0 6px; }
.top3-badge{
  display:inline-flex; align-items:center; gap:6px;
  padding:4px 10px; border-radius:999px;
  background:#fff4ed; border:1px solid #ffd0c7; color:#ff6154;
  font-size:12.5px; font-weight:700;
}
html[data-theme="dark"] .top3-badge{ background:#1e293b; border-color:#374151; color:#ff8a7f; }

@media (max-width:640px){
  .hero-ctas{ flex-direction:column; }
  .hero-ctas .btn{ width:100%; justify-content:center; }
  .social-proof{ font-size:13px; }
}

/* Section titles */
.section-title{
  font-size:clamp(22px, 4vw, 26px);
  font-weight:700;
  margin:70px 0 20px;
  color:#222;
  text-align:center;
}
html[data-theme="dark"] .section-title{
  color:#e5e7eb;
}

/* Explore box styling */
.explore-box{
  background:white;
  padding:30px;
  border-radius:18px;
  max-width:800px;
  margin:50px auto;
  border:1px solid #eee;
  text-align:center;
}
.explore-title{
  font-size:22px;
  font-weight:700;
  margin:0 0 22px;
  color:#111827;
}
.explore-links{
  display:flex;
  justify-content:center;
  flex-wrap:wrap;
  gap:12px;
}
.explore-links a{
  background:#fff;
  border:1px solid #ddd;
  padding:12px 20px;
  border-radius:12px;
  font-size:15px;
  font-weight:600;
  color:#333;
  display:flex;
  align-items:center;
  gap:6px;
  transition:0.15s;
  text-decoration:none;
}
.explore-links a:hover{
  background:#f4f4f4;
  text-decoration:none;
}

html[data-theme="dark"] .explore-box{
  background:#0f172a;
  border-color:#374151;
}
html[data-theme="dark"] .explore-title{
  color:#e5e7eb;
}
html[data-theme="dark"] .explore-links a{
  background:#0b1220;
  border-color:#374151;
  color:#e5e7eb;
}
html[data-theme="dark"] .explore-links a:hover{
  background:#1e293b;
}

/* ===== SECTION CONTAINERS & STYLING ===== */
.section-container{
  background:rgba(249,250,251,0.5);
  border-radius:18px;
  padding:32px 24px;
  margin:48px 0;
  border:1px solid rgba(229,231,235,0.6);
  box-shadow:0 1px 3px rgba(0,0,0,0.03);
}

html[data-theme="dark"] .section-container{
  background:rgba(15,23,42,0.4);
  border-color:rgba(55,65,81,0.6);
}

/* Section Headers with Badges */
.section-header{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:12px;
  margin-bottom:24px;
}

.section-header h2{
  font-size:1.75rem;
  font-weight:800;
  margin:0;
  color:#111827;
  text-align:center;
  display: inline-block;
}


/* Section Badges - Full width badge */
.section-badge{
  display:inline-block;
  padding:12px 24px;
  border-radius:12px;
  font-size:1.75rem;
  font-weight:800;
  letter-spacing:normal;
  box-shadow:0 4px 12px rgba(0,0,0,0.15);
  margin:0;
}

.badge-today{
  background:linear-gradient(135deg, #ff6154 0%, #ff8a7f 100%);
  color:#fff;
}

.badge-yesterday{
  background:linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
  color:#fff;
}

.badge-week{
  background:linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%);
  color:#fff;
}

.badge-month{
  background:linear-gradient(135deg, #10b981 0%, #34d399 100%);
  color:#fff;
}

/* Yesterday/Week/Month Cards - Smaller */
.feed-card.card-secondary{
  padding:14px !important;
  min-height:100px;
}

.feed-card.card-secondary .feed-thumb{
  flex:0 0 52px;
  height:52px;
}

.feed-card.card-secondary .feed-thumb-placeholder{
  width:52px;
  height:52px;
  font-size:18px;
}

.feed-card.card-secondary .name{
  font-size:16px;
}

.feed-card.card-secondary .tagline{
  font-size:12.5px;
}

.feed-card.card-secondary .desc{
  font-size:13px;
  line-height:1.5;
  display:-webkit-box;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
  overflow:hidden;
}

/* Standardized "See All" Buttons */
.section-see-all{
  display:flex;
  justify-content:center;
  margin:28px 0 0;
}

.section-see-all .btn{
  min-width:240px;
  height:48px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:1rem;
  font-weight:700;
  border-radius:12px;
  padding:0 32px;
  transition:all 0.25s ease;
}

.section-see-all .btn:hover{
  transform:translateY(-2px);
  box-shadow:0 8px 20px rgba(255,97,84,0.3);
}

/* Enhanced Explore Box */
.explore-box{
  background:linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  padding:40px 32px;
  border-radius:20px;
  max-width:800px;
  margin:64px auto;
  border:1px solid #e2e8f0;
  text-align:center;
  box-shadow:0 4px 16px rgba(0,0,0,0.04);
}

.explore-title{
  font-size:1.6rem;
  font-weight:800;
  margin:0 0 8px;
  color:#111827;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
}

.explore-title::before{
  content:'🧭';
  font-size:1.8rem;
}

.explore-subtitle{
  font-size:0.95rem;
  color:#6b7280;
  margin:0 0 24px;
}

.explore-links{
  display:flex;
  justify-content:center;
  flex-wrap:wrap;
  gap:12px;
}

.explore-links a{
  background:#fff;
  border:1.5px solid #e5e7eb;
  padding:14px 22px;
  border-radius:12px;
  font-size:15px;
  font-weight:600;
  color:#374151;
  display:flex;
  align-items:center;
  gap:8px;
  transition:all 0.2s ease;
  text-decoration:none;
  box-shadow:0 1px 3px rgba(0,0,0,0.05);
}

.explore-links a:hover{
  background:#f9fafb;
  border-color:#ff6154;
  color:#ff6154;
  transform:translateY(-2px);
  box-shadow:0 4px 12px rgba(255,97,84,0.15);
  text-decoration:none;
}

.explore-links a.active{
  background:linear-gradient(135deg, #ff6154 0%, #ff8a7f 100%);
  border-color:#ff6154;
  color:#fff;
  box-shadow:0 4px 12px rgba(255,97,84,0.25);
}

html[data-theme="dark"] .explore-box{
  background:linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-color:#374151;
}

html[data-theme="dark"] .explore-title{
  color:#e5e7eb;
}

html[data-theme="dark"] .explore-subtitle{
  color:#94a3b8;
}

html[data-theme="dark"] .explore-links a{
  background:#0b1220;
  border-color:#374151;
  color:#e5e7eb;
}

html[data-theme="dark"] .explore-links a:hover{
  background:#1e293b;
  border-color:#ff8a7f;
  color:#ff8a7f;
}

html[data-theme="dark"] .explore-links a.active{
  background:linear-gradient(135deg, #ff6154 0%, #ff8a7f 100%);
  border-color:#ff8a7f;
  color:#fff;
}

/* Line Clamp for Better Readability */
.feed-card .desc{
  display:-webkit-box;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:3;
  overflow:hidden;
}

/* Responsive adjustments */
@media (max-width:640px){
  .hero{
    padding:40px 16px 30px;
  }
  .hero h1{
    font-size:24px;
  }
  .hero p{
    font-size:14px;
  }
  .hero-date span{
    font-size:13px;
    padding:6px 12px;
  }
  .section-container{
    padding:24px 16px;
    margin:32px 0;
  }
  .section-header h2{
    font-size:1.4rem;
  }
  .section-badge{
    font-size:1.4rem;
    padding:10px 20px;
    margin:0;
  }
  .explore-box{
    padding:28px 20px;
    margin:48px 16px;
  }
  .explore-title{
    font-size:1.3rem;
  }
  .explore-links{
    gap:8px;
  }
  .explore-links a{
    padding:12px 18px;
    font-size:14px;
  }
  .section-see-all .btn{
    min-width:100%;
    width:100%;
  }
}
