:root {
    --primary-color-1: #4A8267;
    --primary-color-2: #316C50;
    --primary-color-3: #1C5B3D;
    --primary-color-4: #0B4428;
    --primary-color-5: #002B16;
    
    --secondary-color-1: #446A74;
    --secondary-color-2: #2D5561;
    --secondary-color-3: #1B4551;
    --secondary-color-4: #0B323D;
    --secondary-color-5: #011E27;
    
    --accent-color-1: #75A25D;
    --accent-color-2: #57873D;
    --accent-color-3: #3F7224;
    --accent-color-4: #26550E;
    --accent-color-5: #133600;
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    margin: 0;
}

/* Typography */
h1 {
    color: var(--primary-color-2);
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

h2 {
    color: var(--primary-color-3);
    font-size: 1.8rem;
    margin: 1.5rem 0 0.5rem 0;
    font-weight: 500;
}

h3 {
    color: var(--primary-color-4);
    font-size: 1.3rem;
    margin: 1rem 0;
}

p {
    margin: 0.8rem 0;
    color: #444;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation: primary-color-2 keeps white link text at >= 4.5:1 contrast (WCAG AA) */
nav {
    background-color: var(--primary-color-2);
    padding: 15px 0;
    margin-bottom: 2rem;
}

nav a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    padding: 5px 10px;
    transition: background-color 0.2s;
}

nav a:hover {
    background-color: rgba(255,255,255,0.2);
    border-radius: 4px;
}

/* Links: accent-color-3 is >= 4.5:1 on the page background (accent-2 was only ~4.0:1) */
a {
    color: var(--accent-color-3);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-color-4);
    text-decoration: underline;
}

/* Visible keyboard focus for every interactive element (WCAG 2.4.7). currentColor keeps
   the ring visible on both the light content area and the dark nav bar. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 2px;
}

/* Buttons and button-styled links: a single element per action, never an <a> wrapping
   a <button> (nested interactive elements are invalid HTML and confuse assistive tech) */
button,
a.button {
    display: inline-block;
    background-color: var(--secondary-color-2);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: none;
    transition: background-color 0.2s;
}

button:hover,
a.button:hover {
    background-color: var(--secondary-color-1);
    color: white;
    text-decoration: none;
}

/* Skip link: hidden until it receives keyboard focus, then overlays the top of the page */
.skip-link {
    position: absolute;
    left: 1rem;
    top: -4rem;
    z-index: 100;
    background-color: var(--primary-color-5);
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 1rem;
    color: white;
}

/* Visually hidden but available to screen readers */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* Lists */
ul {
    list-style-type: none;
    padding-left: 20px;
}

ul li {
    margin: 0.5rem 0;
    padding-left: 10px;
    position: relative;
}

ul li::before {
    content: "•";
    color: var(--accent-color-3);
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* Cards */
.article-card {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.article-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.article-title {
    color: var(--primary-color-2);
    margin-bottom: 0.5rem;
}

/* Section styling */
.section-header {
    background-color: var(--primary-color-5);
    color: white;
    padding: 10px 15px;
    border-radius: 4px;
    margin: 1.5rem 0;
    font-weight: 600;
}

/* Editor toolbar */
.editor-toolbar {
    background-color: var(--secondary-color-3);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 2rem;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.editor-toolbar a {
    color: white;
}

/* Timestamps on article pages and listings: #595959 for >= 4.5:1 on the page background */
.dates,
.date {
    color: #595959;
    font-size: 0.85rem;
}

/* Pagination controls under long listings */
.pagination {
    color: #595959;
    font-size: 0.85rem;
}

/* Helper text under form fields (e.g. the upload size limit) */
.hint {
    color: #595959;
    font-size: 0.85rem;
}

/* Form fields: explicit border (>= 3:1 against the background) and full-width text inputs
   instead of the presentational size attribute */
input[type="text"],
textarea {
    font: inherit;
    color: #333;
    background-color: white;
    border: 1px solid #767676;
    border-radius: 4px;
    padding: 6px 8px;
}

input[type="text"] {
    width: 100%;
    max-width: 40rem;
}

/* Destructive submit on the deletion confirmation page */
button.danger {
    background-color: #8B1A1A;
}

button.danger:hover {
    background-color: #6E1414;
}

/* Article body */
.article-body {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    margin: 1.5rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Inline article images: full width inside the article, never wrapped like text */
.article-image {
    margin: 1.5em 0;
}

.article-image img {
    max-width: 100%;
    height: auto;
    display: block;
}

.article-image figcaption {
    font-size: 0.9em;
    color: #595959;
    margin-top: 0.4em;
}

/* Block editor: each block row is a card; the dashed insert slots sit between the rows */
.edit-block {
    background-color: white;
    border-radius: 8px;
    padding: 16px 20px;
    margin: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.edit-block textarea {
    width: 100%;
    max-width: 100%;
}

.edit-block .edit-image {
    margin: 0 0 0.8rem 0;
}

.edit-block .edit-image img {
    max-width: 320px;
    height: auto;
}

.edit-block .block-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    align-items: center;
}

.insert-slot {
    border: 1px dashed #767676;
    border-radius: 8px;
    background-color: white;
    padding: 12px 20px;
    margin: 0.6rem 0;
}

/* A form that holds a single small button next to other controls */
.inline-form {
    display: inline-block;
    margin-right: 0.4rem;
}

/* Footer */
.footer {
    margin-top: 3rem;
    padding: 2rem 0;
    border-top: 1px solid #e0e0e0;
    color: #666;
    text-align: center;
}

/* Respect users who prefer no motion: kill transitions/animations and the hover lift */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .article-card:hover {
        transform: none;
    }
}

/* Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    nav {
        flex-direction: column;
    }
    
    .editor-toolbar {
        flex-direction: column;
    }

    .editor-toolbar .button {
        width: 100%;
    }
}
