@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap");

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

:root {
    color-scheme: light dark;
    --bg: #f8fafc; /* slate-50 */
    --surface: #ffffff;
    --text: #0f172a; /* slate-900 */
    --muted: #475569; /* slate-600 */
    --border: #e2e8f0; /* slate-200 */
    --accent: #2563eb; /* blue-600 */
    --accent-600: #1d4ed8; /* blue-700 */
    --shadow: 0 10px 30px rgba(2, 6, 23, 0.06);
    --radius: 14px;
    --tag-code: #2563eb;
    --tag-ml: #10b981;
    --tag-cad: #f59e0b;
    --tag-embed: #8b5cf6;
    --tag-web: #ec4899;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b1220;
        --surface: #0f172a;
        --text: #e5e7eb;
        --muted: #94a3b8;
        --border: #1f2937;
        --shadow: 0 10px 30px rgba(2, 6, 23, 0.4);
    }
}

html,
body {
    height: 100%;
}

body {
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica Neue, Arial, "Apple Color Emoji", "Segoe UI Emoji";
    color: var(--text);
    background: radial-gradient(1200px 600px at 80% -10%, rgba(37, 99, 235, 0.06), transparent 60%), radial-gradient(800px 400px at -10% 0%, rgba(2, 6, 23, 0.06), transparent 60%), var(--bg);
    line-height: 1.6;
}

/* Layout */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

main {
    display: block;
}

/* Navigation */
.main-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--surface) 85%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    padding: 12px 24px;
}

.main-nav .button {
    margin: 0;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 12px;
    box-shadow: 0 3px 12px rgba(37, 99, 235, 0.3);
    transition: transform 0.15s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.main-nav .button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

/* Buttons */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    font-weight: 600;
    text-decoration: none;
    color: #fff;
    background: var(--accent);
    border: 1px solid transparent;
    border-radius: 10px;
    transition: transform 0.15s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
}

.button:hover {
    background: var(--accent-600);
    transform: translateY(-1px);
}

.button:active {
    transform: translateY(0);
}

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

/* Hero */
.hero {
    padding: 16px 0 12px;
}

.hero-content {
    display: flex;
    align-items: center;
    gap: 24px;
}

.hero-image {
    order: 0;
    flex: 0 0 auto;
}

.hero-text {
    order: 1;
}

.hero-text h1 {
    font-size: clamp(32px, 6vw, 48px);
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
}

.hero-text p {
    max-width: 70ch;
    color: var(--muted);
    font-size: clamp(16px, 2.4vw, 18px);
}

.hero-image img {
    width: clamp(220px, 26vw, 260px);
    height: clamp(220px, 26vw, 260px);
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border);
    box-shadow: var(--shadow);
    display: block;
}

/* Highlights */
.highlights {
    padding: 24px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 32px;
}

.highlights-grid {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.highlight-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    text-decoration: none;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.highlight-item:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.highlight-icon {
    font-size: 16px;
}

/* Featured Projects */
.featured-projects {
    padding: 0px 0 12px;
}

.featured-projects h2 {
    text-align: center;
    margin-bottom: 24px;
    font-size: 28px;
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 16px;
}

.view-all {
    text-align: center;
    margin-top: 8px;
    margin-bottom: 0;
}

.view-all .button {
    margin: 0;
}

/* Grid */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    max-width: 1100px;
    margin: 6px auto 32px;
    padding: 0 24px;
    align-items: stretch;
}

.grid-container .box-link {
    height: 100%;
}

.grid-container .box {
    height: 100%;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
}

/* Cards */
.box-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.box {
    background: linear-gradient(180deg, var(--surface), rgba(255, 255, 255, 0.9));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    text-align: left;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    max-width: 1100px;
    margin: 20px auto;
    background: var(--surface) !important;
}

.box h2 {
    font-size: 18px;
    margin-bottom: 8px;
}

.box p {
    color: var(--muted);
}

.box-link:hover .box {
    transform: translateY(-3px);
    box-shadow: 0 18px 40px rgba(2, 6, 23, 0.14);
    border-color: rgba(37, 99, 235, 0.4);
}

