/* ==========================================================================
   CSS Variables & Resets
   ========================================================================== */
:root {
   /* Color Palette */
   --color-primary: #005ce6;
   --color-primary-light: #ebf3ff;
   --color-primary-dark: #0047b3;
   --color-bg-main: #ffffff;
   --color-bg-alt: #f8fafc;
   --color-text-main: #0f172a;
   --color-text-muted: #64748b;
   --color-border: #e2e8f0;

   /* Typography */
   --font-main: 'IBM Plex Sans Arabic', sans-serif;

   /* Effects & Shadows */
   --shadow-soft: 0 10px 30px -10px rgba(0, 0, 0, 0.05);
   --shadow-hover: 0 20px 40px -10px rgba(0, 92, 230, 0.15);
   --transition-normal: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
   --radius-md: 12px;
   --radius-lg: 20px;
}

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

html {
   /* Built-in smooth scroll, but we'll complement this with heavier JS scrolling or CSS transitions if needed */
   scroll-behavior: smooth;
   scroll-padding-top: 100px;
   font-size: 16px;
}

body {
   font-family: var(--font-main);
   background-color: var(--color-bg-main);
   color: var(--color-text-main);
   overflow-x: hidden;
   -webkit-font-smoothing: antialiased;
}

a {
   text-decoration: none;
   color: inherit;
   transition: var(--transition-normal);
}

ul {
   list-style: none;
}

img {
   max-width: 100%;
   display: block;
}

/* ==========================================================================
   Utility Classes & Layout
   ========================================================================== */
.container {
   width: 100%;
   max-width: 1140px;
   margin: 0 auto;
   padding: 0 1.5rem;
}

.section {
   padding: 6rem 0;
}

.bg-light {
   background-color: var(--color-bg-alt);
}

.section-header {
   margin-bottom: 4rem;
   text-align: center;
}

.section-header h2 {
   font-size: 2.5rem;
   font-weight: 800;
   color: var(--color-text-main);
   margin-bottom: 1rem;
   letter-spacing: -0.5px;
}

.section-header .line {
   width: 60px;
   height: 4px;
   background: var(--color-primary);
   margin: 0 auto;
   border-radius: 2px;
}

.btn {
   display: inline-flex;
   align-items: center;
   justify-content: center;
   padding: 0.75rem 1.6rem;
   font-size: 1rem;
   font-weight: 600;
   border-radius: 6px; /* Standard SaaS radius */
   cursor: pointer;
   transition: background-color 0.1s ease, border-color 0.1s ease, color 0.1s ease;
   text-decoration: none;
   letter-spacing: 0.2px;
}

.btn-primary {
   background-color: var(--color-primary);
   color: #ffffff;
   border: 1px solid var(--color-primary);
   box-shadow: 0 1px 3px rgba(0, 92, 230, 0.25);
}

.btn-primary:hover {
   background-color: #004db3; /* A slightly darker nice blue */
   border-color: #004db3;
}

.btn-secondary {
   background-color: #ffffff;
   color: #24292e; /* standard dark dev text */
   border: 1px solid #d1d5da;
   box-shadow: 0 1px 2px rgba(27, 31, 35, 0.04);
}

.btn-secondary:hover {
   background-color: #f3f4f6;
   border-color: #d1d5da;
   color: #24292e;
}

.btn:active {
   transform: scale(0.98);
}

/* ==========================================================================
   Navigation
   ========================================================================== */
nav {
   position: fixed;
   top: 0;
   left: 0;
   width: 100%;
   z-index: 1000;
   background: rgba(255, 255, 255, 0.95);
   backdrop-filter: blur(10px);
   border-bottom: 1px solid transparent;
   /* invisible border usually */
   transition: var(--transition-normal);
   padding: 1.5rem 0;
}

nav.scrolled {
   padding: 1rem 0;
   border-bottom-color: var(--color-border);
   box-shadow: var(--shadow-soft);
}

.nav-container {
   display: flex;
   justify-content: space-between;
   align-items: center;
}

.logo {
   display: flex;
   align-items: center;
}

.logo-img {
   height: 72px;
   /* Increased from 48px to be noticeably bigger */
   width: auto;
   object-fit: contain;
   transition: transform 0.3s ease;
}

.logo-img:hover {
   transform: scale(1.05);
}

.nav-links {
   display: flex;
   gap: 2rem;
}

.nav-links a {
   font-weight: 600;
   color: var(--color-text-muted);
   font-size: 1.05rem;
   position: relative;
   padding-bottom: 4px;
}

.nav-links a:hover,
.nav-links a.active {
   color: var(--color-primary);
}

.nav-links a::after {
   content: '';
   position: absolute;
   bottom: -2px;
   right: 0;
   width: 0;
   height: 2px;
   background-color: var(--color-primary);
   transition: var(--transition-normal);
}

.nav-links a.active::after,
.nav-links a:hover::after {
   width: 100%;
}

.lang-switcher {
   position: relative;
   margin-left: 1.5rem;
   margin-right: 1.5rem;
}

.lang-selected {
   display: flex;
   align-items: center;
   gap: 0.4rem;
   background: transparent;
   border: 1px solid var(--color-border);
   border-radius: 8px;
   padding: 0.3rem 0.6rem;
   cursor: pointer;
   color: var(--color-text-main);
   font-family: inherit;
   font-size: 0.9rem;
   transition: border-color 0.2s, background 0.2s;
   white-space: nowrap;
}

.lang-selected:hover {
   border-color: var(--color-text-muted);
   background: var(--color-bg-alt);
}

.lang-flag {
   width: 20px;
   height: 20px;
   object-fit: cover;
   border-radius: 50%;
}

.lang-chevron {
   width: 14px;
   height: 14px;
   transition: transform 0.2s;
   flex-shrink: 0;
}

.lang-switcher.open .lang-chevron {
   transform: rotate(180deg);
}

