/* ==========================================================
   TAJAWAL — SELF HOSTED
========================================================== */


@font-face {
    font-family: "Tajawal";
    src: url("fonts/Tajawal-Regular.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Tajawal";
    src: url("fonts/Tajawal-Medium.ttf") format("truetype");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Tajawal";
    src: url("fonts/Tajawal-Bold.ttf") format("truetype");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Tajawal";
    src: url("fonts/Tajawal-ExtraBold.ttf") format("truetype");
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

/* ==========================================================
   GLOBAL / RESET
========================================================== */

:root {
    --accent: #007fd3;
    --border: #ddd;
    --background: #fff;
    --text: #222;
    --text-soft: #555;
}

* {
    box-sizing: border-box;
}

html {
    margin: 0;
    padding: 0;
    direction: rtl;
}

body {
    margin: 0;
    padding: 0;

    font-family: "Tajawal", Arial, sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.7;

    background: #f7f7f7;
    color: #222;
}


/* Links */

a {
    color: inherit;
    text-decoration: none;
}


/* Images */

img {
    max-width: 100%;
    height: auto;
}


/* ==========================================================
   HEADER
========================================================== */

.site-header {
    min-height: 70px;

    display: grid;

    position: relative;

    /*
       Because the website is RTL:
       first column appears on the RIGHT.
    */

    grid-template-columns: 250px 1fr;

    background: #fff;

    border-bottom: 1px solid #ddd;
}


/* ==========================================================
   BRAND / LOGO
========================================================== */

.brand {
    display: flex;
    align-items: center;

    padding: 15px 20px;

    border-left: 1px solid #ddd;
}


.brand-link {
    display: flex;
    align-items: center;

    gap: 10px;

    white-space: nowrap;
}


.logo {
    font-weight: 800;
}


.site-name {
          font-family: "Cairo", sans-serif;
  font-optical-sizing: auto;
  font-variation-settings:
    "slnt" 0;
        font-size: 22px;
        color: #007fd3;
         font-weight: bold;
}


/* ==========================================================
   TOP NAVIGATION
========================================================== */

.top-nav {
    display: flex;

    align-items: center;

    /*
       RTL website:
       menu begins from the right side
       of its available area.
    */

    justify-content: flex-start;

    gap: 28px;

    padding: 0 25px;
}


.top-nav a {
    position: relative;

    font-size: 16px;
    font-weight: 500;

    color: #222;

    transition: opacity 0.2s ease;
}


.top-nav a:hover {
    opacity: 0.65;
}


/* ==========================================================
   MOBILE MENU BUTTON
========================================================== */

.menu-button {
    display: none;

    border: 0;

    background: transparent;

    color: #222;

    font-family: inherit;

    font-size: 28px;

    cursor: pointer;
}


/* ==========================================================
   MAIN PAGE LAYOUT
========================================================== */

.page-layout {
    display: grid;

    /*
       RTL:
       sidebar = right
       content = left
    */

    grid-template-columns: 220px 1fr;

    min-height: calc(100vh - 130px);
}


/* ==========================================================
   SIDEBAR
========================================================== */


.sidebar {
    background: var(--background);
    border-left: 1px solid var(--border);
}


.sidebar-nav {
    width: 100%;
}


.sidebar-nav a {
    position: relative;

    display: block;

    padding: 18px 22px;

    font-size: 16px;
    font-weight: 500;

    color: var(--text);

    border-bottom: 1px solid var(--border);

    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        padding-right 0.2s ease;
}


/* Hover */

.sidebar-nav a:hover {
    background: #f7f9fb;

    color: var(--accent);

    padding-right: 27px;
}


/* Active section */

.sidebar-nav a.active {
    color: var(--accent);

    font-weight: 700;

    background: #f8fbfe;
}


/* Blue active indicator */

.sidebar-nav a.active::before {
    content: "";

    position: absolute;

    right: 0;
    top: 0;

    width: 4px;
    height: 100%;

    background: var(--accent);
}


/* ==========================================================
   MAIN CONTENT
========================================================== */


.content {
    min-width: 0;

    padding: 40px;

    background: #fff;
}


.content article {
    width: 100%;
    max-width: 850px;

    margin-right: 0;
    margin-left: auto;
}


.home-hero {
    max-width: 980px !important;
    padding: 54px 56px 48px;
    border: 1px solid #dbe7ee;
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(0, 127, 211, 0.08), transparent 42%),
        #fff;
    box-shadow: 0 14px 35px rgba(25, 65, 90, 0.07);
}


.hero-kicker {
    margin-bottom: 12px;
    color: var(--accent);
    font-size: 14px;
    font-weight: 700;
}


.home-hero h1 {
    margin-bottom: 20px;
    font-size: 48px;
    line-height: 1.25;
}


.home-hero h1 span {
    color: var(--accent);
}


.home-hero p {
    max-width: 760px;
}


.home-hero .hero-lead {
    margin-bottom: 12px;
    color: #263d4b;
    font-size: 21px;
    font-weight: 500;
    line-height: 1.9;
}


.hero-actions {
    display: flex;
    align-items: center;
    gap: 24px;
    margin: 30px 0 48px;
}


.hero-button {
    padding: 11px 24px;
    border-radius: 4px;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    transition: background 0.2s ease, transform 0.2s ease;
}


.hero-button:hover {
    background: #0069ae;
    transform: translateY(-2px);
}


.hero-link {
    color: var(--accent);
    font-weight: 700;
}


.hero-link span {
    display: inline-block;
    margin-right: 5px;
    transition: transform 0.2s ease;
}


.hero-link:hover span {
    transform: translateX(-4px);
}


.welcome-path {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    border-top: 1px solid #dbe7ee;
}


.path-item {
    min-height: 150px;
    padding: 24px 22px 0;
    border-left: 1px solid #dbe7ee;
}


.path-item:first-child {
    padding-right: 0;
}


.path-item:last-child {
    border-left: 0;
}


.path-number {
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
}


.path-item h2 {
    margin: 5px 0 4px;
    font-size: 19px;
}


.path-item p {
    margin: 0;
    color: var(--text-soft);
    font-size: 14px;
    line-height: 1.8;
}


.tutorial-page {
    max-width: 980px !important;
}


.tutorial-intro {
    margin-bottom: 38px;
    padding-bottom: 28px;
    border-bottom: 1px solid #dbe7ee;
}


.tutorial-intro h1 {
    margin-bottom: 14px;
    font-size: 42px;
}


.tutorial-intro h1 span {
    display: inline-block;
    color: var(--accent);
    direction: ltr;
}


.tutorial-lead {
    max-width: 720px;
    margin-bottom: 20px;
    color: #263d4b !important;
    font-size: 20px;
}


.lesson-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}


