@property --accent {
    syntax: '<color>';
    inherits: true;
    initial-value: #cba6f7;
}

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

/* Catppuccin Mocha (dark) */
:root {
    --base: #1e1e2e;
    --mantle: #181825;
    --crust: #11111b;
    --text: #cdd6f4;
    --subtext1: #bac2de;
    --subtext0: #a6adc8;
    --overlay2: #9399b2;
    --overlay1: #7f849c;
    --overlay0: #6c7086;
    --surface2: #585b70;
    --surface1: #45475a;
    --surface0: #313244;
    --blue: #89b4fa;
    --lavender: #b4befe;
    --sapphire: #74c7ec;
    --sky: #89dceb;
    --teal: #94e2d5;
    --green: #a6e3a1;
    --yellow: #f9e2af;
    --peach: #fab387;
    --maroon: #eba0ac;
    --red: #f38ba8;
    --mauve: #cba6f7;
    --pink: #f5c2e7;
    --flamingo: #f2cdcd;
    --rosewater: #f5e0dc;
    animation: accent-dark 30s linear infinite;
}

@keyframes accent-dark {
    0%, 100% { --accent: #cba6f7; }  /* mauve */
    8.3%     { --accent: #f5c2e7; }  /* pink */
    16.7%    { --accent: #f2cdcd; }  /* flamingo */
    25%      { --accent: #fab387; }  /* peach */
    33.3%    { --accent: #f9e2af; }  /* yellow */
    41.7%    { --accent: #a6e3a1; }  /* green */
    50%      { --accent: #94e2d5; }  /* teal */
    58.3%    { --accent: #89dceb; }  /* sky */
    66.7%    { --accent: #74c7ec; }  /* sapphire */
    75%      { --accent: #89b4fa; }  /* blue */
    83.3%    { --accent: #b4befe; }  /* lavender */
    91.7%    { --accent: #f5c2e7; }  /* pink (ease back) */
}

/* Catppuccin Latte (light) */
[data-theme="light"] {
    --base: #eff1f5;
    --mantle: #e6e9ef;
    --crust: #dce0e8;
    --text: #4c4f69;
    --subtext1: #5c5f77;
    --subtext0: #6c6f85;
    --overlay2: #7c7f93;
    --overlay1: #8c8fa1;
    --overlay0: #9ca0b0;
    --surface2: #acb0be;
    --surface1: #bcc0cc;
    --surface0: #ccd0da;
    --blue: #1e66f5;
    --lavender: #7287fd;
    --sapphire: #209fb5;
    --sky: #04a5e5;
    --teal: #179299;
    --green: #40a02b;
    --yellow: #df8e1d;
    --peach: #fe640b;
    --maroon: #e64553;
    --red: #d20f39;
    --mauve: #8839ef;
    --pink: #ea76cb;
    --flamingo: #dd7878;
    --rosewater: #dc8a78;
    animation: accent-light 30s linear infinite;
}

@keyframes accent-light {
    0%, 100% { --accent: #8839ef; }  /* mauve */
    8.3%     { --accent: #ea76cb; }  /* pink */
    16.7%    { --accent: #dd7878; }  /* flamingo */
    25%      { --accent: #fe640b; }  /* peach */
    33.3%    { --accent: #df8e1d; }  /* yellow */
    41.7%    { --accent: #40a02b; }  /* green */
    50%      { --accent: #179299; }  /* teal */
    58.3%    { --accent: #04a5e5; }  /* sky */
    66.7%    { --accent: #209fb5; }  /* sapphire */
    75%      { --accent: #1e66f5; }  /* blue */
    83.3%    { --accent: #7287fd; }  /* lavender */
    91.7%    { --accent: #ea76cb; }  /* pink (ease back) */
}

/* Language toggle */

[data-lang="en"] [lang="pt"] { display: none; }
[data-lang="pt"] [lang="en"] { display: none; }

body {
    font-family: ui-monospace, 'SF Mono', 'Cascadia Code', 'Source Code Pro',
        Menlo, Consolas, 'DejaVu Sans Mono', monospace;
    font-size: 15px;
    background: var(--base);
    color: var(--text);
    line-height: 1.6;
    transition: background 0.3s, color 0.3s;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

header, main, .oss, footer {
    max-width: 640px;
    margin: 0 auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.hero {
    max-width: 640px;
    margin: 0 auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

a {
    color: var(--subtext0);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover, a:focus-visible {
    color: var(--text);
}

/* Nav */

nav {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding-top: 2rem;
    padding-bottom: 1.5rem;
}

#lang-toggle,
#theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--surface1);
    border-radius: 8px;
    color: var(--overlay1);
    cursor: pointer;
    padding: 0.4rem;
    transition: border-color 0.2s, color 0.2s, transform 0.2s;
}

#lang-toggle {
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35rem 0.55rem;
    letter-spacing: 0.02em;
}

#lang-toggle:hover,
#theme-toggle:hover {
    border-color: var(--overlay0);
    color: var(--text);
    transform: scale(1.05);
}

#lang-toggle:active,
#theme-toggle:active {
    transform: scale(0.95);
}

#theme-toggle .icon-moon {
    display: none;
}

[data-theme="light"] #theme-toggle .icon-sun {
    display: none;
}

[data-theme="light"] #theme-toggle .icon-moon {
    display: block;
}

/* Header */

header {
    text-align: center;
    padding-bottom: 3rem;
}

.avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid var(--accent);
    margin-bottom: 1.25rem;
    transition: border-color 0.5s, transform 0.3s;
}

.avatar:hover {
    transform: scale(1.05);
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.subtitle {
    color: var(--accent);
    font-size: 0.9rem;
    margin-top: 0.3rem;
    letter-spacing: 0.02em;
    transition: color 0.5s;
}

/* Social icons */

.social {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.social a {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem;
    border-radius: 6px;
    transition: background 0.2s, transform 0.2s;
}

.social svg {
    fill: var(--overlay0);
    transition: fill 0.2s;
}

.social a:hover,
.social a:focus-visible {
    background: var(--surface0);
    transform: translateY(-2px);
}

.social a:hover svg,
.social a:focus-visible svg {
    fill: var(--accent);
}

/* Intro */

.intro {
    text-align: left;
    margin-top: 1.5rem;
    color: var(--subtext0);
    font-size: 0.9rem;
    line-height: 1.7;
}

.intro + .intro {
    margin-top: 0.75rem;
}

.intro a {
    color: var(--accent);
    transition: color 0.5s;
}

/* Sections */

section {
    margin-bottom: 3rem;
}

.oss {
    margin-top: 4rem;
}

h2 {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--accent);
    letter-spacing: 0.08em;
    margin-bottom: 1.5rem;
    text-transform: lowercase;
    transition: color 0.5s;
}

/* Timeline */

.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline-track {
    position: absolute;
    left: 4px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: var(--surface1);
    border-radius: 1px;
    transition: background 0.3s;
}

.tl-entry {
    position: relative;
    padding-bottom: 2rem;
}

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

.dot {
    position: absolute;
    left: -2rem;
    top: 0.35em;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--c, var(--text));
    box-shadow: 0 0 0 3px var(--base), 0 0 0 3px var(--base);
    transition: box-shadow 0.3s, transform 0.3s;
}

.tl-entry:hover .dot {
    transform: scale(1.3);
}

.tl-entry time {
    display: block;
    font-size: 0.8rem;
    color: var(--overlay1);
    margin-bottom: 0.1rem;
}

.tl-entry h3 {
    font-size: 1rem;
    font-weight: 600;
    transition: color 0.2s;
}

.tl-entry:hover h3 {
    color: var(--c, var(--text));
}

.tl-entry p {
    font-size: 0.85rem;
    color: var(--subtext0);
    margin-top: 0.15rem;
}

.tl-entry .desc {
    color: var(--overlay1);
    font-size: 0.8rem;
}

.tl-entry p a {
    color: var(--accent);
    transition: color 0.5s;
}

/* Current position pulse */

.now .dot {
    animation: glow 3s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 0 3px var(--base), 0 0 0 3px var(--base); }
    50% { box-shadow: 0 0 0 3px var(--base), 0 0 10px 1px var(--c); }
}

/* Projects */

.projects {
    display: grid;
    gap: 0.75rem;
}

.project {
    display: block;
    padding: 1rem;
    border: 1px solid var(--surface1);
    border-radius: 8px;
    transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.project:hover {
    border-color: var(--overlay0);
    background: var(--surface0);
    transform: translateY(-2px);
}

.project h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}

.tag {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--overlay1);
    margin-left: 0.4rem;
}

.project p {
    font-size: 0.85rem;
    color: var(--subtext0);
    margin-top: 0.2rem;
}

/* Footer */

footer {
    padding-top: 2rem;
    padding-bottom: 3rem;
    font-size: 0.85rem;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

footer a:hover {
    color: var(--accent);
}

footer span {
    color: var(--surface2);
}

/* Page load animation */

.js header {
    animation: fadeUp 0.6s ease both;
}

.js header .intro {
    animation: fadeUp 0.6s ease both;
    animation-delay: 0.15s;
}

.js header .intro + .intro {
    animation-delay: 0.25s;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
}

/* Scroll animations */

.js .tl-entry,
.js .project {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.js .tl-entry.visible,
.js .project.visible {
    opacity: 1;
    transform: none;
}

/* Reduced motion */

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

/* Responsive — tablet and up */

@media (min-width: 768px) {
    header {
        padding-bottom: 4rem;
    }

    .avatar {
        width: 140px;
        height: 140px;
    }

    h1 {
        font-size: 2.2rem;
    }
}

/* Responsive — desktop (side-by-side) */

@media (min-width: 960px) {
    .hero {
        max-width: 1100px;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 3rem;
    }

    .hero header,
    .hero main {
        max-width: none;
        margin: 0;
        padding: 0;
    }

    .hero header {
        text-align: left;
        position: sticky;
        top: 0;
        align-self: start;
        padding-bottom: 2rem;
        background: var(--base);
        transition: background 0.3s;
    }

    .hero header nav {
        justify-content: flex-start;
        padding-top: 50px;
        padding-bottom: 2rem;
    }

    .hero main {
        padding-top: 50px;
    }

    .hero .social {
        justify-content: flex-start;
    }
}

/* Responsive — mobile */

@media (max-width: 480px) {
    body {
        font-size: 14px;
    }

    header, main, .hero, .oss, footer {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }

    header {
        padding-bottom: 2.5rem;
    }

    .avatar {
        width: 120px;
        height: 120px;
    }

    h1 {
        font-size: 1.6rem;
    }

    .intro {
        font-size: 0.85rem;
    }

    .timeline {
        padding-left: 1.75rem;
    }

    .dot {
        left: -1.75rem;
    }

    .timeline-track {
        left: 3px;
    }
}
