/* Colour palette */
:root {
    --bg: #0e1116; /* Page background */
    --surface: #161b22; /* Card background */
    --text: #e6edf3; /* Main text */
    --muted: #8b949e; /* Grey text for dates etc. */
    --accent: #7c5cff; /* Accent colour for links and highlights */
    --border: #2a313c; /* Border colour */
}

/* Light theme: used when <html> has class "light" */
:root.light {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --text: #1b1f24;
    --muted: #57606a;
    --accent: #5b3cf0;
    --border: #e1e4e8;
}

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

/* Theme button: outlined "secondary" style */
#theme-toggle {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

#theme-toggle:hover {
    border-color: var(--accent);
}

/* Whole page */
body {
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, sans-serif;
    line-height: 1.6;
    margin: 0;
}

/* Links */
a {
    color: var(--accent);
    text-decoration: none;
    background-image: linear-gradient(currentColor, currentColor);
    background-size: 0% 1px;
    background-position: 0 100%;
    background-repeat: no-repeat;
    transition: background-size 0.25s;
}

a:hover {
    background-size: 100% 1px;
}

.arrow {
    display: inline-block;
    transition: transform 0.2s;
}

.project:hover .arrow {
    transform: translateX(4px);
}

/* Date and organization text */
.date,
.org {
    color: var(--muted);
}

.org {
    margin: 0.2rem 0 0.5rem;
}

.date {
    font-size: 0.9rem;
}

section {
    margin-bottom: 2rem;
}

/* Paper like panel */
.cv {
    max-width: 860px;
    margin: 2rem auto;
    padding: 2.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
}

/* Header and contact info */
header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;

    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);

    gap: 1rem 2rem;
}

.intro h1,
.intro p {
    margin: 0;
}

h1 {
    line-height: 1.2;
}

.role {
    color: var(--accent);
    font-size: 1.2rem;
}

.contact {
    list-style: none;
    padding: 0;
    margin: 0;
}

.location {
    color: var(--muted);
}

/* Title on the left, date on  the right */
.entry-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.entry h3 {
    margin: 0;
}

/* The list: remove bullets, lay items out in a wrapping row */
.chips {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Each skill: a pill */
.chips li {
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
}

/* The grid of cards */
.projects {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

/* Each card */
.project {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    gap: 0.6rem;

    display: flex;
    flex-direction: column;

    transition: border-color 0.2s;
}

.project:hover {
    border-color: var(--accent);
}

/* Card tags */
.project .tags {
    color: var(--muted);
    font-size: 0.85rem;
    font-family: monospace;

    margin-top: auto;
    margin-bottom: 0;
}

.project h3,
.project p {
    margin: 0;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    position: sticky; 
    top: 0; 
}

.toolbar-actions {
    display: flex;
    gap: 0.5rem;
}

.logo {
    font-family: monospace;
    font-weight: bold;
    color: var(--accent);
}

button {
    font: inherit; 
    cursor: pointer; 
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.4rem 0.9rem;
}

button:hover {
    filter: brightness(1.15);
}

/* Print / PDF */
@media print {
    /* Black on white colours for paper */
    :root,
    :root.light {
        --bg: #fff;
        --surface: #fff;
        --text: #000;
        --muted: #444;
        --border: #ccc;
        --accent: #3a24b8;
    }

    /* A4 page with sensible margins */
    @page {
        size: A4;
        margin: 14mm;
    }

    /* Hide the toolbar and anything else marked no-print */
    .no-print {
        display: none;
    }

    /* Smaller text and tighter spacign to fit on fewer pages */
    body {
        font-size: 10pt;
        line-height: 1.4;
    }

    header,
    main,
    footer {
        max-width: none;
        padding: 0;
    }

    section {
        margin-bottom: 1rem;
    }

    /* Never split a card or a job across two pages */
    .entry,
    .project {
        break-inside: avoid;
    }

    .cv {
        margin: 0;
        padding: 0;
        border: none;
        max-width: none;
    }
}

/* Phones: no panel, full width */
@media (max-width: 640px) {
    .cv {
        margin: 0;
        padding: 1.25rem;
        border: none;
        border-radius: 0;
    }
}