:root {
    --bg: #fbfbf8;
    --card: #ffffff;
    --ink: #121417;
    --muted: #6b7280;
    --line: #e6e7eb;
    --brand: #0b5fa8;
    --brand2: #0a4f8a;
    --shadow: 0 10px 30px rgba(17, 24, 39, .08);
    --radius: 18px;
    --radius2: 22px;
    --max: 1180px;
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans", sans-serif;
    color: var(--ink);
    background: var(--bg);
}

/* Topbar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: saturate(180%) blur(10px);
    background: rgba(251, 251, 248, .75);
    border-bottom: 1px solid rgba(230, 231, 235, .7);
}

.topbar .wrap {
    max-width: var(--max);
    margin: 0 auto;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.brand img {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.brand .name {
    display: flex;
    flex-direction: column;
    line-height: 1.1
}

.brand .name b {
    font-size: 14px
}

.brand .name span {
    font-size: 12px;
    color: var(--muted)
}

.nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-left: auto;
}

.nav a {
    text-decoration: none;
    font-size: 13px;
    color: var(--muted);
    padding: 10px 10px;
    border-radius: 12px;
}

.nav a:hover {
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line);
    padding: 9px 9px;
}

.nav a.active {
    color: var(--brand);
    background: rgba(11, 95, 168, .06);
    border: 1px solid rgba(11, 95, 168, .15);
}

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

/* Hero */
.hero {
    max-width: var(--max);
    margin: 0 auto;
    padding: 34px 18px 14px;
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    gap: 18px;
    align-items: stretch;
}

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

.heroCard {
    background: linear-gradient(135deg, rgba(11, 95, 168, .10), rgba(11, 95, 168, .04));
    border: 1px solid rgba(11, 95, 168, .12);
    border-radius: var(--radius2);
    padding: 22px 22px 18px;
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
}

.heroCard:before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url("assets/pattern-bina.png");
    /* زخرفة بناء الثابتة */
    background-repeat: repeat-x;
    background-size: auto 72px;
    background-position: bottom center;
    opacity: .55;
    pointer-events: none;
    mix-blend-mode: multiply;
}

.heroCard>* {
    position: relative
}

.kicker {
    display: inline-flex;
    gap: 10px;
    align-items: center;
    font-size: 12px;
    color: var(--brand);
    background: rgba(255, 255, 255, .70);
    border: 1px solid rgba(11, 95, 168, .18);
    padding: 6px 10px;
    border-radius: 999px;
}

.heroCard h1 {
    margin: 12px 0 6px;
    font-size: 28px
}

.heroCard p {
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
    max-width: 56ch
}

.ctaRow {
    margin-top: 16px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: 14px;
    padding: 11px 14px;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
}

.btn.primary {
    background: linear-gradient(135deg, var(--brand), var(--brand2));
    color: #fff;
    border: 1px solid rgba(0, 0, 0, .08);
    box-shadow: 0 10px 20px rgba(11, 95, 168, .18);
}

.btn.ghost {
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line);
}

.heroSide {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius2);
    padding: 18px;
    box-shadow: var(--shadow);
}

.search {
    display: flex;
    gap: 10px;
    align-items: center;
    background: #fafafa;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 10px 12px;
}

.search input {
    border: none;
    outline: none;
    background: transparent;
    width: 100%;
    font-size: 13px;
}

.chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 14px
}

.chip {
    font-size: 12px;
    padding: 8px 10px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    cursor: pointer;
    color: var(--muted);
}

.chip.active {
    color: var(--brand);
    border-color: rgba(11, 95, 168, .25);
    box-shadow: 0 0 0 4px rgba(11, 95, 168, .08)
}

/* Main */
main {
    max-width: var(--max);
    margin: 0 auto;
    padding: 8px 18px 40px
}

.semester {
    margin-top: 18px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: var(--radius2);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.semesterHead {
    padding: 16px 18px;
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, #fff, #fcfcfc);
}

.semesterTitle {
    display: flex;
    flex-direction: column;
    gap: 2px
}

.semesterTitle b {
    font-size: 14px
}

.semesterTitle span {
    font-size: 12px;
    color: var(--muted)
}

.semesterMeta {
    font-size: 12px;
    color: var(--muted);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.grid {
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

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

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

.card {
    border: 1px solid var(--line);
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    min-height: 220px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: rgba(11, 95, 168, 0.2);
}

.thumb {
    height: 180px;
    background: #f3f4f6;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 640px) {
    .thumb {
        height: 220px;
    }
}

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

.card:hover .thumb img {
    transform: scale(1.05);
}

/* Overlay for a more professional look */
.thumb::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.4), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.card:hover .thumb::before {
    opacity: 1;
}

.thumb:after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 40px;
    background-image: url("assets/pattern-bina.png");
    background-repeat: repeat-x;
    background-size: auto 40px;
    background-position: bottom center;
    opacity: .3;
    pointer-events: none;
    z-index: 2;
}

.thumb .badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--brand);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 6px;
    z-index: 3;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1
}

.content h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--ink);
}

.content h3 a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

.content h3 a:hover {
    color: var(--brand);
}

.stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.stat {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    padding: 4px 10px;
    border-radius: 8px;
    background: #f9fafb;
    border: 1px solid #f3f4f6;
    font-size: 12px;
    color: #4b5563;
    font-weight: 500;
}

.actions {
    padding: 0 16px 16px;
    margin-top: auto;
}

.actions a.primary {
    display: block;
    width: 100%;
    background: var(--brand);
    color: #fff;
    text-align: center;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border-radius: 10px;
    padding: 12px;
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 4px 10px rgba(11, 95, 168, 0.2);
}

.actions a.primary:hover {
    background: var(--brand2);
    box-shadow: 0 6px 15px rgba(11, 95, 168, 0.3);
    transform: translateY(-1px);
}

footer {
    border-top: 1px solid var(--line);
    background: #fff
}

footer .wrap {
    max-width: var(--max);
    margin: 0 auto;
    padding: 18px 18px 24px;
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
}

footer small {
    color: var(--muted)
}
