/* ========== Arman Ahangari Kiasari — AI researcher, personal site ==========
   Palette and fonts live in :root. Change --accent / --accent-light to re-colour the whole site. */

:root {
    /* Colour */
    --accent: #2b59ff;          /* links, buttons, small accents on light backgrounds */
    --accent-hover: #1f45d6;
    --accent-active: #1a3bb8;
    --accent-light: #8fb0ff;    /* accent on dark backgrounds (hero, footer) */
    --navy: #0c1627;            /* hero */
    --footer: #0a1220;
    --ink: #0f1b2d;             /* headings */
    --text: #2b3a4e;            /* body text */
    --muted: #59697e;
    --bg: #f4f7fb;              /* tinted sections */
    --paper: #ffffff;
    --silver: #e9eef6;
    --line: #dbe2ec;
    --focus: rgba(43, 89, 255, 0.28);

    /* Type */
    --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --serif: "Source Serif 4", Georgia, "Times New Roman", serif;

    /* Shape and depth */
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(15, 27, 45, 0.04), 0 10px 28px -20px rgba(15, 27, 45, 0.2);
    --shadow-soft: 0 12px 30px -22px rgba(15, 27, 45, 0.28);
    --shadow-medium: 0 14px 33px -22px rgba(15, 27, 45, 0.3);

    --max: 1100px;
    --header-h: 72px;
    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scrollbar-width: thin;
    scrollbar-color: var(--navy) #fff;
    cursor: default;
}

/* Anchor scrolling (menu, arrow, buttons) is eased in script.js:
   slow and gentle, and it stops as soon as the visitor scrolls. */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-delay: 0s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0s !important;
    }
    .js [data-reveal] {
        opacity: 1;
    }
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-thumb {
    background: var(--navy);
    border-radius: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

body {
    font-family: var(--sans);
    color: var(--text);
    background: var(--paper);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

ul,
ol {
    list-style: none;
}

button,
input,
textarea {
    font: inherit;
}

h1,
h2,
h3 {
    text-wrap: balance;
}

p,
li {
    text-wrap: pretty;
}

[tabindex="-1"]:focus {
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 2000;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    transform: translateY(-200%);
    transition: transform 0.2s var(--ease);
}

.skip-link:focus {
    transform: translateY(0);
}


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

#site-header {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 1000;
    background-color: transparent;
    transition: background-color 0.4s var(--ease), box-shadow 0.4s var(--ease), -webkit-backdrop-filter 0.4s var(--ease), backdrop-filter 0.4s var(--ease);
}

#site-header.sticky,
#site-header.menu-open {
    background-color: rgba(12, 22, 39, 0.9);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

#site-header.sticky {
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.07);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: #fff;
    min-width: 0;
}

.brand-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 4px;
    flex-shrink: 0;
}

.brand-name {
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.005em;
    white-space: nowrap;
}

.nav-desktop ul {
    display: flex;
    align-items: center;
    gap: 1.7rem;
}

.nav-desktop a {
    position: relative;
    display: inline-block;
    padding: 0.35rem 0;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.25s ease;
}

.nav-desktop a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: var(--accent-light);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.35s var(--ease);
}

.nav-desktop a:hover,
.nav-desktop a.active {
    color: var(--accent-light)
}

.nav-desktop a:hover::after,
.nav-desktop a.active::after {
    transform: scaleX(1);
}

/* Contact stands out as a button in the nav */
.nav-desktop a.nav-cta {
    padding: 0.45rem 1.05rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-sm);
    color: #fff;
    transition: background-color 0.35s ease, border-color 0.35s ease, color 0.35s ease;
}

.nav-desktop a.nav-cta::after {
    display: none;
}

.nav-desktop a.nav-cta:hover,
.nav-desktop a.nav-cta.active {
    background: var(--accent-light);
    border-color: var(--accent-light);
    color: var(--navy);
}

.scroll-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-light);
    transform: scaleX(0);
    transform-origin: left;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#site-header.sticky .scroll-progress {
    opacity: 1;
}

