/* Material Design 3 System */
:root {
    /* Color Palette - Dark Mode Default */
    --md-sys-color-primary: #d0bcff;
    --md-sys-color-on-primary: #381e72;
    --md-sys-color-primary-container: #4f378b;
    --md-sys-color-on-primary-container: #eaddff;

    --md-sys-color-surface: #141218;
    --md-sys-color-on-surface: #e6e1e5;
    --md-sys-color-surface-variant: #49454f;
    --md-sys-color-on-surface-variant: #cac4d0;

    --md-sys-color-outline: #938f99;
    --md-sys-color-background: #141218;

    /* Typography */
    --font-family: 'Roboto', sans-serif;

    /* Elevation / Shadows */
    --elevation-1: 0px 1px 2px rgba(0, 0, 0, 0.3), 0px 1px 3px 1px rgba(0, 0, 0, 0.15);
    --elevation-2: 0px 1px 2px rgba(0, 0, 0, 0.3), 0px 2px 6px 2px rgba(0, 0, 0, 0.15);
    --elevation-3: 0px 4px 8px 3px rgba(0, 0, 0, 0.15), 0px 1px 3px rgba(0, 0, 0, 0.3);

    /* Shapes */
    --shape-corner-small: 8px;
    --shape-corner-medium: 12px;
    --shape-corner-large: 16px;
    --shape-corner-extra-large: 28px;
}

[data-theme="light"] {
    --md-sys-color-primary: #6750a4;
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-primary-container: #eaddff;
    --md-sys-color-on-primary-container: #21005d;

    --md-sys-color-surface: #fdf8fd;
    --md-sys-color-on-surface: #1c1b1f;
    --md-sys-color-surface-variant: #e7e0ec;
    --md-sys-color-on-surface-variant: #49454f;

    --md-sys-color-outline: #79747e;
    --md-sys-color-background: #fdf8fd;

    /* Light mode shadows are softer */
    --elevation-1: 0px 1px 3px 1px rgba(0, 0, 0, 0.15), 0px 1px 2px 0px rgba(0, 0, 0, 0.3);
    --elevation-2: 0px 2px 6px 2px rgba(0, 0, 0, 0.15), 0px 1px 2px 0px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--md-sys-color-background);
    color: var(--md-sys-color-on-surface);
    background-size: contain;
    background-repeat: repeat;
    background-position: center center;
    transition: background-image 0.5s ease-in-out;
    transition: background-color 0.3s, color 0.3s;
    line-height: 1.5;
}

/* Typography Scale */
.headline-1 {
    font-size: 3.5rem;
    font-weight: 600;
    letter-spacing: -0.25px;
    margin-bottom: 1rem;
}

.headline-2 {
    font-size: 2.5rem;
    font-weight: 400;
    margin-bottom: 2rem;
    color: var(--md-sys-color-primary);
}

.headline-6 {
    font-size: 1.25rem;
    font-weight: 500;
    letter-spacing: 0.15px;
}

.body-large {
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 0.5px;
    opacity: 0.8;
    margin-bottom: 2rem;
}

.body-medium {
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 0.25px;
    opacity: 0.7;
}

.body-small {
    font-size: 0.875rem;
    font-weight: 400;
    letter-spacing: 0.4px;
}

.overline {
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 1.5px;
    color: var(--md-sys-color-primary);
    margin-bottom: 0.5rem;
}

/* Top App Bar */
.top-app-bar {
    position: sticky;
    /* Make it sticky */
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background-color: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    transition: box-shadow 0.3s;
}

.top-app-bar.scrolled {
    background-color: var(--md-sys-color-surface-variant);
    /* Slightly different color when scrolled */
    box-shadow: var(--elevation-2);
}

.app-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.icon-button {
    background: none;
    border: none;
    color: var(--md-sys-color-on-surface);
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s;
}

.icon-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .icon-button:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

/* Layout */
.content-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 80px;
}

/* Section specific */
.hero-section {
    padding: 60px 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.abstract-shape {
    position: absolute;
    top: -50px;
    right: -50px;
    width: 300px;
    height: 300px;
    background: var(--md-sys-color-primary-container);
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.5;
    animation: pulse 4s infinite alternate;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }

    100% {
        transform: scale(1.1);
        opacity: 0.7;
    }
}

.section-container {
    text-align: center;
}

/* Cards */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.card {
    background-color: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface);
    border-radius: var(--shape-corner-large);
    padding: 24px;
    text-decoration: none;
    transition: box-shadow 0.3s, transform 0.3s;
    box-shadow: var(--elevation-1);
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Center content in card */
    text-align: center;
    position: relative;
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--elevation-3);
    transform: translateY(-4px);
}

.card-icon {
    font-size: 48px;
    color: var(--md-sys-color-primary);
    margin-bottom: 16px;
}

/* Project Cards */
.project-card {
    padding: 0;
    /* Remove default padding for image flush */
    align-items: flex-start;
    /* Align text to left */
    text-align: left;
    height: 100%;
    cursor: default;
    /* Projects might not be links themselves, or use a button inside */
}

.card-image {
    width: 100%;
    /* height: 200px;  Removed fixed height to show full image */
    background-color: var(--md-sys-color-surface-variant);
    overflow: hidden;
}

.card-image img {
    width: 100%;
    height: auto;
    /* Allow height to adjust based on width */
    display: block;
    /* Remove bottom space */
    object-fit: contain;
    /* Ensure full image is visible if we ever set height */
    transition: transform 0.5s;
}

