:root {
  --bg: #0b0f14;
  --bg-alt: #111821;
  --card: #141c26;
  --border: #223041;
  --text: #d6dee8;
  --muted: #8494a7;
  --accent: #38e0a5;
  --accent-2: #4aa8ff;
  --radius: 12px;
  --max: 1100px;
}
* { box-sizing: border-box; margin: 5px; padding: 0; } /*Had to change the padding here to make the popouts looks better*/
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  line-height: 1.6;
  background-image: radial-gradient(circle at 20% 0%, rgba(56,224,165,.08), transparent 40%),
                    radial-gradient(circle at 90% 30%, rgba(74,168,255,.06), transparent 40%);
}
/* ANIMATED BACKGROUND */
body::before, body::after {
  content: ""; position: fixed; z-index: -1; pointer-events: none;
}
body::before {                         /* drifting grid */
  inset: -60px;
  background-image:
    linear-gradient(rgba(56,224,165,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56,224,165,.06) 1px, transparent 1px);
  background-size: 60px 60px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 30%, #000 15%, transparent 75%);
          mask-image: radial-gradient(ellipse at 50% 30%, #000 15%, transparent 75%);
  animation: grid-drift 20s linear infinite;
}
body::after {                          /* slow wandering glow */
  width: 600px; height: 600px; top: -200px; left: -200px;
  background: radial-gradient(circle, rgba(56,224,165,.14), rgba(74,168,255,.06) 40%, transparent 65%);
  filter: blur(40px);
  animation: glow-wander 28s ease-in-out infinite alternate;
}
@keyframes grid-drift  { to { transform: translate(60px, 60px); } }
@keyframes glow-wander {
  50%  { transform: translate(55vw, 25vh); }
  100% { transform: translate(20vw, 60vh); }
}
a { color: inherit; text-decoration: none; }
.mono { font-family: "JetBrains Mono", monospace; }
.muted { color: var(--muted); }
.accent { color: var(--accent); }
/*Links*/
.skill-popout-dialogue:not::after {
  content: " ↗";
  display: inline-block;
  margin-left: 3px;
  font-size: 0.85em;
  transition: transform 0.2s ease
}
.skill-popout-dialogue:not:hover::after {
  transform: translate(2px, -2pc);
}
/* NAV */
.nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem clamp(16px, 5vw, 3rem);
  background: rgba(11,15,20,.8); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.logo { font-family: "JetBrains Mono", monospace; font-weight: 600; }
.nav-links { display: flex; gap: 1.75rem; list-style: none; font-size: .95rem; }
.nav-links a { color: var(--muted); transition: color .2s; }
.nav-links a:hover, .nav-links a.active { color: var(--accent); }
.nav-toggle { display: none; background: none; border: 0; color: var(--text); font-size: 1.5rem; cursor: pointer; }

/* LAYOUT */
main { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
section { padding: 6rem 0; }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin-bottom: 2rem; display: flex; align-items: center; gap: .75rem; }
h2::after { content: ""; flex: 1; height: 1px; background: var(--border); max-width: 300px; }
.num { font-family: "JetBrains Mono", monospace; color: var(--accent); font-size: .8em; }
h3 { font-size: 1.15rem; margin-bottom: .5rem; }

/* HERO */
.hero { min-height: calc(100vh - 70px); display: flex; flex-direction: column; justify-content: center; gap: 1rem; }
.hero h1 { font-size: clamp(2.5rem, 7vw, 5rem); line-height: 1.1; }
.tagline { font-size: clamp(1.1rem, 2.5vw, 1.5rem); color: var(--accent); min-height: 1.6em; }
.lead { max-width: 560px; color: var(--muted); font-size: 1.1rem; }
.cursor { color: var(--accent); animation: blink 1s steps(1) infinite; }
.typed::after { content: "▍"; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.cta { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; }

.btn {
  display: inline-block; padding: .75rem 1.4rem; border-radius: 8px;
  border: 1px solid var(--accent); color: var(--accent);
  font-family: "JetBrains Mono", monospace; font-size: .9rem; transition: all .2s;
}
.btn:hover { background: rgba(56,224,165,.1); }
.btn.primary { background: var(--accent); color: var(--bg); }
.btn.primary:hover { box-shadow: 0 0 24px rgba(56,224,165,.4); background: var(--accent); }

/* GRIDS & CARDS */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; align-items: start; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem; transition: transform .2s, border-color .2s, box-shadow .2s;
}
/*For the new skill cards*/
.points { padding-left: 1.2rem; margin-top: .5rem; color: var(--muted); }
.points li { margin-bottom: .6rem; }
.points strong { color: var(--text); }

.card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.card p { color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; margin-top: 1rem; }
.tags li {
  font-family: "JetBrains Mono", monospace; font-size: .75rem;
  padding: .25rem .6rem; border-radius: 999px;
  background: rgba(74,168,255,.1); color: var(--accent-2);
}
.links { display: flex; gap: 1rem; margin-top: 1rem; font-size: .9rem; }
.links a:hover { color: var(--accent); }

/* CARD STACK */
.stack { display: grid; max-width: 440px; padding: 0 24px 24px 0; cursor: pointer; }
.stack .card { grid-area: 1 / 1; transition: transform .4s ease, opacity .4s ease; }
.stack .card:nth-child(1) { z-index: 3; }
.stack .card:nth-child(2) { z-index: 2; transform: translate(12px, 12px); opacity: .6; }
.stack .card:nth-child(3) { z-index: 1; transform: translate(24px, 24px); opacity: .3; }
.stack .card:nth-child(n+4) { opacity: 0; }
.stack .card.leaving { transform: translateX(-110%) rotate(-8deg); opacity: 0; }
.stack:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; border-radius: var(--radius); }
.hint { font-size: .8rem; margin-top: .5rem; }

