:root {
    --bg-color: #f8f9fb;
    --surface-color: #ffffff;
    --surface-color-muted: #f8f9fb;
    --border-color: #e5e7eb;
    --text-color: #1f2933;
    --subtext-color: #6b7280;
    --accent-color: teal;
    --backdrop-color: rgba(0, 0, 0, 0.5);
    --techstack-background: color-mix(in srgb, teal 12%, transparent);
    --techstack-background-hover: color-mix(in srgb, teal 25%, transparent);
    --techstack-text: teal;
    --techstack-border: color-mix(in srgb, teal 35%, transparent);
    --timeline-color: color-mix(in srgb, teal 30%, transparent);

    --main-font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;

    --small-radius: 8px;
    --medium-radius: 12px;

    --small-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    --medium-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);

    --theme-icon-size: 1.5rem;
    --icon-size: 2rem;
    --timeline-width: 2px;
    --timeline-dot-size: 10px;
    --timeline-offset: 3.5rem;
    --timeline-line-offset: 1.5rem;
}

:root[data-theme="dark"] {
    --bg-color: #0f172a;
    --surface-color: #111827;
    --surface-color-muted: #1f2937;
    --border-color: #374151;
    --text-color: #e5e7eb;
    --subtext-color: #9ca3af;
    --accent-color: #38bdf8;
    --backdrop-color: rgba(0, 0, 0, 0.7);
    --techstack-background: color-mix(in srgb, #38bdf8 18%, transparent);
    --techstack-background-hover: color-mix(in srgb, #38bdf8 25%, transparent);
    --techstack-text: #38bdf8;
    --techstack-border: color-mix(in srgb, #38bdf8 45%, transparent);
    --timeline-color: color-mix(in srgb, #38bdf8 30%, transparent);
}

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

body {
    background-color: var(--bg-color);
    font-family: var(--main-font);
    font-weight:400;
    color:var(--text-color);
    margin: 0;
    padding: 0;
}

/* HEADER */
#header {
    height:fit-content;
    margin:0;
    padding: 20px;
    text-align: center;
}

#header p {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}



/* MAIN */

#themeToggle {
    position: absolute;
    top: 1rem;
    right:1rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 0.5rem 0.5rem;
    cursor: pointer;
}

#themeToggle .icon {
    width: var(--theme-icon-size);
    height: var(--theme-icon-size);
}

.icon {
    width: var(--icon-size);
    height: var(--icon-size);
}

#content {
    max-width: 1200px;
    height:fit-content;
    padding:20px;
    margin-inline:auto;
}

.section {
    padding:3rem;
    margin-bottom: 3rem;
    background-color: var(--surface-color);
    border-radius: var(--medium-radius);
    box-shadow: var(--small-shadow);
}

h1 {
    font-weight:900;
    letter-spacing:-0.03em;
}

.section-header {
    color: var(--accent-color);
    margin-bottom:1.5rem;
    font-size: 1.4rem;
    font-weight: 700;
}

.sub-heading {
    margin-top:2rem;
    margin-bottom:0.5rem;
}

.body-text {
    line-height:1.6;
}

.items-grid {
    display:grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap:1rem;
}

.item {
    background-color: var(--surface-color-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--small-radius);
    padding: 1.25rem;
    cursor:pointer;

    font-family:inherit;
    color:inherit;

    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.item:hover {
    transform: translateY(-2px);
    box-shadow: var(--medium-shadow);
    border-color: var(--accent-color);
}

.item:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 3px;
}

.item-text {
    font-weight: 600;
}

.item-subtext {
    display:block;
    font-size: 0.85rem;
    color: var(--subtext-color);
    margin-top: 0.25rem;
}

/* EXPERIENCE TIMELINE */
.timeline {
    position:relative;
    padding-left: var(--timeline-offset);
}

.timeline::before {
    content: "";
    position:absolute;
    top:0;
    left: var(--timeline-line-offset);
    width:var(--timeline-width);
    height: 100%;
    background-color: var(--timeline-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 2.5rem;
}

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

.timeline-dot {
    position: absolute;
    left: calc((var(--timeline-line-offset) - var(--timeline-offset)) - (var(--timeline-dot-size) / 2 - var(--timeline-width) / 2));
    top: 0.4rem;
    width: var(--timeline-dot-size);
    height: var(--timeline-dot-size);
    border-radius: 50%;
    background-color: var(--accent-color);
}

.timeline-content {
    background: transparent;
}

.role {
    font-weight: 600;
    font-size: 1.05rem;
    margin-bottom: 0.15rem;
}

.company {
    font-size: 0.95rem;
    color: var(--subtext-color);
    margin-bottom: 0.15rem;
}

.date {
    font-size: 0.85rem;
    color: var(--subtext-color);
    margin-bottom: 0.75rem;
}

.summary {
    line-height: 1.6;
    max-width: 60ch;
}

/* FORM */
.contact-form {
    max-width:600px;
    margin-top:2rem;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1.25rem;
}

.form-field label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--subtext-color);
}