.lang-dropdown {
   display: none;
   position: absolute;
   top: calc(100% + 6px);
   right: 0;
   background: var(--color-bg-main, #fff);
   border: 1px solid var(--color-border);
   border-radius: 10px;
   padding: 0.3rem;
   list-style: none;
   margin: 0;
   min-width: 140px;
   box-shadow: 0 8px 24px rgba(0,0,0,0.15);
   z-index: 1000;
}

.lang-switcher.open .lang-dropdown {
   display: block;
   animation: fadeSlideDown 0.15s ease;
}

@keyframes fadeSlideDown {
   from { opacity: 0; transform: translateY(-6px); }
   to   { opacity: 1; transform: translateY(0); }
}

.lang-option {
   display: flex;
   align-items: center;
   gap: 0.5rem;
   padding: 0.45rem 0.65rem;
   border-radius: 7px;
   cursor: pointer;
   font-size: 0.9rem;
   transition: background 0.15s;
}

.lang-option:hover {
   background: var(--color-bg-alt, rgba(128,128,128,0.1));
}

.lang-option.active {
   font-weight: 600;
   background: var(--color-bg-alt, rgba(128,128,128,0.08));
}

.hamburger {
   display: none;
   cursor: pointer;
}

.hamburger .bar {
   display: block;
   width: 25px;
   height: 3px;
   margin: 5px auto;
   transition: var(--transition-normal);
   background-color: var(--color-text-main);
   border-radius: 2px;
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
#hero {
   min-height: 100vh;
   display: flex;
   align-items: center;
   padding-top: 80px;
   position: relative;
   overflow: hidden;
}

.hero-container {
   display: grid;
   grid-template-columns: 1fr 1fr;
   gap: 4rem;
   align-items: center;
}

.subtitle {
   font-size: 1.25rem;
   color: var(--color-primary);
   font-weight: 700;
   margin-bottom: 0.5rem;
}

.title {
   font-size: 4rem;
   font-weight: 800;
   line-height: 1.2;
   margin-bottom: 1rem;
   color: var(--color-text-main);
   letter-spacing: -1px;
}

.role {
   font-size: 1.75rem;
   color: var(--color-text-muted);
   font-weight: 500;
   margin-bottom: 1.5rem;
}

.hero-content .description {
   font-size: 1.15rem;
   color: var(--color-text-muted);
   margin-bottom: 2.5rem;
   max-width: 500px;
}

.hero-buttons {
   display: flex;
   gap: 1rem;
}

/* Hero Visual Animation - 3D Cyber Cube */
.hero-visual {
   position: relative;
   height: 500px;
   display: flex;
   justify-content: center;
   align-items: center;
   perspective: 1000px;
}

.cyber-cube-container {
   position: relative;
   width: 200px;
   height: 200px;
   transform-style: preserve-3d;
   transform: rotateX(-20deg) rotateY(45deg);
   animation: floatCube 8s ease-in-out infinite, rotateCube 20s linear infinite;
}

.cyber-cube {
   position: absolute;
   width: 100%;
   height: 100%;
   transform-style: preserve-3d;
}

.face {
   position: absolute;
   width: 200px;
   height: 200px;
   background: rgba(0, 92, 230, 0.05); /* very faint primary color */
   border: 1px solid rgba(0, 92, 230, 0.3);
   display: flex;
   justify-content: center;
   align-items: center;
   font-family: monospace;
   font-size: 1.5rem;
   font-weight: bold;
   color: var(--color-primary);
   box-shadow: inset 0 0 40px rgba(0, 92, 230, 0.1);
   backdrop-filter: blur(4px);
}

.front  { transform: translateZ(100px); }
.back   { transform: rotateY(180deg) translateZ(100px); }
.right  { transform: rotateY(90deg) translateZ(100px); }
.left   { transform: rotateY(-90deg) translateZ(100px); }
.top    { transform: rotateX(90deg) translateZ(100px); background: rgba(0, 92, 230, 0.1); }
.bottom { transform: rotateX(-90deg) translateZ(100px); box-shadow: 0 0 50px rgba(0, 92, 230, 0.4); }

.glitch-text {
   position: relative;
   display: inline-block;
}

.glitch-text::before,
.glitch-text::after {
   content: attr(data-text);
   position: absolute;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   opacity: 0.8;
}

.glitch-text::before {
   left: 2px;
   text-shadow: -1px 0 red;
   clip: rect(24px, 550px, 90px, 0);
   animation: glitch-anim 3s infinite linear alternate-reverse;
}

.glitch-text::after {
   left: -2px;
   text-shadow: -1px 0 blue;
   clip: rect(85px, 550px, 140px, 0);
   animation: glitch-anim 2.5s infinite linear alternate-reverse;
}

.floating-badge {
   position: absolute;
   background: var(--color-bg-main);
   border: 1px solid var(--color-border);
   padding: 0.5rem 1rem;
   border-radius: 4px;
   font-family: monospace;
   font-size: 0.9rem;
   color: var(--color-text-main);
   box-shadow: 0 4px 15px rgba(0,0,0,0.05);
   pointer-events: none;
}

.badge-1 {
   top: -50px;
   right: -80px;
   animation: floatBadge 4s ease-in-out infinite;
}

.badge-2 {
   bottom: -30px;
   left: -100px;
   animation: floatBadge 5s ease-in-out infinite 1s;
}

.cube-shadow {
   position: absolute;
   bottom: -100px;
   left: 50%;
   transform: translateX(-50%) rotateX(90deg);
   width: 150px;
   height: 150px;
   background: rgba(0,0,0,0.1);
   filter: blur(20px);
   border-radius: 50%;
   animation: shadowScale 8s ease-in-out infinite;
}

@keyframes rotateCube {
   0% { transform: rotateX(-20deg) rotateY(0deg); }
   100% { transform: rotateX(-20deg) rotateY(360deg); }
}

@keyframes floatCube {
   0%, 100% { transform: rotateX(-20deg) translateY(0) rotateY(var(--ry, 0deg)); }
   50% { transform: rotateX(-20deg) translateY(-20px) rotateY(var(--ry, 0deg)); }
}

@keyframes floatBadge {
   0%, 100% { transform: translateY(0); }
   50% { transform: translateY(-10px); }
}

@keyframes shadowScale {
   0%, 100% { transform: translateX(-50%) rotateX(90deg) scale(1); opacity: 0.1; }
   50% { transform: translateX(-50%) rotateX(90deg) scale(0.8); opacity: 0.05; }
}

@keyframes glitch-anim {
   0% { clip: rect(10px, 9999px, 86px, 0); }
   20% { clip: rect(69px, 9999px, 78px, 0); }
   40% { clip: rect(17px, 9999px, 44px, 0); }
   60% { clip: rect(8px, 9999px, 12px, 0); }
   80% { clip: rect(48px, 9999px, 91px, 0); }
   100% { clip: rect(32px, 9999px, 5px, 0); }
}

/* ==========================================================================
   About Section
   ========================================================================== */
.about-content {
   max-width: 800px;
   margin: 0 auto;
   font-size: 1.25rem;
   color: var(--color-text-muted);
   text-align: right;
}

.about-content p {
   margin-bottom: 1.5rem;
}

.about-content strong {
   color: var(--color-primary);
}

/* ==========================================================================
   Skills Section
   ========================================================================== */
.skills-grid {
   display: grid;
   grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
   gap: 2rem;
}

.skill-card {
   background: var(--color-bg-main);
   padding: 2.5rem 2rem;
   border-radius: var(--radius-lg);
   border: 1px solid var(--color-border);
   transition: var(--transition-normal);
}

.skill-card:hover {
   transform: translateY(-10px) scale(1.02);
   box-shadow: 0 25px 50px -12px rgba(0, 92, 230, 0.15);
   border-color: var(--color-primary-light);
}

.skill-card .icon {
   width: 64px;
   height: 64px;
   background: var(--color-bg-alt);
   color: var(--color-primary);
   border-radius: var(--radius-md);
   display: flex;
   align-items: center;
   justify-content: center;
   margin-bottom: 1.5rem;
   transition: all 0.4s ease;
}

.skill-card:hover .icon {
   background: var(--color-primary);
   color: #fff;
   transform: scale(1.1) rotate(5deg);
}

.skill-card .icon svg {
   width: 32px;
   height: 32px;
}

.skill-card h3 {
   font-size: 1.35rem;
   margin-bottom: 1rem;
   color: var(--color-text-main);
   font-weight: 700;
}

.skill-card p {
   color: var(--color-text-muted);
   font-size: 1.05rem;
   line-height: 1.7;
}

/* ==========================================================================
   Projects Section
   ========================================================================== */
.projects-grid {
   display: grid;
   grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
   gap: 2.5rem;
}

.project-card {
   background: var(--color-bg-main);
   border-radius: var(--radius-lg);
   padding: 3rem 2.5rem;
   position: relative;
   border: 1px solid var(--color-border);
   transition: var(--transition-normal);
   overflow: hidden;
   z-index: 1;
}

.project-card::before {
   content: '';
   position: absolute;
   top: 0;
   right: 0;
   width: 6px;
   height: 0;
   background: var(--color-primary);
   transition: var(--transition-normal);
   z-index: -1;
}

.project-card:hover {
   transform: translateY(-8px);
   box-shadow: var(--shadow-hover);
   border-color: var(--color-border);
}

.project-card:hover::before {
   height: 100%;
}

.project-tag {
   font-size: 0.85rem;
   font-weight: 700;
   color: var(--color-primary);
   background: var(--color-primary-light);
   padding: 0.4rem 1rem;
   border-radius: 20px;
   display: inline-block;
   margin-bottom: 1.25rem;
}

.project-card h3 {
   font-size: 1.75rem;
   margin-bottom: 1rem;
   color: var(--color-text-main);
   font-weight: 800;
}

.project-card p {
   color: var(--color-text-muted);
   margin-bottom: 2rem;
   font-size: 1.1rem;
}

.project-link {
   display: inline-flex;
   align-items: center;
   font-weight: 700;
   color: var(--color-primary);
   font-size: 1.1rem;
}

.project-link:hover {
   padding-right: 0.5rem;
   /* Moves it in RTL */
}

/* ==========================================================================
   Journey Section
   ========================================================================== */
.timeline {
   position: relative;
   max-width: 800px;
   margin: 0 auto;
   padding-right: 30px;
   /* space for the line in RTL */
}

.timeline::before {
   content: '';
   position: absolute;
   top: 0;
   right: 0;
   width: 2px;
   height: 100%;
   background: var(--color-border);
}

.timeline-item {
   position: relative;
   margin-bottom: 3rem;
}

.timeline-item:last-child {
   margin-bottom: 0;
}

.timeline-dot {
   position: absolute;
   top: 8px;
   right: -35px;
   /* adjust based on padding-right of timeline */
   width: 12px;
   height: 12px;
   background: var(--color-primary);
   border-radius: 50%;
   box-shadow: 0 0 0 6px var(--color-bg-main), 0 0 0 8px var(--color-primary-light);
}

.timeline-content {
   background: var(--color-bg-alt);
   padding: 2.5rem;
   border-radius: var(--radius-lg);
   border: 1px solid var(--color-border);
   transition: var(--transition-normal);
}

.timeline-content:hover {
   box-shadow: var(--shadow-soft);
   border-color: var(--color-primary-light);
}

.timeline-content h3 {
   font-size: 1.4rem;
   margin-bottom: 0.75rem;
   color: var(--color-text-main);
}

.timeline-content p {
   color: var(--color-text-muted);
   font-size: 1.1rem;
}

/* ==========================================================================
   Achievements Section
   ========================================================================== */
.achievements-grid {
   display: grid;
   grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
   gap: 2rem;
}

.achievement-card {
   text-align: center;
   padding: 3rem 2rem;
   background: var(--color-bg-main);
   border-radius: var(--radius-lg);
   border: 1px solid var(--color-border);
   transition: var(--transition-normal);
}

.achievement-card:hover {
   transform: translateY(-5px);
   box-shadow: var(--shadow-soft);
   border-color: var(--color-primary-light);
}

.achievement-card h4 {
   font-size: 1.75rem; /* Reduced from 3.5rem to fit real words */
   font-weight: 800;
   color: var(--color-primary);
   margin-bottom: 0.75rem;
   line-height: 1.3;
   direction: rtl; /* Enforce proper RTL flow for mixed text */
   unicode-bidi: isolate; /* Fixes mixed Arabic/English punctuation flow */
}

.achievement-card p {
   font-size: 1rem;
   color: var(--color-text-main);
   font-weight: 600;
   line-height: 1.5;
   margin-bottom: 0.75rem;
   direction: rtl; /* Enforce proper RTL flow for mixed text */
   unicode-bidi: isolate; /* Fixes mixed Arabic/English punctuation flow */
}

.icon-award {
   font-size: 3rem;
   margin-bottom: 0.5rem;
}

/* ==========================================================================
   Contact Section
   ========================================================================== */
.contact-desc {
   text-align: center;
   font-size: 1.25rem;
   color: var(--color-text-muted);
   max-width: 600px;
   margin: 0 auto 3rem;
}

.contact-wrapper {
   display: flex;
   justify-content: center;
}

.contact-info {
   background: var(--color-bg-alt);
   padding: 3rem;
   border-radius: var(--radius-lg);
   border: 1px solid var(--color-border);
}

.info-item {
   display: flex;
   align-items: flex-start;
   gap: 1.25rem;
   margin-bottom: 2rem;
}

.info-icon {
   width: 45px;
   height: 45px;
   background: var(--color-primary-light);
   color: var(--color-primary);
   border-radius: 50%;
   display: flex;
   align-items: center;
   justify-content: center;
   flex-shrink: 0;
}

.info-icon svg {
   width: 20px;
   height: 20px;
}

.info-label {
   display: block;
   color: var(--color-text-muted);
   font-size: 0.95rem;
   margin-bottom: 0.25rem;
}

.info-value {
   font-size: 1.1rem;
   font-weight: 700;
   color: var(--color-text-main);
}

.info-value[href]:hover {
   color: var(--color-primary);
}

.social-links {
   display: flex;
   gap: 1rem;
   margin-top: 3rem;
   justify-content: center;
}

.social-link {
   width: 45px;
   height: 45px;
   background: var(--color-bg-main);
   border: 1px solid var(--color-border);
   border-radius: 50%;
   display: flex;
   align-items: center;
   justify-content: center;
   color: var(--color-text-main);
   transition: var(--transition-normal);
}

.social-link svg {
   width: 20px;
   height: 20px;
}

.social-link:hover {
   background: var(--color-primary);
   color: #fff;
   border-color: var(--color-primary);
   transform: translateY(-3px);
}

.contact-form {
   padding: 0;
}

.form-group {
   margin-bottom: 1.5rem;
}

.form-group label {
   display: block;
   margin-bottom: 0.75rem;
   font-weight: 700;
   color: var(--color-text-main);
}

.form-group input,
.form-group textarea {
   width: 100%;
   padding: 1rem 1.25rem;
   border: 1px solid var(--color-border);
   border-radius: var(--radius-md);
   font-family: var(--font-main);
   font-size: 1rem;
   transition: var(--transition-normal);
   background: var(--color-bg-alt);
}

.form-group input:focus,
.form-group textarea:focus {
   outline: none;
   border-color: var(--color-primary);
   background: var(--color-bg-main);
   box-shadow: 0 0 0 4px var(--color-primary-light);
}

.btn-block {
   width: 100%;
}

/* ==========================================================================
   Footer
   ========================================================================== */
footer {
   background: var(--color-text-main);
   /* Dark background */
   color: #fff;
   padding: 4rem 0 2rem;
   text-align: center;
}

.footer-logo {
   display: flex;
   justify-content: center;
   margin-bottom: 2rem;
}

.footer-logo-img {
   height: 80px;
   width: auto;
   object-fit: contain;
   /* A white filter can make the blue bird white for the dark footer */
   filter: brightness(0) invert(1);
}

footer p {
   color: var(--color-text-muted);
   margin-bottom: 2rem;
}

.footer-links {
   display: flex;
   justify-content: center;
   gap: 2.5rem;
   border-top: 1px solid rgba(255, 255, 255, 0.1);
   padding-top: 2rem;
}

.footer-links a {
   color: #cbd5e1;
   font-weight: 500;
}

.footer-links a:hover {
   color: #fff;
}

/* ==========================================================================
   Animations
   ========================================================================== */
.reveal {
   opacity: 0;
   transform: translateY(40px) scale(0.98);
   transition: all 0.8s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.reveal.active {
   opacity: 1;
   transform: translateY(0) scale(1);
}

/* ==========================================================================
   Media Queries
   ========================================================================== */
@media (max-width: 1024px) {
   .title {
      font-size: 3.25rem;
   }

   .hero-container {
      gap: 2rem;
   }

   .contact-wrapper {
      grid-template-columns: 1fr;
      gap: 3rem;
   }
}

@media (max-width: 768px) {
   .section {
      padding: 4rem 0;
   }

   /* Navbar Mobile */
   .hamburger {
      display: block;
   }

   .hamburger.active .bar:nth-child(2) {
      opacity: 0;
   }

   .hamburger.active .bar:nth-child(1) {
      transform: translateY(8px) rotate(45deg);
   }

   .hamburger.active .bar:nth-child(3) {
      transform: translateY(-8px) rotate(-45deg);
   }

   .nav-links {
      position: fixed;
      right: -100%;
      top: 76px;
      gap: 0;
      flex-direction: column;
      background: rgba(255, 255, 255, 0.98);
      width: 100%;
      height: calc(100vh - 76px);
      text-align: center;
      transition: 0.3s;
      box-shadow: var(--shadow-soft);
   }

   .nav-links.active {
      right: 0;
   }

   .nav-links li {
      margin: 1.5rem 0;
   }

   /* Hero Mobile */
   #hero {
      padding-top: 100px;
   }

   .hero-container {
      grid-template-columns: 1fr;
      text-align: center;
   }

   .hero-content .description {
      margin: 0 auto 2.5rem;
   }

   .hero-buttons {
      justify-content: center;
   }

   .hero-visual {
      display: none;
      /* Hide visual on small screens */
   }
}

/* ==========================================================================
   Preloader
   ========================================================================== */
#preloader {
   position: fixed;
   top: 0;
   left: 0;
   width: 100vw;
   height: 100vh;
   background-color: var(--color-bg-main);
   display: flex;
   justify-content: center;
   align-items: center;
   z-index: 9999;
   transition: opacity 0.3s ease-out;
}

