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

:root {
  --bg: #060810;
  --bg2: #0c1020;
  --bg3: #111827;
  --surface: #151d2e;
  --surface2: #1a2235;
  --border: #1e2d45;
  --border2: #2a3d5a;
  --text: #e8edf5;
  --text2: #8899b4;
  --text3: #4a6080;
  --accent: #00d4ff;
  --accent2: #0099cc;
  --accent3: #003d52;
  --green: #00ff88;
  --green2: #00cc6a;
  --amber: #ffb800;
  --red: #ff4444;
  --purple: #8b5cf6;
  --font-display: 'Syne', sans-serif;
  --font-body: 'Instrument Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --r: 8px;
  --r2: 14px;
  --r3: 20px;
}

html {
  scroll-behavior: smooth
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.7;
  overflow-x: hidden;
  min-height: 100vh
}

a {
  color: inherit;
  text-decoration: none
}

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  background: none
}

input,
textarea,
select {
  font-family: var(--font-body);
  background: var(--surface);
  border: 1px solid var(--border2);
  color: var(--text);
  border-radius: var(--r);
  padding: 10px 14px;
  width: 100%;
  font-size: 14px;
  outline: none;
  transition: border .2s
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent)
}

textarea {
  resize: vertical;
  min-height: 100px
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar {
  width: 4px;
  height: 4px
}

::-webkit-scrollbar-track {
  background: var(--bg2)
}

::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 2px
}

/* ── NAV ── */
#nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0 5%;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(6, 8, 16, .85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(30, 45, 69, .5)
}

.nav-logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -.5px
}

.nav-logo span {
  color: var(--accent)
}

.nav-links {
  display: flex;
  gap: 32px;
  list-style: none
}

.nav-links a {
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  letter-spacing: .5px;
  text-transform: uppercase;
  transition: color .2s
}

.nav-links a:hover {
  color: var(--accent)
}

.nav-cta {
  display: flex;
  gap: 10px;
  align-items: center
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 20px;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 500;
  transition: all .2s;
  letter-spacing: .3px;
  cursor: pointer
}

.btn-primary {
  background: var(--accent);
  color: #000;
  border: 1px solid var(--accent)
}

.btn-primary:hover {
  background: #00eeff;
  box-shadow: 0 0 24px rgba(0, 212, 255, .3)
}

.btn-outline {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border2)
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent)
}

.btn-ghost {
  background: var(--surface);
  color: var(--text2);
  border: 1px solid var(--border)
}

.btn-ghost:hover {
  background: var(--surface2);
  color: var(--text)
}

.btn-danger {
  background: rgba(255, 68, 68, .1);
  color: var(--red);
  border: 1px solid rgba(255, 68, 68, .2)
}

.btn-danger:hover {
  background: rgba(255, 68, 68, .2)
}

.btn-sm {
  padding: 6px 14px;
  font-size: 12px
}

.btn-icon {
  padding: 8px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text2);
  transition: all .2s
}

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

/* ── HERO ── */
#hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 80px 5% 60px;
  position: relative;
  overflow: hidden
}

.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none
}

.hero-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(0, 212, 255, .03) 1px, transparent 1px), linear-gradient(90deg, rgba(0, 212, 255, .03) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black, transparent)
}

.hero-glow {
  position: absolute;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(ellipse, rgba(0, 212, 255, .06) 0%, transparent 65%);
  pointer-events: none
}

.hero-glow2 {
  position: absolute;
  bottom: -100px;
  right: -100px;
  width: 500px;
  height: 500px;
  background: radial-gradient(ellipse, rgba(139, 92, 246, .05) 0%, transparent 65%)
}

.hero-content {
  position: relative;
  max-width: 760px;
  z-index: 2
}