.lesson-meta span {
    padding: 4px 12px;
    border: 1px solid #cfe1eb;
    border-radius: 20px;
    color: #416172;
    font-size: 13px;
}


.lesson-section {
    margin-bottom: 48px;
}


.section-label {
    margin-bottom: 6px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
}


.lesson-section h2 {
    margin-top: 0;
}


.lesson-section code {
    direction: ltr;
    font-family: Consolas, monospace;
    color: #075985;
}


.code-example {
    overflow: hidden;
    margin: 24px 0;
    border-radius: 6px;
    background: #10212b;
    box-shadow: 0 10px 24px rgba(16, 33, 43, 0.12);
}


.code-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 16px;
    border-bottom: 1px solid #29414f;
    color: #89c9e8;
    font: 12px Consolas, monospace;
}


.copy-code {
    padding: 3px 10px;
    border: 1px solid #507080;
    border-radius: 3px;
    background: transparent;
    color: #d9f2ff;
    font: inherit;
    cursor: pointer;
}


.copy-code:hover {
    background: #1e3b4b;
}


.code-example pre {
    overflow-x: auto;
    margin: 0;
    padding: 20px 18px 12px;
    color: #f2fbff;
    font: 17px/1.8 Consolas, monospace;
}


.code-example pre code {
    color: inherit;
}


.code-output {
    margin: 0 18px 18px;
    padding: 8px 12px;
    border-right: 3px solid #55b8dc;
    background: #18313d;
    color: #d5f3df;
    font: 14px/1.7 Consolas, monospace;
}


