/* ═══════════════════════════════════════════════════
   IB Chemistry Content Pages — Shared Styles
   ═══════════════════════════════════════════════════ */

/* ── Layout ── */
.ib-content {
    max-width: 860px;
    margin: 0 auto;
    padding: var(--space-xl) var(--space-lg);
}

.ib-content__header {
    display: flex;
    align-items: center;
    gap: .75rem;
    border-bottom: 2px solid rgba(15, 23, 42, .08);
    padding-bottom: var(--space-md);
    margin-bottom: var(--space-xl);
}

.ib-content__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 .5rem;
    border-radius: 6px;
    background: #3b82f6;
    color: #fff;
    font-weight: 800;
    font-size: .8rem;
    flex-shrink: 0;
}

.ib-content__title {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--color-dark);
    margin: 0;
    line-height: 1.2;
}

/* ── Prose / article text ── */
.ib-prose {
    color: var(--color-body);
    line-height: 1.75;
    font-size: .95rem;
}

.ib-prose h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-dark);
    margin: 2rem 0 .75rem;
}

.ib-prose p {
    margin-bottom: 1rem;
}

.ib-prose ul {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.ib-prose li {
    margin-bottom: .4rem;
}

.ib-prose strong {
    color: var(--color-dark);
}

.ib-prose table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(15, 23, 42, .1);
    border-radius: 8px;
    overflow: hidden;
}

.ib-prose table th,
.ib-prose table td {
    padding: .65rem .85rem;
    border: 1px solid rgba(15, 23, 42, .08);
    text-align: left;
}

