body {
    margin: 0;
    padding: 0 20px;      /* Add 20px padding on left and right sides */
    font-family: Arial, Helvetica, sans-serif;
    background: #0d1117;
    color: #e6edf3;
}

header {
    padding: 40px;
    text-align: center;
    background: #161b22;
    border-bottom: 1px solid #30363d;
}

header h1 {
    margin: 0;
    font-size: 3rem;
}

header p {
    margin-top: 10px;
    font-size: 1.2rem;
    color: #8b949e;
}

nav {
    display: flex;
    justify-content: center;
    gap: 30px;
    padding: 20px;
    background: #161b22;
    border-bottom: 1px solid #30363d;
}

nav a {
    color: #58a6ff;
    text-decoration: none;
    font-size: 1.1rem;
}

section {
    max-width: 900px;
    margin: 40px auto;
    padding: 20px;
}

main {
    max-width: 900px;
    margin: 40px auto;
    padding: 20px;
}

h2 {
    border-left: 4px solid #58a6ff;
    padding-left: 10px;
    margin-bottom: 20px;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.tools-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 0 auto;
    align-items: center;
}

#index-tools .tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 0;
    align-items: initial;
}

.card {
    background: #161b22;
    padding: 20px;
    border: 1px solid #30363d;
    border-radius: 8px;
}

.card a {
    color: #e6edf3; /* White text for links */
    text-decoration: none; /* Remove underline */
}

.card a:hover {
    color: #58a6ff; /* Blue on hover */
}

#index-tools .card {
    /* Homepage tools cards - use default compact styling */
    height: auto;
    max-width: none;
    display: block;
}

.tools-grid .card {
    height: 600px;
    max-width: 30vw;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.project {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #30363d;
}

.contact-box {
    background: #161b22;
    padding: 20px;
    border: 1px solid #30363d;
    border-radius: 8px;
}

.button {
    background: #238636;
    border: none;
    padding: 12px 20px;
    color: white;
    font-size: 1rem;
    border-radius: 6px;
    cursor: pointer;
}

button:hover {
    background: #2ea043;
}

footer {
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    color: #8b949e;
    border-top: 1px solid #30363d;
}

.tool-img {
    width: 100%;          /* Fill the card width */
    max-width: 100%;      /* Don't exceed card width */
    height: auto;         /* Maintain aspect ratio */
    object-fit: contain;  /* Fit entire image without cropping */
    border-radius: 6px;
    display: block;
    margin: 0 auto;       /* Center the image */
}

.card {
    display: flex;
    flex-direction: column;
}

.card img {
    flex-shrink: 0;
}

.card p {
    margin-top: auto;
}

pre {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 15px;
    overflow-x: auto;
    overflow-wrap: break-word;
    word-wrap: break-word;
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.4;
    margin: 15px 0;
}

code {
    color: #e6edf3;
    background: transparent;
}

pre code {
    display: block;
}

.tools-showcase {
    display: flex;
    flex-direction: column;
    gap: 40px;
    margin-top: 30px;
}

.tool-featured {
    display: flex;
    align-items: center;
    gap: 30px;
    background: #161b22;
    padding: 30px;
    border-radius: 12px;
    border: 1px solid #30363d;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tool-featured:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.tool-featured:nth-child(even) {
    flex-direction: row-reverse;
}

.tool-content {
    flex: 1;
    min-width: 300px;
}

.tool-content h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.4em;
}

.tool-content h3 a {
    color: #e6edf3;
    text-decoration: none;
}

.tool-content h3 a:hover {
    color: #58a6ff;
}

.tool-content p {
    margin-bottom: 20px;
    line-height: 1.6;
    color: #c9d1d9;
}

.tool-link {
    display: inline-block;
    color: #58a6ff;
    text-decoration: none;
    font-weight: bold;
    padding: 8px 16px;
    border: 1px solid #58a6ff;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.tool-link:hover {
    background: #58a6ff;
    color: #0d1117;
}

