/* =========================================================
   The AI Crisis in Higher Education – web edition
   Mobile-first, accessibility-focused overrides for the
   Start Bootstrap "Creative" theme.
   ========================================================= */

:root {
    --book-accent: #b5401d;        /* 5.6:1 on white (theme orange was 3.2:1) */
    --book-accent-dark: #8a3416;
    --book-ink: #1f2328;
    --book-muted: #565e66;         /* 6.4:1 on white */
    --book-warm: #5c4d42;          /* masthead brown from the theme */
    --book-paper: #faf7f4;
    --book-focus: #ffbf47;
    --bs-primary: #b5401d;
    --bs-primary-rgb: 181, 64, 29;
    --bs-link-color: #b5401d;
    --bs-link-hover-color: #8a3416;
    scroll-padding-top: 5rem;      /* keeps anchored headings clear of the fixed nav */
}

/* ---------- Base (mobile first) ---------- */
body {
    color: var(--book-ink);
    font-size: 1.0625rem;
    -webkit-text-size-adjust: 100%;
}
a { color: var(--book-accent); text-underline-offset: 0.15em; }
a:hover { color: var(--book-accent-dark); }

/* Visible focus for keyboard users everywhere */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
.btn:focus-visible,
.nav-link:focus-visible,
.dropdown-item:focus-visible {
    outline: 3px solid var(--book-focus) !important;
    outline-offset: 2px;
    box-shadow: 0 0 0 5px #1f2328 !important;
}
main:focus { outline: none; }

