/* =========================================================
   AGUNECHEMBA — TECH BLOG
   styles.css
   ========================================================= */

/* =========================================================
   1. DESIGN TOKENS
   ========================================================= */
:root {
  color-scheme: light dark;

  --bg: #f7f9fb;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --text: #0d1524;
  --body: #3a4759;
  --muted: #5b6b80;
  --accent: #047857;
  --accent-hover: #036b4d;
  --accent-soft: rgba(4, 120, 87, 0.09);
  --accent-line: rgba(4, 120, 87, 0.35);
  --on-accent: #ffffff;

  --hover-bg: rgba(13, 21, 36, 0.05);

  --card-a: #ffffff;
  --card-b: #fbfdfc;

  --header-bg: rgba(247, 249, 251, 0.75);
  --header-bg-scrolled: rgba(247, 249, 251, 0.94);

  --logo-bg: linear-gradient(145deg, rgba(4, 120, 87, 0.12), rgba(79, 70, 229, 0.12));

  --code-bg: rgba(13, 21, 36, 0.06);
  --code-text: #0b5f47;
  --pre-bg: #f1f5f9;
  --pre-border: #e2e8f0;
  --pre-text: #1e293b;

  --glow-a: rgba(4, 120, 87, 0.06);
  --glow-b: rgba(79, 70, 229, 0.06);

  --radius: 14px;
  --maxw: 1080px;
  --header-h: 64px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0c10;
    --line: #1f262f;
    --line-strong: #303b48;
    --text: #e9eef5;
    --body: #cbd5e1;
    --muted: #8a95a6;
    --accent: #2ee6a8;
    --accent-hover: #57f0bd;
    --accent-soft: rgba(46, 230, 168, 0.12);
    --accent-line: rgba(46, 230, 168, 0.45);
    --on-accent: #04120d;

    --hover-bg: rgba(255, 255, 255, 0.05);

    --card-a: rgba(255, 255, 255, 0.035);
    --card-b: rgba(255, 255, 255, 0.012);

    --header-bg: rgba(10, 12, 16, 0.72);
    --header-bg-scrolled: rgba(10, 12, 16, 0.92);

    --logo-bg: linear-gradient(145deg, rgba(46, 230, 168, 0.18), rgba(99, 102, 241, 0.18));

    --code-bg: rgba(255, 255, 255, 0.07);
    --code-text: #d7f7ea;
    --pre-bg: #0e1218;
    --pre-border: #1f262f;
    --pre-text: #bfe9d8;

    --glow-a: rgba(46, 230, 168, 0.10);
    --glow-b: rgba(99, 102, 241, 0.10);
  }
}

/* =========================================================
   2. BASE
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  padding-top: var(--header-h);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(620px 320px at 12% -6%, var(--glow-a), transparent 70%),
    radial-gradient(760px 420px at 92% -4%, var(--glow-b), transparent 70%);
}

/* =========================================================
   3. FIXED HEADER
   ========================================================= */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  z-index: 50;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid transparent;
  transition: background 0.25s ease, border-color 0.25s ease;
}

.header.is-scrolled {
  background: var(--header-bg-scrolled);
  border-bottom-color: var(--line);
}

.header__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  height: 100%;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}

.brand__logo {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 4px;
  box-sizing: border-box;
  border-radius: 50%;
  flex: none;
  box-shadow: 0 0 0 1px var(--line);
  background: var(--logo-bg);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.brand__logo img,
.brand__logo svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand:hover .brand__logo {
  box-shadow: 0 0 0 1px var(--accent-line);
  transform: scale(1.04);
}

.brand__name { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.02em; }
.brand__name span { color: var(--accent); }

.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 8px 12px;
  border-radius: 9px;
  transition: color 0.2s ease, background 0.2s ease;
}
.nav a:hover { color: var(--text); background: var(--hover-bg); }
.nav .cta {
  color: var(--on-accent);
  background: var(--accent);
  font-weight: 600;
  padding: 8px 16px;
}
.nav .cta:hover { background: var(--accent-hover); color: var(--on-accent); }

/* =========================================================
   4. HERO
   ========================================================= */
.hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 56px 20px 22px;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin: 0 0 14px;
}

.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(1.9rem, 5vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 750;
}

.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { margin: 0; max-width: 58ch; color: var(--muted); font-size: 1.02rem; }

/* =========================================================
   6. POST GRID
   ========================================================= */
.posts {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px 88px;
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--card-a), var(--card-b));
  transition: transform 0.25s ease, border-color 0.25s ease;
  animation: rise 0.5s ease both;
}

.card:hover { transform: translateY(-3px); border-color: var(--line-strong); }

.card__title {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
  font-weight: 650;
}

.card__excerpt { margin: 0; color: var(--muted); font-size: 0.93rem; }