.ib-prose table thead {
    background: var(--color-light-bg, #f8fafc);
    font-weight: 700;
    text-transform: uppercase;
    font-size: .7rem;
    letter-spacing: .04em;
    color: var(--color-dark);
}

.ib-prose table td:first-child {
    font-weight: 600;
    background: rgba(248, 250, 252, .7);
}

/* ── Info Boxes ── */
.ib-definition-box {
    background: rgba(59, 130, 246, .06);
    border-left: 4px solid #3b82f6;
    padding: 1rem 1.25rem;
    border-radius: 0 8px 8px 0;
    margin-bottom: 1.5rem;
}

.ib-definition-box strong {
    color: #1e3a8a;
}

.ib-definition-box p {
    margin: .25rem 0 0;
    color: #1e40af;
    font-size: .9rem;
}

/* ── Two-column grid ── */
.ib-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.ib-grid--2 {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.ib-grid--3 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.ib-grid--2x3 {
    grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 768px) {
    .ib-grid--2x3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

.ib-grid-card {
    background: #fff;
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
}

.ib-grid-card h5 {
    font-size: .95rem;
    font-weight: 700;
    color: var(--color-dark);
    margin: 0 0 .25rem;
}

.ib-grid-card .label {
    font-size: .7rem;
    color: var(--color-muted);
    margin: 0 0 .25rem;
}

.ib-grid-card p {
    font-size: .8rem;
    margin: 0;
}

.ib-grid-card--highlight {
    background: #fff7ed;
    border-color: #fed7aa;
}

/* ── Section-colored border cards ── */
.ib-section-card {
    padding: 1rem 1.25rem;
    border-radius: 8px;
}

.ib-section-card--indigo {
    background: #f0f0ff;
    border-left: 4px solid #6366f1;
}

.ib-section-card--teal {
    background: #f0fdfa;
    border-left: 4px solid #14b8a6;
}

.ib-section-card h4 {
    margin: 0 0 .5rem;
    font-weight: 700;
}

.ib-section-card--indigo h4 {
    color: #312e81;
}

.ib-section-card--teal h4 {
    color: #134e4a;
}

.ib-section-card ul {
    font-size: .85rem;
    padding-left: 1.25rem;
}

/* Phase change tiles */
.ib-phase-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .5rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .ib-phase-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.ib-phase-tile {
    background: #f8fafc;
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 6px;
    padding: .6rem;
    text-align: center;
    font-size: .85rem;
}

.ib-phase-tile strong {
    display: block;
    margin-top: .2rem;
    color: var(--color-dark);
}

/* ── Deep Think Card ── */
.ib-deepthink {
    background: linear-gradient(135deg, #fefce8, #fef9c3);
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
}

.ib-deepthink__title {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 700;
    color: #92400e;
    margin-bottom: .75rem;
    font-size: 1rem;
}

.ib-deepthink p,
.ib-deepthink li {
    font-size: .85rem;
    color: #78350f;
}

.ib-deepthink ol {
    padding-left: 1.25rem;
}

.ib-deepthink li {
    margin-bottom: .5rem;
}

/* ── Worked Example Card ── */
.ib-worked-example {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
}

.ib-worked-example__title {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 700;
    color: #166534;
    margin-bottom: .75rem;
    font-size: 1rem;
}

.ib-worked-example__problem {
    background: rgba(255, 255, 255, .6);
    border-radius: 6px;
    padding: .75rem 1rem;
    margin-bottom: 1rem;
    font-size: .85rem;
    font-style: italic;
    color: #14532d;
    border-left: 3px solid #22c55e;
}

.ib-worked-example p {
    font-size: .85rem;
    color: #15803d;
    margin-bottom: .5rem;
}

/* ── NOS Card ── */
.ib-nos-card {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    background: #faf5ff;
    border: 1px solid #e9d5ff;
    border-radius: 10px;
    padding: 1.25rem;
    margin: 1.5rem 0;
}

.ib-nos-card__icon {
    flex-shrink: 0;
    font-size: 1.5rem;
    margin-top: .1rem;
}

.ib-nos-card h4 {
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6b21a8;
    margin: 0 0 .5rem;
}

.ib-nos-card p {
    font-size: .85rem;
    color: #581c87;
    margin: 0;
    line-height: 1.6;
}

/* Formula box */
.ib-formula-box {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
    padding: 1rem;
    background: #f1f5f9;
    border-radius: 8px;
}

/* ── Quiz Widget ── */
.ib-quiz {
    margin: 2rem 0;
}

.ib-quiz__title {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--color-dark);
    padding-bottom: .5rem;
    border-bottom: 2px solid rgba(15, 23, 42, .08);
    margin-bottom: 1.5rem;
}

.ib-quiz__question {
    margin-bottom: 1.5rem;
}

.ib-quiz__question-text {
    font-weight: 600;
    font-size: .9rem;
    color: var(--color-dark);
    margin-bottom: .75rem;
    display: flex;
    gap: .4rem;
}

.ib-quiz__options {
    display: grid;
    grid-template-columns: 1fr;
    gap: .5rem;
}

@media (min-width: 600px) {
    .ib-quiz__options {
        grid-template-columns: 1fr 1fr;
    }
}

.ib-quiz__option {
    text-align: left;
    padding: .7rem 1rem;
    border: 1px solid rgba(15, 23, 42, .12);
    border-radius: 8px;
    font-size: .85rem;
    background: #fff;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    color: var(--color-body);
    font-family: inherit;
}

.ib-quiz__option:hover:not(:disabled) {
    background: #f8fafc;
    border-color: rgba(15, 23, 42, .2);
}

.ib-quiz__option:disabled {
    cursor: default;
}

.ib-quiz__option--correct {
    background: #dcfce7 !important;
    border-color: #22c55e !important;
    color: #166534 !important;
}

.ib-quiz__option--incorrect {
    background: #fee2e2 !important;
    border-color: #ef4444 !important;
    color: #991b1b !important;
}

.ib-quiz__option--dimmed {
    opacity: .45;
}

.ib-quiz__score {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    border-radius: 10px;
    font-weight: 700;
    text-align: center;
    font-size: 1.05rem;
    display: none;
}

.ib-quiz__score--show {
    display: block;
}

.ib-quiz__score--great {
    background: #dcfce7;
    color: #166534;
}

.ib-quiz__score--ok {
    background: #fef9c3;
    color: #854d0e;
}

.ib-quiz__score--bad {
    background: #fee2e2;
    color: #991b1b;
}

/* ── Flashcard Widget ── */
.ib-flashcards {
    margin: 2rem 0;
}

.ib-flashcards__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.ib-flashcards__title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--color-dark);
    display: flex;
    align-items: center;
    gap: .5rem;
}

.ib-flashcards__counter {
    font-size: .8rem;
    font-family: monospace;
    background: #f1f5f9;
    padding: .25rem .75rem;
    border-radius: 20px;
    color: var(--color-muted);
}

.ib-flashcards__card-area {
    perspective: 1200px;
    height: 300px;
    cursor: pointer;
    margin-bottom: 1rem;
}

.ib-flashcards__card {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform .6s cubic-bezier(.4, 0, .2, 1);
}

.ib-flashcards__card.flipped {
    transform: rotateY(180deg);
}

.ib-flashcards__face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.ib-flashcards__front {
    background: #fff;
    border: 1px solid rgba(15, 23, 42, .1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, .06);
}

.ib-flashcards__front-label {
    position: absolute;
    top: 1rem;
    left: 1rem;
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #3b82f6;
}

.ib-flashcards__front h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-dark);
    margin: 0;
    line-height: 1.4;
}

