:root {
    --bg: #fbf9f6;
    --fg: #221d17;
    --muted: #7a7168;
    --accent: #b5541a;
    --accent-fg: #fffaf5;
    --accent-soft: rgba(181, 84, 26, 0.09);
    --line: #e8e1d8;
    --card-bg: #ffffff;
    --shadow: rgba(34, 29, 23, 0.08);
}

[data-theme="dark"] {
    --bg: #171310;
    --fg: #f2ece3;
    --muted: #a89a89;
    --accent: #e8894a;
    --accent-fg: #1a1108;
    --accent-soft: rgba(232, 137, 74, 0.14);
    --line: #2c261f;
    --card-bg: #1e1811;
    --shadow: rgba(0, 0, 0, 0.4);
}

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

body {
    background-color: var(--bg);
    color: var(--fg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

::selection {
    background: var(--accent);
    color: var(--accent-fg);
}

.page {
    max-width: 760px;
    margin: 0 auto;
    padding: 6rem 1.75rem 5rem;
}

/* ---------- Hero ---------- */
.hero {
    padding-bottom: 3rem;
    border-bottom: 1px solid var(--line);
}

.eyebrow {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.9rem;
}

h1 {
    font-size: clamp(2.2rem, 5vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.tagline {
    max-width: 46ch;
    margin-top: 1rem;
    color: var(--muted);
    font-size: 1.05rem;
}

.location {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-top: 1.1rem;
    font-size: 0.88rem;
    color: var(--muted);
}

.pulse {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
    animation: pulse 2.4s ease-out infinite;
}

@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 var(--accent); opacity: 1; }
    70%  { box-shadow: 0 0 0 7px transparent; opacity: 0.7; }
    100% { box-shadow: 0 0 0 0 transparent; opacity: 1; }
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1.75rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.55rem 1.05rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--fg);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
}

.btn:hover,
.btn:focus-visible {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-fg);
}

.btn-primary:hover,
.btn-primary:focus-visible {
    filter: brightness(1.08);
}

a:focus-visible,
.theme-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

/* ---------- Section blocks ---------- */
.block {
    margin-top: 3.5rem;
}

.block h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 50%;
    border: 1px solid var(--accent);
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
}

.prose p {
    color: var(--muted);
    max-width: 62ch;
}

.prose p + p {
    margin-top: 0.9rem;
}

/* ---------- Timeline ---------- */
.timeline {
    list-style: none;
    position: relative;
    padding-left: 1.6rem;
    border-left: 1px solid var(--line);
}

.timeline li {
    position: relative;
    padding-bottom: 1.6rem;
}

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

.timeline .dot {
    position: absolute;
    left: -1.85rem;
    top: 0.35rem;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--accent);
}

.timeline .role {
    font-weight: 700;
    font-size: 0.98rem;
}

.timeline .org {
    color: var(--muted);
    font-size: 0.9rem;
    margin-top: 0.15rem;
}

.timeline .when {
    color: var(--muted);
    font-size: 0.8rem;
    margin-top: 0.3rem;
    letter-spacing: 0.02em;
}

/* ---------- Project grid ---------- */
.grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1.35rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px var(--shadow);
    border-color: var(--accent);
}

.card h3 {
    font-size: 1rem;
    font-weight: 700;
}

.card p {
    color: var(--muted);
    font-size: 0.88rem;
    margin-top: 0.4rem;
    line-height: 1.5;
}

.card a {
    display: inline-block;
    margin-top: 0.9rem;
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
}

.card a:hover,
.card a:focus-visible {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.responsive-img {
  max-width: 100%; /* Image will shrink if container is smaller than its actual width */
  height: auto;    /* Maintains the original aspect ratio to avoid distortion */
  display: block;  /* Removes extra inline whitespace below the image */
}
/* ---------- Footer ---------- */
footer {
    margin-top: 4.5rem;
    padding-top: 1.75rem;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.85rem;
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    background: var(--card-bg);
    border: 1px solid var(--line);
    border-radius: 50%;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.4s ease;
}

.theme-toggle:hover {
    border-color: var(--accent);
    transform: rotate(20deg);
}

.theme-toggle img {
    width: 16px;
    height: 16px;
    display: block;
}

[data-theme="dark"] .theme-toggle img {
    filter: invert(1);
}

/* ---------- Scroll reveal ---------- */
.reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
    opacity: 1;
    transform: none;
}

/* ---------- Responsive ---------- */
@media screen and (max-width: 640px) {
    .page {
        padding: 5rem 1.25rem 3.5rem;
    }

    .grid {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }
}