.menu-toggle {
    display: none;
    width: 44px;
    height: 44px;
    border: 0;
    background: transparent;
    cursor: pointer;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
}

.menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.3s var(--ease), opacity 0.2s ease;
}

.menu-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.menu-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.nav-mobile {
    display: none;
}


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

.hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    min-height: min(100svh, 800px);
    background: var(--navy);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 7rem 1.25rem 6rem;
}

/* Faint graph paper with a soft light from above */
.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(60% 55% at 50% 0%, rgba(70, 110, 255, 0.22), transparent 70%),
        linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
    background-size: auto, 56px 56px, 56px 56px;
    -webkit-mask-image: radial-gradient(ellipse 85% 75% at 50% 35%, #000 25%, transparent 85%);
    mask-image: radial-gradient(ellipse 85% 75% at 50% 35%, #000 25%, transparent 85%);
}

/* Training / validation curves, drawn once on load */
.hero-plot {
    position: absolute;
    left: 0;
    bottom: 0;
    z-index: -1;
    width: 100%;
    height: auto;
    pointer-events: none;
    -webkit-mask-image: linear-gradient(to top, #000 35%, transparent 100%);
    mask-image: linear-gradient(to top, #000 35%, transparent 100%);
}

.hero-plot path,
.hero-plot line {
    fill: none;
    stroke-linejoin: round;
}

.plot-base {
    stroke: rgba(255, 255, 255, 0.2);
    stroke-width: 1;
    stroke-dasharray: 4 6;
}

.plot-val {
    stroke: rgba(255, 255, 255, 0.4);
    stroke-width: 1.5;
}

.plot-train {
    stroke: var(--accent-light);
    stroke-width: 2.2;
}

.plot-val,
.plot-train {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: draw 2.8s var(--ease) forwards;
}

.plot-val {
    animation-delay: 0.7s;
}

.plot-train {
    animation-delay: 0.9s;
}

@keyframes draw {
    to {
        stroke-dashoffset: 0;
    }
}

.hero-inner {
    max-width: 720px;
}

/* One entrance, in reading order */
.hero-inner > * {
    opacity: 0;
    animation: rise 0.85s var(--ease) forwards;
}

.hero-inner > :nth-child(1) { animation-delay: 0.05s; }
.hero-inner > :nth-child(2) { animation-delay: 0.15s; }
.hero-inner > :nth-child(3) { animation-delay: 0.25s; }
.hero-inner > :nth-child(4) { animation-delay: 0.35s; }
.hero-inner > :nth-child(5) { animation-delay: 0.45s; }
.hero-inner > :nth-child(6) { animation-delay: 0.6s; }

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

.hero h1 {
    font-family: var(--serif);
    font-size: clamp(2.1rem, 1.2rem + 4vw, 3.75rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.hero-role {
    margin-top: 0.85rem;
    font-size: clamp(1.1rem, 2.3vw, 1.35rem);
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--accent-light);
}

.hero-bio {
    margin: 1.4rem auto 0;
    max-width: 38rem;
    font-size: clamp(1rem, 0.95rem + 0.3vw, 1.1rem);
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.76);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.8rem;
    margin-top: 2rem;
}

.hero .btn-primary {
    background: var(--accent-light);
    color: var(--navy);
}

.hero .btn-primary:hover {
    background: #fff;
    box-shadow: 0 10px 24px -12px rgba(143, 176, 255, 0.8);
}

/* Quick contact and profile links, visible without scrolling */
.hero-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem 0;
    margin-top: 1.5rem;
    font-size: 0.92rem;
}

.hero-links li + li::before {
    content: "·";
    margin: 0 0.75rem;
    color: rgba(255, 255, 255, 0.35);
}

.hero-links a {
    color: rgba(255, 255, 255, 0.75);
}

.hero-links a:hover {
    color: #fff;
}

/* Latest activity: jumps to its card and highlights it */
.hero-status {
    margin-top: 2rem;
}

.hero-status-label {
    margin-bottom: 0.7rem;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.55);
}

.hero-status ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
}

.hero-status a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    transition: border-color 0.35s ease, background-color 0.35s ease, color 0.35s ease;
}