.hero-photo {
  position: absolute;
  right: 12%;
  top: 45%;
  transform: translateY(-50%);
  width: 540px;
  height: 540px;
  background: url('https://github.com/Oussama12520.png') center/cover no-repeat;
  border-radius: 50%;
  opacity: 0.12;
  filter: grayscale(100%) contrast(1.1);
  mask-image: radial-gradient(circle at center, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(circle at center, black 20%, transparent 70%);
  z-index: 1;
  animation: photoBeat 6s ease-in-out infinite;
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-photo:hover {
  opacity: 0.25;
  filter: grayscale(0%) contrast(1.2) brightness(1.1) blur(0px);
  transform: translateY(-52%) scale(1.05);
  mask-image: radial-gradient(circle at center, black 40%, transparent 80%);
  -webkit-mask-image: radial-gradient(circle at center, black 40%, transparent 80%);
}

@keyframes photoBeat {

  0%,
  100% {
    transform: translateY(-50%) scale(1);
    filter: grayscale(100%) contrast(1.1) blur(0px);
    opacity: 0.12;
  }

  50% {
    transform: translateY(-51%) scale(1.04);
    filter: grayscale(100%) contrast(1.15) blur(5px);
    opacity: 0.2;
  }
}

@media(max-width:1100px) {
  .hero-photo {
    width: 400px;
    height: 400px;
    opacity: 0.08
  }
}

@media(max-width:768px) {
  .hero-photo {
    width: 300px;
    height: 300px;
    right: 50%;
    transform: translate(50%, -50%);
    mask-image: radial-gradient(circle at center, black 10%, transparent 60%);
    -webkit-mask-image: radial-gradient(circle at center, black 10%, transparent 60%)
  }
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(0, 212, 255, .06);
  border: 1px solid rgba(0, 212, 255, .15);
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 28px
}

.hero-tag::before {
  content: '';
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  animation: blink 2s infinite
}

@keyframes blink {

  0%,
  100% {
    opacity: 1
  }

  50% {
    opacity: .3
  }
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(44px, 7vw, 88px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -2px;
  margin-bottom: 20px
}

.hero-title .name {
  color: var(--accent)
}

.hero-title .role {
  display: block;
  color: var(--text2);
  font-size: .55em;
  font-weight: 600;
  letter-spacing: -1px;
  margin-top: 6px
}

.hero-desc {
  font-size: 17px;
  color: var(--text2);
  max-width: 520px;
  margin-bottom: 40px;
  line-height: 1.8
}

.hero-desc em {
  color: var(--text);
  font-style: normal;
  font-weight: 500
}

.hero-btns {
  display: flex;
  gap: 14px;
  flex-wrap: wrap
}

.hero-stats {
  display: flex;
  gap: 40px;
  margin-top: 56px;
  padding-top: 40px;
  border-top: 1px solid var(--border)
}

.stat-item {
  font-family: var(--font-display)
}

.stat-num {
  font-size: 32px;
  font-weight: 700;
  color: var(--accent)
}

.stat-label {
  font-size: 12px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-top: 2px
}

.hero-floating {
  position: absolute;
  right: 8%;
  top: 85%;
  transform: translateY(-50%);
  z-index: 3;
  display: none
}

@media(min-width:1100px) {
  .hero-floating {
    display: block
  }
}

.code-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r2);
  padding: 20px;
  font-family: var(--font-mono);
  font-size: 12px;
  width: 100%;
  max-width: 400px;
  line-height: 1.8
}

.code-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 14px
}

.code-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%
}

.kw {
  color: #ff79c6
}

.fn {
  color: var(--accent)
}

.str {
  color: var(--green)
}

.cm {
  color: var(--text3)
}

.num {
  color: var(--amber)
}

/* ── SECTIONS ── */
.section {
  padding: 100px 5%
}

.section-inner {
  max-width: 1100px;
  margin: 0 auto
}

.section-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 12px
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(32px, 4vw, 52px);
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 16px
}

.section-sub {
  font-size: 16px;
  color: var(--text2);
  max-width: 520px;
  line-height: 1.8
}

.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 0 5%
}

/* ── ABOUT ── */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
  margin-top: 56px
}

