/* =========================
   Miled Issa Portfolio CSS
   Premium dark + light theme
   ========================= */

/* Theme tokens */
:root {
  color-scheme: dark;
  --bg: #0b0b0b;
  --surface: #141414;
  --surface-2: #101014;
  --text: #f2f2f2;
  --muted: #a6a6a6;
  --accent: #f4f4f4;
  --accent-2: #cfcfcf;
  --border: rgba(255, 255, 255, 0.1);
  --shadow-lg: 0 28px 60px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 18px 36px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 10px 24px rgba(0, 0, 0, 0.25);
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;
  --nav-h: 80px;
  --t-fast: 0.16s ease;
  --t: 0.26s ease;
  --bg-spot: rgba(255, 255, 255, 0.08);
  --bg-spot-2: rgba(255, 255, 255, 0.05);
  --pill-bg: rgba(255, 255, 255, 0.05);
  --hero-glow: rgba(255, 255, 255, 0.14);
  --hero-glow-2: rgba(255, 255, 255, 0.1);
}

:root.light-theme {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f1f3;
  --text: #1b1e23;
  --muted: #4b515a;
  --accent: #1a1a1a;
  --accent-2: #3c3c3c;
  --border: rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 24px 56px rgba(0, 0, 0, 0.12);
  --shadow-md: 0 16px 34px rgba(0, 0, 0, 0.1);
  --shadow-sm: 0 10px 24px rgba(0, 0, 0, 0.08);
  --bg-spot: rgba(0, 0, 0, 0.08);
  --bg-spot-2: rgba(0, 0, 0, 0.04);
  --pill-bg: rgba(0, 0, 0, 0.04);
  --hero-glow: rgba(0, 0, 0, 0.12);
  --hero-glow-2: rgba(0, 0, 0, 0.08);
}

@media (max-width: 575.98px) {
  :root { --nav-h: 72px; }
}

/* Base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 24px);
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  background:
    radial-gradient(1200px 520px at 12% -15%, var(--bg-spot), transparent 60%),
    radial-gradient(960px 480px at 90% 8%, var(--bg-spot-2), transparent 55%),
    var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  padding-top: var(--nav-h);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  height: auto;
}

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

button { font-family: inherit; }

h1,
h2,
h3 {
  letter-spacing: 0.01em;
}

.display-4 {
  font-size: clamp(2.4rem, 4.6vw, 3.6rem);
  line-height: 1.1;
}

.lead { font-size: clamp(1.05rem, 1.8vw, 1.25rem); }

/* Utilities */
.container { max-width: 1180px; }

.text-neon { color: var(--accent) !important; }
.text-text-primary { color: var(--text) !important; }
.text-text-secondary { color: var(--muted) !important; }
.bg-dark-secondary { background-color: var(--surface) !important; }

/* Focus */
:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.35);
  outline-offset: 3px;
}

.light-theme :focus-visible {
  outline: 3px solid rgba(0, 0, 0, 0.28);
}

/* Skip link */
.skip-link {
  position: absolute;
  left: 14px;
  top: 14px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  transform: translateY(-220%);
  transition: transform var(--t-fast);
  z-index: 9999;
  box-shadow: var(--shadow-sm);
}

.skip-link:focus { transform: translateY(0); }

/* Navbar */
.navbar {
  min-height: var(--nav-h);
  padding: 0.75rem 0;
  background: rgba(11, 12, 15, 0.9);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  z-index: 1000;
}

@supports (backdrop-filter: blur(12px)) {
  .navbar { backdrop-filter: blur(12px); }
}

.light-theme .navbar { background: rgba(255, 255, 255, 0.9); }

.navbar-brand {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--accent) !important;
  letter-spacing: 0.03em;
  position: relative;
}

.navbar-brand::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -7px;
  height: 2px;
  width: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--t);
  opacity: 0.9;
}

.navbar-brand:hover::after { transform: scaleX(1); }

.nav-controls > button {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.navbar-nav { gap: 0.25rem; }

.nav-link {
  position: relative;
  font-weight: 600;
  color: var(--muted) !important;
  padding: 0.5rem 0.85rem;
  transition: color var(--t-fast), transform var(--t-fast);
}

.nav-link:hover,
.nav-link.active {
  color: var(--accent) !important;
  transform: translateY(-1px);
}

.nav-link::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width var(--t-fast), left var(--t-fast);
  opacity: 0.85;
}

.nav-link:hover::before,
.nav-link.active::before {
  width: 100%;
  left: 0;
}

.nav-link-cta {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.45rem 0.9rem !important;
  margin-left: 0.2rem;
  background: var(--pill-bg);
}