.hero-status a strong {
    color: #fff;
    font-weight: 600;
}

.hero-status a:hover {
    border-color: rgba(143, 176, 255, 0.6);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot-published {
    background: #4ade80;
}

.dot-submitted {
    background: #fbbf24;
}

.dot-progress {
    background: var(--accent-light);
}


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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 48px;
    padding: 0.7rem 1.5rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background-color 0.35s ease, border-color 0.35s ease, color 0.35s ease, transform 0.35s var(--ease), box-shadow 0.35s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: scale(0.98);
}

/* Arrow glyphs inside buttons drift a few pixels on hover */
.btn span[aria-hidden="true"] {
    display: inline-block;
    transition: transform 0.35s var(--ease);
}

.btn:hover span[aria-hidden="true"] {
    transform: translate(2px, -2px);
}

.btn-sm {
    min-height: 44px;
    padding: 0.5rem 1.1rem;
    font-size: 0.9rem;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 10px 22px -12px rgba(43, 89, 255, 0.7);
}

.btn-primary:active {
    background: var(--accent-active);
}

.btn-secondary {
    background: var(--ink);
    color: #fff;
}

.btn-secondary:hover {
    background: #1b2d47;
}

.btn-ghost {
    background: transparent;
    color: var(--ink);
    border-color: var(--line);
}

.btn-ghost:hover {
    border-color: #b6c3d6;
    background: var(--bg);
}

.btn-outline-light {
    background: transparent;
    color: #fff;
    border-color: rgba(255, 255, 255, 0.32);
}

.btn-outline-light:hover {
    border-color: #fff;
    background: rgba(255, 255, 255, 0.08);
}


/* ---------- Sections ---------- */

.section {
    padding: 5.5rem 1.25rem;
}

.container {
    max-width: var(--max);
    margin: 0 auto;
}

.section-head {
    text-align: center;
    margin-bottom: 2.75rem;
}

.eyebrow {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
}

.section-head h2,
.about-head h2 {
    margin-top: 0.45rem;
    font-family: var(--serif);
    font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.3rem);
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.015em;
    line-height: 1.2;
}

.section-sub {
    margin: 0.85rem auto 0;
    max-width: 36rem;
    color: var(--muted);
    line-height: 1.7;
}


/* ---------- Scroll reveal (only active when JS is running) ---------- */

.js [data-reveal] {
    opacity: 0;
}

.js [data-reveal].is-visible {
    opacity: 1;
    animation: reveal 0.75s var(--ease) backwards;
    animation-delay: var(--d, 0ms);
}

@keyframes reveal {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
}


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

.section-about {
    background: var(--paper);
}

.about-layout {
    display: grid;
    grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr);
    gap: clamp(2rem, 6vw, 5rem);
    align-items: start;
}

.about-head {
    position: sticky;
    top: calc(var(--header-h) + 1.5rem);
}

.about-head .btn {
    margin-top: 1.5rem;
}

.about-block + .about-block {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--line);
}

.about-block h3 {
    margin-bottom: 0.7rem;
    color: var(--accent);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.about-block p + .about-list {
    margin-top: 1rem;
}

.about-list,
.timeline-list {
    display: grid;
    gap: 0.7rem;
}

.about-list li,
.timeline-list li {
    position: relative;
    padding-left: 1.35rem;
    line-height: 1.6;
}

.about-list li::before,
.timeline-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.68em;
    width: 7px;
    height: 7px;
    border-radius: 2px;
    background: var(--accent);
}


/* ---------- Experience ---------- */

.section-experience {
    background: var(--bg);
}

.timeline {
    position: relative;
    max-width: 820px;
    margin: 0 auto;
    padding-left: 1.9rem;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 5px;
    top: 0.7rem;
    bottom: 0.7rem;
    width: 2px;
    background: var(--line);
}

.timeline-item {
    position: relative;
    padding-bottom: 2.25rem;
}

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

.timeline-item::before {
    content: "";
    position: absolute;
    left: -1.9rem;
    top: 0.5rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px var(--bg);
}

.timeline-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.25rem 1rem;
}

