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

:root {
  --bg:         #0c0a14;
  --bg2:        #131022;
  --card:       #16112a;
  --card-hov:   #1e1838;
  --border:     rgba(168,85,247,0.22);
  --border-hov: rgba(168,85,247,0.55);
  --accent:     #a855f7;
  --accent2:    #7c3aed;
  --text:       #e2d9f3;
  --text-dim:   #8b7aa8;
  --radius:     12px;
  --radius-sm:  6px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  line-height: 1.6;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--accent2); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── NAV ── */
nav {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 100;
  background: rgba(12,10,20,0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  height: 54px;
  display: flex;
  align-items: center;
  padding: 0 24px;
}

.nav-inner {
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-brand {
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, #d8b4fe 0%, #a855f7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  margin-right: 8px;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}

.nav-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  text-decoration: none;
  padding: 5px 11px;
  border-radius: 99px;
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--text);
  background: rgba(168,85,247,0.1);
}

/* ── HEADER ── */
header {
  position: relative;
  overflow: hidden;
  padding: 110px 24px 68px;
  text-align: center;
  background: linear-gradient(160deg, #1a0a2e 0%, #0c0a14 60%);
  border-bottom: 1px solid var(--border);
}

header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 50% at 50% 0%, rgba(168,85,247,0.18) 0%, transparent 70%);
  pointer-events: none;
}

.site-title {
  font-size: clamp(2.2rem, 6vw, 3.8rem);
  font-weight: 800;
  letter-spacing: -1px;
  background: linear-gradient(135deg, #d8b4fe 0%, #a855f7 50%, #7c3aed 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
  animation: fadeUp 0.65s ease both;
}

.site-subtitle {
  margin-top: 14px;
  font-size: 1rem;
  color: var(--text-dim);
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
  animation: fadeUp 0.65s 0.1s ease both;
}

.header-links {
  margin-top: 24px;
  display: flex;
  justify-content: center;
  gap: 10px;
  position: relative;
  flex-wrap: wrap;
  animation: fadeUp 0.65s 0.2s ease both;
}

.header-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-dim);
  border: 1px solid var(--border);
  background: rgba(168,85,247,0.06);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.header-link:hover {
  color: var(--accent);
  border-color: var(--border-hov);
  background: rgba(168,85,247,0.13);
}

/* ── MAIN ── */
main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 56px 20px 88px;
}

/* ── SECTION ── */
.section {
  margin-bottom: 60px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.section-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
}

.section-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.section-count {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}

.section-desc {
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.75;
  margin-bottom: 22px;
  max-width: 680px;
}

/* ── CARD GRID ── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 0.2s, background 0.2s, transform 0.15s, box-shadow 0.2s;
  text-decoration: none;
  color: inherit;
  animation: fadeUp 0.5s ease both;
}

.card:hover {
  border-color: var(--border-hov);
  background: var(--card-hov);
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(168,85,247,0.08);
}

.card-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(168,85,247,0.12);
  border: 1px solid rgba(168,85,247,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.card-icon-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}

.card-title-wrap { flex: 1; min-width: 0; }

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 3px;
}

.card-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.65;
  flex: 1;
}

.card-desc a { color: var(--accent); text-decoration: none; }
.card-desc a:hover { text-decoration: underline; }

.card-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 2px;
}

.btn-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  background: rgba(168,85,247,0.14);
  color: #c084fc;
  border: 1px solid rgba(168,85,247,0.3);
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.card:hover .btn-open {
  background: rgba(168,85,247,0.28);
  border-color: rgba(168,85,247,0.6);
  color: #e9d5ff;
}

.btn-open svg { width: 13px; height: 13px; flex-shrink: 0; }

/* ── PERSONAL PROJECTS CTA ── */
.personal-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.personal-cta:hover {
  border-color: var(--border-hov);
  background: var(--card-hov);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(168,85,247,0.08);
}

