@import url('https://fonts.googleapis.com/css2?family=Google+Sans+Code:ital,wght@0,300..800;1,300..800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Rubik+Iso&display=swap');

/* ---------- Base & Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; font-size: clamp(14px, 0.9vw + 10px, 16px); }
body { margin: 0; overflow-x: hidden; }
img, svg { max-width: 100%; height: auto; display: block; }

:root{
  --radius: 16px;
  --space: clamp(0.5rem, 1.2vw, 1rem);
  --container: min(1040px, 100% - 1.5rem);
  --font-main: "Google Sans Code", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --font-nav: "Rubik Iso", "Google Sans Code", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* ---------- Body ---------- */
body{
  font-family: var(--font-main);
  font-weight: 400;
  background: linear-gradient(145deg, #1a0b26, #2c1340);
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: cover;
  color: #f2eaff;
  line-height: 1.6;
  padding-bottom: 4rem; /* for fixed footer */
  z-index: 1;
}

/* ---------- Header / Hero ---------- */
.site-header{
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: clamp(0.75rem, 2vw, 1.5rem) 0.75rem 0.5rem;
  background-color: transparent;
  text-align: center;
  z-index: 1;
}

.site-logo{
  position: relative;
  z-index: 2;
  width: clamp(96px, 14vw, 180px);
  display: block;
  margin-inline: auto;
}

.site-title{
  font-size: clamp(1.2rem, 2.8vw, 2.1rem);
  color: #cfaaff;
  text-shadow: 0 0 5px #a15eff;
  margin: .35rem 0 0;
}

/* ASCII watermark behind logo */
.ascii-bg{
  position: absolute;
  inset: 0;
  margin: auto;
  z-index: 1;
  font-family: monospace, monospace;
  white-space: pre;
  font-size: clamp(0.3rem, 1.2vw, 0.7rem);
  line-height: 1.1;
  color: rgba(0,0,0,0.1);
  pointer-events: none;
  user-select: none;
  display: grid;
  place-items: center;
  max-width: 100%;
  max-height: 100%;
  overflow: clip;
}

/* If you also use plain <header>, keep it lean */
header{
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: clamp(0.75rem, 2vw, 1.5rem) 0.75rem 0.5rem;
  background-color: transparent;
  text-align: center;
  z-index: 1;
}
header img { width: clamp(120px, 15vw, 180px); }
header h1 {
  font-size: clamp(1.2rem, 2.8vw, 2.1rem);
  color: #cfaaff;
  text-shadow: 0 0 5px #a15eff;
}

/* ---------- Nav ---------- */
nav{
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(0.5rem, 1.8vw, 1.25rem);
  background-color: #2a1042;
  padding: .5rem .75rem;
  box-shadow: 0 4px 12px rgba(128, 0, 255, 0.2);
  border-radius: 10px;
  margin: 0 auto 1.25rem;
  width: min(680px, 100%);
  z-index: 1;
  flex-wrap: wrap;
  font-family: var(--font-nav);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

nav a{
  color: #dab6ff;
  text-decoration: none;
  font-size: clamp(0.85rem, 1vw, 1rem);
  transition: transform .2s ease, color .2s ease;
}
nav a:hover{ color:#e5b137; transform: translateY(-1px); }

/* ---------- Main & Sections ---------- */
main{
  width: var(--container);
  margin-inline: auto;
  padding: 0.75rem;
  display: grid;
  gap: 1.25rem;
  z-index: 1;
}

section{
  padding: clamp(0.8rem, 2vw, 1.5rem);
  background: #1f0d2f;
  border-left: 5px solid #a15eff;
  border-radius: var(--radius);
  box-shadow: 0 0 20px rgba(161, 94, 255, 0.2);
  transition: transform 0.25s ease;
  z-index: 1;
  overflow: hidden;
}
section:hover{ transform: translateY(-3px); }

section h2{
  margin-bottom: 0.75rem;
  color: #e5b137;
  font-size: clamp(1.05rem, 1.6vw, 1.4rem);
}
section p, section ul{ color: #f2eaff; }

/* ---------- Team ---------- */
.team-member{
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1rem;
  background-color: #2c1b3f;
  padding: 0.85rem;
  border-radius: 10px;
  z-index: 1;
}
.team-member img{
  width: 64px; height: 64px;
  border-radius: 12px;
  object-fit: cover;
  background-color: #fff;
}
.team-member div{ flex: 1; min-width: 0; }
.team-member strong{
  display: block;
  color: #e3c2ff;
  font-size: clamp(0.95rem, 1.4vw, 1.1rem);
}
@media (max-width: 600px){
  .team-member{ flex-direction: column; align-items: flex-start; }
  .team-member img{ width: 58px; height: 58px; }
}

/* ---------- Writeups list (cards) ---------- */
.writeups-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(220px,1fr));
  gap:0.75rem;
}
.ctf-group{
  background:#1f0d2f;
  border-left:5px solid #a15eff;
  border-radius:16px;
  box-shadow:0 0 20px rgba(161,94,255,0.2);
  padding:.6rem .9rem .9rem;
}
.ctf-summary{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  cursor:pointer;
  list-style:none;
  user-select:none;
}
.ctf-summary::-webkit-details-marker{ display:none; }
.ctf-name{
  margin:0;
  color:#e5b137;
  font-size:1rem;
}
.ctf-meta{ color:#cbb8ef; font-size:.85rem; opacity:.85; }
.ctf-links{ list-style:none; padding:0; margin:.4rem 0 0; }
.ctf-links li{
  display:flex; gap:.5rem; align-items:center; justify-content:space-between;
  padding:.25rem .2rem; border-radius:10px;
}
.ctf-links li:hover{ background:rgba(255,255,255,0.03); }
.challenge-link{
  color:#dab6ff; text-decoration:none; border-bottom:1px dashed rgba(218,182,255,.35);
}
.challenge-link:hover{ color:#e5b137; border-bottom-color:#e5b137; }
.challenge-meta{ color:#a570d8; font-size:.75rem; opacity:.95; }
.challenge-meta .by{ color:#cbb8ef; }

/* tables inside writeups */
@media (max-width: 520px){
  .ctf-table{ display: block; overflow-x: auto; }
}

/* ---------- Footer ---------- */
footer{
  text-align: center;
  padding: 0.75rem;
  font-size: 0.7rem;
  color: #a570d8;
  background-color: #0f0019;
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 1;
}

/* ---------- Effects ---------- */
.code-rain-char{
  position: fixed;
  top: -2rem;
  font-size: clamp(0.9rem, 1.8vw, 1.3rem);
  color: rgba(255,255,255,0.07);
  font-family: var(--font-nav);
  pointer-events: none;
  animation-name: fall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
  z-index: 0;
}
@keyframes fall{
  0%{ transform: translateY(0); opacity: .1; }
  100%{ transform: translateY(120vh); opacity: 0; }
}
.fade-in{
  animation: fadeInAnimation ease 2s;
  animation-iteration-count: 1;
  animation-fill-mode: forwards;
}
@keyframes fadeInAnimation{ 0%{opacity:0;} 100%{opacity:1;} }

/* ---------- Compact tiers (tablet & phone) ---------- */
@media (max-width: 992px){
  :root{ --container: min(980px, 100% - 1.25rem); }
  nav{ margin-bottom: 1rem; }
  main{ gap: 1rem; }
  section{ padding: clamp(0.75rem, 2vw, 1.25rem); }
}

@media (max-width: 768px){
  html { font-size: clamp(13.5px, 1.6vw + 8px, 15px); }
  .site-logo{ width: clamp(90px, 18vw, 160px); }
  .site-title, header h1{ font-size: 1.25rem; }
  nav{ gap: .6rem; padding: .5rem .6rem; }
  nav a{ font-size: .85rem; }
  section h2{ font-size: 1.05rem; }
  .ctf-name{ font-size: .95rem; }
}

@media (max-width: 480px){
  html { font-size: 13.5px; }
  body { line-height: 1.5; }
  .site-header { padding: 0.6rem 0.6rem 0.45rem; }
  .site-logo { width: clamp(84px, 22vw, 140px); }
  .site-title, header h1 { font-size: 1.2rem; }

  nav { gap: .5rem; padding: .45rem .5rem; }
  nav a { font-size: .82rem; letter-spacing: 0.01em; }

  main { padding: .5rem; gap: .8rem; }
  section { padding: .8rem; border-radius: 12px; }
  section h2 { font-size: 1rem; }

  .writeups-grid { gap: .6rem; }
  .ctf-group { padding: .5rem .65rem .65rem; }
  .ctf-summary { padding-top: .05rem; }
  .ctf-name { font-size: .92rem; }
  .ctf-meta { font-size: .78rem; }
  .ctf-links li { padding: .2rem .15rem; }
  .challenge-link { font-size: .92rem; }
  .challenge-meta { font-size: .72rem; }

  .team-member { gap: .6rem; padding: .6rem; }
  .team-member img { width: 54px; height: 54px; }
}

@media (max-width: 360px){
  html { font-size: 13px; }
  nav { gap: .45rem; }
  nav a { font-size: .78rem; }
  .ctf-name { font-size: .9rem; }
}
