/* Root Variables */
:root {
    --bg-dark-start: #0a0a0a;
    --bg-dark-end: #1a1a2e;
    --accent-primary: #093952;
    --accent-secondary: #145209;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
}

/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
        "Ubuntu", "Cantarell", sans-serif;
    background: linear-gradient(
        135deg,
        var(--bg-dark-start) 0%,
        var(--bg-dark-end) 100%
    );
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Navbar */
.navbar {
    position: sticky;
    top: 0;
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--card-border);
    z-index: 1000;
    padding: 0rem 0;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(
        135deg,
        var(--accent-primary),
        var(--accent-secondary)
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    flex-shrink: 0;
    transition: brightness 0.3s ease-in-out;
    filter: brightness(0.9);
}

/* Ensure no underline in any state */
.nav-brand-link:link,
.nav-brand-link:visited {
    text-decoration: none !important;
    transition: brightness 0.3s ease-in-out;
    filter: brightness(0.9);
}

/* Nav brand with avatar */
.nav-brand-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: inherit;
    cursor: pointer;
    transition: brightness 0.3s ease-in-out;
    filter: brightness(0.9);
}

.nav-brand-link:hover {
    transition: brightness 0.3s ease-in-out;
    filter: brightness(1.2);
}

.nav-brand-avatar {
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 20%;
    object-fit: cover;
    border: 1px solid var(--accent-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: brightness 0.3s ease;
}

/* Mobile adjustments */
@media (max-width: 767px) {
    .nav-brand-avatar {
        width: 2rem;
        height: 2rem;
        border-width: 1.5px;
    }

    .nav-brand-link {
        gap: 0.5rem;
    }
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    text-decoration: none !important;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none !important;
    font-weight: 500;
    transition: color 0.3s ease;
    font-size: 0.95rem;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    padding: 0;
    white-space: nowrap;
}

.nav-link-seperator {
    color: var(--text-secondary);
    text-decoration: none !important;
    font-weight: 250;
    font-size: 0.9rem;
    background: none;
    border: none;
    font-family: inherit;
    padding: 0;
    white-space: nowrap;
    opacity: 0.65;
}
.nav-link:hover {
    color: var(--text-primary);
}

/* Dropdown Menu */
.nav-dropdown {
    position: relative;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dropdown-arrow {
    font-size: 0.7rem;
    transition: transform 0.3s ease;
}

.dropdown-toggle:hover .dropdown-arrow {
    transform: translateY(2px);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 30, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 0.5rem 0;
    min-width: 120px;
    opacity: 0;
    visibility: hidden;
    transition:
        opacity 0.3s ease,
        visibility 0.3s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.nav-dropdown:hover .dropdown-menu,
.nav-dropdown:focus-within .dropdown-menu {
    opacity: 1;
    visibility: visible;
}

.dropdown-item {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    transition:
        background 0.2s ease,
        color 0.2s ease;
    white-space: nowrap;
    text-align: center;
}

.dropdown-item:hover {
    background: var(--card-bg);
    color: var(--text-primary);
}

/* Hamburger Menu */
.hamburger {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    gap: 0.35rem;
    z-index: 1001;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}

.hamburger span {
    display: block;
    width: 25px;
    height: 2px;
    background: var(--text-primary);
    transition:
        transform 0.3s ease,
        opacity 0.3s ease;
    border-radius: 2px;
}

.hamburger.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* Main Content */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 4rem 2rem;
}

/* Hero Section */
.hero-section {
    display: grid;
    grid-template-columns: 450px 1fr;
    gap: 4rem;
    align-items: start;
    margin-bottom: 3rem;
}

.profile-container {
    position: sticky;
    top: 100px;
    align-self: start;
}

/* FIXED: Profile image with better mobile support */
.profile-image-wrapper {
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    border: 2px solid var(--card-border);
    width: 100%;
    position: relative;
    /* Use aspect-ratio for modern browsers */
    aspect-ratio: 1 / 1;
}

/* Fallback for browsers that don't support aspect-ratio */
@supports not (aspect-ratio: 1 / 1) {
    .profile-image-wrapper {
        height: 0;
        padding-bottom: 100%;
    }
}

.profile-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%;
    display: block;
}

.hero-text {
    padding-top: 0;
    align-self: start;
}

@keyframes huerotatetitle {
    0% {
        filter: hue-rotate(0deg);
    }
    10% {
        filter: hue-rotate(36deg);
    }
    20% {
        filter: hue-rotate(72deg);
    }
    30% {
        filter: hue-rotate(180deg);
    }
    40% {
        filter: hue-rotate(144deg);
    }
    50% {
        filter: hue-rotate(180deg);
    }
    60% {
        filter: hue-rotate(216deg);
    }
    70% {
        filter: hue-rotate(252deg);
    }
    80% {
        filter: hue-rotate(288deg);
    }
    90% {
        filter: hue-rotate(384deg);
    }
    100% {
        filter: hue-rotate(360deg);
    }
}

.hero-title {
    font-size: 3.25rem;
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 1.75rem;
    padding: 0 0 0.5rem 0;
    background: linear-gradient(
        135deg,
        var(--accent-primary),
        var(--accent-secondary)
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: filter 0.3s ease-in-out;
    filter: drop-shadow(3px 4px 5px #091b26);
}
.hero-title:hover {
    animation-name: huerotatetitle;
    animation-duration: 1.4s;
    animation-iteration-count: infinite;
    animation-timing-function: ease-in-out;
    transition: filter 0.3s ease-in-out;
    filter: drop-shadow(6px 10px 8px #0b2633);
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 0.8rem;
    font-weight: 450;
    line-height: 1.6;
}

.hero-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

/* Terminal Animation */
.terminal-container {
    margin-top: 2.25rem;
    background: rgba(15, 15, 20, 0.6);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    max-width: 100%;
}

.terminal-header {
    background: linear-gradient(
        to bottom,
        rgba(40, 40, 45, 0.9),
        rgba(25, 25, 30, 0.9)
    );
    padding: 0.35rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.terminal-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.terminal-dot.red {
    background: linear-gradient(135deg, #ff6058 0%, #d83a2c 100%);
}

.terminal-dot.yellow {
    background: linear-gradient(135deg, #ffbd2e 0%, #d99e1f 100%);
}

.terminal-dot.green {
    background: linear-gradient(135deg, #27c93f 0%, #1fa62f 100%);
}

.terminal-title {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.95rem;
    margin-left: auto;
    font-family: "Courier New", monospace;
    letter-spacing: 0.05em;
}

.terminal-body {
    padding: 1.25rem 1.5rem;
    font-family: "Courier New", "Monaco", monospace;
    font-size: 1rem;
    min-height: 60px;
    background: rgba(10, 10, 15, 0.5);
}

.terminal-line {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.terminal-prompt {
    color: var(--accent-secondary);
    font-weight: bold;
    user-select: none;
}

.terminal-command {
    color: var(--text-primary);
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.terminal-cursor {
    color: var(--accent-secondary);
    font-weight: bold;
    display: inline-block;
    margin-left: 2px;
}

/* Make terminal clickable */
.terminal-link {
    text-decoration: none;
    color: inherit;
    display: block;
    cursor: pointer;
}

.terminal-container {
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
}

.terminal-link:hover .terminal-container {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

/* Optional: Add a subtle indication it's clickable */
.terminal-link:hover .terminal-body {
    background: rgba(10, 10, 15, 0.6);
}

/* Services Section */
.section {
    margin-bottom: 2rem;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1.8rem;
    text-align: center;
    color: var(--text-secondary);
    padding-top: 1rem;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(300px, 1fr));
    gap: 2rem;
}

.service-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 2rem;
    transition:
        transform 0.3s ease,
        border-color 0.3s ease;
}

.service-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-primary);
}

.service-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.service-description {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Experience Page */
.experience-section {
    max-width: 900px;
    margin: 0 auto;
}

.page-title {
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 3rem;
    text-align: center;
    background: linear-gradient(
        135deg,
        var(--accent-primary),
        var(--accent-secondary)
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.experience-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.experience-item {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 2.5rem;
    transition:
        transform 0.3s ease,
        border-color 0.3s ease;
}

.experience-item:hover {
    transform: translateX(10px);
    border-color: var(--accent-primary);
}

.experience-item p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.experience-item h2 {
    font-size: 2.75rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
    color: var(--text-secondary);
}

.experience-item h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
}

.experience-item h4 {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--accent-secondary);
    margin-bottom: 1rem;
    font-style: italic;
}

.experience-item ul {
    list-style: none;
    padding-left: 0;
}

.experience-item li {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
    position: relative;
}

.experience-item li:before {
    content: "▹";
    position: absolute;
    left: 0;
    color: var(--accent-secondary);
    font-weight: bold;
}

/* Footer */
.footer {
    text-align: center;
    padding: 0.5rem 0rem;
    border-top: 1px solid var(--card-border);
    color: var(--text-secondary);
    font-size: 0.9rem;
    opacity: 0.6;
}

/* Code Styling */
code {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: "Courier New", monospace;
    font-size: 0.9em;
    color: var(--accent-primary);
}

/* ====================================================================== */
/* RESPONSIVE DESIGN */
/* ====================================================================== */

@media (max-width: 1024px) {
    .hero-section {
        grid-template-columns: 300px 1fr;
        gap: 3rem;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .nav-links {
        gap: 1.5rem;
    }

    .nav-link {
        font-size: 0.9rem;
    }
}

/* IPAD STYLING (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .nav-container {
        padding: 0 1.5rem;
    }

    .nav-links {
        display: flex !important;
        position: static !important;
        width: auto !important;
        height: auto !important;
        gap: 1.2rem;
        flex-direction: row;
        align-items: center;
        background: none !important;
        padding: 0 !important;
        border: none !important;
    }

    .nav-link {
        font-size: 0.85rem;
    }

    .hamburger {
        display: none !important;
    }
}

/* MOBILE (below 768px) */
@media (max-width: 767px) {
    .hamburger {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 75%;
        max-width: 300px;
        max-height: 100vh;
        max-height: 100dvh;
        background: rgba(10, 10, 20, 0.98);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        flex-direction: column;
        align-items: flex-start;
        padding: 5rem 2rem 2rem;
        gap: 1.5rem;
        border-left: 1px solid var(--card-border);
        transition: right 0.3s ease;
        z-index: 1000;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .nav-links.active {
        right: 0;
    }

    .nav-dropdown {
        width: 100%;
    }

    .dropdown-toggle {
        width: 100%;
        text-align: left;
        justify-content: space-between;
    }

    .dropdown-menu {
        position: static;
        transform: none;
        opacity: 1;
        visibility: visible;
        display: none;
        margin-top: 0.5rem;
        margin-left: 1rem;
        width: calc(100% - 1rem);
        box-shadow: none;
    }

    .dropdown-menu.active {
        display: block;
    }

    .hero-section {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    /* FIXED: Better mobile image container */
    .profile-container {
        position: relative;
        top: 0;
        width: 100%;
        max-width: 400px;
        min-width: 280px;
        margin: 0 auto;
    }

    /* Ensure wrapper maintains aspect ratio on mobile */
    .profile-image-wrapper {
        width: 100%;
        /* Force padding-bottom fallback on mobile for better compatibility */
        aspect-ratio: 1 / 1;
    }

    /* Extra fallback for older mobile browsers */
    @supports not (aspect-ratio: 1 / 1) {
        .profile-image-wrapper {
            height: 0;
            padding-bottom: 100% !important;
        }
    }

    .hero-title {
        font-size: 2rem;
        text-align: center;
    }

    .hero-subtitle {
        font-size: 1.1rem;
        text-align: center;
    }

    .hero-description {
        font-size: 1rem;
        text-align: center;
    }

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

    .page-title {
        font-size: 2rem;
    }

    .experience-item {
        padding: 1.5rem;
    }

    .experience-item h2 {
        font-size: 1.5rem;
    }

    .terminal-container {
        margin-top: 1.5rem;
    }

    .terminal-header {
        padding: 0.6rem 0.875rem;
    }

    .terminal-dot {
        width: 10px;
        height: 10px;
    }

    .terminal-body {
        padding: 1rem;
        font-size: 0.85rem;
    }

    .terminal-command {
        font-size: 0.85rem;
    }

    .terminal-line {
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 2rem 1rem;
    }

    .hero-title {
        font-size: 1.75rem;
    }

    .section-title {
        font-size: 1.75rem;
    }

    .nav-container {
        padding: 0 1rem;
    }

    .nav-links {
        width: 85%;
    }

    /* FIXED: Ensure image container works on small phones */
    .profile-container {
        max-width: 320px;
        min-width: 240px;
    }

    .terminal-body {
        font-size: 0.75rem;
        padding: 0.875rem;
    }

    .terminal-command {
        font-size: 0.75rem;
    }

    .terminal-header {
        padding: 0.5rem 0.75rem;
    }

    .terminal-title {
        font-size: 0.65rem;
    }
}

/* ====================================================================== */
/* Enhanced Markdown Pages - Header with Image Support - SCALED */
/* ====================================================================== */

/* Container for heading + image layout */
.experience-header-with-image {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 1rem;
    /* Ensure heading doesn't exceed 6 rems */
    max-height: 6rem;
}

/* Heading wrapper - constrain height */
.experience-heading-wrapper {
    flex: 1;
    min-width: 0;
    /* Ensure heading text is constrained */
    overflow: hidden;
    /* Match the container height */
    height: 100%;
    display: flex;
    align-items: center;
}

.experience-heading-wrapper h2 {
    /* Constrain heading to max 6 rems */
    max-height: 6rem;
    overflow: hidden;
    line-height: 1.4;
    margin: 0;
    word-wrap: break-word;
}

/* Image wrapper - scale to match heading height */
.experience-image-wrapper {
    flex-shrink: 0;
    /* Match the container height (which is 6rem max) */
    height: 6rem;
    width: 6rem;
    border-radius: 0px;
    overflow: hidden;
    border: none; /* 2px solid var(--card-border); */
    box-shadow: none; /* 0 4px 12px rgba(0, 0, 0, 0.3); */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Image - fill the wrapper */
.experience-header-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* Mobile responsive layout */
@media (max-width: 767px) {
    .experience-header-with-image {
        flex-direction: column;
        gap: 1rem;
        max-height: none;
        align-items: flex-start;
    }

    .experience-heading-wrapper {
        width: 100%;
        height: auto;
        max-height: 6rem;
    }

    .experience-image-wrapper {
        /* Smaller on mobile: 4 rems */
        width: 4rem;
        height: 4rem;
        align-self: center;
    }
}

@media (max-width: 480px) {
    .experience-image-wrapper {
        /* Even smaller on tiny screens: 3.5 rems */
        width: 3.5rem;
        height: 3.5rem;
    }
}

/* ====================================================================== */
/* EXPANDABLE CARD SCROLL FIXES - ADDED TO YOUR EXISTING STYLES */
/* ====================================================================== */

/* Make expanded cards work with natural scrolling */
.service-card.expanded {
    grid-column: 1 / -1;
    position: relative;
    z-index: 100;
    min-height: 600px;
}

/* When a card is expanded, hide others */
.services-grid.has-expanded-card {
    grid-template-columns: 1fr;
}

.services-grid.has-expanded-card .service-card:not(.expanded) {
    display: none;
}

/* Brief content (hidden when expanded) */
.service-brief {
    opacity: 1;
    transition: opacity 0.3s;
}

.service-card.expanded .service-brief {
    display: none;
}

/* Detailed content (shown when expanded) */
.service-detailed {
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
    padding-top: 1rem;
    padding: 1.5rem 3rem 3rem 3rem;
}

.service-card.expanded .service-detailed {
    display: block;
    opacity: 1;
}

.service-detailed h3 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

.service-detailed h4 {
    font-size: 1.3rem;
    margin: 2rem 0 1rem 0;
    color: var(--accent-primary);
}

.service-detailed p {
    margin-bottom: 1.5rem;
}

.service-detailed ul {
    margin: 1rem 0 1rem 1.5rem;
}

.service-detailed li {
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

/* macOS-style close button */
.card-close-btn {
    display: none;
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ff5f57;
    border: 1px solid rgba(0, 0, 0, 0.3);
    z-index: 10;
    cursor: pointer;
    transition: all 0.2s;
}

.service-card.expanded .card-close-btn {
    display: block;
}

.card-close-btn::before {
    content: "×";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(0, 0, 0, 0.5);
    font-size: 10px;
    opacity: 0;
    transition: opacity 0.2s;
}

.card-close-btn:hover {
    background: #ff3b30;
    transform: scale(1.1);
}

.card-close-btn:hover::before {
    opacity: 1;
}

/* Mobile adjustments */
@media (max-width: 767px) {
    .card-close-btn {
        top: 1rem;
        left: 1rem;
    }

    .service-detailed {
        padding-top: 2.5rem;
    }
}