@media(max-width:768px) {
  .about-grid {
    grid-template-columns: 1fr
  }
}

.about-text p {
  color: var(--text2);
  line-height: 1.9;
  margin-bottom: 16px
}

.about-text p strong {
  color: var(--text)
}

.skills-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px
}

.skill-tag {
  padding: 7px 16px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 100px;
  font-size: 12px;
  color: var(--text2);
  font-family: var(--font-mono);
  transition: all .2s
}

.skill-tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0, 212, 255, .05)
}

.about-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r3);
  padding: 32px
}

.about-card-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--accent)
}

.exp-item {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border)
}

.exp-item:last-child {
  border: none;
  margin: 0;
  padding: 0
}

.exp-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r);
  background: rgba(0, 212, 255, .1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0
}

.exp-info h4 {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px
}

.exp-info p {
  font-size: 12px;
  color: var(--text3)
}

/* ── PROJECTS ── */
#projects {
  background: var(--bg2)
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
  margin-top: 56px;
  transition: all 0.4s ease;
}

/* CAROUSEL MODE */
.grid-wrapper {
  position: relative;
  margin-top: 56px;
}

.projects-grid.is-carousel, 
.certs-grid.is-carousel {
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  gap: 24px;
  margin-top: 0;
  padding: 10px 0 30px;
  scrollbar-width: none; /* Hide scrollbar */
}

.projects-grid.is-carousel::-webkit-scrollbar,
.certs-grid.is-carousel::-webkit-scrollbar {
  display: none;
}

.projects-grid.is-carousel .project-card,
.certs-grid.is-carousel .cert-card {
  flex: 0 0 340px;
  scroll-snap-align: start;
}

.carousel-nav {
  display: none;
  position: absolute;
  top: -60px;
  right: 0;
  gap: 10px;
}

.projects-grid.is-carousel + .carousel-nav,
.certs-grid.is-carousel + .carousel-nav {
  display: flex;
}

.carousel-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border2);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 18px;
}

.carousel-btn:hover {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
  box-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
}

@media (max-width: 768px) {
  .carousel-nav {
    display: none !important;
  }
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r3);
  overflow: hidden;
  transition: all .3s;
  position: relative
}

.project-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: 0 20px 60px rgba(0, 212, 255, .08)
}

.project-img {
  aspect-ratio: 16 / 9;
  height: auto;
  background: var(--bg3);
  overflow: hidden;
  position: relative
}

.project-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s
}

.project-card:hover .project-img img {
  transform: scale(1.06)
}

.project-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  background: linear-gradient(135deg, var(--surface), var(--bg3))
}

.project-body {
  padding: 24px
}

.project-techs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px
}

.tech-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 9px;
  background: rgba(0, 212, 255, .06);
  border: 1px solid rgba(0, 212, 255, .12);
  color: var(--accent);
  border-radius: 100px
}

.project-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -.3px
}

.project-desc {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.7;
  margin-bottom: 18px
}

.project-links {
  display: flex;
  gap: 10px
}

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text3)
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 16px
}

.empty-state h3 {
  font-size: 18px;
  color: var(--text2);
  margin-bottom: 8px
}

.empty-state p {
  font-size: 14px
}

/* ── CERTS ── */
.certs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
  margin-top: 56px
}

.cert-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r3);
  overflow: hidden;
  cursor: pointer;
  transition: all .3s
}

.cert-card:hover {
  transform: translateY(-4px);
  border-color: var(--purple);
  box-shadow: 0 16px 48px rgba(139, 92, 246, .1)
}

.cert-img {
  aspect-ratio: 16 / 9;
  height: auto;
  background: var(--bg3);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center
}

.cert-img img {
  width: 100%;
  height: 100%;
  object-fit: cover
}

.cert-placeholder {
  font-size: 40px;
  color: var(--text3)
}

.cert-body {
  padding: 24px
}

.cert-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 4px
}

.cert-issuer {
  font-size: 12px;
  color: var(--purple)
}

