/* ---------- Colour tokens ----------
   All text/background pairs below meet WCAG AA (most meet AAA):
   --text on --bg ............ ~15:1
   --text-muted on --bg ...... ~9:1
   --accent on --bg .......... ~7.5:1
   white on --button ......... ~7:1
*/
:root{
    --bg: #121218;
    --surface: #1d1d27;
    --text: #f5f5f7;
    --text-muted: #c8c8d2;
    --accent: #b794f6;      /* light purple, readable on dark */
    --button: #6d28d9;      /* deep purple, white text on top */
    --button-hover: #5b21b6;
    --focus: #ffd166;       /* high-visibility focus ring */

    /* shared layout column: content never gets wider than this,
       backgrounds still span the full screen */
    --content-width: 1200px;
    --gutter: clamp(16px, 4vw, 48px);
}

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

html{
    font-size: 100%; /* respect the user's browser font-size setting */
    scroll-behavior: smooth;
}

body{
    font-family: 'Atkinson Hyperlegible', 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 1.125rem;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
    /* dark overlay keeps text readable no matter what the photo looks like */
    background-image:
        linear-gradient(rgba(18, 18, 24, 0.85), rgba(18, 18, 24, 0.85)),
        url(images/background.jpg);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

p{
    margin-bottom: 0.75em;
    max-width: 65ch;
    margin-left: auto;
    margin-right: auto;
}

/* ---------- Focus & motion ---------- */

a:focus-visible,
button:focus-visible{
    outline: 3px solid var(--focus);
    outline-offset: 4px;
    border-radius: 4px;
}

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

.visually-hidden{
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.skip-link{
    position: absolute;
    left: 1rem;
    top: -100px;
    background: var(--focus);
    color: #000;
    padding: 0.5rem 1rem;
    font-weight: 700;
    z-index: 100;
    border-radius: 4px;
}
.skip-link:focus{
    top: 1rem;
}

/* ---------- Header ---------- */

#header{
    width: 100%;
}

.container{
    padding: 10px 0;
}

/* ---------- Side rail (wide monitors only) ---------- */

.side-rail{
    display: none;
}

@media (min-width: 1500px){
    .side-rail{
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 50;
        width: 72px;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2rem;
        padding: 24px 0;
        background: linear-gradient(to right, rgba(13, 13, 18, 0.9), rgba(13, 13, 18, 0.55));
        border-right: 1px solid rgba(183, 148, 246, 0.15);
        backdrop-filter: blur(6px);
    }
}

.rail-mark{
    width: 34px;
    height: 34px;
}

.rail-group{
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

/* social links sit at the bottom of the rail */
.rail-group-social{
    margin-top: auto;
}

.rail-link{
    position: relative;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 1.15rem;
    text-decoration: none;
    transition: color 0.2s, background-color 0.2s;
}

.rail-link:hover,
.rail-link:focus-visible{
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
}

/* current section: purple icon with a bar on the rail's edge */
.rail-link[aria-current="true"]{
    color: var(--accent);
    background: rgba(183, 148, 246, 0.12);
}
.rail-link[aria-current="true"]::before{
    content: "";
    position: absolute;
    left: -13px;
    top: 10px;
    bottom: 10px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--accent);
}

/* label pops out to the right on hover / keyboard focus */
.rail-label{
    position: absolute;
    left: calc(100% + 14px);
    top: 50%;
    transform: translate(-6px, -50%);
    white-space: nowrap;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    background: var(--surface);
    border: 1px solid rgba(183, 148, 246, 0.3);
    padding: 0.3rem 0.7rem;
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s, transform 0.15s;
}

.rail-link:hover .rail-label,
.rail-link:focus-visible .rail-label{
    opacity: 1;
    transform: translate(0, -50%);
}

/* ---------- Hero banner ---------- */

.hero{
    position: relative;
    overflow: hidden;
    display: flex;
}

.hero-network{
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.hero-inner{
    position: relative;         /* sits above the canvas */
    width: 100%;
    max-width: calc(var(--content-width) + 2 * var(--gutter));
    margin: 0 auto;
    padding: 28px var(--gutter) 56px;
    display: flex;
    flex-direction: column;
}

.logo{
    width: clamp(130px, 16vw, 200px);
    height: auto;
}

/* text on the left, terminal on the right */
.hero-body{
    display: grid;
    /* text column hugs its content; the terminal takes the right-hand side */
    grid-template-columns: fit-content(38rem) minmax(0, 1fr);
    align-items: center;
    gap: clamp(2rem, 4vw, 4rem);
    padding-top: 36px;
}

.hero-content{
    max-width: 38rem;
}

/* ---------- Hero terminal ---------- */

.hero-terminal{
    width: 100%;
    max-width: 34rem;
    justify-self: end;          /* lines up with the right edge of the content column */
    border-radius: 10px;
    overflow: hidden;
    background: rgba(13, 13, 18, 0.82);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(183, 148, 246, 0.3);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    animation: hero-in 0.9s 1s cubic-bezier(.2,.8,.2,1) backwards;
}

.terminal-bar{
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.terminal-dot{
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #ff5f57;
}
.terminal-dot:nth-child(2){ background: #febc2e; }
.terminal-dot:nth-child(3){ background: #28c840; }

.terminal-title{
    margin-left: auto;
    margin-right: auto;
    padding-right: 40px;        /* optically centre against the dots */
    font-size: 0.8rem;
    color: var(--text-muted);
}

.terminal-body{
    font-family: 'Cascadia Code', Consolas, 'SFMono-Regular', Menlo, monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    padding: 16px 18px 18px;
    color: var(--text);
}

.terminal-line{
    display: block;
    margin: 0;
    max-width: none;
    font: inherit;
}

#contact-heading{
    margin: 0.25rem 0 1rem;
}

/* ---------- Terminal contact form ---------- */

.terminal-field{
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
}

.terminal-field label{
    flex: 0 0 5.5rem;
    color: var(--accent);
    font-weight: 700;
}

.terminal-field input,
.terminal-field textarea{
    flex: 1;
    min-width: 0;
    font: inherit;
    color: var(--text);
    caret-color: var(--accent);
    background: rgba(255, 255, 255, 0.04);
    border: none;
    border-bottom: 1px solid rgba(183, 148, 246, 0.35);
    border-radius: 3px 3px 0 0;
    padding: 0.3rem 0.5rem;
    transition: border-color 0.2s, background-color 0.2s;
}

.terminal-field textarea{
    resize: vertical;
    min-height: 5.5rem;
}

.terminal-field-message{
    align-items: flex-start;
}
.terminal-field-message label{
    padding-top: 0.3rem;
}

.terminal-field input:focus,
.terminal-field textarea:focus{
    outline: none;
    background: rgba(183, 148, 246, 0.08);
    border-bottom-color: var(--accent);
}
/* keep a strong visible focus for keyboard users */
.terminal-field input:focus-visible,
.terminal-field textarea:focus-visible{
    box-shadow: 0 2px 0 0 var(--focus);
}

.terminal-submit{
    margin: 0.6rem 0 0 calc(5.5rem + 0.6rem);   /* line up with the inputs */
    font: inherit;
    font-weight: 700;
    color: var(--bg);
    background: var(--accent);
    border: none;
    border-radius: 4px;
    padding: 0.45rem 1.1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}
.terminal-submit:hover{
    background: #cbb2fa;
}
.terminal-submit:disabled{
    opacity: 0.6;
    cursor: wait;
}

.terminal-status:not(:empty){
    margin-top: 0.9rem;
}

.terminal-err{
    color: #fca5a5;
}

.terminal-prompt{
    color: var(--accent);
    font-weight: 700;
}

.terminal-out{
    color: var(--text-muted);
}

.terminal-ok{
    color: #86efac;
}

/* blinking block cursor while a command is being typed */
.terminal-cmd.typing::after{
    content: "";
    display: inline-block;
    width: 0.55em;
    height: 1.1em;
    margin-left: 2px;
    vertical-align: text-bottom;
    background: var(--accent);
    animation: cursor-blink 1s steps(1) infinite;
}

@keyframes cursor-blink{
    50%{ opacity: 0; }
}

/* narrower screens: the contact terminal drops below the hero text */
@media (max-width: 1100px){
    .hero-body{
        grid-template-columns: minmax(0, 38rem);
    }
    .hero-terminal{
        justify-self: start;
        max-width: 38rem;
    }
}

@media (max-width: 480px){
    .terminal-field{
        flex-direction: column;
        gap: 0.25rem;
    }
    .terminal-field label{
        flex: none;
    }
    .terminal-field input,
    .terminal-field textarea{
        width: 100%;
    }
    .terminal-submit{
        margin-left: 0;
    }
}

/* title-sequence style: each line fades up in turn */
.hero-content > *{
    animation: hero-in 0.8s cubic-bezier(.2,.8,.2,1) backwards;
}
.hero-content > :nth-child(1){ animation-delay: 0.1s; }
.hero-content > :nth-child(2){ animation-delay: 0.25s; }
.hero-content > :nth-child(3){ animation-delay: 0.4s; }
.hero-content > :nth-child(4){ animation-delay: 0.55s; }
.hero-content > :nth-child(5){ animation-delay: 0.7s; }
.hero-content > :nth-child(6){ animation-delay: 0.85s; }

@keyframes hero-in{
    from{ opacity: 0; transform: translateY(18px); }
    to{   opacity: 1; transform: none; }
}

.hero-badge{
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.hero-badge::before{
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent);
    animation: badge-pulse 2.4s ease-in-out infinite;
}

.hero h1{
    font-size: clamp(2.75rem, 8vw, 4.75rem);
    font-weight: 700;
    line-height: 1.05;
    margin: 0.75rem 0 0.5rem;
    text-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
}

.hero h1 span{
    color: var(--accent);
}

.hero-role{
    font-size: clamp(1.2rem, 2.6vw, 1.5rem);
    font-weight: 700;
    margin: 0 0 0.75rem;
    max-width: none;
}

.hero-meta{
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-muted);
}
.hero-meta li + li::before{
    content: "·";
    padding: 0 0.6rem;
    color: var(--accent);
}

.hero-tagline{
    margin: 1.25rem 0 1.75rem;
    font-size: 1.15rem;
    color: var(--text);
}

.hero-actions{
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
}

.hero-btn{
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.6rem;
    border-radius: 6px;
    font-size: 1.05rem;
    font-weight: 700;
    text-decoration: none;
    transition: background-color 0.2s, transform 0.2s;
}
.hero-btn:hover{
    transform: scale(1.04);
}

.hero-btn-primary{
    background: #fff;
    color: var(--bg);
}
.hero-btn-primary:hover{
    background: #e4e4ea;
}

.hero-btn-secondary{
    background: rgba(255, 255, 255, 0.16);
    color: var(--text);
    backdrop-filter: blur(4px);
}
.hero-btn-secondary:hover{
    background: rgba(255, 255, 255, 0.26);
}

/* ---------- About me ---------- */

/* same column as the hero, so everything shares a left and right edge */
#about .container{
    max-width: var(--content-width);
    margin: 0 auto;
}

.row{
    display: grid;
    align-items: start;
    /* resume on the left (under the logo), about/cards fill the rest */
    grid-template-columns: 15rem minmax(0, 1fr);
    column-gap: clamp(2rem, 4vw, 4rem);
}

.row-center{
    width: 100%;
}

.about-col-2{
    grid-column: 2;
    min-width: 0;
}

.about-body p{
    margin-left: 0;
}

.sub-title{
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.75em;
    color: var(--accent);
}

.sub-title-2{
    font-size: 1.25rem;
    font-weight: 700;
    margin: 1em 0;
}

#about{
    width: 100%;
    /* bottom padding so the page doesn't end right under the cards */
    padding: 0 var(--gutter) 96px;
    margin: 40px 0 0;
}

/* ---------- Buttons ---------- */

.resume{
    width: 100%;
}

.resume h2{
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    /* line up with the vertical centre of the larger "About Me" heading */
    padding: 0.4rem 0 1.5rem;
}

/* resume links share the card look, but stay still (no motion) */
.resume a{
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 5.5rem;
    padding: 1rem;
    margin: 0 0 18px;
    border-radius: 8px;
    background:
        linear-gradient(160deg, rgba(109, 40, 217, 0.45), transparent 60%),
        var(--surface);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    text-decoration: none;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
}

.resume a i{
    font-size: 1.75rem;
    color: var(--accent);
}

.resume a:hover{
    background:
        linear-gradient(160deg, rgba(109, 40, 217, 0.65), transparent 70%),
        var(--surface);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4),
                0 0 0 2px var(--accent);
    text-decoration: underline;
}