.concept-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-top: 24px;
}


.concept-item {
    padding: 20px;
    border: 1px solid #dbe7ee;
    border-radius: 6px;
    background: #fbfdfe;
}


.concept-mark {
    color: var(--accent);
    font: 700 13px Consolas, monospace;
}


.concept-item h3 {
    margin: 8px 0 4px;
    font-size: 18px;
}


.concept-item p {
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 1.8;
}


.concept-item code {
    font-size: 13px;
}


.print-lab {
    padding: 28px;
    border: 1px solid #b9d9e8;
    border-radius: 8px;
    background: #f2f9fc;
}


.lab-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-top: 22px;
}


.lab-editor {
    display: grid;
    gap: 8px;
    color: #315366;
    font-weight: 700;
}


.lab-editor textarea {
    width: 100%;
    min-height: 105px;
    padding: 12px;
    border: 1px solid #b9d9e8;
    border-radius: 4px;
    background: #fff;
    color: var(--text);
    font: inherit;
    line-height: 1.7;
    resize: vertical;
}


.lab-editor textarea:focus {
    outline: 2px solid rgba(0, 127, 211, 0.2);
    border-color: var(--accent);
}


.variable-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #b9d9e8;
    border-radius: 4px;
    background: #fff;
    color: var(--text);
    font: inherit;
}


.variable-input:focus {
    outline: 2px solid rgba(0, 127, 211, 0.2);
    border-color: var(--accent);
}


.lab-screen {
    min-height: 105px;
    padding: 12px 16px;
    border-radius: 4px;
    background: #10212b;
    color: #d5f3df;
}


.screen-header {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 20px;
    color: #89c9e8;
    font: 11px Consolas, monospace;
}


.screen-header span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #f28b82;
}


.screen-header span:nth-child(2) {
    background: #fbbc04;
}


.screen-header span:nth-child(3) {
    background: #81c995;
}


.screen-header b {
    margin-right: 8px;
    font-weight: 400;
}


.lab-screen code {
    color: #d5f3df;
    font-size: 15px;
}


.lab-note {
    margin-top: 12px;
    color: #416172;
    font-size: 13px;
}


.challenge-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: center;
    padding: 24px;
    border-right: 4px solid #f0a64b;
    background: #fffaf2;
}


.challenge-box h2 {
    margin-bottom: 5px;
    font-size: 21px;
}


.challenge-box p {
    margin-bottom: 0;
    font-size: 14px;
}


.challenge-example {
    overflow-x: auto;
    padding: 16px;
    background: #fff;
    color: #075985;
    font: 14px/1.8 Consolas, monospace;
}


.next-lesson {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 24px;
    border-top: 1px solid #dbe7ee;
}


.next-lesson div {
    display: grid;
    gap: 3px;
}


.next-lesson span {
    color: var(--text-soft);
    font-size: 13px;
}


.next-lesson strong {
    color: var(--accent);
}


.next-lesson a {
    color: var(--accent);
    font-size: 28px;
}


.content p {
    color: var(--text-soft);
    line-height: 1.9;
}

/* ==========================================================
   TYPOGRAPHY
========================================================== */

h1,
h2,
h3,
h4,
h5,
h6 {
    margin-top: 0;

    line-height: 1.4;

    color: #111;
}


h1 {
    margin-bottom: 20px;

    font-size: 32px;
    font-weight: 800;
}


h2 {
    margin-top: 35px;
    margin-bottom: 15px;

    font-size: 26px;
    font-weight: 700;
}


h3 {
    margin-top: 30px;
    margin-bottom: 12px;

    font-size: 21px;
    font-weight: 700;
}


p {
    margin-top: 0;
    margin-bottom: 18px;
}


/* ==========================================================
   FOOTER
========================================================== */

.site-footer {
    min-height: 60px;

    display: flex;

    justify-content: center;
    align-items: center;

    padding: 15px 20px;

    background: #fff;

    border-top: 1px solid #ddd;

    text-align: center;
}


.footer-content {
    display: grid;
    justify-items: center;
    gap: 10px;
}


.social-links {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    direction: ltr;
}