#preloader.fade-out {
   opacity: 0;
   pointer-events: none;
}

/* From Uiverse.io by Nawsome */
.spinner:before {
   transform: rotateX(60deg) rotateY(45deg) rotateZ(45deg);
   animation: 750ms rotateBefore infinite linear reverse;
}

.spinner:after {
   transform: rotateX(240deg) rotateY(45deg) rotateZ(45deg);
   animation: 750ms rotateAfter infinite linear;
}

.spinner:before,
.spinner:after {
   box-sizing: border-box;
   content: '';
   display: block;
   position: absolute;
   margin-top: -5em;
   margin-left: -5em;
   width: 10em;
   height: 10em;
   transform-style: preserve-3d;
   transform-origin: 50%;
   transform: rotateY(50%);
   perspective-origin: 50% 50%;
   perspective: 340px;
   background-size: 10em 10em;
   background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjI2NnB4IiBoZWlnaHQ9IjI5N3B4IiB2aWV3Qm94PSIwIDAgMjY2IDI5NyIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bWxuczpza2V0Y2g9Imh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaC9ucyI+CiAgICA8dGl0bGU+c3Bpbm5lcjwvdGl0bGU+CiAgICA8ZGVzY3JpcHRpb24+Q3JlYXRlZCB3aXRoIFNrZXRjaCAoaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoKTwvZGVzY3JpcHRpb24+CiAgICA8ZGVmcz48L2RlZnM+CiAgICA8ZyBpZD0iUGFnZS0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIiBza2V0Y2g6dHlwZT0iTVNQYWdlIj4KICAgICAgICA8cGF0aCBkPSJNMTcxLjUwNzgxMywzLjI1MDAwMDM4IEMyMjYuMjA4MTgzLDEyLjg1NzcxMTEgMjk3LjExMjcyMiw3MS40OTEyODIzIDI1MC44OTU1OTksMTA4LjQxMDE1NSBDMjE2LjU4MjAyNCwxMzUuODIwMzEgMTg2LjUyODQwNSw5Ny4wNjI0OTY0IDE1Ni44MDA3NzQsODUuNzczNDM0NiBDMTI3LjA3MzE0Myw3NC40ODQzNzIxIDc2Ljg4ODQ2MzIsODQuMjE2MTQ2MiA2MC4xMjg5MDY1LDEwOC40MTAxNTMgQy0xNS45ODA0Njg1LDIxOC4yODEyNDcgMTQ1LjI3NzM0NCwyOTYuNjY3OTY4IDE0NS4yNzczNDQsMjk2LjY2Nzk2OCBDMTQ1LjI3NzM0NCwyOTYuNjY3OTY4IC0yNS40NDkyMTg3LDI1Ny4yNDIxOTggMy4zOTg0Mzc1LDEwOC40MTAxNTUgQzE2LjMwNzA2NjEsNDEuODExNDE3NCA4NC43Mjc1ODI5LC0xMS45OTIyOTg1IDE3MS41MDc4MTMsMy4yNTAwMDAzOCBaIiBpZD0iUGF0aC0xIiBmaWxsPSIjMDAwMDAwIiBza2V0Y2g6dHlwZT0iTVNTaGFwZUdyb3VwIj48L3BhdGg+CiAgICA8L2c+Cjwvc3ZnPg==);
}