/* =========================================================
   11. FOOTER
   ========================================================= */
.footer { border-top: 1px solid var(--line); }

.footer__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 26px 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.85rem;
}

.footer a { color: var(--muted); text-decoration: none; }
.footer a:hover { color: var(--accent); }

/* =========================================================
   12. MOTION
   ========================================================= */
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* =========================================================
   13. SMALL SCREENS
   ========================================================= */
@media (max-width: 620px) {
  .nav a:not(.cta) { display: none; }
  .hero { padding-top: 40px; }
  .card { padding: 18px; }
}


/* =========================================================
   CUSTOM ADDITIONS FOR PRIME PROGRAMMERS HUB
   ========================================================= */

/* Prodigy Card Layout */
.prodigy-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: linear-gradient(180deg, var(--card-a), var(--card-b));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    animation: rise 0.5s ease both;
}

.image-placeholder {
    width: 100%;
    height: 300px;
    border: 1px solid var(--line);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--mono);
    font-size: 0.9rem;
    color: var(--muted);
    background-color: var(--bg);
    background-size: cover;
    background-position: center;
}

.details-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 0.95rem;
    padding: 0;
    margin: 0;
}

.details-list li {
    border-bottom: 1px dashed var(--line-strong);
    padding-bottom: 8px;
    color: var(--body);
    overflow-wrap: anywhere;
}

.details-list strong {
    color: var(--text);
    font-weight: 600;
    display: inline-block;
    min-width: 110px;
}

/* ---------------------------------------------------------
   URL row: label + link side by side, link truncates with "…"
   --------------------------------------------------------- */
.details-list li:has(a) {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px;
}

.details-list li:has(a) strong {
    flex: none;
}

/* External-link arrow, kept as a sibling of the anchor so it
   is never clipped when the URL itself is truncated. */
.details-list li:has(a)::after {
    content: "\2197"; /* ↗ */
    flex: none;
    font-size: 0.85em;
    color: var(--accent);
    opacity: 0.65;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.details-list li:has(a):hover::after {
    opacity: 1;
    transform: translate(1px, -1px);
}

/* The link itself — monospace, ellipsis when too long */
.details-list a {
    color: var(--accent);
    text-decoration: none;
    font-family: var(--mono);
    font-size: 0.88em;
    border-bottom: 1px solid var(--accent-line);
    transition: color 0.2s ease, border-color 0.2s ease;

    /* Truncation setup */
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.details-list a:hover,
.details-list a:focus-visible {
    color: var(--accent-hover);
    border-bottom-color: var(--accent-hover);
}

.details-list a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 3px;
}

/* Marquee Animations */
.marquee-wrapper {
    width: 100%;
    overflow: hidden;
    position: relative;
    padding: 24px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: linear-gradient(90deg, var(--bg) 0%, transparent 10%, transparent 90%, var(--bg) 100%);
}

.marquee-track {
    display: flex;
    width: max-content;
    gap: 40px;
    animation: slide 20s linear infinite;
    will-change: transform;
}

@keyframes slide {
    0%   { transform: translateX(0); }
    100% { transform: translateX(calc(-1 * var(--shift, 0px))); }
}

.marquee-wrapper:hover .marquee-track {
    animation-play-state: paused;
}

/* =========================================================
   SPONSOR & SOCIAL ICON FRAMES
   ========================================================= */

.sponsor-logo {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 14px;
    box-sizing: border-box;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    background: var(--card-a);
    transition: border-color 0.2s ease;
}

.sponsor-logo img,
.sponsor-logo svg {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: 50%;
    display: block;
}

.sponsor-logo:hover {
    border-color: var(--accent);
}

.social-icon {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 14px;
    box-sizing: border-box;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: var(--card-a);
    color: var(--muted);
    transition: border-color 0.2s ease, color 0.2s ease;
}

.social-icon img,
.social-icon svg {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.social-icon:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.sponsor-logo img,
.sponsor-logo svg,
.social-icon img,
.social-icon svg {
    transition: transform 0.2s ease;
}

.sponsor-logo:hover img,
.sponsor-logo:hover svg,
.social-icon:hover img,
.social-icon:hover svg {
    transform: scale(1.1);
}

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

.loading .empty {
    grid-column: 1 / -1;
    padding: 64px 20px;
    text-align: center;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.9rem;
}

/* ---------------------------------------------------------
   Brand logo image — fit cleanly inside the circular frame
   --------------------------------------------------------- */
.brand__logo img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  border-radius: 50%;
  pointer-events: none;
}

.brand__logo:has(img) { padding: 0; }
.brand__logo:has(img) img { border-radius: 50%; object-fit: cover; }

/* ---------------------------------------------------------
   Sponsor logos — remove padding when an image fills the frame
   --------------------------------------------------------- */
.sponsor-logo:has(img) {
  padding: 0;
}