/* Civic newspaper theme: black on plain white, red as the only accent. */

:root,
[data-theme="light"] {
    --ink: #1a1a1a;
    --ink-soft: #404040;
    --ink-deep: #0d0d0d;
    --paper: #ffffff;
    --paper-deep: #f2f2f2;
    --surface: #ffffff;
    --rule: #d9d9d9;
    --muted: #666666;
    --deep-red: #940000;
    --deep-red-light: #b50000;
    --deep-red-dark: #730000;
    --second: #1a365d;
    --second-light: #2a4a7a;

    --font-serif: "Source Serif 4", Georgia, serif;
    --font-ui: "Libre Franklin", "Helvetica Neue", Arial, sans-serif;

    --background: #f0f4f8;
    --text: var(--ink);

    /* Bulma reads these; #940000 in HSL */
    --bulma-family-primary: var(--font-ui);
    --bulma-link-h: 0deg;
    --bulma-link-s: 100%;
    --bulma-link-l: 29%;
    --bulma-link-on-scheme-l: 29%;
    --bulma-label-color: var(--ink);
}

/* Body and general styles */
html,
body {
    background-color: var(--background);
    color: var(--text);
}

/* Typography customization */
h1,
h2,
h3,
h4,
h5,
h6,
.title,
.subtitle {
    color: var(--ink);
}

h1,
h2,
h3,
h4,
h5,
h6,
.title {
    font-family: var(--font-serif);
}

strong {
    color: var(--ink);
}

/* Link customization */
a {
    color: var(--ink);
}

a:hover {
    color: var(--deep-red);
}

.section .content a {
    color: var(--deep-red);
    font-weight: 700;
    text-decoration: none;
}

.section .content a:hover,
.article-nav a:hover,
a.card-footer-item:hover {
    color: var(--deep-red-light);
}

.article-nav a,
a.card-footer-item {
    color: var(--deep-red);
    font-weight: 700;
}

.breadcrumb {
    --bulma-breadcrumb-item-color: var(--second);
    --bulma-breadcrumb-item-hover-color: var(--second-light);
    --bulma-breadcrumb-item-active-color: var(--second);
    font-size: 0.9rem;
    /* Lines up with the first menu item (measured in the browser) */
    padding-inline-start: 1rem;
}

/* Navbar customization */
.navbar-menu {
    padding-left: 1rem;
    padding-right: 1rem;
}

.navbar.is-primary {
    --bulma-navbar-background-color: var(--second);
    background-color: var(--second);
}

.navbar.is-primary .navbar-brand > a.navbar-item,
.navbar.is-primary .navbar-brand .navbar-link,
.navbar.is-primary .navbar-burger,
.navbar.is-primary .navbar-menu .navbar-item,
.navbar.is-primary .navbar-menu .navbar-link {
    color: white;
}

.navbar.is-primary .navbar-brand > a.navbar-item:hover,
.navbar.is-primary .navbar-brand .navbar-link:hover,
.navbar.is-primary .navbar-burger:hover,
.navbar.is-primary .navbar-menu .navbar-item:hover,
.navbar.is-primary .navbar-menu .navbar-link:hover {
    background-color: var(--second-light);
    color: white;
}

/* Button customization */
.button.is-primary {
    background-color: var(--ink);
    color: white;
}

.button.is-primary:hover {
    background-color: var(--ink-soft);
}

.button.is-primary:focus {
    border-color: var(--ink-deep);
}

.button.is-secondary {
    background-color: var(--deep-red);
    color: white;
}

.button.is-secondary:hover {
    background-color: var(--deep-red-light);
}

.button.is-secondary:focus {
    border-color: var(--deep-red-dark);
    box-shadow: 0 0 0 0.125em rgba(148, 0, 0, 0.25);
}

/* Outline button styles */
.button.is-outline-primary {
    background-color: transparent;
    border-color: var(--ink);
    color: var(--ink);
}

.button.is-outline-primary:hover {
    background-color: var(--ink);
    color: white;
}

.button.is-outline-secondary {
    background-color: transparent;
    border-color: var(--deep-red);
    color: var(--deep-red);
}

.button.is-outline-secondary:hover {
    background-color: var(--deep-red);
    color: white;
}

/* Hero customization */
.hero.is-primary {
    background-color: var(--ink);
}

.hero.is-secondary {
    background-color: var(--deep-red);
    color: white;
}

.hero.is-secondary .title,
.hero.is-secondary .subtitle {
    color: white;
}

/* Card customization */
.card {
    --bulma-card-radius: 2px;
    --bulma-card-background-color: var(--surface);
    border: 1px solid var(--rule);
    box-shadow: none;
    background-color: var(--surface);
}

.card .title,
.card .title a {
    color: var(--deep-red);
}

.card .title a:hover,
.media-content .title a:hover {
    color: var(--deep-red-light);
}

.media-content .title a {
    color: var(--deep-red);
}