.tool-image {
    flex-shrink: 0;
    max-width: 300px;
}

.tool-screenshot {
    width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid #30363d;
    transition: transform 0.2s ease;
}

.tool-screenshot:hover {
    transform: scale(1.02);
}

/* Build Gallery Styles */
.builds-gallery {
    margin: 40px 0;
}

.build-section {
    margin-bottom: 40px;
}

.build-section h4 {
    color: #58a6ff;
    border-bottom: 2px solid #30363d;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

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

.image-grid img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    border: 2px solid #30363d;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    object-fit: cover;
}

.image-grid img:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(88, 166, 255, 0.4);
    border-color: #58a6ff;
    cursor: pointer;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
    position: relative;
    margin: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: 20px;
}

.modal-image {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(88, 166, 255, 0.6);
}

.close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #e6edf3;
    font-size: 2.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
}

.close:hover {
    color: #58a6ff;
}

/* ===== MOBILE RESPONSIVE STYLES ===== */

/* Tablets and small laptops */
@media (max-width: 1024px) {
    .tools-grid .card {
        max-width: 45vw;
        height: auto;
    }

    .tool-featured {
        flex-direction: column !important;
        padding: 20px;
    }

    .tool-image {
        max-width: 100%;
    }

    .image-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

/* Mobile devices */
@media (max-width: 768px) {
    body {
        padding: 0 10px;
    }

    header {
        padding: 20px 10px;
    }

    header h1 {
        font-size: 2rem;
    }

    header p {
        font-size: 1rem;
    }

    nav {
        flex-wrap: wrap;
        gap: 15px;
        padding: 15px 10px;
        justify-content: center;
    }

    nav a {
        font-size: 0.95rem;
        padding: 5px 10px;
    }

    section, main {
        margin: 20px auto;
        padding: 15px;
    }

    h2 {
        font-size: 1.5rem;
    }

    .skills-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    #index-tools .tools-grid {
        grid-template-columns: 1fr;
    }

    .tools-grid .card {
        max-width: 100%;
        height: auto;
    }

    .card {
        padding: 15px;
    }

    .tool-featured {
        gap: 20px;
        padding: 15px;
    }

    .tool-content {
        min-width: 0;
    }

    .tool-content h3 {
        font-size: 1.2em;
    }

    .image-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    pre {
        padding: 10px;
        font-size: 12px;
    }

    .modal-content {
        padding: 10px;
    }

    .modal-image {
        max-width: 95%;
        max-height: 95%;
    }

    .close {
        top: 10px;
        right: 15px;
        font-size: 2rem;
    }

    /* Whiteboard mobile adjustments */
    .whiteboard-container canvas {
        height: 400px;
    }

    #toolbar {
        gap: 10px;
        padding: 10px;
    }

    #toolbar label {
        font-size: 0.85rem;
    }

    .btn {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }

    header p {
        font-size: 0.9rem;
    }

    nav {
        gap: 10px;
        padding: 10px;
    }

    nav a {
        font-size: 0.85rem;
        padding: 5px 8px;
    }

    h2 {
        font-size: 1.3rem;
    }

    .card h3 {
        font-size: 1.1rem;
    }

    .tool-content h3 {
        font-size: 1.1em;
    }

    .image-grid {
        gap: 8px;
    }

    .build-section h4 {
        font-size: 1rem;
    }

    /* Terminal mobile adjustments */
    .terminal-container {
        margin: 10px 0;
    }

    .terminal-body {
        height: 350px;
        font-size: 0.85rem;
        padding: 10px;
    }

    #terminalInput {
        font-size: 0.85rem;
    }

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

    /* Whiteboard adjustments for small screens */
    .whiteboard-container canvas {
        height: 300px;
    }

    #toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    #size {
        width: 100%;
        max-width: 200px;
    }
}

/* Ensure touch targets are at least 44px for mobile */
@media (max-width: 768px) {
    nav a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .btn, button, .tool-link {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}