/* ============================================================
   topic-pages.css: extras for the split topic pages
   ============================================================
   Load AFTER style.css (and after exercises.css on exercise pages):

     <link rel="stylesheet" href="style.css">
     <link rel="stylesheet" href="topic-pages.css">

   Uses only the variables defined in style.css's :root. Sections:
   Popup title, Breadcrumb, Previous/Next bar, Practice link,
   Topic lists, Sidebar current page, Exercise pages.
   ============================================================ */


/* ==========================================
   POPUP TITLE
   ========================================== */
/* The tooltip popup's title used to be an <h2> reading "Popup Title",
   which search engines saw on every page. It is a plain element now and
   main.js fills it in. Same look as "#custom-popup h2" in style.css. */
#custom-popup .popup-title-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-heading);
    text-align: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-main);
}


/* ==========================================
   BREADCRUMB
   ========================================== */

.breadcrumb {
    margin: -10px 0 22px 4px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.breadcrumb a {
    color: var(--accent-blue);
    text-decoration: none;
}

.breadcrumb a:hover {
    color: var(--accent-green);
    text-decoration: underline;
}

.breadcrumb .sep {
    margin: 0 4px;
    opacity: 0.7;
}


/* ==========================================
   PREVIOUS / NEXT BAR
   ========================================== */
/* Real links instead of the old Next/Previous buttons, so every topic
   page is reachable by a normal crawl and has its own address. */

.topic-nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr; /* Guarantees the middle item is perfectly centered */
    align-items: center;
    gap: 14px;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-main);
}

/* Force the left button (or empty span) to the left edge */
.topic-nav > :first-child {
    justify-self: start;
}

.notes-content a.page-nav-btn {
    text-decoration: none;
    color: var(--accent-green);
}

.notes-content a.page-nav-btn:hover {
    background: var(--accent-green);
    color: #111;
}

.notes-content a.topic-nav-hub {
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
    justify-self: center; /* Centers the middle button */
}

/* Force the right button to the right edge */
.topic-nav > :last-child {
    justify-self: end;
}

@media (max-width: 600px) {
    .topic-nav {
        display: flex; /* Return to flexbox on mobile so they wrap nicely */
        flex-wrap: wrap;
        justify-content: center;
    }
    .topic-nav .topic-nav-hub {
        order: 3;
        flex-basis: 100%;
    }
    .topic-nav .page-nav-btn {
        flex: 1;
        justify-content: center;
        text-align: center;
        padding: 10px 12px;
    }
    .topic-nav .nav-arrow {
        display: none;
    }
    .topic-nav > span:empty {
        display: none; /* empty placeholders only exist for the desktop grid; they add gap space in flex */
    }
}


/* ==========================================
   PRACTICE LINK (under a topic)
   ========================================== */

.notes-content .related-practice {
    margin-top: 36px;
    padding: 4px 22px 14px;
    background: var(--bg-card);
    border: 2px solid var(--border-main);
    border-left: 4px solid var(--accent-amber);
    border-radius: 10px;
}

.notes-content .related-practice h2 {
    margin: 16px 0 8px;
    padding: 0;
    background: none;
    border: none;
    text-align: left;
    font-size: 1.25rem;
}

.notes-content .related-practice p {
    margin-bottom: 0;
}


/* ==========================================
   TOPIC LISTS (the contents lists on hub pages)
   ========================================== */

.notes-content ul.topic-list {
    list-style: none;
    padding-left: 0;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.notes-content ul.topic-list li {
    padding: 10px 16px;
    margin-bottom: 8px;
    background: var(--bg-card);
    border: 1.5px solid var(--border-main);
    border-left: 4px solid var(--accent-green);
    border-radius: 8px;
}

.notes-content ul.topic-list li a {
    font-weight: 700;
    text-decoration: none;
}

.notes-content ul.topic-list li a:hover {
    text-decoration: underline;
}

.notes-content .topic-blurb {
    color: var(--text-secondary);
}


/* ==========================================
   PHONE FIX: FULL-WIDTH EXAMPLE BOXES
   ========================================== */
/* style.css pulls .example-box out by 40px on each side to match the
   desktop container padding. On phones the container padding is only
   16px, so the box stuck out 8px and the whole page scrolled sideways. */
@media (max-width: 768px) {
    .example-box {
        margin-left: -16px;
        margin-right: -16px;
        padding-left: 16px;
        padding-right: 16px;
    }
}


/* ==========================================
   SIDEBAR: CURRENT PAGE
   ========================================== */

#side-nav ul li a[aria-current="page"] {
    color: var(--accent-green);
    border-left-color: var(--accent-green);
    background: rgba(61, 214, 140, 0.1);
    font-weight: 700;
}


/* ==========================================
   EXERCISE PAGES
   ========================================== */