.cert-date {
  font-size: 11px;
  color: var(--text3);
  margin-top: 4px;
  font-family: var(--font-mono)
}

/* ── CONTACT ── */
#contact {
  background: var(--bg2)
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 60px;
  margin-top: 56px;
  align-items: start
}

@media(max-width:768px) {
  .contact-grid {
    grid-template-columns: 1fr
  }
}

.contact-info h3 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 16px
}

.contact-info p {
  color: var(--text2);
  font-size: 15px;
  line-height: 1.8;
  margin-bottom: 32px
}

.social-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 60px;
}

.social-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r2);
  transition: all .2s;
  min-width: 0;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
}

.social-link>div:last-child {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.social-link:hover {
  border-color: var(--accent);
  background: rgba(0, 212, 255, .04)
}

.social-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r);
  background: rgba(0, 212, 255, .1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px
}

.social-name {
  font-weight: 500;
  font-size: 14px
}

.social-handle {
  font-size: 12px;
  color: var(--text3);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 16px
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px
}

@media(max-width:480px) {
  .form-row {
    grid-template-columns: 1fr
  }
}

.form-group label {
  display: block;
  font-size: 12px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 6px;
  font-family: var(--font-mono)
}

.form-success {
  background: rgba(0, 255, 136, .05);
  border: 1px solid rgba(0, 255, 136, .2);
  border-radius: var(--r2);
  padding: 20px;
  text-align: center;
  color: var(--green)
}

.form-success .icon {
  font-size: 32px;
  margin-bottom: 8px
}

/* ── FOOTER ── */
footer {
  padding: 40px 5%;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text3);
  font-size: 13px
}

footer span {
  color: var(--accent)
}

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .85);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(8px)
}

.modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--r3);
  padding: 32px;
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--border2);
  color: var(--text2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all .2s
}

.modal-close:hover {
  border-color: var(--red);
  color: var(--red)
}

.modal-img {
  width: 100%;
  border-radius: var(--r2);
  margin-bottom: 20px;
  max-height: 360px;
  object-fit: cover
}

.modal-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 8px
}

.modal-issuer {
  color: var(--purple);
  font-size: 14px;
  margin-bottom: 4px
}

.modal-date {
  color: var(--text3);
  font-family: var(--font-mono);
  font-size: 12px;
  margin-bottom: 16px
}

/* ── ADMIN ── */
#admin {
  display: none;
  min-height: 100vh;
  background: var(--bg)
}

.admin-active #admin {
  display: flex
}

.admin-active #portfolio {
  display: none
}

.admin-active #nav {
  display: none
}

.admin-sidebar {
  width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0
}

.admin-logo {
  padding: 0 20px 24px;
  border-bottom: 1px solid var(--border)
}

.admin-logo h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--accent)
}

.admin-logo p {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
  font-family: var(--font-mono)
}

.admin-nav {
  padding: 16px 12px;
  flex: 1
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r);
  font-size: 13px;
  color: var(--text2);
  cursor: pointer;
  transition: all .2s;
  margin-bottom: 4px
}

.admin-nav-item:hover {
  background: var(--surface2);
  color: var(--text)
}

.admin-nav-item.active {
  background: rgba(0, 212, 255, .08);
  color: var(--accent);
  border: 1px solid rgba(0, 212, 255, .12)
}

.admin-nav-item .nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center
}

.admin-logout {
  padding: 16px 12px
}

.admin-logout button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r);
  font-size: 13px;
  color: var(--text3);
  width: 100%;
  transition: all .2s
}

.admin-logout button:hover {
  color: var(--red);
  background: rgba(255, 68, 68, .06)
}

.admin-main {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
  height: 100vh
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px
}

.admin-header h1 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700
}

.admin-header p {
  font-size: 13px;
  color: var(--text3);
  margin-top: 4px
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px
}

@media(max-width:900px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr)
  }
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r2);
  padding: 20px
}

.stat-card .num {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--accent)
}