.social-links a {
    display: flex;
    min-width: 72px;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 5px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: #fff;
    color: #416172;
    font-size: 12px;
    transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}


.social-links a:hover,
.social-links a:focus-visible {
    border-color: currentColor;
    color: var(--accent);
    transform: translateY(-2px);
}


.social-mark {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border: 1px solid currentColor;
    border-radius: 50%;
    font: 700 13px/1 Consolas, monospace;
}


.social-name {
    font-weight: 500;
}


@media (max-width: 480px) {

    .site-footer {
        padding: 15px 10px;
    }


    .footer-content {
        width: 100%;
    }


    .social-links {
        width: 100%;
        gap: 6px;
    }


    .social-links a {
        min-width: 60px;
        padding-right: 3px;
        padding-left: 3px;
    }


    .site-footer p {
        max-width: 100%;
        font-size: 13px;
    }
}


.social-links a:nth-child(1):hover,
.social-links a:nth-child(1):focus-visible {
    color: #d62828;
}


.social-links a:nth-child(2):hover,
.social-links a:nth-child(2):focus-visible {
    color: #c13584;
}


.social-links a:nth-child(3):hover,
.social-links a:nth-child(3):focus-visible {
    color: #111;
}


.social-links a:nth-child(4):hover,
.social-links a:nth-child(4):focus-visible {
    color: #1877f2;
}


.social-links a:nth-child(5):hover,
.social-links a:nth-child(5):focus-visible {
    color: #111;
}


.site-footer p {
    margin: 0;

    font-size: 14px;

    color: #666;
}


.contact-page {
    max-width: 1100px;
}


.contact-intro {
    max-width: 850px;
    margin-bottom: 32px;
}


.contact-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
    gap: 28px;
    align-items: start;
}


.contact-form-container,
.info-card {
    padding: 26px;
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 6px;
}


.contact-form {
    display: grid;
    gap: 18px;
}


.form-group {
    display: grid;
    gap: 7px;
}


.form-group label {
    color: var(--text);
    font-weight: 700;
}


.required {
    color: #c62828;
}


.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #cfcfcf;
    border-radius: 4px;
    background: #fff;
    color: var(--text);
    font: inherit;
    line-height: 1.5;
}


.form-group textarea {
    min-height: 150px;
    resize: vertical;
}


.form-group input:focus,
.form-group textarea:focus {
    outline: 2px solid rgba(0, 127, 211, 0.2);
    border-color: var(--accent);
}


.btn-submit {
    width: 100%;
    padding: 12px 18px;
    border: 0;
    border-radius: 4px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease;
}


.btn-submit:hover {
    background: #0069ae;
}


.alert {
    margin-bottom: 20px;
    padding: 12px 14px;
    border-radius: 4px;
}


.alert-success {
    background: #eaf7ee;
    color: #176b35;
}


.alert-error {
    background: #fff0f0;
    color: #a52222;
}


.contact-info-container {
    display: grid;
    gap: 20px;
}


.info-card h3 {
    margin-bottom: 10px;
}


.contact-info-list,
.quick-topics ul {
    display: grid;
    gap: 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}


.contact-info-list li {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}


.info-icon {
    flex: 0 0 28px;
    font-size: 20px;
    line-height: 1.5;
    text-align: center;
}


.contact-info-list a {
    color: var(--accent);
}


.quick-topics li {
    position: relative;
    padding-right: 18px;
}


.quick-topics li::before {
    content: "";
    position: absolute;
    top: 0.75em;
    right: 0;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}


@media (max-width: 768px) {

    .contact-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }


    .contact-form-container,
    .info-card {
        padding: 20px;
    }

}


/* ==========================================================
   TABLET
========================================================== */

@media (max-width: 900px) {

    .site-header {
        grid-template-columns: 250px 1fr;
    }


    .page-layout {
        grid-template-columns: 190px 1fr;
    }


    .content {
        padding: 30px;
    }


    .top-nav {
        gap: 20px;
    }

}


/* ==========================================================
   MOBILE
========================================================== */