@keyframes rotateBefore {
   from {
      transform: rotateX(60deg) rotateY(45deg) rotateZ(0deg);
   }

   to {
      transform: rotateX(60deg) rotateY(45deg) rotateZ(-360deg);
   }
}

@keyframes rotateAfter {
   from {
      transform: rotateX(240deg) rotateY(45deg) rotateZ(0deg);
   }

   to {
      transform: rotateX(240deg) rotateY(45deg) rotateZ(360deg);
   }
}

/* ==========================================================================
   Portfolio Compact Section
   ========================================================================== */
#portfolio {
   padding: 3rem 0;
}

.pc-grid {
   display: grid;
   grid-template-columns: repeat(3, 1fr);
   gap: 1.5rem;
}

.pc-block {
   background: var(--color-bg-main);
   border: 1px solid var(--color-border);
   border-radius: var(--radius-md);
   padding: 1.5rem;
}

.pc-label {
   display: block;
   font-size: 0.75rem;
   font-weight: 700;
   text-transform: uppercase;
   letter-spacing: 1px;
   color: var(--color-primary);
   margin-bottom: 1rem;
}

.pc-block p {
   font-size: 0.95rem;
   color: var(--color-text-muted);
   line-height: 1.7;
}

.pc-block p strong {
   color: var(--color-primary);
}

.pc-pills {
   display: flex;
   flex-wrap: wrap;
   gap: 0.5rem;
}

.pc-pill {
   background: var(--color-primary-light);
   color: var(--color-primary);
   font-size: 0.8rem;
   font-weight: 600;
   padding: 0.3rem 0.8rem;
   border-radius: 20px;
}

.pc-achiev {
   list-style: none;
   display: flex;
   flex-direction: column;
   gap: 0.6rem;
}

.pc-achiev li {
   display: flex;
   gap: 0.6rem;
   align-items: baseline;
   font-size: 0.9rem;
}

.pc-achiev strong {
   color: var(--color-primary);
   font-weight: 700;
   white-space: nowrap;
}

.pc-achiev span {
   color: var(--color-text-muted);
}

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

/* ==========================================================================
   Write-ups Section
   ========================================================================== */
.section-sub {
   text-align: center;
   font-size: 1.1rem;
   color: var(--color-text-muted);
   max-width: 550px;
   margin: 1rem auto 0;
}

.writeups-filter {
   display: flex;
   justify-content: center;
   gap: 0.75rem;
   margin-bottom: 3rem;
   flex-wrap: wrap;
}

.filter-btn {
   padding: 0.5rem 1.5rem;
   border: 1px solid var(--color-border);
   background: transparent;
   border-radius: 20px;
   font-family: var(--font-main);
   font-size: 0.95rem;
   font-weight: 600;
   color: var(--color-text-muted);
   cursor: pointer;
   transition: var(--transition-normal);
}

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

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

.writeups-empty {
   display: flex;
   flex-direction: column;
   align-items: center;
   gap: 1rem;
   padding: 4rem 2rem;
   color: var(--color-text-muted);
}

.writeups-empty svg {
   width: 48px;
   height: 48px;
   opacity: 0.4;
}

.writeups-empty p {
   font-size: 1rem;
   opacity: 0.6;
}

.writeups-grid {
   align-items: stretch;
}

.writeup-card {
   background: var(--color-bg-main);
   border: 1px solid var(--color-border);
   border-radius: var(--radius-lg);
   overflow: hidden;
   transition: var(--transition-normal);
   display: flex;
   flex-direction: column;
}

.writeup-card:hover {
   transform: translateY(-6px);
   box-shadow: var(--shadow-hover);
}

.writeup-card.hidden {
   display: none;
}