.timeline-head h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--ink);
}

.timeline-date {
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 500;
}

.timeline-org {
    margin: 0.15rem 0 0.6rem;
    color: var(--accent);
    font-weight: 500;
    font-size: 0.95rem;
}

.timeline-list a {
    color: var(--accent);
    font-weight: 500;
}


/* ---------- Skills ---------- */

.section-skills {
    background: var(--bg);
}

.skills-grid {
    display: grid;
    grid-template-columns:repeat(2, 1fr); 
    grid-template-rows:repeat(2, 1fr);
    justify-content: center;
    gap: 1.25rem;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
	height: 100%;
}

.skills-grid .card-1{
    grid-area: 1/1/2/2;
}
.skills-grid .card-2{
    grid-area: 1/2/2/3; 
}
.skills-grid .card-3{
    grid-area: 2 / 1 / 3 / 3;
    
}
.skill-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.4rem 1.5rem;
    transition: border-color 0.4s ease, box-shadow 0.4s ease;
}


/* Gentle: no movement, just a slightly firmer edge and a faint shadow */
.skill-card:hover {
    border-color: #c6d2e3;
    box-shadow: var(--shadow-soft);
}

.skill-card h3 {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.2rem 0.6rem;
    margin-bottom: 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink);
}

.skill-note {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 500;
}

.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chip-list li {
    padding: 0.3rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--bg);
    color: var(--ink);
    font-size: 0.88rem;
    font-weight: 500;
    transition: background-color 0.4s ease;
}

.chip-list li:hover {
    background: var(--silver);
}


/* ---------- Work ---------- */

.section-work {
    background: var(--paper);
}

.work-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 920px;
    margin: 0 auto;
}

.work-card {
    --stripe: var(--accent);
    position: relative;
    padding: 1.9rem 2.1rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: box-shadow 0.5s ease;
}

.work-card:hover {
    box-shadow: var(--shadow-medium);
}

/* Highlight ring when a card is opened from the hero (or by its link) */
.work-card::after {
    content: "";
    position: absolute;
    inset: -1px;
    border: 2px solid var(--stripe);
    border-radius: inherit;
    opacity: 0;
    pointer-events: none;
}

.work-card.flash::after,
.work-card:target::after {
    animation: ring 2s ease 0.1s;
}

@keyframes ring {
    0%,
    100% {
        opacity: 0;
    }
    25%,
    60% {
        opacity: 1;
    }
}

.work-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.9rem;
    flex-wrap: wrap;
}

.work-venue {
    font-size: 0.88rem;
    color: var(--muted);
    font-weight: 500;
}

.status-pill {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: 0;
    padding: 0;
    border: none;
    background: transparent;
}

.status-pill.published {
    color: #28764B;
}

.status-pill.submitted {
    color: #94620C;
}

.status-pill.progress {
    color: #3F5FAD;
}

.status-pill.ongoing {
    color: #B54747;
}

.work-card h3 {
    margin-bottom: 0.7rem;
    font-family: var(--serif);
    font-size: clamp(1.15rem, 0.9rem + 1.2vw, 1.45rem);
    font-weight: 600;
    line-height: 1.3;
    color: var(--ink);
}

.work-card p {
    line-height: 1.7;
}
.work-card p a{
    text-decoration: underline;
    /* color: var(--accent); */
}

.work-credit {
    margin-top: 0.9rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.work-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 1.2rem;
}


/* ---------- Contact ---------- */

.section-contact {
    background: var(--paper);
}

.contact-direct {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    max-width: 820px;
    margin: 0 auto 2rem;
}