/* ---------- About panel (first tab) ---------- */

.about-body{
    padding: 2rem 2.25rem;
    border-radius: 8px;
    background:
        linear-gradient(160deg, rgba(109, 40, 217, 0.25), transparent 50%),
        var(--surface);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5);
}
.active-tab .about-body{
    animation: about-open 0.5s cubic-bezier(.2,.8,.2,1);
}

@keyframes about-open{
    from{ opacity: 0; transform: translateY(16px); }
    to{   opacity: 1; transform: none; }
}

.about-body p{
    margin-bottom: 1em;
}

.about-body .sub-title-2{
    color: var(--accent);
    margin-bottom: 0;
}

/* ---------- Tabs ---------- */

/* tab buttons are navigation cards */
.tab-titles{
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin: 32px 0 44px;
}

.tab-links{
    font: inherit;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 6.5rem;
    padding: 1rem 0.5rem;
    border: none;
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
    transition: transform 0.35s cubic-bezier(.2,.8,.2,1),
                box-shadow 0.35s, color 0.2s, background 0.35s;
}

.tab-links i{
    font-size: 1.75rem;
    color: var(--accent);
    transition: transform 0.35s cubic-bezier(.2,.8,.2,1);
}

.tab-links:hover{
    color: var(--text);
    transform: scale(1.06);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.6);
}
.tab-links:hover i{
    transform: translateY(-3px) scale(1.1);
}