.stat-card .lbl {
  font-size: 12px;
  color: var(--text3);
  margin-top: 4px;
  font-family: var(--font-mono)
}

.stat-card .trend {
  font-size: 11px;
  color: var(--green);
  margin-top: 8px
}

.admin-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r2);
  padding: 24px;
  margin-bottom: 20px
}

.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border)
}

.admin-card-header h2 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700
}

.table {
  width: 100%;
  border-collapse: collapse
}

.table th {
  text-align: left;
  font-size: 11px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-weight: 500
}

.table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle
}

.table tr:last-child td {
  border: none
}

.table tr:hover td {
  background: rgba(255, 255, 255, .015)
}

.table .actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end
}

.badge {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-family: var(--font-mono)
}

.badge-read {
  background: rgba(0, 255, 136, .08);
  border: 1px solid rgba(0, 255, 136, .2);
  color: var(--green)
}

.badge-unread {
  background: rgba(255, 184, 0, .08);
  border: 1px solid rgba(255, 184, 0, .2);
  color: var(--amber)
}

.badge-tech {
  background: rgba(0, 212, 255, .06);
  border: 1px solid rgba(0, 212, 255, .12);
  color: var(--accent);
  font-size: 10px;
  padding: 2px 7px
}

/* ── ADMIN FORM ── */
.form-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .8);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(8px)
}

.form-modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--r3);
  padding: 32px;
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative
}

.form-modal h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 24px
}

.field-group {
  margin-bottom: 18px
}

.field-group label {
  display: block;
  font-size: 11px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 6px;
  font-family: var(--font-mono)
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px
}

/* ── LOGIN ── */
#login-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  display: none
}

#login-screen.visible {
  display: flex
}

.login-box {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r3);
  padding: 40px;
  max-width: 420px;
  width: 90%;
  text-align: center
}

.login-box .login-logo {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px
}

.login-box .login-logo span {
  color: var(--accent)
}

.login-box p {
  font-size: 13px;
  color: var(--text3);
  margin-bottom: 32px
}

.login-box .form-group {
  text-align: left;
  margin-bottom: 16px
}

.login-error {
  color: var(--red);
  font-size: 13px;
  margin-top: 8px;
  display: none
}

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r2);
  padding: 14px 20px;
  font-size: 13px;
  z-index: 9999;
  transform: translateX(120%);
  transition: transform .3s;
  max-width: 320px
}

.toast.show {
  transform: translateX(0)
}

.toast.success {
  border-color: rgba(0, 255, 136, .3);
  color: var(--green)
}

.toast.error {
  border-color: rgba(255, 68, 68, .3);
  color: var(--red)
}

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

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

@keyframes fadeIn {
  from {
    opacity: 0
  }

  to {
    opacity: 1
  }
}

.fade-up {
  animation: fadeUp .7s ease both
}

.delay-1 {
  animation-delay: .1s
}

.delay-2 {
  animation-delay: .2s
}

.delay-3 {
  animation-delay: .3s
}

.delay-4 {
  animation-delay: .4s
}

.delay-5 {
  animation-delay: .5s
}

@media(max-width:768px) {
  .nav-links {
    display: none
  }

  .admin-sidebar {
    display: none
  }

  .admin-main {
    padding: 20px
  }
}

/* ── PROJECT FILTERS ── */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 8px 20px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: all .2s;
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-btn.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

/* ── STATUS DASHBOARD ── */
.status-widget {
  position: fixed;
  top: 80px;
  right: 5%;
  background: rgba(13, 17, 28, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  padding: 12px 16px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 200px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: slideInDown .5s ease-out;
}

@keyframes slideInDown {
  from {
    transform: translateY(-20px);
    opacity: 0
  }

  to {
    transform: translateY(0);
    opacity: 1
  }
}

body.admin-active .status-widget,
body.admin-active .terminal-toggle-btn,
body.admin-active .terminal-container {
  display: none !important;
}

.status-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text2);
}