.cta-text h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 5px;
}

.cta-text p {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
}

.btn-cta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(168,85,247,0.25), rgba(124,58,237,0.25));
  border: 1px solid rgba(168,85,247,0.45);
  color: #e9d5ff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s;
}

.personal-cta:hover .btn-cta {
  background: linear-gradient(135deg, rgba(168,85,247,0.45), rgba(124,58,237,0.45));
  border-color: rgba(168,85,247,0.75);
}

.btn-cta svg { width: 13px; height: 13px; }

/* ── FOOTER ── */
footer {
  text-align: center;
  padding: 24px;
  font-size: 12px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
}

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

/* ── ANIMATIONS ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  header { padding: 86px 16px 52px; }
  main { padding: 40px 14px 64px; }
  .card { padding: 18px; }
  .card-grid { grid-template-columns: 1fr; }
  .personal-cta { flex-direction: column; align-items: flex-start; }
  nav { padding: 0 14px; }
  .nav-link { font-size: 12px; padding: 4px 8px; }
}

/* lock hint on password-protected school projects */
.card-footer { gap: 10px; }
.card-lock { font-size: 12px; opacity: .75; margin-right: auto; }

/* ── LOGIN (popup + login page) ── */
.login-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(6,4,12,0.72);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.login-backdrop.open { opacity: 1; pointer-events: auto; }
.login-box {
  width: 100%; max-width: 380px;
  background: var(--card);
  border: 1px solid var(--border-hov);
  border-radius: var(--radius);
  padding: 28px 26px 24px;
  box-shadow: 0 16px 48px rgba(124,58,237,0.25);
  transform: translateY(8px); transition: transform 0.2s;
}
.login-backdrop.open .login-box { transform: none; }
.login-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.login-head .card-icon { flex-shrink: 0; }
.login-title { font-size: 18px; font-weight: 700; }
.login-sub { font-size: 13px; color: var(--text-dim); margin-bottom: 20px; }
.login-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-dim); margin-bottom: 6px; letter-spacing: .03em; text-transform: uppercase; }
.login-input {
  width: 100%; padding: 11px 14px;
  background: var(--bg2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font: inherit; font-size: 15px; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.login-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(168,85,247,0.18); }
.login-error { min-height: 20px; font-size: 13px; color: #f87171; margin: 8px 0 4px; }
.login-actions { display: flex; gap: 10px; margin-top: 8px; }
.login-btn {
  flex: 1; padding: 11px 16px; border-radius: var(--radius-sm);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--accent2);
  background: linear-gradient(135deg, var(--accent2), var(--accent)); color: #fff;
  transition: filter 0.2s, opacity 0.2s;
}
.login-btn:hover { filter: brightness(1.1); }
.login-btn:disabled { opacity: .6; cursor: wait; }
.login-btn.secondary { flex: 0 0 auto; background: transparent; color: var(--text-dim); border-color: var(--border); }
.login-btn.secondary:hover { color: var(--text); border-color: var(--border-hov); }
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-page .login-box { transform: none; }
.login-back { display: inline-block; margin-top: 16px; font-size: 13px; color: var(--text-dim); text-decoration: none; }
.login-back:hover { color: var(--accent); }

/* login status in the top bar */
.nav-status {
  margin-left: auto; flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-dim);
  padding: 4px 6px 4px 11px; border-radius: 99px;
  border: 1px solid var(--border); background: rgba(168,85,247,0.06);
}
.nav-status[hidden] { display: none; }
.nav-status-dot { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 6px #4ade80; }
.nav-status a {
  color: var(--text); text-decoration: none; font-weight: 600;
  padding: 3px 9px; border-radius: 99px; background: rgba(168,85,247,0.16);
  transition: background 0.2s;
}
.nav-status a:hover { background: rgba(168,85,247,0.3); }
@media (max-width: 640px) {
  .nav-status-text { display: none; }
}