@media (max-width: 768px) {

    /*
       HEADER
    */

    .site-header {
        min-height: 65px;

        display: flex;

        align-items: center;

        justify-content: space-between;

        padding: 0 18px;
    }


    .brand {
        padding: 0;

        border-left: 0;

        min-width: 0;
    }


    .brand-link {
        max-width: calc(100vw - 70px);
        min-width: 0;
    }


    .site-name {
        overflow: hidden;
        text-overflow: ellipsis;
    }


    .site-name {
        font-size: 17px;
    }


    /*
       Hide desktop navigation
    */

    .top-nav {
        display: none;

        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        z-index: 10;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0;
        background: #fff;
        border-top: 1px solid #ddd;
        border-bottom: 1px solid #ddd;
    }


    .top-nav.open {
        display: flex;
    }


    .top-nav a {
        padding: 14px 20px;
        border-bottom: 1px solid #eee;
    }


    /*
       Show hamburger
    */

    .menu-button {
        display: block;

        padding: 5px;
    }


    /*
       PAGE
    */

    .page-layout {
        display: block;

        min-height: calc(100vh - 125px);
    }


    /*
       SIDEBAR

       Hidden until JavaScript adds:
       .open
    */

    .sidebar {
        display: block;

        width: 100%;

        border-left: 0;

        border-bottom: 1px solid #ddd;
    }


    .sidebar.open {
        display: block;
    }


    .sidebar-nav a {
        padding: 14px 20px;
    }


    /*
       CONTENT
    */

    .content {
        padding: 25px 20px;
    }


    .home-hero {
        padding: 34px 24px 28px;
    }


    .home-hero .hero-lead {
        font-size: 18px;
    }


    .tutorial-intro h1 {
        font-size: 30px;
    }


    .tutorial-lead {
        font-size: 18px;
    }


    .concept-grid,
    .lab-layout,
    .challenge-box {
        grid-template-columns: 1fr;
    }


    .print-lab,
    .challenge-box {
        padding: 20px;
    }


    .hero-actions {
        align-items: flex-start;
        flex-direction: column;
        gap: 16px;
        margin-bottom: 34px;
    }


    .welcome-path {
        grid-template-columns: 1fr;
    }


    .path-item,
    .path-item:first-child {
        min-height: 0;
        padding: 18px 0;
        border-left: 0;
        border-bottom: 1px solid #dbe7ee;
    }


    .path-item:last-child {
        border-bottom: 0;
    }


    h1 {
        font-size: 27px;
    }


    h2 {
        font-size: 23px;
    }


    h3 {
        font-size: 19px;
    }

}


/* ==========================================================
   SMALL PHONES
========================================================== */

@media (max-width: 480px) {

    body {
        font-size: 15px;
    }


    .site-header {
        padding: 0 14px;
    }


    .content {
        padding: 22px 16px;
    }


    h1 {
        font-size: 25px;
    }


    .logo {
        font-size: 14px;
    }


    .site-name {
          font-family: "Cairo", sans-serif;
  font-optical-sizing: auto;
  font-variation-settings:
    "slnt" 0;
        font-size: 16px;
    }

}


.category-toggle {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: space-between;

    width: 100%;
    padding: 18px 22px;

    border: 0;
    border-bottom: 1px solid var(--border);

    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 16px;
    font-weight: 500;
    text-align: right;
    cursor: pointer;

    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        padding-right 0.2s ease;
}


.category-toggle:hover {
    background: #f7f9fb;
    color: var(--accent);
    padding-right: 27px;
}


.category-toggle.active {
    color: var(--accent);
    font-weight: 700;
    background: #f8fbfe;
}


.category-toggle.active::before {
    content: "";

    position: absolute;
    right: 0;
    top: 0;

    width: 4px;
    height: 100%;

    background: var(--accent);
}


.category-arrow {
    color: var(--accent);
    font-size: 20px;
    line-height: 1;
    transition: transform 0.2s ease;
}


.sidebar-category:not(.is-open) .category-arrow {
    transform: rotate(90deg);
}


.subcategory-list a {
    padding: 12px 38px 12px 22px;
    border-bottom: 1px solid #eee;
    color: var(--text-soft);
    font-size: 15px;
    font-weight: 400;
}


.subcategory-list a:hover {
    padding-right: 43px;
}