.navbar-toggler {
  border: 1px solid var(--border) !important;
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--pill-bg);
  transition: transform var(--t-fast), background var(--t-fast);
}

.navbar-toggler:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.08);
}

.light-theme .navbar-toggler:hover { background: rgba(0, 0, 0, 0.08); }

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255,255,255,0.85)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
  background-size: 1.35rem 1.35rem;
  background-repeat: no-repeat;
  background-position: center;
}

.light-theme .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(0,0,0,0.75)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Theme toggle */
.theme-toggle-btn {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--pill-bg);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
  transition: transform var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}

.theme-toggle-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-md);
}

.light-theme .theme-toggle-btn:hover { background: rgba(0, 0, 0, 0.08); }

/* Hero */
.hero {
  position: relative;
  padding: clamp(5.5rem, 8vw, 7rem) 1rem 5rem;
  background: linear-gradient(180deg, var(--surface-2), transparent 65%);
  overflow: hidden;
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  z-index: 0;
}

.hero::before {
  width: 360px;
  height: 360px;
  left: -160px;
  top: 6%;
  background: radial-gradient(circle, var(--hero-glow), transparent 65%);
}

.hero::after {
  width: 260px;
  height: 260px;
  right: -120px;
  bottom: 14%;
  background: radial-gradient(circle, var(--hero-glow-2), transparent 70%);
}

.hero .container { position: relative; z-index: 1; }

.profile-image {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  border: 3px solid var(--border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 0 8px rgba(255, 255, 255, 0.03);
  object-fit: cover;
  object-position: center;
  display: block;
  margin: 0 auto 1.6rem;
  transition: transform var(--t), box-shadow var(--t);
}

.profile-image:hover {
  transform: scale(1.03);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 0 10px rgba(255, 255, 255, 0.05);
}

.light-theme .profile-image {
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.12), 0 0 0 8px rgba(0, 0, 0, 0.02);
}

.hero-badges {
  list-style: none;
  padding: 0;
  margin: 0.8rem 0 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--pill-bg);
  color: var(--text);
  font-weight: 600;
  font-size: 0.92rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem;
  margin-top: 1.6rem;
}

.hero-actions .btn { min-width: 180px; }

.hero-social {
  display: flex;
  justify-content: center;
  gap: 0.65rem;
}

.social-chip {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--pill-bg);
  transition: transform var(--t-fast), background var(--t-fast);
  color: var(--accent);
}

.social-chip:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.1);
}

.light-theme .social-chip:hover { background: rgba(0, 0, 0, 0.08); }

/* Sections */
.section {
  position: relative;
  padding: clamp(3.5rem, 6vw, 5rem) 0;
  scroll-margin-top: calc(var(--nav-h) + 20px);
}

.section-title {
  position: relative;
  display: inline-block;
  margin-bottom: 2.2rem;
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(1.8rem, 3.2vw, 2.4rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--accent);
}

.section-title::after {
  content: "";
  display: block;
  width: 60%;
  height: 3px;
  margin: 0.7rem auto 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.95));
  border-radius: 2px;
  opacity: 0.9;
}

.light-theme .section-title::after {
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.7));
}

.about-text {
  max-width: 760px;
  margin: 0 auto;
  font-size: 1.05rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: transform var(--t-fast), box-shadow var(--t-fast), background var(--t-fast),
    color var(--t-fast), border-color var(--t-fast);
}

.btn-cta {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0b0b0b;
  border: 1px solid transparent;
  box-shadow: var(--shadow-sm);
}

.light-theme .btn-cta {
  background: linear-gradient(135deg, #1b1b1b, #353535);
  color: #ffffff;
}

.btn-cta:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-ghost {
  border: 1px solid var(--border);
  background: var(--pill-bg);
  color: var(--text);
}

.btn-ghost:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.1);
}

.light-theme .btn-ghost:hover { background: rgba(0, 0, 0, 0.08); }

.btn-outline-neon {
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  text-transform: none;
}

.btn-outline-neon:hover {
  background: var(--accent);
  color: var(--bg);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.light-theme .btn-outline-neon { border-color: rgba(0, 0, 0, 0.2); }
.light-theme .btn-outline-neon:hover { color: #ffffff; }

/* Cards */
.card-neon,
.project-card {
  position: relative;
  height: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 45%), var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}

.light-theme .card-neon,
.light-theme .project-card {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.03), transparent 45%), var(--surface);
}

.card-neon { padding: 2rem; }

.project-card {
  padding: 2.2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card-neon:hover,
.project-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-md);
  border-color: rgba(255, 255, 255, 0.18);
}