.form-field input, .form-field textarea {
    font-family: inherit;
    font-size: 0.95rem;
    padding: 0.65rem 0.75rem;

    background-color: var(--surface-color-muted);
    color: var(--text-color);

    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.form-field textarea {
    resize: vertical;
}

.form-field input:focus, .form-field textarea:focus {
    outline:none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-color) 20%, transparent);
    background-color: var(--surface-color);
}

.form-submit {
    margin-top: 0.5rem;
    padding: 0.65rem 1.25rem;

    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;

    background-color: var(--accent-color);
    color: white;

    border: none;
    border-radius: 999px;
    cursor: pointer;

    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.form-submit:hover {
    transform: translateY(-1px);
    box-shadow: var(--small-shadow);
}

.form-submit:active {
    transform: translateY(0);
    box-shadow: none;
}

.form-submit:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--accent-color) 40%, transparent);
    outline-offset: 3px;
}

/* FOOTER */
#footer {
    width: 100%;
    height:fit-content;
    padding:20px;
}

#socialLinks {
    display:flex;
    flex-wrap:wrap;
    gap:1rem;
    justify-content:center;
    width:100%;
    height:100%;
}

/* MODAL */
.modal-backdrop {
    position:fixed;
    inset:0;
    background-color: var(--backdrop-color);

    display: grid;
    place-items: center;
    z-index: 1000;
}

.modal-backdrop[hidden] {
    display: none;
}

.modal {
    background-color: var(--surface-color);
    color: var(--text-color);
    border-radius: var(--medium-radius);
    padding: 2rem;
    width: min(90%, 500px);
    box-shadow: var(--medium-shadow);

    transform: translateY(20px);
    opacity: 0;
}

.modal.is-open {
    transform: translateY(0);
    opacity: 1;
}

.modal.is-opening {
    animation: modalIn 0.25s ease forwards;
}

.modal.is-closing {
    animation: modalOut 0.2s ease forwards;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right:1rem;

    background:none;
    border:none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
}

@keyframes modalIn {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes modalOut {
    to {
        transform: translateY(20px);
        opacity: 0;
    }
}

.modal-image {
    width: 100%;
    border-radius: var(--small-radius);
    margin-bottom: 1rem;
}

.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0 0;
    padding: 0;
    list-style: none;
}

.tech-stack[hidden] {
    display: none;
}

.tech-stack li {
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 999px;
    background-color: var(--techstack-background);
    color: var(--techstack-text);
    border: 1px solid var(--techstack-border);
    white-space: nowrap;
}

.tech-stack li:hover {
    background-color: var(--techstack-background-hover);
}

.modal-link {
    display: inline-block;
    margin-top: 1rem;
    color: var(--accent-color);
    font-weight: 500;
    text-decoration: none;
}

.modal-link[hidden] {
    display: none;
}

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

/* ENTRY ANIMATIONS */
.reveal {
    opacity: 0;
    transform: translateY(20px);
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

@media (max-width: 768px) {
    /* GLOBAL SPACING */
    #content {
        padding: 1rem;
    }

    .section {
        padding: 1.75rem;
        margin-bottom: 2rem;
    }

    #themeToggle {
        top: 0.5rem;
        right: 0.5rem;
        padding: 0.5rem;
    }

    /* HEADER */
    #header {
        padding: 1.5rem 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    .section-header {
        font-size: 1.25rem;
    }

    /* ITEMS GRID  */
    .items-grid {
        grid-template-columns: 1fr;
    }

    .item {
        padding: 1.5rem;
    }

    /* TIMELINE */
    .timeline {
        padding-left: 2.5rem;
    }

    .timeline::before {
        left: 1rem;
    }

    .timeline-dot {
        left: calc((1rem - 2.5rem) - (var(--timeline-dot-size) / 2 - var(--timeline-width) / 2));
    }

    .summary {
        max-width: 100%;
    }

    /* MODAL */
    .modal {
        padding: 1.5rem;
        width: min(92%, 420px);
    }

    /* CONTACT FORM */
    .contact-form {
        margin-top: 1.5rem;
    }

    .form-submit {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.75rem;
    }

    .section {
        padding: 1.5rem;
    }

    .item-text {
        font-size: 0.95rem;
    }

    .item-subtext {
        font-size: 0.8rem;
    }

    .role {
        font-size: 1rem;
    }

    .company {
        font-size: 0.9rem;
    }
}