/* SKILL DETAILS POPUP */
.more {
  margin-top: 1rem; padding: 0; background: none; border: 0; cursor: pointer;
  color: var(--accent); font-family: "JetBrains Mono", monospace; font-size: .8rem;
}
.more:hover, .more:focus-visible { text-decoration: underline; }

.skill-dialog {
  margin: auto; padding: 0;
  width: min(560px, 92vw); max-height: 80vh; overflow: auto;
  background: var(--card); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.skill-dialog::backdrop { background: rgba(5,8,12,.7); backdrop-filter: blur(4px); }
.dialog-body { padding: 1.5rem; }
.dialog-body p { color: var(--muted); margin-bottom: 1rem; }
.skill-dialog .close { margin-top: 1.25rem; }

@media (max-width: 760px) {
  .skill-dialog {
    width: 100%; max-width: 100%; max-height: 85vh;
    margin: auto 0 0;                                  /* stick to bottom */
    border-radius: var(--radius) var(--radius) 0 0;
  }
}

/* SECURITY */
.card.sec { position: relative; overflow: hidden; }
.card.sec::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.badge {
  display: inline-block; font-family: "JetBrains Mono", monospace; font-size: .7rem;
  padding: .2rem .5rem; border: 1px solid var(--accent); color: var(--accent);
  border-radius: 4px; margin-bottom: .75rem;
}

/* TERMINAL */
.terminal { background: #070a0e; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.term-bar { display: flex; gap: 6px; padding: .6rem .8rem; background: var(--bg-alt); }
.term-bar span { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.term-bar span:nth-child(2) { background: #febc2e; }
.term-bar span:nth-child(3) { background: #28c840; }
.terminal pre { padding: 1.25rem; font-size: .85rem; overflow-x: auto; }

/* TIMELINE */
.timeline { list-style: none; border-left: 2px solid var(--border); padding-left: 1.75rem; }
.timeline li { position: relative; margin-bottom: 2.5rem; }
.timeline li::before {
  content: ""; position: absolute; left: calc(-1.75rem - 7px); top: .35rem;
  width: 12px; height: 12px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}
.date { color: var(--accent); font-size: .8rem; }
.timeline p { color: var(--muted); }

/* CONTACT & FOOTER */
.contact { text-align: center; }
.contact h2 { justify-content: center; }
.contact h2::after { display: none; }
.contact p { color: var(--muted); margin-bottom: 1.5rem; }
.socials { display: flex; justify-content: center; gap: 1.5rem; list-style: none; margin-top: 2rem; }
.socials a { color: var(--muted); }
.socials a:hover { color: var(--accent); }
footer { text-align: center; padding: 2rem 16px; border-top: 1px solid var(--border); font-size: .85rem; }

/* REVEAL ANIMATION */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity .7s ease, transform .7s ease; }
.reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  body::before, body::after { animation: none; }
}

/* PROJECT PAGES */
.project-page section { padding: 2rem 0; }
.project-page h2 + .tags { margin-top: 0; }

/* PHOTOS */
.story { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; align-items: center; }
.story.flip .photo { order: -1; }
.story-text p + p { margin-top: 1rem; }

.photo img {
  display: block; width: 100%; height: auto; cursor: zoom-in;
  border: 1px solid var(--border); border-radius: var(--radius);
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.photo img:hover, .photo img:focus-visible {
  transform: translateY(-4px); border-color: var(--accent);
  box-shadow: 0 10px 30px rgba(0,0,0,.35); outline: none;
}
.photo figcaption { margin-top: .5rem; font-size: .8rem; color: var(--muted); }
.photo figcaption::before { content: "// "; color: var(--accent); }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; margin-top: 2rem; }
.gallery img { aspect-ratio: 4 / 3; object-fit: cover; }

.lightbox {
  margin: auto; padding: 0; max-width: 92vw;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
}
.lightbox img { display: block; max-width: 92vw; max-height: 80vh; }
.lightbox p { padding: .6rem 1rem; font-size: .8rem; color: var(--muted); }
.lightbox::backdrop { background: rgba(5,8,12,.85); backdrop-filter: blur(4px); }

/* MOBILE */
@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav nav { position: absolute; top: 100%; left: 0; right: 0; background: var(--bg-alt); border-bottom: 1px solid var(--border); display: none; }
  .nav nav.open { display: block; }
  .nav-links { flex-direction: column; gap: 0; padding: .5rem 16px; }
  .nav-links a { display: block; padding: .75rem 0; }
  .grid-2 { grid-template-columns: 1fr; }
  section { padding: 4rem 0; }
  .story { grid-template-columns: 1fr; }
  .story.flip .photo { order: 0; }
}

/* INVENTORY TAGS */
.inv-tags li { padding: 0; background: none; }          /* the button becomes the pill */
.tag-btn {
  font: inherit; cursor: pointer;
  padding: .25rem .6rem; border-radius: 999px;
  background: rgba(74,168,255,.1); color: var(--accent-2);
  border: 1px solid transparent;
  transition: transform .2s, border-color .2s, box-shadow .2s, color .2s, background .2s;
}
.tag-btn:hover, .tag-btn:focus-visible {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 6px 18px rgba(0,0,0,.35);
  outline: none;
}
.tag-btn[aria-expanded="true"] {
  border-color: var(--accent); color: var(--accent); background: rgba(56,224,165,.1);
}

/* panel that pushes content down */
.inv-panel {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows .35s ease, margin-top .35s ease;
}
.inv-panel.open { grid-template-rows: 1fr; margin-top: 1.25rem; }
.inv-panel-inner { overflow: hidden; }
.inv-body { padding: 1.25rem; }
.inv-body .mono { font-size: .85rem; margin-bottom: .75rem; }
.inv-content p { color: var(--muted); }

/*Project Cards*/
.card.project { position: relative; }
.card-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.card.project .links a { position: relative; z-index: 1; }   /* keeps Code ↗ clickable on top */

.card-link:focus-visible { outline: none; }
.card.project:has(.card-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 4px; }

.read-more { display: inline-block; margin-top: 1rem; font-size: .85rem; color: var(--accent); transition: transform .2s; }
.card.project:hover .read-more { transform: translateX(4px); }