.light-theme .card-neon:hover,
.light-theme .project-card:hover {
  border-color: rgba(0, 0, 0, 0.18);
}

/* Equal cards */
.equal-cards > [class*="col-"] { display: flex; }
.equal-cards .card-neon { width: 100%; }

/* Education */
.edu-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.edu-logo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.card-title {
  font-family: "JetBrains Mono", monospace;
  font-weight: 800;
  font-size: 1.05rem;
  margin: 0;
  color: var(--accent);
}

.card-subtitle {
  color: var(--muted);
  margin: 0;
  font-size: 0.95rem;
}

.mini-facts {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.mini-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--pill-bg);
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text);
}

/* Skills */
.skills-grid > [class*="col-"] { display: flex; }
.skills-card {
  width: 100%;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.skills-card-header {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 0;
}

.skills-icon {
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--pill-bg);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.skills-title {
  font-family: "JetBrains Mono", monospace;
  font-weight: 800;
  font-size: 1.05rem;
  margin: 0 0 0.15rem;
  color: var(--accent);
}

.skills-subtitle {
  margin: 0;
  font-size: 0.92rem;
}

.skill-chip-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.skill-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--pill-bg);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
}

.skill-chip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-width: 16px;
  height: 16px;
  color: var(--accent);
  flex-shrink: 0;
}

.skill-chip-icon i {
  font-size: 0.85rem;
  line-height: 1;
}

.skill-chip-icon-group { width: auto; }

.skill-chip-icon-svg {
  width: 16px;
  height: 16px;
  display: block;
  filter: brightness(0) invert(1);
}

.light-theme .skill-chip-icon-svg { filter: brightness(0) invert(0); }

/* Projects */
.project-title {
  font-family: "JetBrains Mono", monospace;
  font-weight: 800;
  color: var(--accent);
  margin: 0;
  font-size: 1.1rem;
}

.project-summary { margin: 0; }

.impact-list {
  margin: 0 0 0.6rem;
  padding-left: 1.2rem;
  color: var(--muted);
}

.impact-list li { margin-bottom: 0.35rem; }

.tech-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.32rem 0.72rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  transition: transform var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}

.tech-badge:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.light-theme .tech-badge {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
}

.badge-icon-svg { filter: brightness(0) invert(1); }
.light-theme .badge-icon-svg { filter: brightness(0) invert(0); }

/* Contact */
.contact-card a {
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color var(--t-fast), border-color var(--t-fast);
}

.contact-card a:hover {
  color: var(--accent-2);
  border-color: rgba(255, 255, 255, 0.22);
}

.light-theme .contact-card a:hover { border-color: rgba(0, 0, 0, 0.2); }

.contact-title {
  font-family: "JetBrains Mono", monospace;
  font-weight: 800;
  font-size: 1rem;
  color: var(--accent);
}

/* Footer */
footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.25);
}

.social-icon {
  color: var(--muted);
  font-size: 1.7rem;
  text-decoration: none;
  transition: transform var(--t-fast), color var(--t-fast);
}

.social-icon:hover {
  color: var(--accent);
  transform: translateY(-2px) scale(1.05);
}

/* Back to top */
.back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent);
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity var(--t-fast), transform var(--t-fast), background var(--t-fast);
  z-index: 1000;
}

.back-to-top.is-visible {
  opacity: 0.92;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

.light-theme .back-to-top {
  background: rgba(0, 0, 0, 0.05);
  box-shadow: var(--shadow-sm);
}

/* Mobile navbar panel */
@media (max-width: 991.98px) {
  .navbar-collapse {
    margin-top: 0.65rem;
    padding: 1rem;
    border-top: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(11, 12, 15, 0.94);
    box-shadow: var(--shadow-sm);
  }

  .light-theme .navbar-collapse {
    background: rgba(255, 255, 255, 0.94);
  }

  .navbar-nav .nav-item { text-align: center; }
  .nav-link::before { display: none !important; }
}

/* Responsive */
@media (max-width: 767.98px) {
  .hero { padding: 5.8rem 1rem 4.2rem; }
  .profile-image { width: 180px; height: 180px; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions .btn { width: 100%; }
  .project-card { padding: 1.8rem; }
}

@media (max-width: 575.98px) {
  .profile-image { width: 155px; height: 155px; }
  .display-4 { font-size: 2.2rem; }
  .lead { font-size: 1rem; }
  .card-neon,
  .project-card { padding: 1.5rem; }
  .social-icon { font-size: 1.5rem; }
  .pill { font-size: 0.85rem; }
}

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