.ib-flashcards__front .hint {
    margin-top: 1rem;
    font-size: .8rem;
    color: var(--color-muted);
}

.ib-flashcards__back {
    transform: rotateY(180deg);
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
}

.ib-flashcards__back-label {
    position: absolute;
    top: 1rem;
    left: 1rem;
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255, 255, 255, .5);
}

.ib-flashcards__back p {
    font-size: 1.15rem;
    font-weight: 500;
    line-height: 1.5;
    margin: 0;
}

.ib-flashcards__controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ib-flashcards__btn {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-weight: 700;
    font-size: .85rem;
    color: var(--color-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: .5rem;
    border-radius: 6px;
    transition: color .15s, background .15s;
    font-family: inherit;
}

.ib-flashcards__btn:hover {
    color: #3b82f6;
    background: rgba(59, 130, 246, .06);
}

.ib-flashcards__dots {
    display: flex;
    gap: 4px;
}

.ib-flashcards__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e2e8f0;
    transition: background .2s;
}

.ib-flashcards__dot--active {
    background: #3b82f6;
}

/* ── Topic Navigation (subtopic links) ── */
.ib-topic-links {
    margin: 2rem 0;
}

.ib-topic-link {
    display: block;
    padding: 1.25rem 1.5rem;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 10px;
    text-decoration: none;
    margin-bottom: .75rem;
    transition: box-shadow .2s, border-color .2s, transform .15s;
}

.ib-topic-link:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, .06);
    border-color: #93c5fd;
    transform: translateY(-1px);
}

.ib-topic-link__inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ib-topic-link h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-dark);
    margin: 0 0 .2rem;
    transition: color .15s;
}

.ib-topic-link:hover h3 {
    color: #2563eb;
}

.ib-topic-link p {
    font-size: .8rem;
    color: var(--color-muted);
    margin: 0;
}

.ib-topic-link__arrow {
    font-size: 1.2rem;
    color: var(--color-muted);
    transition: transform .15s;
}

.ib-topic-link:hover .ib-topic-link__arrow {
    transform: translateX(3px);
}

/* ── Breadcrumb ── */
.ib-breadcrumb {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .8rem;
    color: var(--color-muted);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}

.ib-breadcrumb a {
    color: #3b82f6;
    text-decoration: none;
}

.ib-breadcrumb a:hover {
    text-decoration: underline;
}

.ib-breadcrumb__sep {
    color: #cbd5e1;
}

/* ── Bottom nav ── */
.ib-bottom-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(15, 23, 42, .08);
    gap: 1rem;
}

.ib-bottom-nav a {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .85rem;
    font-weight: 600;
    color: #3b82f6;
    text-decoration: none;
    padding: .5rem .75rem;
    border-radius: 6px;
    transition: background .15s;
}

.ib-bottom-nav a:hover {
    background: rgba(59, 130, 246, .06);
}

/* ── Topic Grid (landing page cards) ── */
.ib-topic-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: .75rem;
}

@media (min-width: 600px) {
    .ib-topic-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.ib-topic-card {
    display: block;
    position: relative;
    padding: 1.25rem 1.5rem;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 12px;
    text-decoration: none;
    transition: box-shadow .2s, border-color .2s, transform .15s;
    color: inherit;
}

.ib-topic-card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, .08);
    border-color: #93c5fd;
    transform: translateY(-2px);
}

.ib-topic-card h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-dark);
    margin: 0 0 .25rem;
    transition: color .15s;
}

.ib-topic-card:hover h3 {
    color: #2563eb;
}

.ib-topic-card p {
    font-size: .82rem;
    color: var(--color-muted);
    margin: 0;
    line-height: 1.4;
}

.ib-topic-card__arrow {
    position: absolute;
    top: 50%;
    right: 1.25rem;
    transform: translateY(-50%);
    font-size: 1.1rem;
    color: #cbd5e1;
    transition: transform .15s, color .15s;
}

.ib-topic-card:hover .ib-topic-card__arrow {
    transform: translateY(-50%) translateX(3px);
    color: #3b82f6;
}

