/* ================================
   CSS Custom Properties
   ================================ */
:root {
    --color-bg: #ffffff;
    --color-text: #1a1a1a;
    --color-text-light: #666666;
    --color-border: #e5e5e5;
    --color-timeline: #1a1a1a;
    --font-system: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --max-width: 650px;
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 3rem;
    --spacing-xl: 5rem;
    --transition-speed: 200ms;
}

/* Dark Mode */
[data-theme="dark"] {
    --color-bg: #0a0a0a;
    --color-text: #e5e5e5;
    --color-text-light: #999999;
    --color-border: #2a2a2a;
    --color-timeline: #e5e5e5;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-system);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

/* ================================
   Typography
   ================================ */
h1 {
    font-size: 3rem;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: var(--spacing-sm);
}

h2 {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: var(--spacing-xs);
}

h3 {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: var(--spacing-xs);
}

p {
    margin-bottom: var(--spacing-md);
}

p:last-child {
    margin-bottom: 0;
}

/* ================================
   Links
   ================================ */
a {
    color: var(--color-text);
    text-decoration: underline;
    transition: opacity var(--transition-speed) ease;
}

a:hover {
    opacity: 0.7;
}

a:focus {
    outline: 2px solid var(--color-text);
    outline-offset: 2px;
}

/* ================================
   Layout Container
   ================================ */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--spacing-md);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ================================
   Hero Section (Landing Page)
   ================================ */
.hero {
    margin-top: var(--spacing-xl);
    margin-bottom: var(--spacing-lg);
    text-align: center;
}

.tagline {
    font-size: 1.25rem;
    color: var(--color-text-light);
    margin-bottom: 0;
}

/* ================================
   Page Header (Subpages)
   ================================ */
.page-header {
    margin-top: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.page-header h1 {
    font-size: 1.5rem;
}

.home-link {
    text-decoration: none;
}

.home-link:hover {
    text-decoration: underline;
}

/* ================================
   Theme Toggle
   ================================ */
.theme-toggle {
    position: fixed;
    top: var(--spacing-md);
    right: var(--spacing-md);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: opacity var(--transition-speed) ease;
}

.theme-toggle:hover {
    opacity: 0.7;
}

.theme-toggle svg {
    width: 24px;
    height: 24px;
    stroke: var(--color-text);
    fill: none;
    transition: stroke var(--transition-speed) ease;
}

/* ================================
   Navigation
   ================================ */
.main-nav {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xl);
    align-items: center;
}

.main-nav a {
    font-size: 1.125rem;
    text-decoration: none;
}

.main-nav a:hover {
    text-decoration: underline;
}

.main-nav a.active {
    text-decoration: underline;
}

/* ================================
   Content Sections
   ================================ */
.content {
    flex: 1;
    margin-bottom: var(--spacing-xl);
}

/* ================================
   About Page
   ================================ */
.about-title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
}

.bio p {
    margin-bottom: var(--spacing-md);
    line-height: 1.7;
}

.bio-section-title {
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.4rem !important;
}

.bio-list {
    margin: 0 0 0.75rem var(--spacing-md);
    padding: 0;
    list-style-position: outside;
}

.bio-list li {
    margin-bottom: 0.3rem;
    line-height: 1.6;
}

.section-divider {
    width: 100%;
    height: 2px;
    background: repeating-linear-gradient(
        to right,
        var(--color-border) 0,
        var(--color-border) 8px,
        transparent 8px,
        transparent 16px
    );
    margin: var(--spacing-lg) 0;
}

/* ================================
   Experience Page
   ================================ */
.exp-page-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 0;
}

.exp-page-header .about-title {
    margin-bottom: 0;
}

.cv-download {
    font-size: 0.8125rem;
    color: var(--color-text-light);
    text-decoration: none;
    letter-spacing: 0.03em;
    transition: color var(--transition-speed) ease;
}

.cv-download:hover {
    color: var(--color-text);
    opacity: 1;
}

/* ---- BBC-style dotted timeline ---- */