.project-card:hover .card-image img {
    transform: scale(1.05);
    /* Zoom effect on hover */
}

.project-card .card-content {
    padding: 16px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

/* Chips / Tags */
.chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
    /* Push to bottom if content varies */
    padding-top: 12px;
}

.chip {
    font-size: 0.75rem;
    padding: 4px 12px;
    border-radius: 16px;
    background-color: var(--md-sys-color-surface);
    /* Use surface color for contrast on Surface Variant card */
    color: var(--md-sys-color-on-surface-variant);
    border: 1px solid var(--md-sys-color-outline);
    font-weight: 500;
}

[data-theme="light"] .chip {
    background-color: rgba(0, 0, 0, 0.05);
}

.contact-card {
    max-width: 500px;
    margin: 0 auto;
    text-align: left;
    align-items: stretch;
    /* Stretch content */
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 0;
}

.contact-item .material-icons-round {
    color: var(--md-sys-color-primary);
    font-size: 24px;
}

.link {
    color: var(--md-sys-color-primary);
    text-decoration: none;
    font-weight: 500;
}

.divider {
    height: 1px;
    background-color: var(--md-sys-color-outline);
    opacity: 0.3;
    margin: 16px 0;
}

/* Buttons */
.btn-filled {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    padding: 10px 24px;
    border-radius: 100px;
    /* Pillow shape */
    text-decoration: none;
    font-weight: 500;
    transition: box-shadow 0.3s, filter 0.3s;
    box-shadow: var(--elevation-1);
}

.btn-filled:hover {
    box-shadow: var(--elevation-2);
    filter: brightness(1.1);
}

/* FAB */
.fab-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: var(--shape-corner-extra-large);
    /* 16px generally for FAB in M3, or slightly more rounded */
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: var(--elevation-3);
    transition: transform 0.3s, box-shadow 0.3s;
    z-index: 10;
}

.fab:hover {
    transform: scale(1.1);
}

/* Ripple Effect */
.ripple {
    position: relative;
    overflow: hidden;
}

span.ripple-effect {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    animation: ripple 0.6s linear;
    background-color: rgba(255, 255, 255, 0.3);
    /* Default white ripple */
    pointer-events: none;
}

[data-theme="light"] span.ripple-effect {
    background-color: rgba(0, 0, 0, 0.1);
    /* Dark ripple for light theme */
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Footer */
footer {
    text-align: center;
    padding: 40px 24px;
    opacity: 0.9;
    margin-top: 40px;
    border-top: 1px solid var(--md-sys-color-outline);
    background-color: var(--md-sys-color-surface);
}

.footer-socials {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 16px;
}

.footer-socials a {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 1.5rem;
    transition: color 0.3s, transform 0.3s;
}

.footer-socials a:hover {
    color: var(--md-sys-color-primary);
    transform: translateY(-2px);
}

/* Responsive */
@media (max-width: 600px) {
    .headline-1 {
        font-size: 2.5rem;
    }

    .content-container {
        padding: 16px;
    }
}

/* Card Actions */
.card-actions {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    margin-top: 16px;
}

.btn-text {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    color: var(--md-sys-color-primary);
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s;
    font-size: 0.9rem;
}

.btn-text:hover {
    background-color: rgba(208, 188, 255, 0.1);
}

.btn-text .material-icons-round {
    font-size: 20px;
}

/* Back Link */
.back-link {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    text-decoration: none;
    color: var(--md-sys-color-on-surface);
    opacity: 0.8;
}

.back-link:hover {
    opacity: 1;
    color: var(--md-sys-color-primary);
}

/* Markdown Styling */
.markdown-body {
    text-align: left;
    width: 100%;
    max-width: 100%;
    line-height: 1.6;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
    color: var(--md-sys-color-primary);
    margin-top: 24px;
    margin-bottom: 16px;
}

.markdown-body h1 {
    font-size: 2rem;
    border-bottom: 1px solid var(--md-sys-color-outline);
    padding-bottom: 8px;
}

.markdown-body h2 {
    font-size: 1.5rem;
}

.markdown-body h3 {
    font-size: 1.25rem;
}

.markdown-body p,
.markdown-body li {
    margin-bottom: 12px;
    color: var(--md-sys-color-on-surface);
    opacity: 0.9;
}

.markdown-body ul,
.markdown-body ol {
    margin-left: 24px;
    margin-bottom: 24px;
}

.markdown-body pre {
    background-color: var(--md-sys-color-surface);
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 24px;
    border: 1px solid var(--md-sys-color-outline);
}

.markdown-body code {
    font-family: 'Courier New', Courier, monospace;
    background-color: rgba(255, 255, 255, 0.1);
    padding: 2px 4px;
    border-radius: 4px;
}

.markdown-body pre code {
    background-color: transparent;
    padding: 0;
}

.markdown-body blockquote {
    border-left: 4px solid var(--md-sys-color-primary);
    padding-left: 16px;
    margin-bottom: 24px;
    font-style: italic;
    opacity: 0.8;
}

/* Loading & Error */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 48px;
    opacity: 0.7;
}

.spinning {
    animation: rotate 2s linear infinite;
    display: inline-block;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.error-msg {
    color: #ffb4ab;
    padding: 24px;
    text-align: center;
}