.tab-links.active-link{
    color: var(--text);
    background:
        linear-gradient(160deg, rgba(109, 40, 217, 0.65), transparent 70%),
        var(--surface);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5),
                0 0 0 2px var(--accent);
}

/* accent bar sweeps in along the bottom of the selected card */
.tab-links::after{
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 4px;
    background: var(--accent);
    transition: width 0.4s cubic-bezier(.2,.8,.2,1);
}
.tab-links.active-link::after{
    width: 100%;
}

.tab-contents{
    display: none;
}

.tab-contents.active-tab{
    display: block;
}

.card-row{
    list-style: none;
}

/* ---------- Experience: streaming-style card row ---------- */

.card-row{
    display: flex;
    gap: 1.1rem;
    /* room for hovered cards to grow without being clipped */
    padding: 2rem 1.5rem;
    margin: -1rem -1.5rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    scrollbar-color: var(--button) transparent;
}

.tab-contents .card-row li.card{
    flex: 0 0 11.5rem;
    margin: 0;
    scroll-snap-align: start;
    position: relative;
    display: flex;
    flex-direction: column;
    text-align: left;
    padding: 1rem;
    min-height: 13rem;
    border-radius: 8px;
    background:
        linear-gradient(160deg, rgba(109, 40, 217, 0.45), transparent 60%),
        var(--surface);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    transform-origin: center;
    transition: transform 0.35s cubic-bezier(.2,.8,.2,1),
                box-shadow 0.35s, opacity 0.35s;
    /* staggered slide-in each time the tab opens */
    /* "backwards" (not "both") so hover transforms still apply once it ends */
    animation: card-in 0.6s cubic-bezier(.2,.8,.2,1) backwards;
    /* capped so long rows (e.g. 13 skills) don't take ages to finish */
    animation-delay: calc(min(var(--i, 0), 7) * 110ms);
}

