/* =========================================================
   style.css  —  v4.2  (2025‑06‑26)
   ---------------------------------------------------------
   • Adds stacking‑context for the module header
   • Locks grid height + clips overflow during FLIP animation
   • No other rules removed – file remains drop‑in compatible
   ========================================================= */

/* ----------  CSS Custom Properties  ---------- */
:root{
  --bg-intensity:1;                 /* PCB background effect knob */
  --neon:#00bfff;                   /* primary neon accent */
  --panel-bg:rgba(20,25,40,.55);    /* frosted card & panel base */
}

/* ----------  Reset & Box‑Sizing  ---------- */
*{margin:0;padding:0;box-sizing:border-box;}

/* ----------  Global Layout  ---------- */
html,body{height:100%;}
body{
  display:flex;
  align-items:center;
  justify-content:center;
  position:relative;

  font-family:'Roboto',sans-serif;
  color:#cfd8dc;
  text-align:center;

  overflow-x:hidden;
  overflow-y:auto;

  cursor:url('../img/robot-cursor.png') 16 16,auto;
}
@media(max-width:600px){
  body{align-items:flex-start;padding-top:1rem;}
}

/* ----------  PCB Background  ---------- */
body::before{
  content:'';
  position:fixed; inset:0;
  height:100vh;
  background:url('../img/spaceinvaderspcb.png') center/cover no-repeat;
  filter:
    grayscale(calc(60%*var(--bg-intensity)))
    brightness(calc(.7 + .3*(1 - var(--bg-intensity))))
    contrast(calc(1 + .3*var(--bg-intensity)))
    hue-rotate(calc(210deg*var(--bg-intensity)));
  z-index:0;
}
.overlay{
  position:fixed; inset:0;
  height:100vh;
  background:rgba(0,0,20,.8);
  z-index:1;
}

/* ----------  Container  ---------- */
.container{
  position:relative;z-index:2;
  max-width:600px;
  padding:2rem;
  animation:fadeIn 1.5s ease-out;
}

/* ----------  Headings & Intro Text  ---------- */
h1{
  font-family:'Orbitron',sans-serif;
  font-size:3rem;
  margin-bottom:.5rem;
  color:var(--neon);
  transition:color .3s;
}
h1:hover{color:#66d9ff;}
p{font-size:1.2rem;line-height:1.6;margin-bottom:2rem;}

/* ----------  Countdown Timer  ---------- */
#countdown{
  display:flex;justify-content:center;gap:1rem;
  font-family:'Orbitron',sans-serif;
  font-size:2rem;letter-spacing:1px;
}
.time-box{
  background:rgba(0,191,255,.2);
  padding:1rem 1.5rem;border-radius:.5rem;
  transition:transform .3s,background .3s;
}
.time-box:hover{
  transform:translateY(-5px);
  background:rgba(0,191,255,.15);
}
.label{font-size:.8rem;color:#90a4ae;}
@media(max-width:600px){
  #countdown{flex-direction:column;gap:.5rem;}
}
@keyframes fadeIn{
  from{opacity:0;transform:translateY(20px);}
  to  {opacity:1;transform:translateY(0);}
}

/* =========================================================
   ===  LATEST INSIGHTS  (Cards Grid Module)  ===
   ========================================================= */
.articles-module{
  margin-top:3rem;
  padding:1.75rem;
  border-radius:.75rem;

  background:var(--panel-bg);
  backdrop-filter:blur(8px);
  box-shadow:0 6px 20px rgba(0,0,0,.35);
  text-align:left;
}

/* Header row: title + CTA */
.articles-header{
  display:flex;justify-content:space-between;align-items:center;
  margin-bottom:1.25rem;

  /* NEW — give the row its own stacking context
     so slide‑in cards never overlap the heading. */
  position:relative;
  z-index:2;
}
.articles-header h2{
  font-family:'Orbitron',sans-serif;
  color:var(--neon);
  font-size:1.9rem;
  position:relative;
}
.articles-header h2::after{
  content:'';
  position:absolute;left:0;bottom:-4px;
  height:2px;width:100%;
  background:var(--neon);
  transform-origin:left;
  transform:scaleX(0);
  transition:transform .6s cubic-bezier(.4,.0,.2,1);
}
@media(prefers-reduced-motion:no-preference){
  .articles-header h2:is(:hover,:focus)::after{transform:scaleX(1);}
}
.view-all{
  font-size:.9rem;text-decoration:none;color:#cfd8dc;
  opacity:.8;transition:opacity .2s;
}
.view-all:hover{opacity:1;}

/* Responsive grid */
.articles-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(260px,1fr));
  gap:1rem;

  /* NEW — create a positioned element so translateY clipping
     can be handled purely with overflow:hidden. */
  position:relative;
}
@media(max-width:600px){
  .articles-grid{grid-template-columns:1fr;}
}