/* Consolidated body > .box rules */
body > .box {
    max-width: calc(1100px - 48px);
    width: calc(100% - 48px);
    margin: 20px auto;
    padding: 22px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

/* Projects grid and cards */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 22px;
    max-width: 1100px;
    margin: 20px auto 48px;
    padding: 0 24px;
}

.project-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 2px);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: block;
    color: inherit;
    text-decoration: none;
}

.project-card::before {
    content: "";
    position: absolute;
    inset: 0;
    height: 6px;
    background: linear-gradient(90deg, var(--accent-card, var(--accent)), transparent 70%);
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 22px 46px rgba(2, 6, 23, 0.16);
}

.project-cover {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
}

.project-content {
    padding: 16px 16px 18px;
}

.project-content h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.project-content p {
    color: var(--muted);
    font-size: 14px;
}

.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0 14px;
}

/* Consolidated badge rules */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.38rem 0.75rem;
    border-radius: 16px;
    font-size: 0.95rem;
    font-weight: 600;
    border: 1px solid transparent;
    line-height: 1;
    white-space: nowrap;
    word-break: keep-all;
    hyphens: none;
    min-height: 34px;
}

.badge.blue {
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
    border-color: rgba(37, 99, 235, 0.2);
}
.badge.emerald {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
    border-color: rgba(16, 185, 129, 0.2);
}
.badge.amber {
    background: rgba(245, 158, 11, 0.14);
    color: #b45309;
    border-color: rgba(245, 158, 11, 0.2);
}
.badge.purple {
    background: rgba(139, 92, 246, 0.14);
    color: #6d28d9;
    border-color: rgba(139, 92, 246, 0.2);
}
.badge.pink {
    background: rgba(236, 72, 153, 0.14);
    color: #be185d;
    border-color: rgba(236, 72, 153, 0.2);
}
.badge.tag-code {
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
    border-color: rgba(37, 99, 235, 0.2);
}
.badge.tag-ml {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
    border-color: rgba(16, 185, 129, 0.2);
}
.badge.tag-cad {
    background: rgba(245, 158, 11, 0.14);
    color: #b45309;
    border-color: rgba(245, 158, 11, 0.2);
}
.badge.tag-embed {
    background: rgba(139, 92, 246, 0.14);
    color: #6d28d9;
    border-color: rgba(139, 92, 246, 0.2);
}
.badge.tag-web {
    background: rgba(236, 72, 153, 0.14);
    color: #be185d;
    border-color: rgba(236, 72, 153, 0.2);
}

.card-actions {
    display: flex;
    gap: 10px;
}
.card-actions .button {
    padding: 8px 12px;
    font-size: 14px;
    box-shadow: none;
}

/* Per-card accent colors */
.accent-blue {
    --accent-card: #2563eb;
}
.accent-emerald {
    --accent-card: #10b981;
}
.accent-amber {
    --accent-card: #f59e0b;
}
.accent-purple {
    --accent-card: #8b5cf6;
}
.accent-pink {
    --accent-card: #ec4899;
}
.accent-code {
    --accent-card: var(--tag-code);
}
.accent-ml {
    --accent-card: var(--tag-ml);
}
.accent-cad {
    --accent-card: var(--tag-cad);
}
.accent-embed {
    --accent-card: var(--tag-embed);
}
.accent-web {
    --accent-card: var(--tag-web);
}

/* Align top-level back links like content */
body > p {
    max-width: 1100px;
    margin: 16px auto;
    padding: 0 24px;
}

/* Default page spacing for existing subpages without wrappers */
body > h1,
body > h2,
body > h3,
body > h4 {
    max-width: 1100px;
    margin: 28px auto 8px;
    padding: 0 24px;
}

/* Awards list */
.awards {
    padding-left: 18px;
    margin-top: 6px;
}
.awards li {
    margin: 6px 0;
}