.tl-container {
    position: relative;
    margin-top: var(--spacing-lg);
    padding-left: 68px;
}

/* The dotted vertical spine */
.tl-container::before {
    content: '';
    position: absolute;
    left: 23px;
    top: 0;
    bottom: 0;
    width: 2px;
    background-image: radial-gradient(circle, var(--color-text) 1.5px, transparent 1.5px);
    background-size: 2px 10px;
    background-repeat: repeat-y;
}

/* Each company block */
.tl-entry {
    position: relative;
    margin-bottom: 3.5rem;
}

.tl-entry:last-child {
    margin-bottom: 0;
}

/* Numbered circle sitting on the line */
.tl-marker {
    position: absolute;
    left: -68px;
    top: 0;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--color-text);
    color: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9375rem;
    /* Ring of bg color so dot line doesn't bleed through */
    box-shadow: 0 0 0 5px var(--color-bg);
    z-index: 1;
}

/* Company name + meta */
.tl-company {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
    padding-top: 0.6rem;
    line-height: 1.3;
}

.tl-company-meta {
    font-size: 0.8125rem;
    color: var(--color-text-light);
    margin-bottom: 0;
}

/* Individual role within a company */
.tl-role {
    margin-top: 1rem;
}

.tl-role-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 0.25rem;
}

.tl-role-title {
    font-size: 0.9rem;
    font-style: italic;
    color: var(--color-text-light);
}

.tl-role-dates {
    font-size: 0.8125rem;
    color: var(--color-text-light);
    flex-shrink: 0;
    white-space: nowrap;
}

.tl-desc {
    font-size: 0.9rem;
    line-height: 1.75;
    margin-bottom: 0;
    text-align: justify;
    hyphens: auto;
}

/* Awards */
.awards-section {
    margin-top: var(--spacing-lg);
}

.awards-title {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-light);
    margin-bottom: var(--spacing-md);
}

.awards-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.award-row {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.award-left {
    flex: 1;
    min-width: 0;
}

.award-name {
    font-size: 0.9375rem;
    font-weight: 500;
    margin-bottom: 0.15rem;
    line-height: 1.4;
}

.award-meta {
    font-size: 0.8125rem;
    color: var(--color-text-light);
    margin-bottom: 0;
    line-height: 1.5;
}

.award-year {
    flex-shrink: 0;
    width: 80px;
    text-align: right;
    font-size: 0.8125rem;
    color: var(--color-text-light);
    padding-top: 0.1rem;
}

@media (max-width: 560px) {
    .exp-page-header {
        flex-direction: column;
        gap: 0.4rem;
        align-items: flex-start;
    }

    .tl-container {
        padding-left: 56px;
    }

    .tl-marker {
        left: -56px;
        width: 38px;
        height: 38px;
        font-size: 0.8125rem;
    }

    .tl-container::before {
        left: 19px;
    }
}

/* Company list */
.exp-list {
    margin-top: var(--spacing-lg);
}

.company-block {
    padding-top: 2rem;
    padding-bottom: 0.25rem;
    border-top: 1px solid var(--color-border);
}

/* Company header: name left, meta right */
.company-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 0.35rem;
}

.company-name {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 0;
    line-height: 1.3;
}

.company-meta {
    font-size: 0.8125rem;
    color: var(--color-text-light);
    flex-shrink: 0;
}

/* Role row: title+desc left, date right */
.role-row {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    margin-top: 1.1rem;
}

.role-left {
    flex: 1;
    min-width: 0;
}

.role-right {
    flex-shrink: 0;
    width: 120px;
    text-align: right;
    padding-top: 0.1rem;
}

.role-title {
    font-size: 0.9375rem;
    font-weight: 500;
    margin-bottom: 0.2rem;
    line-height: 1.4;
    font-style: italic;
}

.role-desc {
    font-size: 0.9rem;
    line-height: 1.75;
    color: var(--color-text);
    margin-bottom: 0;
}