.notes-content .exercise-intro {
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

/* "How does this work?" link under the intro text */
.notes-content .how-it-works-btn {
    display: block;
    margin: 0 auto 18px;
    background: transparent;
    color: var(--accent-blue);
    border: 1.5px solid var(--accent-blue);
    border-radius: 6px;
    padding: 6px 14px;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.notes-content .how-it-works-btn:hover {
    background: var(--accent-blue);
    color: #fff;
}

/* The hub list of problems */
.notes-content ul.exercise-list {
    list-style: none;
    padding-left: 0;
    margin: 24px auto;
    max-width: 800px;
}

.notes-content ul.exercise-list li {
    margin-bottom: 14px;
}

.notes-content ul.exercise-list a.exercise-link {
    display: block;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 2px solid var(--border-main);
    border-left: 4px solid var(--accent-amber);
    border-radius: 10px;
    text-decoration: none;
    transition: border-color 0.2s, transform 0.15s;
}

.notes-content ul.exercise-list a.exercise-link:hover {
    border-color: var(--accent-amber);
    transform: translateY(-2px);
}

.notes-content ul.exercise-list .exercise-title {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-heading);
}

.notes-content ul.exercise-list .exercise-desc {
    display: block;
    margin-top: 4px;
    font-size: 1rem;
    color: var(--text-secondary);
}

.notes-content ul.exercise-list .exercise-soon {
    display: block;
    padding: 14px 18px;
    border: 2px dashed var(--border-main);
    border-radius: 10px;
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 1.1rem;
}


/* ==========================================
   PHONE FIX: IMAGES BESIDE TEXT
   ========================================== */
/* On phones the text and picture stack. A picture that is a direct child
   of .media-side-by-side kept its full 600px width and pushed the page
   sideways (495px wide on a 390px phone). */
@media (max-width: 768px) {
    .media-side-by-side > picture {
        max-width: 100%;
        min-width: 0;
    }
    .media-side-by-side img.notes_image {
        max-width: 100%;
        height: auto;
    }
}


/* ==========================================
   TOPIC CARDS (hub page contents lists)
   ========================================== */
/* Hub pages build their contents lists from the same card markup as
   the homepage exercise grid (.exercise-hub-card). The blurb paragraph
   sits where a preview image would normally sit, so it needs its own
   type scale instead of inheriting the larger .notes-content p sizing
   (which would also add 18px of bottom margin inside the card). */

.notes-content a.exercise-hub-card .topic-blurb {
    margin: 0;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
}


/* ==========================================
   HUB CARD PROBLEM LABELS (calc_find_mistake.html)
   ========================================== */

.exercise-hub-problem-label {
    display: block;
    text-align: left;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Ensure long MathJax equations don't overflow the card */
.exercise-hub-title mjx-container {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}




/* ==========================================
   ABOUT PAGE (append to the end of topic-pages.css)
   ========================================== */

.notes-content .about-intro {
    display: flex;
    align-items: center;
    gap: 32px;
    margin: 8px 0 24px;
}

.notes-content .about-photo-frame {
    flex: 0 0 280px;
    margin: 0;
    text-align: center;
}

.notes-content .about-photo {
    display: block;
    width: 100%;
    max-width: 280px;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    margin: 0 auto;
    border-radius: 50%;                      /* round photo; use 12px for a rounded square */
    border: 3px solid var(--border-accent);
    box-shadow: var(--shadow-soft);
    background: var(--bg-card);
}

.notes-content .about-photo-frame figcaption {
    margin-top: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.notes-content .about-intro-text {
    flex: 1;
    min-width: 0;
}

.notes-content .about-note {
    margin-top: 28px;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .notes-content .about-intro {
        flex-direction: column;
        gap: 18px;
    }
    .notes-content .about-photo-frame {
        flex: none;
        width: 100%;
    }
    .notes-content .about-photo {
        max-width: 220px;
    }
}

/* Contact Call-to-Action Box */
.notes-content .about-contact {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 2px dashed var(--border-main);
    text-align: center;
}

.notes-content .about-contact h2 {
    margin-top: 0;
    margin-bottom: 12px;
    border: none;
    background: none;
    padding: 0;
    font-size: 1.5rem;
}

.notes-content .about-contact p {
    max-width: 600px;
    margin: 0 auto 24px auto;
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.notes-content .about-buttons {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.notes-content .about-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.05rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.notes-content .about-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
    color: #fff;
}

.notes-content .about-btn-discord {
    background: #5865F2;
    color: #fff;
}

.notes-content .about-btn-discord:hover {
    background: #4752C4;
}

.notes-content .about-btn-email {
    background: var(--accent-blue);
    color: #fff;
}

.notes-content .about-btn-email:hover {
    background: #4a88df;
}