.card-accent {
   height: 4px;
   width: 100%;
}

.card-accent.ctf {
   background: var(--color-primary);
}

.card-accent.bugbounty {
   background: #10b981;
}

.writeup-body {
   padding: 1.75rem;
   display: flex;
   flex-direction: column;
   flex: 1;
}

.writeup-meta {
   display: flex;
   align-items: center;
   gap: 0.75rem;
   margin-bottom: 1rem;
}

.writeup-tag {
   font-size: 0.8rem;
   font-weight: 700;
   padding: 0.25rem 0.75rem;
   border-radius: 20px;
   font-family: var(--font-main);
}

.writeup-tag.ctf {
   background: var(--color-primary-light);
   color: var(--color-primary);
}

.writeup-tag.bugbounty {
   background: #d1fae5;
   color: #065f46;
}

.writeup-difficulty {
   font-size: 0.8rem;
   font-weight: 700;
   padding: 0.25rem 0.75rem;
   border-radius: 20px;
}

.writeup-difficulty.easy {
   background: #d1fae5;
   color: #065f46;
}

.writeup-difficulty.medium {
   background: #fef3c7;
   color: #92400e;
}

.writeup-difficulty.hard {
   background: #fee2e2;
   color: #991b1b;
}

.writeup-card h3 {
   font-size: 1.15rem;
   font-weight: 700;
   color: var(--color-text-main);
   margin-bottom: 0.75rem;
   line-height: 1.4;
}

.writeup-card p {
   color: var(--color-text-muted);
   font-size: 0.95rem;
   line-height: 1.7;
   margin-bottom: 1.5rem;
   display: -webkit-box;
   -webkit-line-clamp: 3;
   -webkit-box-orient: vertical;
   overflow: hidden;
   flex: 1;
}

.writeup-footer {
   display: flex;
   justify-content: space-between;
   align-items: center;
   padding-top: 1rem;
   border-top: 1px solid var(--color-border);
   margin-top: auto;
}

.writeup-date {
   font-size: 0.85rem;
   color: var(--color-text-muted);
   font-family: monospace;
}

.writeup-link {
   font-size: 0.9rem;
   font-weight: 700;
   color: var(--color-primary);
   transition: var(--transition-normal);
}

.writeup-link:hover {
   opacity: 0.75;
}

/* ==========================================================================
   Error Page (TV 404 Design)
   ========================================================================== */
.main_wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30em;
  height: 30em;
}

.main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 5em;
}

.antenna {
  width: 5em;
  height: 5em;
  border-radius: 50%;
  border: 2px solid black;
  background-color: var(--color-primary); /* Changed to primary blue */
  margin-bottom: -6em;
  margin-left: 0em;
  z-index: -1;
}
.antenna_shadow {
  position: absolute;
  background-color: transparent;
  width: 50px;
  height: 56px;
  margin-left: 1.68em;
  border-radius: 45%;
  transform: rotate(140deg);
  border: 4px solid transparent;
  box-shadow:
    inset 0px 16px var(--color-primary-dark),
    inset 0px 16px 1px 1px var(--color-primary-dark);
  -moz-box-shadow:
    inset 0px 16px var(--color-primary-dark),
    inset 0px 16px 1px 1px var(--color-primary-dark);
}
.antenna::after {
  content: "";
  position: absolute;
  margin-top: -9.4em;
  margin-left: 0.4em;
  transform: rotate(-25deg);
  width: 1em;
  height: 0.5em;
  border-radius: 50%;
  background-color: #4da6ff; /* Lighter blue */
}
.antenna::before {
  content: "";
  position: absolute;
  margin-top: 0.2em;
  margin-left: 1.25em;
  transform: rotate(-20deg);
  width: 1.5em;
  height: 0.8em;
  border-radius: 50%;
  background-color: #4da6ff; /* Lighter blue */
}
.a1 {
  position: relative;
  top: -102%;
  left: -130%;
  width: 12em;
  height: 5.5em;
  border-radius: 50px;
  background-image: linear-gradient(
    #171717,
    #171717,
    #353535,
    #353535,
    #171717
  );
  transform: rotate(-29deg);
  clip-path: polygon(50% 0%, 49% 100%, 52% 100%);
}
.a1d {
  position: relative;
  top: -211%;
  left: -35%;
  transform: rotate(45deg);
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  border: 2px solid black;
  background-color: #979797;
  z-index: 99;
}
.a2 {
  position: relative;
  top: -210%;
  left: -10%;
  width: 12em;
  height: 4em;
  border-radius: 50px;
  background-color: #171717;
  background-image: linear-gradient(
    #171717,
    #171717,
    #353535,
    #353535,
    #171717
  );
  margin-right: 5em;
  clip-path: polygon(
    47% 0,
    47% 0,
    34% 34%,
    54% 25%,
    32% 100%,
    29% 96%,
    49% 32%,
    30% 38%
  );
  transform: rotate(-8deg);
}
.a2d {
  position: relative;
  top: -294%;
  left: 94%;
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  border: 2px solid black;
  background-color: #979797;
  z-index: 99;
}