/* Experience Timeline */
.experience-timeline {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

.timeline-item {
    display: flex;
    gap: 20px;
    margin-bottom: 32px;
    position: relative;
}

/* Consolidated timeline-marker rules */
.timeline-marker {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    background: var(--surface);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 2px var(--border);
    position: relative;
    z-index: 2;
    overflow: hidden;
}

.timeline-icon {
    font-size: 20px;
}

.timeline-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
    display: block;
}

.timeline-content {
    flex: 1;
    min-width: 0;
}

.experience-box {
    margin: 0;
    border-left: 4px solid var(--accent);
    padding-left: 20px;
}

.experience-header {
    margin-bottom: 16px;
}

.experience-header h2 {
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--text);
}

.experience-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 14px;
    color: var(--muted);
}

.experience-date {
    font-weight: 600;
}

.experience-location {
    opacity: 0.8;
}

.experience-details p {
    margin-bottom: 16px;
    line-height: 1.6;
}

.experience-highlights {
    background: rgba(37, 99, 235, 0.05);
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
}

.experience-highlights h4 {
    font-size: 16px;
    margin-bottom: 12px;
    color: var(--accent);
}

/* About Page Styles */
.about-sections {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

.about-section {
    margin-bottom: 32px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.section-icon {
    font-size: 24px;
    width: 40px;
    height: 40px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.section-header h2 {
    margin: 0;
    font-size: 24px;
}

.about-box {
    margin: 0;
}

.education-item {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.education-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.education-item h3 {
    font-size: 18px;
    margin-bottom: 4px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.edu-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    border-radius: 4px;
    display: block;
}

.education-degree {
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 4px;
}

.education-details {
    color: var(--muted);
    font-size: 14px;
}

.awards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.award-item {
    background: rgba(37, 99, 235, 0.05);
    border-radius: 8px;
    padding: 16px;
}

.award-item h4 {
    font-size: 16px;
    margin-bottom: 8px;
    color: var(--accent);
}

.award-item p {
    font-size: 14px;
    color: var(--muted);
    margin: 0;
}

.awards-list h4,
.competition-placements h4 {
    font-size: 18px;
    margin-bottom: 12px;
    color: var(--text);
}

/* Consolidated skills grid rules */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.skills-grid .box {
    background: var(--surface);
    padding: 1rem;
}

.skill-category {
    background: rgba(37, 99, 235, 0.05);
    border-radius: 8px;
    padding: 16px;
}

.skill-category h4 {
    font-size: 16px;
    margin-bottom: 0.4rem;
    color: var(--accent);
}

.skill-category p {
    font-size: 14px;
    color: var(--muted);
    margin: 0;
    line-height: 1.5;
}

.skills-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.skills-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.skills-badges .badge {
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    font-size: 0.95rem;
}

/* Research Page Styles */
.research-sections {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

.research-section {
    margin-bottom: 32px;
}

.research-box {
    margin: 0;
}

.research-highlights {
    background: rgba(37, 99, 235, 0.05);
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
}

.research-highlights h4 {
    font-size: 16px;
    margin-bottom: 12px;
    color: var(--accent);
}

.publication-item h4 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--accent);
}

.publication-details {
    background: rgba(37, 99, 235, 0.05);
    border-radius: 8px;
    padding: 16px;
    margin-top: 12px;
}

.interests-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.interest-item {
    background: rgba(37, 99, 235, 0.05);
    border-radius: 8px;
    padding: 16px;
}

.interest-item h4 {
    font-size: 16px;
    margin-bottom: 8px;
    color: var(--accent);
}

.interest-item p {
    font-size: 14px;
    color: var(--muted);
    margin: 0;
    line-height: 1.5;
}

/* Quick Links Section */
.quick-links {
    padding: 6px 0 32px;
}

.quick-links h2 {
    text-align: center;
    margin-bottom: 24px;
    font-size: 28px;
}

.quick-link-box {
    text-align: center;
    padding: 24px 20px;
    position: relative;
    overflow: hidden;
}

.quick-link-box::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), transparent);
}

.quick-link-icon {
    font-size: 32px;
    margin-bottom: 12px;
    display: block;
}

