html {
    box-sizing: border-box;
}

*, *:before, *:after {
    box-sizing: inherit;
}

html, body {
    height: 100%;
}

main {
    flex: 1;
}


.racelogic-card {
    transition: all 0.3s ease; /* smooth transition */
    font-weight: 400;
    min-height: 8rem;
    height: 100%;
}

.racelogic-card:hover {
    border: 1px solid var(--dark-blue); /* blue border */
    transform: translateY(-5px); /* raises the card up */
    box-shadow: 0 4px 8px rgba(0,0,0,0.2); /* often adds shadow for depth */
}

.card-link:hover {
    text-decoration: none;
}

.racelogic-card-title {
    font-size: clamp(0.9rem, 1.8vw, 1.5rem);
    font-family: var(--font-heading);
    color: var(--blue);
    overflow-wrap: break-word;
    word-break: keep-all;
}

@media (max-width: 991.98px) {
    .racelogic-card .card-body {
        padding: 0.5rem 0;
    }
}

.racelogic-card-text {
    color: var(--blue-grey);
}

.related-pages-card-title {
    font-size: large;
    font-family: var(--font-heading);
    color: var(--blue);
}

.related-pages-card-text {
    font-size: medium;
    font-family: var(--font-text);
    color: var(--blue-grey);
}

.related-pages-icon {
    font-size: x-large;
    margin-right: 0.5rem;
    color: var(--blue);
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0 auto;
    color: var(--blue-grey);
    font-family: var(--font-text);
    line-height: 1.4;
}

a {
    background-color: transparent;
    text-decoration: none;
    color: var(--blue);
}

a:hover {
    text-decoration: underline;
}

p {
    margin-top: 1rem;
    margin-bottom: 1rem;
}

h1, h2, h3, h4, h5, h6 {
    margin-top: 2rem;
    margin-bottom: 0.5rem;
    font-family: var(--font-heading);
    color: var(--dark-blue);
    font-weight: 600;
}

/* Utility nav */
.utility-nav {
    background-color: var(--light-blue);
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--light-grey);
}

.utility-nav-link {
    background: none;
    border: none;
    color: var(--dark-blue);
    font-family: var(--font-text);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
}

.utility-nav-link:hover {
    text-decoration: underline;
}

.utility-nav-form {
    display: inline;
    margin: 0;
    padding: 0;
}

.utility-nav-separator {
    color: var(--dark-blue);
    font-size: 0.8rem;
    margin: 0 0.5rem;
}

/* Table border colour — light grey borders on all cells (ticket 27403) */
.table {
    --bs-table-border-color: var(--grey);
}

/* Opt-in fixed column widths — set when an editor ticks "Force equal column
   widths" or supplies explicit column widths. Under fixed layout a <colgroup>
   is authoritative, and with no colgroup the columns divide equally; under the
   browser default (auto) both are merely advisory, which is why this class is
   required for either feature to work at all.

   The min-width floor is what keeps Bootstrap's .table-responsive wrapper
   useful. Fixed layout alone pins the table to exactly 100% of its container,
   so it can never overflow and the wrapper has nothing to scroll — on a phone
   a wide table is squeezed to nothing instead of scrolling. The floor
   guarantees every grid column at least 7.5rem, so the table overflows and
   scrolls once the viewport is too narrow to hold them all.

   --table-cols is emitted per table by the renderer (see blocks.py). The
   fallback only applies if a table is rendered without it. */
.table-fixed-cols {
    table-layout: fixed;
    min-width: calc(var(--table-cols, 3) * 7.5rem);
}

/* Fixed layout will not widen a column to fit its content, so a long
   unbreakable token (e.g. a part number) would otherwise spill out of its
   cell — on desktop as well as mobile. */
.table-fixed-cols th,
.table-fixed-cols td {
    overflow-wrap: anywhere;
}

/* Table heading rows */
.table thead th {
    background-color: var(--light-blue);
}

/* Table striped row colour — opt-in via block setting, not applied by default */
.table-striped > tbody > tr:nth-of-type(odd) {
    --bs-table-striped-bg: var(--light-grey);
}

/* Table hover highlight — distinct from striped row colour (ticket 27500) */
.table-hover > tbody > tr:hover > * {
    --bs-table-bg-state: var(--pale-blue);
}

/* Cell background colours — uses Bootstrap's --bs-table-bg-state to layer
   correctly with striped rows and hover highlights (tickets 27404/27406) */
.table td.cell-bg-yellow, .table th.cell-bg-yellow { --bs-table-bg-state: #fff3cd; }
.table td.cell-bg-blue, .table th.cell-bg-blue { --bs-table-bg-state: #cfe2ff; }
.table td.cell-bg-green, .table th.cell-bg-green { --bs-table-bg-state: #d1e7dd; }
.table td.cell-bg-red, .table th.cell-bg-red { --bs-table-bg-state: #f8d7da; }
.table td.cell-bg-grey, .table th.cell-bg-grey { --bs-table-bg-state: #e2e3e5; }
.table td.cell-bg-orange, .table th.cell-bg-orange { --bs-table-bg-state: #fde8d0; }

/* Border preset: header border only (ticket 27404) */
.table.table-header-border { border: none; }
.table.table-header-border > :not(caption) > * > * { border-width: 0; }
.table.table-header-border > thead > tr > * { border-bottom: 2px solid var(--grey); }

/* Border preset: outer border only (ticket 27404) */
.table.table-outer-border { border: 1px solid var(--grey); }
.table.table-outer-border > :not(caption) > * > * { border-width: 0; }

/* Rich text content in table cells (ticket 27420).
   Draftail wraps all text in <p> tags — remove bottom margin on the last
   paragraph to prevent extra spacing. Keep lists compact. */
.table td p:last-child, .table th p:last-child { margin-bottom: 0; }
.table td ul, .table td ol, .table th ul, .table th ol { margin-bottom: 0; padding-left: 1.5rem; }
.table td ul:last-child, .table td ol:last-child, .table th ul:last-child, .table th ol:last-child { margin-bottom: 0; }
