:root {
    --primary: #22a1f0;
    --primary-dark: #087fc8;
    --black: #0f0a0a;
    --white: #fafaff;
    --text: #20242a;
    --muted: #6c757d;
    --line: #e4e7eb;
    --info: #d9f3ff;
    --shadow: 0 8px 24px rgba(15, 10, 10, .10);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--text); background: #fff; font-family: "Roboto", Tahoma, Arial, sans-serif; font-size: 16px; font-weight: 400; line-height: 1.8; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; }
h1, h2, h3 { font-weight: 900; }
h4, h5, h6 { font-weight: 700; }
.container { width: min(1140px, calc(100% - 32px)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.skip-link { position: fixed; z-index: 100; top: -80px; right: 20px; padding: 8px 14px; background: #fff; border: 1px solid var(--line); }
.skip-link:focus { top: 12px; }

/* Navigation — based on the original Bootstrap header */
.site-header { position: sticky; z-index: 30; top: 0; background: rgba(250,250,255,.98); border-bottom: 1px solid #eee; }
.header-inner { min-height: 80px; display: flex; align-items: center; gap: 24px; }
.brand { flex: 0 0 auto; font-size: 2rem; font-weight: 400; color: var(--black); white-space: nowrap; }
.main-nav { display: flex; align-items: center; gap: 2px; margin-right: auto; }
.main-nav a { padding: 7px 9px; border-radius: 999px; color: var(--black); font-size: .88rem; white-space: nowrap; transition: .2s; }
.main-nav a:hover { color: var(--primary); }
.main-nav a.active { background: var(--primary); color: var(--white); padding-inline: 14px; }
.main-nav a.active:hover { background: transparent; color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.menu-toggle { display: none; margin-right: auto; border: 1px solid #ddd; background: #fff; color: var(--black); padding: 5px 11px; font-size: 1.35rem; cursor: pointer; }

/* Original image slider, repaired */
.classic-slider { position: relative; width: 100%; aspect-ratio: 4 / 1; min-height: 210px; max-height: 430px; overflow: hidden; background: #f4f4f4; }
.slides, .slide { position: absolute; inset: 0; width: 100%; height: 100%; }
.slide { object-fit: cover; opacity: 0; transition: opacity .65s ease; }
.slide.active { opacity: 1; }
.slider-button { position: absolute; z-index: 2; top: 50%; width: 44px; height: 58px; transform: translateY(-50%); border: 0; background: rgba(15,10,10,.33); color: #fff; font-size: 2.2rem; line-height: 1; cursor: pointer; }
.slider-button:hover { background: rgba(15,10,10,.65); }
.slider-button.prev { right: 16px; }
.slider-button.next { left: 16px; }

/* Original service cards */
.section { padding-block: 64px; }
.section-heading { margin: 0 0 38px; text-align: center; font-size: 2rem; }
.section-heading::first-letter { color: var(--primary); }
.category-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.single-service { position: relative; display: flex; min-height: 330px; flex-direction: column; align-items: center; margin-bottom: 20px; padding: 30px 22px; overflow: hidden; background: var(--white); text-align: center; box-shadow: var(--shadow); transition: .3s; }
.single-service::before, .single-service::after { position: absolute; width: 0; height: 2px; content: ""; background: var(--primary); transition: .3s; }
.single-service::before { top: 0; left: 0; }
.single-service::after { right: 0; bottom: 0; }
.single-service:hover::before, .single-service:hover::after { width: 50%; }
.classic-icon { display: grid; width: 60px; height: 60px; place-items: center; margin-bottom: 22px; border: 1px solid #ddd; border-radius: 50%; color: var(--primary); font-size: 1.35rem; transition: .3s; }
.single-service:hover .classic-icon { border-color: var(--primary); background: var(--primary); color: #fff; }
.single-service h2 { margin: 0 0 12px; font-size: 1.3rem; font-weight: 400; }
.single-service p { margin: 0 0 10px; line-height: 1.9; }
.single-service small { margin-top: auto; margin-bottom: 13px; color: var(--muted); }
.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; padding: 7px 17px; border: 1px solid var(--line); border-radius: 0; background: #fff; font-weight: 700; cursor: pointer; transition: .2s; }
.button.primary { border-color: var(--primary); background: var(--primary); color: var(--white); }
.button.primary:hover { background: transparent; color: var(--primary); }
.button.ghost { background: #fff; color: var(--black); }
.button.small { min-height: 36px; padding: 5px 12px; font-size: .86rem; }

/* Archive headings and lists */
.page-head { padding: 44px 0 34px; background: var(--info); border-bottom: 1px solid #b9e8fb; text-align: center; }
.page-head h1 { margin: 0 0 8px; color: var(--black); font-size: clamp(1.8rem, 4vw, 2.7rem); }
.archive-intro { max-width: 820px; margin: 0 auto 22px; font-size: 1.05rem; }
.search-form { display: flex; max-width: 650px; margin: 0 auto; gap: 8px; }
.search-form input { width: 100%; min-height: 44px; padding: 8px 13px; border: 1px solid #cdd8df; border-radius: 0; background: #fff; }
.library-list { display: grid; gap: 20px; }
.library-row { display: grid; grid-template-columns: 44px 76px minmax(0,1fr) 145px; align-items: center; gap: 20px; padding: 20px; background: var(--white); box-shadow: var(--shadow); transition: .25s; }
.library-row:hover { transform: translateY(-2px); }
.library-row > img, .resource-placeholder { width: 72px; height: 98px; object-fit: cover; border: 1px solid #ddd; }
.resource-placeholder { display: grid; place-items: center; background: #fff; color: var(--primary); font-size: 1.8rem; }
.row-number { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid #d8e9f4; border-radius: 50%; color: var(--primary); font-weight: 700; }
.row-main h2 { margin: 0; font-size: 1.15rem; }
.row-main h2 a:hover { color: var(--primary); }
.row-main p { margin: 5px 0 0; color: var(--muted); font-size: .9rem; }
.row-main .author { color: var(--text); font-weight: 700; }
.row-meta { display: flex; flex-direction: column; gap: 7px; text-align: center; }
.row-meta > span { color: var(--muted); font-size: .78rem; }
.listing-printed_book .library-row { grid-template-columns: 44px 150px minmax(0,1fr) 160px; min-height: 230px; padding: 28px; }
.listing-printed_book .library-row > img { width: 130px; height: 185px; }
.listing-printed_book .row-main h2 { font-size: 1.55rem; }
.pagination { display: flex; justify-content: center; flex-wrap: wrap; gap: 7px; margin-top: 32px; }
.pagination a { display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid var(--line); background: #fff; }
.pagination a.active { border-color: var(--primary); background: var(--primary); color: #fff; }

/* Detail pages */
.detail-page, .content-page, .app-detail { min-height: 60vh; padding-block: 74px; }
.detail-grid { display: grid; grid-template-columns: 300px minmax(0,1fr); align-items: start; gap: 55px; }
.book-cover { width: 100%; max-height: 500px; object-fit: contain; box-shadow: var(--shadow); }
.detail-page h1, .content-page h1, .app-detail h1 { margin: 8px 0 16px; color: var(--black); font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.35; }
.tag, .eyebrow { display: inline-flex; padding: 3px 10px; background: var(--info); color: var(--primary-dark); font-size: .82rem; font-weight: 700; }
.lead { color: var(--muted); font-size: 1.08rem; }
.rich-content { color: #303945; line-height: 2; }
.rich-content h2, .rich-content h3 { margin-top: 1.8em; color: var(--black); }
.rich-content a { color: var(--primary-dark); text-decoration: underline; }
.rich-content img, .featured-image, .app-hero { max-height: 480px; margin-block: 24px; object-fit: contain; }
.download-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.stats-line { margin-top: 22px; color: var(--muted); font-size: .84rem; }
.content-page { max-width: 900px; text-align: center; }
.content-page .rich-content { text-align: right; }

/* Latest items and applications */
.section-title { margin-bottom: 25px; text-align: center; }
.section-title h2 { margin: 4px 0; font-size: 1.8rem; }
.resource-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.resource-card { display: flex; gap: 15px; padding: 18px; background: #fff; box-shadow: var(--shadow); }
.resource-card img { width: 78px; height: 110px; object-fit: cover; }
.resource-card h3 { margin: 6px 0; font-size: 1rem; }
.resource-card p { margin: 0; color: var(--muted); font-size: .88rem; }
.app-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.app-card { display: flex; gap: 20px; padding: 25px; background: var(--white); box-shadow: var(--shadow); }
.app-icon { width: 80px; height: 80px; flex: 0 0 auto; object-fit: cover; border-radius: 18px; }
.app-icon.large { width: 110px; height: 110px; }
.app-card h2 { margin: 0; }
.app-card p { color: var(--muted); }
.app-meta { display: flex; gap: 8px; margin-bottom: 15px; }
.app-meta span { padding: 2px 8px; background: var(--info); font-size: .8rem; }
.app-title-row { display: flex; align-items: center; gap: 22px; margin-bottom: 35px; }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-top: 35px; }
.gallery img { width: 100%; aspect-ratio: 9/16; object-fit: cover; box-shadow: var(--shadow); }
.empty-state { padding: 70px 20px; text-align: center; }
.error-code { display: block; color: var(--primary); font-size: 5rem; font-weight: 900; }

/* Original dark footer */
.site-footer { padding: 42px 0 28px; background: var(--black); color: var(--white); text-align: center; }
.footer-inner { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.footer-brand { padding-block: 5px; color: var(--primary); font-size: 2rem; }
.site-footer p { margin: 4px 0; color: #e0e0e5; }
.site-footer a { color: var(--white); }
.footer-nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; margin: 10px 0; }
.footer-nav a { padding: 5px 10px; }
.footer-nav a:hover { color: var(--primary); }
.credit { padding-top: 10px; color: #777d85 !important; font-size: .84rem; }

@media (max-width: 1050px) {
    .menu-toggle { display: block; }
    .main-nav { position: absolute; top: 72px; right: 16px; left: 16px; display: none; flex-direction: column; align-items: stretch; padding: 10px; border: 1px solid #eee; background: #fff; box-shadow: var(--shadow); }
    .main-nav.open { display: flex; }
    .main-nav a { border-radius: 0; text-align: center; }
    .category-grid { grid-template-columns: repeat(2, 1fr); }
    .resource-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
    body { font-size: 15px; }
    .header-inner { min-height: 70px; }
    .brand { font-size: 1.45rem; }
    .classic-slider { min-height: 145px; }
    .slider-button { width: 36px; height: 48px; }
    .category-grid, .resource-grid, .app-grid { grid-template-columns: 1fr; }
    .single-service { min-height: 290px; }
    .search-form { flex-direction: column; }
    .library-row, .listing-printed_book .library-row { grid-template-columns: 42px 82px minmax(0,1fr); min-height: auto; gap: 12px; padding: 16px; }
    .library-row > img, .listing-printed_book .library-row > img, .resource-placeholder { width: 76px; height: 105px; }
    .row-main { grid-column: 3; }
    .listing-printed_book .row-main h2 { font-size: 1.15rem; }
    .row-meta { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
    .row-meta > span { grid-column: 1 / -1; }
    .detail-grid { grid-template-columns: 1fr; }
    .detail-grid aside { width: min(270px, 80%); margin-inline: auto; }
    .app-title-row { align-items: flex-start; }
    .gallery { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 460px) {
    .classic-slider { min-height: 110px; }
    .library-row, .listing-printed_book .library-row { grid-template-columns: 38px 68px minmax(0,1fr); }
    .library-row > img, .listing-printed_book .library-row > img, .resource-placeholder { width: 64px; height: 90px; }
    .app-title-row { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
    * { scroll-behavior: auto !important; transition: none !important; }
}