.contact-direct li {
    padding: 1.1rem 1.3rem;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.contact-direct span {
    display: block;
    margin-bottom: 0.2rem;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 500;
}

.contact-direct a {
    color: var(--ink);
    font-weight: 600;
    overflow-wrap: anywhere;
}

.contact-form {
    max-width: 820px;
    margin: 0 auto;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 1.2rem;
}

.input {
    width: 100%;
    min-height: 48px;
    border: 1.5px solid #cdd6e2;
    border-radius: var(--radius-sm);
    padding: 0.7rem 0.85rem;
    background: #fff;
    color: var(--ink);
    outline: none;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.input::placeholder {
    color: #66758a;
}

.input:hover {
    border-color: #aebbcd;
}

.input:focus,
.input:focus-visible {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--focus);
}

.message {
    grid-column: 2;
    grid-row: 1 / span 3;
    height: 100%;
    min-height: 150px;
    resize: vertical;
}

.hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.submit {
    width: 100%;
    margin-top: 1.2rem;
}

.form-error {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid #e2b4a9;
    border-radius: var(--radius-sm);
    background: #fdf1ee;
    color: #8a2c18;
    font-size: 0.92rem;
}

.form-error[hidden],
.form-success[hidden] {
    display: none;
}

.form-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--ink);
    font-weight: 500;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    animation: reveal 0.6s var(--ease);
}

.form-success svg {
    color: #17653a;
}

.check-circle,
.check-mark {
    stroke-dasharray: 70;
    stroke-dashoffset: 70;
    animation: draw 0.7s var(--ease) 0.15s forwards;
}

.check-mark {
    animation-delay: 0.5s;
}

.contact-form.is-sent .form-grid,
.contact-form.is-sent .submit,
.contact-form.is-sent .form-error {
    display: none;
}

.contact-links {
    margin-top: 2.5rem;
    text-align: center;
}

.contact-links p {
    margin-bottom: 0.9rem;
    color: var(--muted);
    font-size: 0.92rem;
}

.contact-links ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

.icon-link {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    /* background: #fff; */
    color: var(--muted);
    transition: color 0.35s ease, background-color 0.35s ease, border-color 0.35s ease, transform 0.35s var(--ease);
}

.icon-link svg {
    transition: transform 0.35s var(--ease);
}

.icon-link:hover {
    color: var(--accent-hover);
    /* border-color: var(--ink); */
    transition: 0.5s;
}

.icon-link:hover svg {
    transform: scale(1.08);
}


/* ---------- Footer ---------- */

.site-footer {
    background: var(--footer);
    color: rgba(255, 255, 255, 0.74);
    padding: 3.4rem 1.25rem 1.4rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 2rem;
    max-width: var(--max);
    margin: 0 auto;
}

.footer-grid p {
    max-width: 24rem;
    line-height: 1.65;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.85rem;
    color: #fff;
    font-weight: 600;
}

.footer-brand img {
    border-radius: 4px;
}

.site-footer h4 {
    margin-bottom: 0.85rem;
    color: #fff;
    font-weight: 600;
}

.site-footer a {
    display: block;
    width: fit-content;
    margin-top: 0.55rem;
    color: rgba(255, 255, 255, 0.62);
}

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

.social a:first-child {
    margin-top: 0;
}

.footer-bottom {
    max-width: var(--max);
    margin: 2.4rem auto 0;
    padding-top: 1.2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    text-align: center;
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.5);
}

.footer-note {
    margin-top: 0.4rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.42);
}


/* ---------- Back to top ---------- */

#top_page_button {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1100;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 10px 22px -10px rgba(12, 22, 39, 0.6);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.35s var(--ease), visibility 0.3s ease, background-color 0.35s ease;
}

#top_page_button.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#top_page_button:hover {
    background: var(--accent-hover);
}

#top_page_button:active {
    background: var(--accent-active);
    transform: scale(0.96);
}


/* ---------- Text links: a thin underline draws in on hover ---------- */

.hero-links a,
.timeline-list a,
.contact-direct a,
.site-footer a {
    padding-bottom: 2px;
    background-image: linear-gradient(currentColor, currentColor);
    background-repeat: no-repeat;
    background-position: 0 100%;
    background-size: 0 1px;
    transition: color 0.3s ease, background-size 0.45s var(--ease);
}

.hero-links a:hover,
.timeline-list a:hover,
.contact-direct a:hover,
.site-footer a:hover {
    background-size: 100% 1px;
}


/* ---------- Gentle entrance details ---------- */