.ib-topic-card--tool {
    background: linear-gradient(135deg, #f8fafc, #eff6ff);
    border-color: #bfdbfe;
}

/* ── Content subtitle ── */
.ib-content__subtitle {
    font-size: .9rem;
    color: var(--color-muted);
    margin: .25rem 0 0;
}

/* ── Info Box ── */
.ib-info-box {
    background: #f8fafc;
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin: 1rem 0;
}

.ib-info-box h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-dark);
    margin: 0 0 .5rem;
}

.ib-info-box p {
    margin: 0;
}

/* ── Deep Think Card ── */
.ib-deep-think {
    background: linear-gradient(135deg, #fefce8, #fef9c3);
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
}

.ib-deep-think h4 {
    font-weight: 700;
    color: #92400e;
    margin: 0 0 .5rem;
    font-size: 1rem;
}

.ib-deep-think p {
    font-size: .85rem;
    color: #78350f;
    margin: .25rem 0 0;
}

/* ── Worked Example (new-style shorthand) ── */
.ib-worked-example h4 {
    font-weight: 700;
    color: #166534;
    margin: 0 0 .5rem;
    font-size: 1rem;
}

/* ── Two-column shorthand ── */
.ib-grid-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin: 1rem 0;
}

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

/* ── Styled table ── */
.ib-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
    border: 1px solid rgba(15, 23, 42, .1);
    border-radius: 8px;
    overflow: hidden;
}

.ib-table th,
.ib-table td {
    padding: .5rem .75rem;
    border: 1px solid rgba(15, 23, 42, .08);
    text-align: left;
}

.ib-table thead {
    background: #f8fafc;
    font-weight: 700;
    text-transform: uppercase;
    font-size: .7rem;
    letter-spacing: .04em;
    color: var(--color-dark);
}

/* ── Exam Tip ── */
.ib-exam-tip {
    background: #fff7ed;
    border-left: 4px solid #fb923c;
    padding: .75rem 1rem;
    border-radius: 0 8px 8px 0;
    margin: 1rem 0;
    font-size: .85rem;
    color: #9a3412;
}

/* ═══════════════════════════════════════════════════
   Structure 3+ Content Components
   ═══════════════════════════════════════════════════ */

/* ── Section wrapper ── */
.ib-section {
    margin: 0 0 2rem;
}

.ib-section-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--color-dark);
    margin: 0 0 1rem;
    padding-bottom: .5rem;
    border-bottom: 2px solid rgba(15, 23, 42, .06);
}

/* ── Card Grid (auto-responsive) ── */
.ib-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
    margin: 1rem 0 .5rem;
}

/* ── Card ── */
.ib-card {
    background: #fff;
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
    transition: box-shadow .2s, transform .15s;
}

.ib-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, .07);
    transform: translateY(-1px);
}

.ib-card h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-dark);
    margin: 0 0 .5rem;
}

.ib-card h4 {
    font-size: .95rem;
    font-weight: 700;
    color: var(--color-dark);
    margin: 0 0 .4rem;
}

.ib-card p {
    font-size: .85rem;
    color: var(--color-body);
    margin: 0 0 .5rem;
    line-height: 1.6;
}

.ib-card ul,
.ib-card ol {
    padding-left: 1.25rem;
    font-size: .85rem;
    line-height: 1.7;
}

/* ── Callout Boxes ── */
.ib-callout {
    padding: .6rem 1rem;
    border-radius: 6px;
    font-size: .82rem;
    margin: .75rem 0 .25rem;
    line-height: 1.5;
}

.ib-callout--info {
    background: rgba(59, 130, 246, .06);
    border-left: 3px solid #3b82f6;
    color: #1e40af;
}

.ib-callout--green {
    background: #f0fdf4;
    border-left: 3px solid #22c55e;
    color: #166534;
}

.ib-callout--amber {
    background: #fffbeb;
    border-left: 3px solid #f59e0b;
    color: #92400e;
}

/* ── Bottom Navigation (new style) ── */
.ib-nav-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(15, 23, 42, .08);
    gap: 1rem;
}

.ib-nav-footer a {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .85rem;
    font-weight: 600;
    color: #3b82f6;
    text-decoration: none;
    padding: .5rem .75rem;
    border-radius: 6px;
    transition: background .15s;
}

.ib-nav-footer a:hover {
    background: rgba(59, 130, 246, .06);
}

.ib-nav-footer__next {
    background: #3b82f6 !important;
    color: #fff !important;
    padding: .5rem 1.25rem !important;
    border-radius: 6px;
}

.ib-nav-footer__next:hover {
    background: #2563eb !important;
}