.status-val {
  color: var(--text);
  font-weight: 500;
}

.status-val.online {
  color: var(--green);
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot-pulse {
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 255, 136, 0.4)
  }

  70% {
    box-shadow: 0 0 0 8px rgba(0, 255, 136, 0)
  }

  100% {
    box-shadow: 0 0 0 0 rgba(0, 255, 136, 0)
  }
}

/* ── TERMINAL ── */
.terminal-toggle-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 101;
}

.terminal-container {
  position: fixed;
  bottom: 80px;
  right: 24px;
  width: 400px;
  height: 300px;
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: var(--r2);
  z-index: 1000;
  display: none;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.terminal-container.active {
  display: flex
}

.terminal-header {
  padding: 8px 14px;
  background: #161b22;
  border-bottom: 1px solid #30363d;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-family: var(--font-mono);
  color: #8b949e;
}

.terminal-body {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  color: #e6edf3;
}

.form-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(5px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.form-modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--r2);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 30px;
  position: relative;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  animation: slideInUp .4s ease-out;
}

@keyframes slideInUp {
  from {
    transform: translateY(30px);
    opacity: 0
  }

  to {
    transform: translateY(0);
    opacity: 1
  }
}

.form-modal .modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  color: var(--text3);
  font-size: 20px;
  cursor: pointer;
  transition: color .3s;
}

.form-modal .modal-close:hover {
  color: var(--text);
}

.terminal-output div {
  margin-bottom: 4px
}

.terminal-prompt {
  color: var(--accent)
}

.terminal-input-wrap {
  display: flex;
  gap: 8px;
  margin-top: 8px
}

.terminal-input-wrap input {
  background: none !important;
  border: none !important;
  color: inherit !important;
  font-family: inherit !important;
  font-size: inherit !important;
  padding: 0 !important;
  width: 100% !important;
  outline: none !important;
}


/* ── HERO SOCIAL ── */
.hero-social {
  display: flex;
  gap: 16px;
  margin-top: 32px;
}

.hero-social a {
  padding: 8px 16px;
  background: rgba(0, 212, 255, 0.05);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: var(--r);
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
  transition: all .3s;
  font-weight: 500;
}

.hero-social a:hover {
  background: var(--accent);
  color: #000;
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 212, 255, 0.3);
}

/* ── FOOTER SOCIAL ── */
.footer-social {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 24px;
}

.footer-social a {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--text3);
  text-decoration: none;
  font-size: 12px;
  font-weight: bold;
  transition: all .3s;
}

.footer-social a:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0, 212, 255, 0.05);
  transform: scale(1.1);
}

/* ── PROJECT GALLERY & DETAIL ── */
.modal-lg {
  max-width: 900px !important;
  width: 95% !important;
}

.detail-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 15px;
  margin-bottom: 25px;
  max-height: 500px;
  overflow-y: auto;
  padding-right: 10px;
}

.detail-gallery img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: var(--r);
  border: 1px solid var(--border2);
  transition: transform .3s;
  cursor: zoom-in;
}

.detail-gallery img:hover {
  transform: scale(1.02);
}

.detail-info {
  padding: 20px 0;
}

.modal-desc {
  color: var(--text2);
  line-height: 1.7;
  font-size: 15px;
}

/* Admin Previews */
.previews-grid .preview-item img {
  transition: filter .3s;
}

.previews-grid .preview-item:hover img {
  filter: brightness(0.7);
}

.project-card:hover .project-view-btn {
  opacity: 1 !important;
}

.project-img {
  position: relative;
  overflow: hidden;
}