/* Skip link */
.skip-link {
    position: absolute;
    left: 1rem;
    top: -10rem;
    z-index: 2000;
    padding: .75rem 1.25rem;
    background: #1f2328;
    color: #fff;
    font-weight: 700;
    border-radius: .375rem;
}
.skip-link:focus { top: 1rem; color: #fff; }

/* Accessible primary colours (theme orange fails contrast with white text) */
.btn-primary {
    --bs-btn-bg: var(--book-accent);
    --bs-btn-border-color: var(--book-accent);
    --bs-btn-hover-bg: var(--book-accent-dark);
    --bs-btn-hover-border-color: var(--book-accent-dark);
    --bs-btn-active-bg: var(--book-accent-dark);
    --bs-btn-active-border-color: var(--book-accent-dark);
    --bs-btn-disabled-bg: var(--book-accent);
}
.btn-outline-primary {
    --bs-btn-color: var(--book-accent);
    --bs-btn-border-color: var(--book-accent);
    --bs-btn-hover-bg: var(--book-accent);
    --bs-btn-hover-border-color: var(--book-accent);
    --bs-btn-active-bg: var(--book-accent-dark);
}
.text-primary { color: var(--book-accent) !important; }
.text-muted { color: var(--book-muted) !important; }
hr.divider { background-color: var(--book-accent); }
hr.divider-light { background-color: #fff; }
.btn-xl { padding: 1rem 1.75rem; }

/* ---------- Navigation ---------- */
#mainNav .navbar-brand { font-size: 1rem; }
#mainNav .navbar-nav .nav-item .nav-link { color: #495057; }
#mainNav .navbar-nav .nav-item .nav-link:hover,
#mainNav .navbar-nav .nav-item .nav-link.active { color: var(--book-accent) !important; }
.nav-modal-btn {
    background: none;
    border: 0;
    text-align: left;
    width: 100%;
}
.nav-modal-btn i { width: 1.25em; }
.dropdown-item { padding: .6rem 1rem; white-space: normal; }
.dropdown-item.active, .dropdown-item:active { background-color: var(--book-accent); }
.dd-num {
    display: inline-grid;
    place-items: center;
    width: 1.6rem; height: 1.6rem;
    margin-right: .4rem;
    border-radius: 50%;
    background: var(--book-accent);
    color: #fff;
    font-size: .8rem;
    font-weight: 700;
}
/* Mobile: make tap targets comfortable in the collapsed menu */
@media (max-width: 991.98px) {
    #mainNav .navbar-nav .nav-item .nav-link { padding: .7rem 0; }
    #navbarResponsive { max-height: calc(100vh - 4.5rem); overflow-y: auto; }
}
@media (min-width: 992px) {
    #mainNav .navbar-nav .nav-item .nav-link { padding: 0 .9rem; }
    #mainNav .nav-modal-btn { width: auto; }
    /* Over the masthead, links are white: keep them fully opaque for contrast */
    #mainNav:not(.navbar-shrink) .navbar-nav .nav-item .nav-link { color: #fff; }
    #mainNav:not(.navbar-shrink) .navbar-brand { color: #fff; }
    #mainNav:not(.navbar-shrink) .navbar-nav .nav-item .nav-link:hover { color: #ffd2c2 !important; }
    #mainNav.navbar-shrink .navbar-nav .nav-item .nav-link { color: #495057; }
}

/* ---------- Masthead ---------- */
header.masthead {
    padding-top: 8rem;
    padding-bottom: 4rem;
    background:
        linear-gradient(to bottom, rgba(40, 33, 28, .82) 0%, rgba(40, 33, 28, .88) 100%),
        url("../assets/img/pixabay/lecture-hall-640.jpg") center / cover no-repeat;
}
@media (min-width: 641px) {
    header.masthead {
        background-image:
            linear-gradient(to bottom, rgba(40, 33, 28, .82) 0%, rgba(40, 33, 28, .88) 100%),
            url("../assets/img/pixabay/lecture-hall-1280.jpg");
    }
}
header.masthead h1 { font-size: 2rem; line-height: 1.2; }
.masthead-sub {
    display: block;
    margin-top: .5rem;
    font-family: "Merriweather", Georgia, serif;
    font-weight: 300;
    font-style: italic;
    font-size: .65em;
    color: rgba(255, 255, 255, .92);
}
.masthead-kicker {
    color: #ffd2c2;
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: .8rem;
    font-weight: 700;
    margin-bottom: .75rem;
}
header.masthead .text-white-75 { color: rgba(255, 255, 255, .9) !important; }
.masthead-actions { display: flex; flex-direction: column; gap: .75rem; align-items: center; }
@media (min-width: 576px) {
    .masthead-actions { flex-direction: row; justify-content: center; }
}
@media (min-width: 992px) {
    header.masthead { padding-bottom: 0; }
    header.masthead h1 { font-size: 3.25rem; }
}

/* ---------- Generic sections ---------- */
.page-section { padding: 4rem 0; }
@media (min-width: 992px) { .page-section { padding: 6rem 0; } }

.bg-book { background: var(--book-warm); }
.text-white-90 { color: rgba(255, 255, 255, .94); }
.blurb p { font-family: "Merriweather", Georgia, serif; line-height: 1.75; }
.blurb p:first-child { font-size: 1.15rem; }
.book-facts {
    list-style: none;
    padding: 0;
    margin: 2rem 0 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: .5rem;
    color: #fff;
    font-size: .95rem;
}
.book-facts li { background: rgba(255, 255, 255, .1); padding: .6rem .9rem; border-radius: .5rem; }
.book-facts i { width: 1.4em; color: #ffd2c2; }
@media (min-width: 576px) { .book-facts { grid-template-columns: 1fr 1fr; } }

/* ---------- Contents cards ---------- */
.contents-section { background: var(--book-paper); }
.toc-card {
    background: #fff;
    border: 1px solid #e6dfd8;
    border-top: 4px solid var(--book-accent);
    border-radius: .75rem;
    padding: 1.5rem;
    box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .04);
}
.toc-icon {
    width: 3rem; height: 3rem;
    display: grid; place-items: center;
    border-radius: 50%;
    background: #fbe9e3;
    color: var(--book-accent);
    font-size: 1.3rem;
    margin-bottom: .75rem;
}
.toc-num {
    text-transform: uppercase;
    letter-spacing: .1em;
    font-size: .75rem;
    font-weight: 700;
    color: var(--book-muted);
    margin-bottom: .25rem;
}
.toc-card h3 a { color: var(--book-ink); text-decoration: none; }
.toc-card h3 a:hover { color: var(--book-accent); text-decoration: underline; }
.toc-sections { padding-left: 1.1rem; margin: 0; font-size: .92rem; }
.toc-sections li { margin: .3rem 0; }
.toc-sections a { color: var(--book-muted); }
.toc-sections a:hover { color: var(--book-accent); }

/* ---------- Chapters ---------- */
.chapter-banner {
    position: relative;
    isolation: isolate;
    padding: 5.5rem 0 2.5rem;
    color: #fff;
    background: #2b241f;
    overflow: hidden;
}
.chapter-banner .banner-img {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    z-index: -2;
}
.chapter-banner::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(100deg, rgba(31, 26, 22, .92) 0%, rgba(31, 26, 22, .78) 55%, rgba(31, 26, 22, .55) 100%);
}
.chapter-kicker {
    text-transform: uppercase;
    letter-spacing: .14em;
    font-size: .8rem;
    font-weight: 700;
    color: #ffd2c2;
    margin-bottom: .5rem;
}
.chapter-kicker i { margin-right: .35rem; }
.chapter-title { color: #fff; font-size: 2rem; margin: 0; }
@media (min-width: 992px) {
    .chapter-banner { padding: 8rem 0 3.5rem; }
    .chapter-title { font-size: 3rem; }
}

/* Reading column: comfortable measure, left aligned (no justification) */
.reading {
    max-width: 46rem;
    margin: 0 auto;
    padding: 2rem 0 3rem;
}
.reading p {
    font-family: "Merriweather", Georgia, serif;
    font-size: 1.0625rem;
    line-height: 1.8;
    text-align: left;
    margin-bottom: 1.25rem;
    hyphens: manual;
    overflow-wrap: break-word;
}
@media (min-width: 768px) { .reading p { font-size: 1.125rem; } }

.reading .section-heading {
    font-size: 1.5rem;
    margin: 3rem 0 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e6dfd8;
    color: var(--book-ink);
}
.reading .section-heading::before {
    content: "";
    display: block;
    width: 3rem; height: .2rem;
    background: var(--book-accent);
    margin-bottom: 1rem;
}
.reading .sub-heading {
    font-size: 1.2rem;
    margin: 2.25rem 0 .9rem;
    color: var(--book-accent-dark);
}
@media (min-width: 992px) {
    .reading .section-heading { font-size: 1.85rem; }
    .reading .sub-heading { font-size: 1.3rem; }
}

/* Chapter outline */
.chapter-outline details {
    background: var(--book-paper);
    border: 1px solid #e6dfd8;
    border-radius: .75rem;
    padding: .9rem 1.1rem;
    margin-bottom: 1.5rem;
}
.chapter-outline summary, .notes-details summary {
    cursor: pointer;
    font-weight: 700;
    font-family: "Merriweather Sans", sans-serif;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: .4rem;
}
.chapter-outline summary .count, .notes-details summary .count { font-weight: 400; color: var(--book-muted); }
.chapter-outline ul { list-style: none; padding: 0; margin: .75rem 0 0; }
.chapter-outline li { margin: .2rem 0; }
.chapter-outline li a { display: inline-block; padding: .3rem 0; }
.chapter-outline li.lvl-4 { padding-left: 1.25rem; font-size: .93rem; }
.chapter-outline li.lvl-3 a { font-weight: 700; }

/* Figures */
.book-figure { margin: 2rem 0; }
.book-figure img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: .75rem;
    display: block;
}
.book-figure figcaption {
    font-size: .9rem;
    color: var(--book-muted);
    margin-top: .6rem;
    line-height: 1.5;
}
.book-figure .credit { display: block; font-size: .8rem; margin-top: .2rem; }

/* Lists converted from the original indented paragraphs */
.book-list { padding: 0; margin: 1.75rem 0; list-style: none; }
.book-list li {
    position: relative;
    font-family: "Merriweather", Georgia, serif;
    line-height: 1.75;
    background: var(--book-paper);
    border-left: 4px solid var(--book-accent);
    border-radius: 0 .6rem .6rem 0;
    padding: 1rem 1rem 1rem 3.4rem;
    margin-bottom: .9rem;
}
.numbered-list { counter-reset: item; }
.numbered-list li { counter-increment: item; }
.numbered-list li::before {
    content: counter(item);
    position: absolute;
    left: .9rem; top: 1rem;
    width: 1.8rem; height: 1.8rem;
    display: grid; place-items: center;
    border-radius: 50%;
    background: var(--book-accent);
    color: #fff;
    font: 700 .9rem/1 "Merriweather Sans", sans-serif;
}
.spectrum-list li::before {
    content: "";
    position: absolute;
    left: 1.25rem; top: 1.45rem;
    width: .8rem; height: .8rem;
    border-radius: 50%;
    background: var(--book-accent);
}
.spectrum-list li strong:first-child { color: var(--book-accent-dark); }

/* Quotation */
.book-quote {
    margin: 2rem 0;
    padding: 1.25rem 1.25rem 1.25rem 1.5rem;
    border-left: 4px solid var(--book-warm);
    background: #f3eee9;
    border-radius: 0 .6rem .6rem 0;
}
.book-quote p { font-style: italic; margin-bottom: .5rem !important; }
.book-quote footer { font-size: .9rem; color: var(--book-muted); }
.book-quote footer::before { content: "— "; }

/* Footnote references: large enough to tap */
sup.fn { line-height: 0; }
sup.fn a {
    display: inline-block;
    min-width: 1.4em;
    padding: .15em .25em;
    margin-left: .1em;
    font: 700 .72rem/1 "Merriweather Sans", sans-serif;
    text-align: center;
    text-decoration: none;
    color: #fff;
    background: var(--book-accent);
    border-radius: .3em;
    vertical-align: super;
}
sup.fn a:hover { background: var(--book-accent-dark); color: #fff; }

/* Notes */
.chapter-notes { margin-top: 3rem; border-top: 2px solid #e6dfd8; padding-top: 1.5rem; }
.notes-heading { font-size: 1.15rem; }
.notes-details { background: var(--book-paper); border-radius: .75rem; padding: .75rem 1.1rem; }
.notes-list { margin: 1rem 0 0; padding-left: 1.5rem; font-size: .95rem; line-height: 1.65; }
.notes-list li { margin-bottom: .9rem; padding-left: .25rem; }
.notes-list li:target { background: #fff3cd; outline: 2px solid var(--book-focus); border-radius: .3rem; }
.fn-back { display: inline-block; padding: .2rem .45rem; margin-left: .2rem; }
.reading p:target, sup.fn a:target { background: #fff3cd; }

.chapter-nav { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-top: 2.5rem; }
.chapter-nav .btn { min-height: 44px; display: inline-flex; align-items: center; gap: .4rem; }

/* References */
.reference-list { list-style: none; padding: 0; margin: 0; }
.reference-list li {
    font-size: .95rem;
    line-height: 1.6;
    padding: .6rem 0 .6rem 1.5rem;
    text-indent: -1.5rem;
    border-bottom: 1px solid #eee7e0;
    overflow-wrap: anywhere;
}

/* ---------- Modals ---------- */
.modal-body p { line-height: 1.7; }
.modal-body h3 { margin-top: 1.5rem; }
.modal-body h3:first-child { margin-top: 0; }
.cc-badges { font-size: 2rem; color: var(--book-ink); display: flex; gap: .5rem; }
.credit-list { font-size: .9rem; padding-left: 1.2rem; }
.credit-list li { margin-bottom: .3rem; }
.modal-header .modal-title i { margin-right: .4rem; }

/* ---------- Footer ---------- */
.site-footer { background: #2b241f; color: rgba(255, 255, 255, .9); }
.site-footer a { color: #ffd2c2; }
.site-footer a.btn-outline-light { color: #fff; }
.footer-actions { display: flex; flex-direction: column; gap: .75rem; }
.footer-actions .btn { min-height: 44px; }
@media (min-width: 576px) {
    .footer-actions { flex-direction: row; flex-wrap: wrap; justify-content: center; }
}
.site-footer .fa-brands { font-size: 1.1rem; }

/* Back-to-top button */
.to-top {
    position: fixed;
    right: 1rem; bottom: 1rem;
    width: 3rem; height: 3rem;
    display: grid; place-items: center;
    border-radius: 50%;
    background: var(--book-accent);
    color: #fff;
    box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .25);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease;
    z-index: 1020;
}
.to-top.show { opacity: 1; visibility: visible; }
.to-top:hover { color: #fff; background: var(--book-accent-dark); }

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
    :root { scroll-behavior: auto !important; }
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Print: show everything plainly */
@media print {
    #mainNav, .to-top, .skip-link, .chapter-nav, .footer-actions, .banner-img, .book-figure { display: none !important; }
    .chapter-banner { background: none; color: #000; padding: 1rem 0; }
    .chapter-banner::after { display: none; }
    .chapter-title, .chapter-kicker { color: #000 !important; }
    details > *:not(summary) { display: block !important; }
}

.btn-xl.btn-outline-light { border: 2px solid #fff; }