.role-dates {
    font-size: 0.8125rem;
    color: var(--color-text-light);
    line-height: 1.5;
}

/* Awards */
.awards-section {
    margin-top: var(--spacing-lg);
}

.awards-title {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-light);
    margin-bottom: 0;
}

.awards-list {
    display: flex;
    flex-direction: column;
}

.award-row {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    padding-top: 1.5rem;
    padding-bottom: 0.25rem;
    border-top: 1px solid var(--color-border);
    margin-top: 1rem;
}

.award-row:first-child {
    margin-top: 1rem;
}

.award-left {
    flex: 1;
    min-width: 0;
}

.award-name {
    font-size: 0.9375rem;
    font-weight: 500;
    margin-bottom: 0.15rem;
    line-height: 1.4;
}

.award-meta {
    font-size: 0.8125rem;
    color: var(--color-text-light);
    margin-bottom: 0;
    line-height: 1.5;
}

.award-year {
    flex-shrink: 0;
    width: 120px;
    text-align: right;
    font-size: 0.8125rem;
    color: var(--color-text-light);
    padding-top: 0.1rem;
}

@media (max-width: 560px) {
    .exp-page-header {
        flex-direction: column;
        gap: 0.4rem;
        align-items: flex-start;
    }

    .role-right,
    .award-year {
        width: 90px;
    }
}

/* ================================
   Writing Section (Posts Style)
   ================================ */
.posts-title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: var(--spacing-xl);
    text-transform: uppercase;
}

.posts-year {
    margin-bottom: calc(var(--spacing-xl) + var(--spacing-lg));
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: var(--spacing-lg);
}

.year-header {
    font-size: 2.5rem;
    font-weight: 400;
    color: var(--color-text-light);
    line-height: 1.2;
}

.posts-list {
    display: flex;
    flex-direction: column;
}

.post-entry {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: var(--spacing-md) 0;
    border-bottom: 2px dashed var(--color-border);
    gap: var(--spacing-md);
}

.post-entry:last-child {
    border-bottom: none;
}

.post-title {
    flex: 1;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    text-decoration: none;
    color: var(--color-text);
}

.post-title:hover {
    text-decoration: underline;
}

a.post-title {
    cursor: pointer;
}

.post-date {
    flex-shrink: 0;
    font-size: 0.875rem;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 400;
}

/* Mobile: Stack year and posts */
@media (max-width: 767px) {
    .posts-year {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
        margin-bottom: var(--spacing-xl);
    }

    .year-header {
        font-size: 2rem;
    }

    .post-entry {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-xs);
    }

    .post-date {
        font-size: 0.8125rem;
    }
}

/* ================================
   Footer
   ================================ */
.footer {
    margin-top: auto;
    padding-top: var(--spacing-lg);
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.footer-links a {
    font-size: 0.9375rem;
}

.footer-separator {
    color: var(--color-text-light);
    user-select: none;
}

.copyright {
    font-size: 0.875rem;
    color: var(--color-text-light);
    margin-bottom: 0;
}

/* ================================
   Responsive Design
   ================================ */

/* Mobile Optimization */
@media (max-width: 767px) {
    :root {
        --spacing-xl: 3rem;
        --spacing-lg: 2rem;
    }

    h1 {
        font-size: 2.5rem;
    }

    .tagline {
        font-size: 1.125rem;
    }

    .main-nav {
        gap: 0.75rem;
    }

    .container {
        padding: var(--spacing-sm);
    }
}

/* Desktop */
@media (min-width: 768px) {
    .container {
        padding: var(--spacing-lg) var(--spacing-md);
    }

    .hero {
        margin-top: 8rem;
    }
}

/* Large Desktop */
@media (min-width: 1024px) {
    :root {
        --spacing-xl: 6rem;
    }
}

/* ================================
   Print Styles
   ================================ */
@media print {
    body {
        background: white;
        color: black;
    }

    a {
        text-decoration: underline;
    }

    .footer-links a::after {
        content: " (" attr(href) ")";
    }
}