.notfound_text {
  background-color: black;
  padding-left: 0.3em;
  padding-right: 0.3em;
  font-size: 0.75em;
  color: white;
  letter-spacing: 0;
  border-radius: 5px;
  z-index: 10;
}
.tv {
  width: 17em;
  height: 9em;
  margin-top: 3em;
  border-radius: 15px;
  background-color: var(--color-primary); /* Changed to primary blue */
  display: flex;
  justify-content: center;
  border: 2px solid #1d0e01;
  box-shadow: inset 0.2em 0.2em #4da6ff; /* Lighter blue shadow */
}
.tv::after {
  content: "";
  position: absolute;
  width: 17em;
  height: 9em;
  border-radius: 15px;
  background:
    repeating-radial-gradient(var(--color-primary) 0 0.0001%, #00000070 0 0.0002%) 50% 0/2500px
      2500px,
    repeating-conic-gradient(var(--color-primary) 0 0.0001%, #00000070 0 0.0002%) 60% 60%/2500px
      2500px;
  background-blend-mode: difference;
  opacity: 0.09;
}
.curve_svg {
  position: absolute;
  margin-top: 0.25em;
  margin-left: -0.25em;
  height: 12px;
  width: 12px;
}
.display_div {
  display: flex;
  align-items: center;
  align-self: center;
  justify-content: center;
  border-radius: 15px;
  box-shadow: 3.5px 3.5px 0px #003380; /* Darker blue display shadow */
}
.screen_out {
  width: auto;
  height: auto;

  border-radius: 10px;
}
.screen_out1 {
  width: 11em;
  height: 7.75em;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}
.screen {
  width: 13em;
  height: 7.85em;
  font-family: Montserrat;
  border: 2px solid #1d0e01;
  background:
    repeating-radial-gradient(#000 0 0.0001%, #ffffff 0 0.0002%) 50% 0/2500px
      2500px,
    repeating-conic-gradient(#000 0 0.0001%, #ffffff 0 0.0002%) 60% 60%/2500px
      2500px;
  background-blend-mode: difference;
  animation: b 0.2s infinite alternate;
  border-radius: 10px;
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #252525;
  letter-spacing: 0.15em;
  text-align: center;
}

.screenM {
  width: 13em;
  height: 7.85em;
  position: relative;
  font-family: Montserrat;
  background: linear-gradient(
    to right,
    #002fc6 0%,
    #002bb2 14.2857142857%,
    #3a3a3a 14.2857142857%,
    #303030 28.5714285714%,
    #ff0afe 28.5714285714%,
    #f500f4 42.8571428571%,
    #6c6c6c 42.8571428571%,
    #626262 57.1428571429%,
    #0affd9 57.1428571429%,
    #00f5ce 71.4285714286%,
    #3a3a3a 71.4285714286%,
    #303030 85.7142857143%,
    white 85.7142857143%,
    #fafafa 100%
  );
  border-radius: 10px;
  border: 2px solid black;
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #252525;
  letter-spacing: 0.15em;
  text-align: center;
  overflow: hidden;
}
.screenM:before,
.screenM:after {
  content: "";
  position: absolute;
  left: 0;
  z-index: 1;
  width: 100%;
}
.screenM:before {
  top: 0;
  height: 68.4782608696%;
  background: linear-gradient(
    to right,
    white 0%,
    #fafafa 14.2857142857%,
    #ffe60a 14.2857142857%,
    #f5dc00 28.5714285714%,
    #0affd9 28.5714285714%,
    #00f5ce 42.8571428571%,
    #10ea00 42.8571428571%,
    #0ed600 57.1428571429%,
    #ff0afe 57.1428571429%,
    #f500f4 71.4285714286%,
    #ed0014 71.4285714286%,
    #d90012 85.7142857143%,
    #002fc6 85.7142857143%,
    #002bb2 100%
  );
}
.screenM:after {
  bottom: 0;
  height: 21.7391304348%;
  background: linear-gradient(
    to right,
    #006c6b 0%,
    #005857 16.6666666667%,
    white 16.6666666667%,
    #fafafa 33.3333333333%,
    #001b75 33.3333333333%,
    #001761 50%,
    #6c6c6c 50%,
    #626262 66.6666666667%,
    #929292 66.6666666667%,
    #888888 83.3333333333%,
    #3a3a3a 83.3333333333%,
    #303030 100%
  );
}

@keyframes b {
  100% {
    background-position:
      50% 0,
      60% 50%;
  }
}

.lines {
  display: flex;
  column-gap: 0.1em;
  align-self: flex-end;
}
.line1,
.line3 {
  width: 2px;
  height: 0.5em;
  background-color: black;
  border-radius: 25px 25px 0px 0px;
  margin-top: 0.5em;
}
.line2 {
  flex-grow: 1;
  width: 2px;
  height: 1em;
  background-color: black;
  border-radius: 25px 25px 0px 0px;
}

.buttons_div {
  width: 4.25em;
  align-self: center;
  height: 8em;
  background-color: var(--color-primary-dark); /* Dark blue */
  border: 2px solid #1d0e01;
  padding: 0.6em;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  row-gap: 0.75em;
  box-shadow: 3px 3px 0px #002266; /* Very dark blue shadow */
}
.b1 {
  width: 1.65em;
  height: 1.65em;
  border-radius: 50%;
  background-color: #333; /* Dark grey for buttons */
  border: 2px solid black;
  box-shadow:
    inset 2px 2px 1px #666,
    -2px 0px #1a1a1a,
    -2px 0px 0px 1px black;
}
.b1::before {
  content: "";
  position: absolute;
  margin-top: 1em;
  margin-left: 0.5em;
  transform: rotate(47deg);
  border-radius: 5px;
  width: 0.1em;
  height: 0.4em;
  background-color: #000000;
}
.b1::after {
  content: "";
  position: absolute;
  margin-top: 0.9em;
  margin-left: 0.8em;
  transform: rotate(47deg);
  border-radius: 5px;
  width: 0.1em;
  height: 0.55em;
  background-color: #000000;
}
.b1 div {
  content: "";
  position: absolute;
  margin-top: -0.1em;
  margin-left: 0.65em;
  transform: rotate(45deg);
  width: 0.15em;
  height: 1.5em;
  background-color: #000000;
}
.b2 {
  width: 1.65em;
  height: 1.65em;
  border-radius: 50%;
  background-color: #333; /* Dark grey for buttons */
  border: 2px solid black;
  box-shadow:
    inset 2px 2px 1px #666,
    -2px 0px #1a1a1a,
    -2px 0px 0px 1px black;
}
.b2::before {
  content: "";
  position: absolute;
  margin-top: 1.05em;
  margin-left: 0.8em;
  transform: rotate(-45deg);
  border-radius: 5px;
  width: 0.15em;
  height: 0.4em;
  background-color: #000000;
}
.b2::after {
  content: "";
  position: absolute;
  margin-top: -0.1em;
  margin-left: 0.65em;
  transform: rotate(-45deg);
  width: 0.15em;
  height: 1.5em;
  background-color: #000000;
}
.speakers {
  display: flex;
  flex-direction: column;
  row-gap: 0.5em;
}
.speakers .g1 {
  display: flex;
  column-gap: 0.25em;
}
.speakers .g1 .g11,
.g12,
.g13 {
  width: 0.65em;
  height: 0.65em;
  border-radius: 50%;
  background-color: #333; /* Dark grey */
  border: 2px solid black;
  box-shadow: inset 1.25px 1.25px 1px #666;
}
.speakers .g {
  width: auto;
  height: 2px;
  background-color: #171717;
}

.bottom {
  width: 100%;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  column-gap: 8.7em;
}
.base1 {
  height: 1em;
  width: 2em;
  border: 2px solid #171717;
  background-color: #4d4d4d;
  margin-top: -0.15em;
  z-index: -1;
}
.base2 {
  height: 1em;
  width: 2em;
  border: 2px solid #171717;
  background-color: #4d4d4d;
  margin-top: -0.15em;
  z-index: -1;
}
.base3 {
  position: absolute;
  height: 0.15em;
  width: 17.5em;
  background-color: #171717;
  margin-top: 0.8em;
}

.text_404 {
  position: absolute;
  display: flex;
  flex-direction: row;
  column-gap: 6em;
  z-index: -5;
  margin-bottom: 2em;
  align-items: center;
  justify-content: center;
  opacity: 0.9; /* Made much more visible */
  color: #d1e3ff; /* Very visible light blue color that still fits the theme */
  font-family: Montserrat, var(--font-main);
  font-weight: 800;
}
.text_4041 {
  transform: scaleY(24.5) scaleX(9);
}
.text_4042 {
  transform: scaleY(24.5) scaleX(9);
}
.text_4043 {
  transform: scaleY(24.5) scaleX(9);
}

@media only screen and (max-width: 495px) {
  .text_404 {
    column-gap: 6em;
  }
}
@media only screen and (max-width: 395px) {
  .text_404 {
    column-gap: 4em;
  }
  .text_4041 {
    transform: scaleY(25) scaleX(8);
  }
  .text_4042 {
    transform: scaleY(25) scaleX(8);
  }
  .text_4043 {
    transform: scaleY(25) scaleX(8);
  }
}

@media (max-width: 275px), (max-height: 520px) {
  .main {
    position: relative;
  }
}

@media only screen and (max-width: 1024px) {
  .screenM {
    display: flex;
  }
  .screen {
    display: none;
  }
}
@media only screen and (min-width: 1025px) {
  .screen {
    display: flex;
  }
  .screenM {
    display: none;
  }
}

/* ==========================================================================
   Write-ups Index Card Grid (index.html)
   ========================================================================== */
.writeups-grid {
   display: grid;
   grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
   gap: 2rem;
}

.writeup-cover {
   width: 100%;
   height: 200px;
   overflow: hidden;
   display: block;
}

.writeup-cover img {
   width: 100%;
   height: 100%;
   object-fit: cover;
   display: block;
   transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.writeup-card:hover .writeup-cover img {
   transform: scale(1.05);
}

.writeup-card .writeup-title-ar {
   font-size: 0.9rem;
   color: var(--color-text-muted);
   margin-bottom: 0.5rem;
   margin-top: -0.25rem;
   font-family: var(--font-main);
   direction: rtl;
   text-align: right;
}

/* ==========================================================================
   Article / Blog Page Styles
   ========================================================================== */

/* --- Article Hero --- */
.article-hero {
   position: relative;
   width: 100%;
   min-height: 560px;
   display: flex;
   flex-direction: column;
   justify-content: flex-end;
   overflow: hidden;
}

.article-hero-img-wrap {
   position: absolute;
   inset: 0;
   z-index: 0;
}

.article-cover-img {
   width: 100%;
   height: 100%;
   object-fit: cover;
   display: block;
}

.article-hero-overlay {
   position: absolute;
   inset: 0;
   background: linear-gradient(
      to bottom,
      rgba(15, 23, 42, 0.25) 0%,
      rgba(15, 23, 42, 0.70) 55%,
      rgba(15, 23, 42, 0.97) 100%
   );
}

.article-hero-inner {
   position: relative;
   z-index: 1;
   padding-top: 9rem;
   padding-bottom: 3.5rem;
}

.back-btn {
   display: inline-flex;
   align-items: center;
   gap: 0.4rem;
   color: rgba(255, 255, 255, 0.65);
   font-size: 0.875rem;
   font-weight: 500;
   text-decoration: none;
   margin-bottom: 2rem;
   transition: var(--transition-normal);
   border: 1px solid rgba(255, 255, 255, 0.2);
   padding: 0.4rem 0.9rem;
   border-radius: 6px;
   width: fit-content;
   direction: rtl;
}

.back-btn:hover {
   color: #fff;
   border-color: rgba(255, 255, 255, 0.5);
   background: rgba(255, 255, 255, 0.08);
}

.article-hero-titles {
   margin-bottom: 1.75rem;
}

.article-category-badge {
   display: inline-block;
   background: var(--color-primary);
   color: white;
   font-size: 0.72rem;
   font-weight: 700;
   padding: 0.28rem 0.85rem;
   border-radius: 100px;
   margin-bottom: 1.1rem;
   letter-spacing: 0.5px;
   font-family: var(--font-main);
}

.article-title-en {
   font-size: 2.4rem;
   font-weight: 800;
   color: #fff;
   line-height: 1.2;
   letter-spacing: -0.5px;
   margin-bottom: 0.65rem;
   direction: ltr;
   text-align: left;
   font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.article-title-ar {
   font-size: 1.55rem;
   font-weight: 600;
   color: rgba(255, 255, 255, 0.68);
   line-height: 1.5;
   direction: rtl;
   text-align: right;
   font-family: var(--font-main);
}

.article-meta-bar {
   display: flex;
   align-items: center;
   gap: 0.75rem;
   flex-wrap: wrap;
   direction: rtl;
}

.article-meta-bar .meta-item {
   display: inline-flex;
   align-items: center;
   gap: 0.35rem;
   color: rgba(255, 255, 255, 0.55);
   font-size: 0.82rem;
   font-family: var(--font-main);
}

.article-meta-bar .meta-divider {
   color: rgba(255, 255, 255, 0.25);
   font-size: 0.8rem;
}

/* --- Article Author Block --- */
.article-author {
   display: flex;
   align-items: center;
   gap: 1rem;
   background: var(--color-bg-main);
   border: 1px solid var(--color-border);
   border-radius: var(--radius-md);
   padding: 1rem 1.5rem;
   margin-bottom: 1.5rem;
   box-shadow: var(--shadow-soft);
   direction: ltr;
}

.author-avatar {
   width: 44px;
   height: 44px;
   object-fit: contain;
   flex-shrink: 0;
   filter: none;
}

.author-info {
   display: flex;
   flex-direction: column;
   gap: 0.15rem;
}

.author-name a {
   font-size: 0.9rem;
   font-weight: 700;
   color: var(--color-text-main);
   font-family: system-ui, -apple-system, sans-serif;
}

.author-name a:hover {
   color: var(--color-primary);
}

.author-role {
   font-size: 0.78rem;
   color: var(--color-text-muted);
   font-family: system-ui, -apple-system, sans-serif;
}

/* --- Article Main Layout --- */
.article-main {
   background: var(--color-bg-alt);
   padding: 3.5rem 0 6rem;
}

.article-container {
   max-width: 860px;
   margin: 0 auto;
   padding: 0 1.5rem;
}

/* --- Intro Block --- */
.bilingual-intro {
   background: var(--color-bg-main);
   border: 1px solid var(--color-border);
   border-radius: var(--radius-lg);
   padding: 2.5rem;
   margin-bottom: 2rem;
   box-shadow: var(--shadow-soft);
}

.intro-en {
   direction: ltr;
   text-align: left;
   color: var(--color-text-main);
   font-size: 1.025rem;
   line-height: 1.85;
   font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
   padding-left: 1.1rem;
   border-left: 3px solid var(--color-primary);
}

.intro-en p {
   margin-bottom: 0.65rem;
}

.intro-en p:last-child {
   margin-bottom: 0;
}

.intro-lang-divider {
   height: 1px;
   background: var(--color-border);
   margin: 1.75rem 0;
}

.intro-ar {
   direction: rtl;
   text-align: right;
   color: var(--color-text-main);
   font-size: 1.025rem;
   line-height: 1.95;
   font-family: var(--font-main);
   padding-right: 1.1rem;
   border-right: 3px solid var(--color-primary);
}

.intro-ar p {
   margin-bottom: 0.65rem;
}

.intro-ar p:last-child {
   margin-bottom: 0;
}

/* --- Phase Cards --- */
.phase-card {
   background: var(--color-bg-main);
   border: 1px solid var(--color-border);
   border-radius: var(--radius-lg);
   margin-bottom: 1.75rem;
   overflow: hidden;
   box-shadow: var(--shadow-soft);
   transition: var(--transition-normal);
}

.phase-card:hover {
   box-shadow: var(--shadow-hover);
   transform: translateY(-3px);
}

.phase-header {
   display: flex;
   align-items: center;
   gap: 1.1rem;
   padding: 1.4rem 2rem;
   border-bottom: 1px solid var(--color-border);
   background: var(--color-bg-main);
}

.phase-num {
   flex-shrink: 0;
   width: 46px;
   height: 46px;
   background: var(--color-primary-light);
   border-radius: 12px;
   display: flex;
   align-items: center;
   justify-content: center;
   font-size: 1rem;
   font-weight: 800;
   color: var(--color-primary);
   font-family: monospace;
}

.phase-titles-wrap {
   flex: 1;
}

.phase-title-en {
   font-size: 1.05rem;
   font-weight: 700;
   color: var(--color-text-main);
   direction: ltr;
   text-align: left;
   margin-bottom: 0.15rem;
   font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
   line-height: 1.3;
}

.phase-title-ar {
   font-size: 0.9rem;
   font-weight: 600;
   color: var(--color-text-muted);
   direction: rtl;
   text-align: right;
   font-family: var(--font-main);
   line-height: 1.4;
}

/* --- Language Blocks --- */
.lang-block {
   padding: 1.75rem 2rem;
}

.ltr-block {
   direction: ltr;
   text-align: left;
   display: flex;
   gap: 1rem;
   align-items: flex-start;
}

.rtl-block {
   direction: rtl;
   text-align: right;
   display: flex;
   gap: 1rem;
   align-items: flex-start;
   background: var(--color-bg-alt);
}

.lang-tag {
   flex-shrink: 0;
   font-size: 0.62rem;
   font-weight: 800;
   letter-spacing: 1px;
   color: var(--color-primary);
   background: var(--color-primary-light);
   padding: 0.2rem 0.4rem;
   border-radius: 4px;
   height: fit-content;
   margin-top: 0.15rem;
   font-family: monospace;
}

.lang-content {
   flex: 1;
   font-size: 0.975rem;
   line-height: 1.85;
   color: var(--color-text-main);
}

.ltr-block .lang-content {
   font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.rtl-block .lang-content {
   font-family: var(--font-main);
}

.lang-content p {
   margin-bottom: 0.65rem;
}

.lang-content p:last-child {
   margin-bottom: 0;
}

.lang-content strong {
   color: var(--color-text-main);
   font-weight: 700;
}

.lang-separator {
   height: 1px;
   background: var(--color-border);
}

/* --- Article List --- */
.article-list {
   margin: 0.4rem 0 0.65rem;
   padding-inline-start: 1.2rem;
}

.article-list li {
   margin-bottom: 0.3rem;
   color: var(--color-text-muted);
   font-size: 0.925rem;
}

.article-list li::marker {
   color: var(--color-primary);
}

/* --- Tool Pills (inline in content) --- */
.tools-inline {
   display: flex;
   flex-wrap: wrap;
   gap: 0.45rem;
   margin: 0.65rem 0;
}

.tool-pill {
   display: inline-flex;
   align-items: center;
   padding: 0.22rem 0.7rem;
   background: var(--color-primary-light);
   color: var(--color-primary);
   border-radius: 100px;
   font-size: 0.775rem;
   font-weight: 600;
   border: 1px solid rgba(0, 92, 230, 0.2);
   font-family: system-ui, -apple-system, monospace;
   direction: ltr;
}

/* --- Prompt Block --- */
.prompt-block {
   border-radius: 10px;
   overflow: hidden;
   margin: 1rem 0 0.5rem;
   border: 1px solid var(--color-border);
   direction: ltr;
}

.prompt-header {
   background: #1e293b;
   padding: 0.55rem 1rem;
   display: flex;
   align-items: center;
}

.prompt-label {
   color: rgba(255, 255, 255, 0.45);
   font-size: 0.7rem;
   font-weight: 700;
   letter-spacing: 0.75px;
   font-family: monospace;
   text-transform: uppercase;
}

.prompt-code {
   background: #0f172a;
   color: #94a3b8;
   font-family: 'Courier New', Courier, monospace;
   font-size: 0.84rem;
   line-height: 1.75;
   padding: 1.25rem;
   margin: 0;
   white-space: pre-wrap;
   word-break: break-word;
   direction: ltr;
   text-align: left;
}

/* --- Article Tools Section --- */
.article-tools-section {
   background: var(--color-bg-main);
   border: 1px solid var(--color-border);
   border-radius: var(--radius-lg);
   padding: 2.5rem;
   margin: 1.75rem 0;
   box-shadow: var(--shadow-soft);
}

.tools-bilingual-heading {
   text-align: center;
   margin-bottom: 2rem;
   padding-bottom: 1.5rem;
   border-bottom: 1px solid var(--color-border);
}

.tools-title-en {
   font-size: 1.4rem;
   font-weight: 800;
   color: var(--color-text-main);
   direction: ltr;
   text-align: center;
   margin-bottom: 0.25rem;
   font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.tools-title-ar {
   font-size: 1.15rem;
   font-weight: 700;
   color: var(--color-text-muted);
   direction: rtl;
   text-align: center;
   font-family: var(--font-main);
}

.tools-badges-grid {
   display: grid;
   grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
   gap: 0.875rem;
}

.tool-badge-card {
   display: flex;
   align-items: center;
   gap: 0.7rem;
   padding: 0.85rem 1rem;
   background: var(--color-bg-alt);
   border: 1px solid var(--color-border);
   border-radius: var(--radius-md);
   transition: var(--transition-normal);
   direction: ltr;
}

.tool-badge-card:hover {
   background: var(--color-primary-light);
   border-color: var(--color-primary);
   transform: translateY(-2px);
   box-shadow: var(--shadow-hover);
}

.tool-num {
   flex-shrink: 0;
   width: 28px;
   height: 28px;
   background: var(--color-primary-light);
   color: var(--color-primary);
   border-radius: 6px;
   display: flex;
   align-items: center;
   justify-content: center;
   font-size: 0.68rem;
   font-weight: 800;
   font-family: monospace;
   transition: var(--transition-normal);
}

.tool-badge-card:hover .tool-num {
   background: var(--color-primary);
   color: #fff;
}

.tool-name {
   font-size: 0.83rem;
   font-weight: 600;
   color: var(--color-text-main);
   font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
   line-height: 1.3;
}

/* --- Conclusion Card --- */
.conclusion-card {
   background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
   border-radius: var(--radius-lg);
   padding: 2.5rem;
   margin: 1.75rem 0;
   color: #fff;
   position: relative;
   overflow: hidden;
}

.conclusion-card::before {
   content: '';
   position: absolute;
   top: -60px;
   right: -60px;
   width: 220px;
   height: 220px;
   background: rgba(255, 255, 255, 0.05);
   border-radius: 50%;
   pointer-events: none;
}

.conclusion-card::after {
   content: '';
   position: absolute;
   bottom: -80px;
   left: -40px;
   width: 260px;
   height: 260px;
   background: rgba(255, 255, 255, 0.04);
   border-radius: 50%;
   pointer-events: none;
}

.conclusion-icon {
   color: rgba(255, 255, 255, 0.5);
   margin-bottom: 1.5rem;
}

.conclusion-body {
   position: relative;
   z-index: 1;
}

.conclusion-en {
   direction: ltr;
   text-align: left;
   padding-left: 1rem;
   border-left: 2px solid rgba(255, 255, 255, 0.3);
   font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.conclusion-en h3 {
   font-size: 1.3rem;
   font-weight: 800;
   color: #fff;
   margin-bottom: 0.65rem;
}

.conclusion-en p {
   color: rgba(255, 255, 255, 0.82);
   font-size: 0.975rem;
   line-height: 1.8;
   margin-bottom: 0.55rem;
}

.conclusion-en p:last-child {
   margin-bottom: 0;
}

.conclusion-en .article-list li {
   color: rgba(255, 255, 255, 0.72);
}

.conclusion-en .article-list li::marker {
   color: rgba(255, 255, 255, 0.45);
}

.conclusion-divider {
   height: 1px;
   background: rgba(255, 255, 255, 0.15);
   margin: 1.75rem 0;
}

.conclusion-ar {
   direction: rtl;
   text-align: right;
   padding-right: 1rem;
   border-right: 2px solid rgba(255, 255, 255, 0.3);
   font-family: var(--font-main);
}

.conclusion-ar h3 {
   font-size: 1.3rem;
   font-weight: 800;
   color: #fff;
   margin-bottom: 0.65rem;
}

.conclusion-ar p {
   color: rgba(255, 255, 255, 0.82);
   font-size: 0.975rem;
   line-height: 1.95;
   margin-bottom: 0.55rem;
}

.conclusion-ar p:last-child {
   margin-bottom: 0;
}

.conclusion-ar .article-list li {
   color: rgba(255, 255, 255, 0.72);
}

.conclusion-ar .article-list li::marker {
   color: rgba(255, 255, 255, 0.45);
}

/* --- Bottom Nav --- */
.article-bottom-nav {
   text-align: center;
   padding: 2rem 0 0.5rem;
}

.back-btn-bottom {
   display: inline-flex;
   align-items: center;
   gap: 0.5rem;
   color: var(--color-text-muted);
   font-size: 0.925rem;
   font-weight: 500;
   text-decoration: none;
   padding: 0.6rem 1.4rem;
   border: 1px solid var(--color-border);
   border-radius: 8px;
   transition: var(--transition-normal);
   background: var(--color-bg-main);
   direction: rtl;
}

.back-btn-bottom:hover {
   color: var(--color-primary);
   border-color: var(--color-primary);
   background: var(--color-primary-light);
}

/* --- Article Page Responsive --- */
@media (max-width: 768px) {
   .article-hero {
      min-height: 420px;
   }

   .article-title-en {
      font-size: 1.65rem;
   }

   .article-title-ar {
      font-size: 1.15rem;
   }

   .article-main {
      padding: 2.5rem 0 4rem;
   }

   .phase-header {
      padding: 1.2rem 1.25rem;
      gap: 0.9rem;
   }

   .lang-block {
      padding: 1.25rem;
   }

   .bilingual-intro,
   .article-tools-section,
   .conclusion-card {
      padding: 1.75rem 1.25rem;
   }

   .tools-badges-grid {
      grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
      gap: 0.65rem;
   }

   .writeups-grid {
      grid-template-columns: 1fr;
   }
}
}