@keyframes card-in{
    from{ opacity: 0; transform: translateX(60px) scale(0.92); }
    to{   opacity: 1; transform: none; }
}

/* hovered card grows and lifts... */
.tab-contents .card-row li.card:hover{
    transform: scale(1.12);
    z-index: 2;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.7),
                0 0 0 2px var(--accent);
}
/* ...neighbours slide out of its way and dim */
.tab-contents .card-row li.card:hover ~ li.card{
    transform: translateX(8%);
}
.tab-contents .card-row li.card:has(~ li.card:hover){
    transform: translateX(-8%);
}
.card-row:has(li.card:hover) li.card:not(:hover){
    opacity: 0.55;
}

.tab-contents .card-row .card-year{
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.card-title{
    font-size: 1.15rem;
    line-height: 1.25;
    margin: 0.35rem 0 0.5rem;
    color: var(--text);
}

.card-desc{
    font-size: 0.95rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}

.tab-contents .card-row .card-badge{
    display: inline-block;
    align-self: flex-start;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fff;
    background: var(--button);
    padding: 2px 8px;
    border-radius: 3px;
    margin-bottom: 0.5rem;
    animation: badge-pulse 2.4s ease-in-out infinite;
}

@keyframes badge-pulse{
    0%, 100%{ box-shadow: 0 0 0 0 rgba(183, 148, 246, 0.6); }
    50%{      box-shadow: 0 0 0 6px rgba(183, 148, 246, 0); }
}

/* "continue watching" progress bar on the current role */
.tab-contents .card-row .card-progress{
    display: block;
    margin-top: auto;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.2);
    overflow: hidden;
}
.tab-contents .card-row .card-progress span{
    display: block;
    height: 100%;
    width: 15%;
    background: var(--accent);
    animation: progress-fill 1.4s 0.6s cubic-bezier(.2,.8,.2,1) both;
}

@keyframes progress-fill{
    from{ width: 0; }
}

.tab-contents .card-row li.card-current:not(:hover){
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4),
                0 0 0 1px rgba(183, 148, 246, 0.5);
}

/* ---------- Small screens ---------- */

@media (max-width: 960px){
    .row{
        grid-template-columns: 1fr;
    }
    .about-col-2{
        grid-column: 1;
        order: -1;
    }
    .resume{
        margin-top: 40px;
    }
}

@media (max-width: 480px){
    .tab-titles{
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    .tab-links{
        font-size: 0.9rem;
        min-height: 5.5rem;
    }
    .tab-links i{
        font-size: 1.4rem;
    }
}