/* Skill chips appear one after another when their card is revealed */
.js .skill-card.is-visible .chip-list li {
    animation: chip-in 0.5s var(--ease) backwards;
    animation-delay: calc(var(--i, 0) * 45ms + 180ms);
}

.chip-list li:nth-child(1) { --i: 0; }
.chip-list li:nth-child(2) { --i: 1; }
.chip-list li:nth-child(3) { --i: 2; }
.chip-list li:nth-child(4) { --i: 3; }
.chip-list li:nth-child(5) { --i: 4; }
.chip-list li:nth-child(6) { --i: 5; }
.chip-list li:nth-child(7) { --i: 6; }
.chip-list li:nth-child(8) { --i: 7; }

@keyframes chip-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
}

/* Timeline: the line draws downward and each dot settles in as its item appears */
.js .timeline::before {
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 1.4s var(--ease);
}

.js .timeline.is-drawn::before {
    transform: scaleY(1);
}

.js .timeline-item::before {
    transform: scale(0);
    transition: transform 0.5s var(--ease) 0.25s;
}

.js .timeline-item.is-visible::before {
    transform: scale(1);
}


/* ---------- Tablet and mobile ---------- */

@media (max-width: 960px) {

    /* Navigation: hamburger, links centred, animated open/close */
    .nav-desktop {
        display: none;
    }
    .menu-toggle {
        display: inline-flex;
    }
    .nav-mobile {
        display: grid;
        grid-template-rows: 0fr;
        visibility: hidden;
        text-align: center;
        transition: grid-template-rows 0.35s var(--ease), visibility 0s linear 0.35s;
    }
    .nav-mobile.open {
        grid-template-rows: 1fr;
        visibility: visible;
        transition: grid-template-rows 0.35s var(--ease), visibility 0s;
    }
    .nav-mobile ul {
        min-height: 0;
        overflow: hidden;
        padding-inline: 1.25rem;
    }
    .nav-mobile a {
        display: block;
        min-height: 44px;
        padding: 0.9rem 0;
        color: #fff;
        border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    }
    .nav-mobile a.active {
        color: var(--accent-light);
    }

    /* About: heading centred, body left-aligned so lists stay readable */
    .about-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    .about-head {
        position: static;
        text-align: center;
    }
    /* Skills */
    .skills-grid {  
        gap: 0.5rem;
    }
    /* Contact form stacks */
    .form-grid {
        grid-template-columns: 1fr;
    }
    .message {
        grid-column: auto;
        grid-row: auto;
        min-height: 150px;
    }

    /* Footer centred */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 1.75rem;
        text-align: center;
    }
    .footer-grid p {
        margin-inline: auto;
    }
    .footer-brand {
        justify-content: center;
    }
    .site-footer a {
        margin-inline: auto;
    }
}

@media (max-width: 720px) {
    .timeline-head {
        display: flex;
        flex-direction: column;
    }
    .skills-grid {
        display: block;
    }
    .skill-card {
        margin-bottom: 0.5rem;
    }
    .contact-direct {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .hero {
        padding: 6.4rem 1.1rem 4.5rem;
    }
    .hero-actions {
        flex-direction: column;
        align-items: stretch;
        max-width: 320px;
        margin-inline: auto;
    }
    .hero-links {
        gap: 0.4rem 1.1rem;
    }
    .hero-links li + li::before {
        display: none;
    }
    .section {
        padding: 3.6rem 1.1rem;
    }
    .section-head {
        margin-bottom: 2.25rem;
    }
    .work-card {
        padding: 1.2rem 1.2rem;
    }
    .work-meta {
        flex-direction: column;
        align-items: start;
        margin-bottom: 0.5rem;
    }
    .skill-card {
        padding: 1.2rem;
    }
    .timeline {
        padding-left: 1.6rem;
    }
    .timeline-item::before {
        left: -1.6rem;
    }
    .brand-name {
        font-size: 0.98rem;
    }
    #top_page_button {
        right: 1rem;
        bottom: 1rem;
    }
}

@media (max-width: 380px) {
    .brand-name {
        font-size: 0.9rem;
    }
    .hero-links {
        font-size: 0.88rem;
    }
}