/* Grid gets this class only *during* animation */
.articles-grid.animating{
  overflow:hidden;                 /* hide top/bottom overflow */
}

/* ----------  Card  ---------- */
.article-card{
  display:flex;align-items:flex-start;gap:1rem;
  padding:1rem;border-radius:10px;
  background:var(--panel-bg);
  backdrop-filter:blur(6px);
  border:1px solid rgba(0,183,255,.25);

  transition:transform .08s ease,box-shadow .08s ease;
  cursor:pointer;
}
.article-card:hover{
  transform:translateY(-2px);
  box-shadow:0 0 10px rgba(0,183,255,.6);
}
.article-card .thumb{
  flex:0 0 48px;height:48px;border-radius:6px;
  background:rgba(0,183,255,.15);
  display:flex;align-items:center;justify-content:center;
  font-size:1.4rem;color:var(--neon);
}
.article-card h3{
  font-size:1.05rem;
  font-weight:600;line-height:1.3;
  margin-bottom:.35rem;color:#fff;
}
.article-card .meta{
  font-size:.8rem;
  color:rgba(255,255,255,.75);
}
.article-card::after{
  content:'→';
  font-size:1rem;margin-left:auto;
  opacity:0;transform:translateX(-4px);
  transition:opacity .15s,transform .15s;
  color:var(--neon);
}
.article-card:hover::after{
  opacity:1;transform:translateX(0);
}
/* Slide‑in helpers (legacy, unused by new FLIP but kept) */
.article-card.slide-in{transform:translateY(-100%);opacity:0;}
.article-card.slide-in-active{transform:translateY(0);opacity:1;}

/* ----------  Tooltip  ---------- */
.tooltip{
  position:absolute;z-index:10;max-width:600px;
  background:rgba(0,0,20,.9);color:#cfd8dc;
  padding:.75rem 1rem;border-radius:.5rem;
  font-size:.9rem;line-height:1.4;
  pointer-events:none;
  box-shadow:0 4px 12px rgba(0,0,0,.5);
}

/* =========================================================
   ===  Legacy list rules kept for safety  ===
   ========================================================= */
.articles-list{list-style:none;position:relative;}
.articles-list li{padding:.75rem 1rem;margin-bottom:.5rem;
  background:rgba(0,191,255,.1);border-radius:.5rem;
  transition:transform .5s ease,opacity .5s ease;}
.articles-list li.slide-in{transform:translateY(-100%);opacity:0;}
.articles-list li.slide-in-active{transform:translateY(0);opacity:1;}
.articles-list a{color:#cfd8dc;text-decoration:none;font-weight:500;}
.articles-list a:hover{color:#fff;}

/* === Icon backdrop for dark theme ======================= */
.article-card .thumb {
  position: relative;           /* establish stacking context */
  display: flex;                /* already present – keeps img centered */
  align-items: center;
  justify-content: center;
}

/* Frame that sits *under* the icon, only visible when needed */
.article-card .thumb::before {
  content: '';
  position: absolute;
  inset: 0;                     /* fill the .thumb box */
  border-radius: 6px;           /* match .thumb’s radius */
  background: #fff;             /* solid light canvas */
  opacity: .9;                  /* dial down to avoid glare */
  z-index: 0;                   /* keep it underneath the img */
}

/* Make sure the real icon stays on top of the back‑pad */
.article-card .thumb > img,
.article-card .thumb > svg,
.article-card .thumb > span {
  position: relative;
  z-index: 1;
}
.article-card .thumb > img,
.article-card .thumb > svg {
  filter: drop-shadow(0 0 4px rgba(0,191,255,.8));
}