.card .card-header {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.card.has-primary-border {
    border-top: 3px solid var(--ink);
}

.card.has-secondary-border {
    border-top: 3px solid var(--deep-red);
}

.card .card-content .title + .subtitle,
.media-content .title + .subtitle {
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

/* Secondary color classes */
.has-text-secondary {
    color: var(--deep-red) !important;
}

.has-background-secondary {
    background-color: var(--deep-red) !important;
    color: white !important;
}

.is-secondary {
    background-color: var(--deep-red) !important;
    color: white !important;
}

/* Tag customizations */
.tag.is-secondary {
    background-color: var(--deep-red);
    color: white;
}

/* Form elements */
.input:focus,
.textarea:focus,
.select select:focus {
    border-color: var(--ink);
    box-shadow: 0 0 0 0.125em rgba(33, 29, 26, 0.25);
}

/* Tables */
.table thead th {
    border-bottom: 2px solid var(--rule);
    color: var(--ink);
}

.table.is-striped tbody tr:not(.is-selected):nth-child(even) {
    background-color: var(--paper-deep);
}

/* Panel customizations */
.panel-heading {
    background-color: var(--ink);
    color: white;
}

.panel-block:hover {
    background-color: var(--paper);
}

.panel-icon {
    color: var(--deep-red);
}

/* Message customizations */
.message.is-primary {
    background-color: var(--surface);
}

.message.is-primary .message-header {
    background-color: var(--second);
    color: white;
}

.message.is-primary .message-body {
    background-color: var(--surface);
    border: 1px solid var(--rule);
    border-top: 0;
    color: var(--ink);
}

.message.is-secondary {
    background-color: #ffe6e6;
}

.message.is-secondary .message-header {
    background-color: var(--deep-red);
    color: white;
}

.message.is-secondary .message-body {
    border-color: var(--deep-red);
    color: var(--ink);
}

/* Notification customizations */
.notification.is-secondary {
    background-color: var(--deep-red);
    color: white;
}

/* Progress bar customizations */
.progress.is-secondary {
    background-color: #ffcccc;
}

.progress.is-secondary::-webkit-progress-value {
    background-color: var(--deep-red);
}

.progress.is-secondary::-moz-progress-bar {
    background-color: var(--deep-red);
}

.progress.is-secondary::-ms-fill {
    background-color: var(--deep-red);
}

/* Custom helper classes */
.section-divider {
    border-top: 1px solid var(--rule);
    margin: 3rem 0;
}

/* Footer customization */
.footer {
    background-color: var(--ink);
    color: white;
}

.footer a {
    color: var(--paper);
}

.footer a:hover {
    color: white;
}

/* Enhance focus states for accessibility */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(33, 29, 26, 0.5);
    outline-offset: 2px;
}

h1::after {
    content: "";
    display: block;
    bottom: -10px;
    left: 0;
    width: 100%;
    height: 1px;
    margin-top: 0.5rem;
    background: var(--ink);
}

/* Budget user page */
.projects-featured {
    background-color: var(--second);
    padding: 1.5rem;
}

.projects-featured > .title {
    color: white;
}

.project-card-event {
    border-top: 1px solid var(--rule);
    padding-top: 0.75rem;
}

.project-card-event time {
    color: var(--muted);
    font-size: 0.875rem;
}

/* Project page */
.project-timeline {
    list-style: none;
    margin: 0;
    border-inline-start: 2px solid var(--second);
}

.project-timeline li {
    position: relative;
    padding-inline-start: 1.5rem;
    padding-bottom: 2rem;
}

.project-timeline li:last-child {
    padding-bottom: 0;
}

.project-timeline li::before {
    content: "";
    position: absolute;
    inset-inline-start: -7px;
    top: 0.3rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--deep-red);
}

.project-timeline time,
.project-timeline-domain,
.project-fact-meta time,
.project-partner-oib {
    color: var(--muted);
    font-size: 0.875rem;
}

.project-timeline-title {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.3;
}

.project-timeline-title a,
.project-partners a {
    color: var(--deep-red);
    font-weight: 700;
}

.project-timeline-title a:hover,
.project-partners a:hover {
    color: var(--deep-red-light);
}

.project-timeline-image {
    display: block;
    max-width: 100%;
    height: auto;
    margin-block: 0.75rem;
}

.project-fact-meta {
    margin-bottom: 0.5rem;
}

.project-fact-type {
    background-color: var(--second);
    color: white;
}

.project-partners {
    margin-top: 1rem;
    border-top: 1px solid var(--rule);
}

.project-partners li {
    padding-block: 0.75rem;
    border-bottom: 1px solid var(--rule);
}

.project-partners li:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

/* Article page */
.article-header .title.is-1 {
    font-size: clamp(2rem, 1.4rem + 3vw, 3rem);
    line-height: 1.15;
}

.article-header time {
    color: var(--muted);
    font-size: 0.875rem;
}

.article-nav {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    margin-top: 3rem;
    padding-top: 1rem;
    border-top: 1px solid var(--ink);
}

.article-nav-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 400;
}

.article-nav a:last-child:not(:first-child) {
    text-align: right;
}

@media screen and (max-width: 768px) {
    .article-nav {
        flex-direction: column;
        gap: 1rem;
    }

    .article-nav a:last-child:not(:first-child) {
        text-align: left;
    }
}

.content-article {
    font-family: var(--font-serif);
    font-optical-sizing: auto;
    font-style: normal;
    font-size: clamp(1.125rem, 1.08rem + 0.2vw, 1.1875rem);
    line-height: 1.6;
}

/* Tables in article body (Wagtail TableBlock) */
.content-article table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-ui);
    font-size: 0.875rem;
}

.content-article table caption {
    caption-side: top;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--ink);
    padding-bottom: 0.75rem;
}

/* Thin rule like h1::after */
.content-article table caption::after {
    content: "";
    display: block;
    width: 100%;
    height: 1px;
    margin-top: 0.5rem;
    background: var(--ink);
}

.content-article table th,
.content-article table td {
    border: 1px solid var(--rule);
    padding: 0.5em 0.75em;
}

/* Bulma's .content removes the bottom border of the last row */
.content-article table tbody tr:last-child td,
.content-article table tbody tr:last-child th {
    border-bottom-width: 1px;
}

.content-article table thead th {
    background-color: var(--ink);
    border-color: var(--ink);
    color: white;
}

.content-article table tbody th {
    background-color: var(--paper);
    color: var(--ink);
}

.content-article table tbody tr:nth-child(even) td {
    background-color: var(--paper-deep);
}