.antispam-box {
  background: rgba(0, 212, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.antispam-box label {
  font-size: 12px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.antispam-box #captcha-question {
  color: var(--accent);
  font-weight: bold;
}

.antispam-box input {
  background: var(--bg2) !important;
  border: 1px solid var(--border2) !important;
  padding: 8px 12px !important;
}

/* ── MOBILE RESPONSIVENESS (PREMIUM UPGRADE) ── */
@media (max-width: 768px) {

  /* GLOBAL */
  .section {
    padding: 60px 20px;
  }

  .section-title {
    font-size: 32px;
    line-height: 1.2;
  }

  /* NAV */
  #nav {
    padding: 0 20px;
  }

  .nav-links {
    display: none;
  }

  /* Hide links on mobile for now, can add hamburger later */
  .nav-cta .btn-outline,
  .nav-cta .btn-ghost {
    display: none;
  }

  /* Keep it clean */

  /* HERO */
  .code-card {
    padding: 12px;
    font-size: 9px;
    line-height: 1.6;
    max-width: 100%;
  }

  #hero {
    min-height: auto;
    padding: 100px 15px 20px;
    text-align: center;
    flex-direction: column;
    justify-content: flex-start;
  }

  .hero-content {
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
  }

  .hero-title {
    font-size: 32px;
    letter-spacing: -0.5px;
    word-break: break-word;
    overflow-wrap: break-word;
    width: 100%;
  }

  .hero-title .role {
    font-size: 0.55em;
    margin-top: 10px;
  }

  .hero-desc {
    font-size: 14px;
    margin-inline: auto;
    word-break: break-word;
  }

  .hero-btns {
    justify-content: center;
    width: 100%;
  }

  .hero-btns .btn {
    width: 100%;
    justify-content: center;
  }

  .hero-photo {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%) !important;
    width: 280px;
    height: 280px;
    margin: 0;
    opacity: 0.45;
    border: none;
    box-shadow: none;
    filter: contrast(1.1);
    mask-image: radial-gradient(circle at center, black 40%, transparent 85%);
    -webkit-mask-image: radial-gradient(circle at center, black 40%, transparent 85%);
    z-index: 1;
    pointer-events: none;
    animation: photoBeatMobile 6s ease-in-out infinite;
  }

  @keyframes photoBeatMobile {

    0%,
    100% {
      transform: translate(-50%, -50%) scale(1);
      opacity: 0.45;
    }

    50% {
      transform: translate(-50%, -52%) scale(1.05);
      opacity: 0.55;
    }
  }

  .hero-stats {
    flex-direction: row;
    justify-content: center;
    gap: 30px;
    width: 100%;
    padding-top: 30px;
    border-top: 1px solid var(--border);
  }

  .stat-item {
    text-align: center;
  }

  .stat-num {
    font-size: 24px;
  }

  .hero-social {
    display: none;
  }

  /* Hide the social grid as requested */

  /* CONTACT SOCIAL LINKS */
  .social-links {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 40px;
  }

  .social-link {
    padding: 16px 20px;
    background: rgba(13, 17, 28, 0.6);
    backdrop-filter: blur(10px);
  }

  .social-name {
    font-size: 16px;
    font-weight: 700;
  }

  .social-handle {
    font-size: 13px;
    color: var(--text2);
  }

  /* PROJECTS CAROUSEL (MOBILE) */
  .projects-grid { 
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    scroll-snap-type: x mandatory;
    scroll-padding-left: 0;
    gap: 16px;
    padding: 20px 0 40px;
    margin: 0;
    scrollbar-width: none;
  }

  .projects-grid::-webkit-scrollbar {
    display: none;
  }

  .project-card {
    width: 300px !important;
    max-width: 300px !important;
    flex-shrink: 0 !important;
    height: auto !important;
    scroll-snap-align: start;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .project-img {
    aspect-ratio: 16 / 9 !important;
    height: auto !important;
    flex-shrink: 0;
  }

  .project-body {
    padding: 12px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .project-title {
    font-size: 14px;
    margin-bottom: 2px;
  }

  .project-desc {
    font-size: 10px;
    line-height: 1.3;
    margin-bottom: 6px;
    color: var(--text2);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .project-links {
    margin-top: auto;
  }

  .project-links .btn {
    width: 100%;
    justify-content: center;
    padding: 5px;
    font-size: 10px;
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
  }

  /* CERTS CAROUSEL (MOBILE) */
  .certs-grid {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-left: 0;
    gap: 16px;
    padding: 20px 0 40px;
    margin: 0;
    scrollbar-width: none;
  }

  .certs-grid::-webkit-scrollbar {
    display: none;
  }

  .cert-card {
    width: 300px !important;
    max-width: 300px !important;
    flex-shrink: 0 !important;
    height: auto !important;
    scroll-snap-align: start;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .cert-img {
    aspect-ratio: 16 / 9 !important;
    height: auto !important;
    flex-shrink: 0;
  }

  .cert-body {
    padding: 12px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .cert-title {
    font-size: 14px;
    margin-bottom: 2px;
  }

  .about-grid {
    gap: 40px;
  }

  /* TERMINAL (MOBILE) */
  .terminal-container {
    width: calc(100% - 30px);
    height: 240px;
    bottom: 80px;
    right: 15px;
    left: 15px;
  }

  .terminal-toggle-btn {
    bottom: 20px;
    right: 20px;
  }

  /* MODALS */
  .modal {
    width: 95%;
    padding: 16px;
    max-height: 95vh;
  }

  #pd-title {
    font-size: 18px !important;
    margin-bottom: 4px !important;
  }

  #pd-desc {
    font-size: 13px !important;
    line-height: 1.4 !important;
    margin-bottom: 15px !important;
  }

  .tech-tag {
    font-size: 9px !important;
    padding: 2px 6px !important;
  }

  .modal-lg {
    width: 98% !important;
  }

  .detail-gallery {
    grid-template-columns: 1fr;
    max-height: 300px;
  }

  .modal-actions {
    flex-direction: column;
  }

  .modal-actions .btn {
    width: 100%;
    justify-content: center;
  }

  /* ADMIN PANEL */
  .admin-sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    height: 60px;
    flex-direction: row;
    padding: 0;
    border-right: none;
    border-top: 1px solid var(--border);
    overflow-x: auto;
    z-index: 999;
  }

  .admin-nav {
    flex-direction: row;
    height: 100%;
  }

  .admin-nav-btn {
    flex: 1;
    justify-content: center;
    padding: 0;
    border-radius: 0;
    font-size: 10px;
    flex-direction: column;
    gap: 4px;
  }

  .admin-nav-btn span {
    display: none;
  }

  /* Only icons or tiny text */
  .admin-main {
    padding: 20px 20px 80px;
  }

  .admin-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  /* STATUS WIDGET */
  .status-widget {
    top: auto;
    bottom: 80px;
    right: 10px;
    left: 10px;
    min-width: 0;
  }
}

/* ── GALLERY ── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  grid-auto-rows: 250px;
  grid-auto-flow: dense;
  gap: 16px;
  margin-top: 40px;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--r3);
  background: var(--surface);
  border: 1px solid var(--border2);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-item.wide { grid-column: span 2; }
.gallery-item.tall { grid-row: span 2; }
.gallery-item.big { grid-column: span 2; grid-row: span 2; }

@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    grid-auto-rows: 160px;
    gap: 10px;
  }
  .gallery-item.wide, .gallery-item.tall, .gallery-item.big {
    grid-column: span 1;
    grid-row: span 1;
  }
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.gallery-item:hover img {
  transform: scale(1.1);
}

.gallery-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 60%);
  display: flex;
  align-items: flex-end;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-overlay {
  opacity: 1;
}

.gallery-info h3 {
  color: #fff;
  font-size: 18px;
  font-family: var(--font-display);
  margin-bottom: 4px;
}

.gallery-likes {
  font-size: 14px;
  color: var(--accent);
  font-family: var(--font-mono);
}

.modal-desc {
  color: var(--text2);
  font-size: 15px;
  line-height: 1.6;
}

/* Mobile gallery overrides are now integrated above */

.admin-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 36px;
  }

  .section-title {
    font-size: 28px;
  }
}