.quick-link-box h2 {
    font-size: 24px;
    margin-bottom: 8px;
    color: var(--text);
}

.quick-link-box p {
    color: var(--muted);
    font-size: 16px;
    margin: 0;
}

/* Footer */
.site-footer {
    width: 100%;
    background: var(--surface);
    border-top: 1px solid var(--border);
    margin-top: 16px;
    padding: 24px 0 20px;
}

.site-footer .container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1rem;
}

.footer-content {
    display: none;
}
.footer-bottom {
    display: none;
}

.footer-min {
    text-align: center;
}

.footer-min .footer-rule {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 0 0 12px 0;
}

.footer-min p {
    margin: 6px 0;
    color: var(--muted);
    font-size: 14px;
}

.footer-min a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.footer-min a:hover {
    text-decoration: underline;
}

.footer-icons a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.footer-icons .icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    display: block;
}

/* Typography defaults */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
}

p + p {
    margin-top: 10px;
}

/* Images */
.image {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    border-radius: 8px;
}

/* Project page image constraints and layout */
.main-image {
    max-width: 800px;
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.image-box {
    text-align: center;
    padding: 16px 22px;
}

.image-box figure > figcaption {
    margin-top: 0.75rem;
}

/* Video styling */
video {
    max-width: 700px;
    max-height: 400px;
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* Project media grid */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.media-item {
    text-align: center;
}

.media-item img {
    max-width: 100%;
    max-height: 300px;
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.media-item p {
    margin-top: 8px;
    font-size: 14px;
    color: var(--muted);
    font-weight: 500;
}

/* Demo section styling */
.demo-section {
    background: rgba(37, 99, 235, 0.03);
    border-radius: 12px;
    padding: 24px;
    margin: 20px 0;
    border: 1px solid rgba(37, 99, 235, 0.1);
}

.demo-section h2,
.demo-section h3 {
    color: var(--accent);
    margin-bottom: 16px;
}

/* GIF and animation styling */
.gif-demo {
    max-width: 500px;
    max-height: 350px;
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    margin: 0 auto;
    display: block;
}

/* Project content sections */
.project-section {
    margin: 24px 0;
}

.project-section h2 {
    border-bottom: 2px solid var(--accent);
    padding-bottom: 8px;
    margin-bottom: 16px;
}

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

/* Prevent text overflow */
.project-content h3,
.box h2,
.hero-text h1 {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Ensure minimum border radius and spacing */
.project-card,
.box,
.button,
.highlight-item {
    min-width: 0;
    min-height: 0;
}

/* Wave-Propagation media layouts */
.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.9rem;
}

.row-of-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.row-of-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    align-items: start;
}

.row-of-2.uniform .thumb {
    margin: 0;
}

.row-of-2.uniform .thumb img,
.row-of-2.uniform .thumb video {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

.row-of-2.uniform .thumb.portrait video {
    aspect-ratio: 9 / 16;
    object-fit: contain;
    background: #000;
}

/* Make grid images smaller and equal-height */
.grid-4 img,
.row-of-3 img,
.row-of-2 img,
.row-of-2 video {
    width: 100%;
    height: clamp(140px, 18vw, 240px);
    object-fit: contain;
}

/* Thumbnail caption */
.thumb figcaption,
.row-of-3 .thumb figcaption,
.row-of-2 .thumb figcaption {
    margin-top: 0.6rem;
    font-size: 0.9rem;
    text-align: center;
    position: static !important;
    line-height: 1.25;
}

figure.thumb > figcaption {
    text-align: center;
    margin-top: 0.4rem;
    font-size: 0.95rem;
    color: var(--muted, #666);
}

/* Ensure captions never sit on top of media */
.row-of-3 .thumb,
.row-of-2 .thumb {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
}

.row-of-3 .thumb img,
.row-of-2 .thumb img,
.row-of-2 .thumb video {
    position: static !important;
    display: block;
    width: 100%;
    height: clamp(140px, 18vw, 240px);
    object-fit: contain;
}

/* Equal heights for all media inside a box */
.box.image-box.equal-height .thumb img,
.box.image-box.equal-height .thumb video,
.box.image-box.equal-height > img,
.box.image-box.equal-height > video {
    width: 100%;
    height: clamp(320px, 20vw, 500px);
    object-fit: contain;
    display: block;
}

/* Text column: top-aligned, flush left */
.row-of-2 .text-col {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-self: start;
    text-align: left;
    gap: 0.5rem;
}

.row-of-2.compact {
    column-gap: 0.6rem;
}

.row-of-2 .text-col.justify p {
    text-align: justify;
    text-justify: inter-word;
    hyphens: auto;
}

.indented-list {
    margin-left: 1.2rem;
    padding-left: 0.8rem;
}

/* CTA buttons */
.cta-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.cta-buttons .button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    display: block;
}

.button.primary {
    background: #0d6efd;
    color: #fff;
    border: 1px solid #0d6efd;
}

.button.secondary {
    background: transparent;
    color: #0d6efd;
    border: 1px solid #0d6efd;
}

.button.primary:hover {
    filter: brightness(0.95);
}

.button.secondary:hover {
    background: rgba(13, 110, 253, 0.08);
}

/* Skills marquee and consolidated skills rules */
.skills {
    margin-bottom: 8px;
}

.skills-viewport {
    overflow: hidden;
    mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}

.skills-track {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0;
    will-change: transform;
    animation: skills-scroll 30s linear infinite;
}

.skills-viewport .skills-track .skills-track {
    display: contents;
}

.skill-badge {
    white-space: nowrap;
    font-size: 0.95rem;
    padding: 0.4rem 0.7rem;
    border: 1px solid #e4e4e7;
    border-radius: 999px;
    background: #fff;
}

@keyframes skills-scroll {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-50%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .skills-track {
        animation: none;
    }
}

/* Contact */
.contact {
    margin-block: 3rem;
    text-align: center;
}

.contact-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px auto 10px;
}

.back-link {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: transparent;
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
}

.back-link:hover {
    background: rgba(37, 99, 235, 0.06);
}

/* Consolidated responsive adjustments */
@media (max-width: 1000px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .row-of-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 800px) {
    .hero-content {
        flex-direction: column;
    }
    .hero-image img {
        width: 180px;
        height: 180px;
    }
    .row-of-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-image {
        justify-self: center;
    }

    .highlights-grid {
        gap: 12px;
    }

    .highlight-item {
        font-size: 13px;
        padding: 6px 12px;
    }

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

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .social-links {
        justify-content: center;
    }

    /* Timeline mobile adjustments */
    .timeline-item {
        flex-direction: column;
        gap: 12px;
    }

    .timeline-marker {
        align-self: flex-start;
        margin-left: 8px;
    }

    .experience-box {
        border-left: none;
        border-top: 4px solid var(--accent);
        padding-left: 0;
        padding-top: 16px;
    }

    .experience-meta {
        flex-direction: column;
        gap: 4px;
    }

    video {
        max-height: 250px;
    }

    .media-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .media-item img {
        max-height: 200px;
    }

    .gif-demo {
        max-height: 250px;
    }
}

@media (max-width: 600px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

@media (max-width: 560px) {
    .grid-4 {
        grid-template-columns: 1fr;
    }
    .row-of-3 {
        grid-template-columns: 1fr;
    }
    .row-of-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }

    .main-nav {
        padding: 12px 16px;
    }

    .grid-container {
        padding: 0 16px;
        gap: 16px;
    }

    .projects-grid {
        padding: 0 16px;
        gap: 16px;
    }

    .featured-grid {
        gap: 16px;
    }

    .highlights-grid {
        gap: 8px;
    }

    .highlight-item {
        padding: 6px 10px;
        font-size: 12px;
    }

    /* Ensure project page boxes maintain buffer on mobile and align with content */
    body > .box {
        width: calc(100% - 32px);
        max-width: calc(1100px - 32px);
        margin-left: auto;
        margin-right: auto;
    }

    body > h1 {
        padding: 0 16px;
    }

    body > p {
        padding: 0 16px;
    }
}
