/* ==========================================================================
   1. DRACULA THEME VARIABLES
   ========================================================================== */

/* Stores the color palette so you can use variable names instead of hex codes. */
:root {
    --background: #282a36;
    --current-line: #44475a;
    --foreground: #f8f8f2;
    --comment: #6272a4;
    --cyan: #8be9fd;
    --green: #50fa7b;
    --orange: #ffb86c;
    --pink: #ff79c6;
    --purple: #bd93f9;
}

/* ==========================================================================
   2. BASE HTML ELEMENTS
   ========================================================================== */

/* Sets the default background, text color, and font for the entire webpage.
   Uses flexbox to center content vertically in a column. */
body {
    background-color: var(--background);
    color: var(--foreground);
    font-family: 'Meslo LG L', 'JetBrains Mono', monospace;
    margin: 0;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Formats the main page title with the theme's purple color and centers it. */
h1 {
    color: var(--purple);
    font-size: 36px;
    margin-top: 0;
    text-align: center;
}

/* Sets default link color to cyan and removes the underline. */
a {
    color: var(--cyan);
    text-decoration: none;
    transition: 0.3s;
}

/* Changes link color to pink when the user hovers over it. */
a:hover {
    color: var(--pink);
}

/* Creates a horizontal line used to separate different sections of the page. */
.divider {
    border: 0;
    border-top: 1px solid var(--current-line);
    margin: 40px 0;
}

/* ==========================================================================
   3. LAYOUT & CONTAINERS
   ========================================================================== */

/* The main wrapper that restricts page content width and keeps it centered. */
.container {
    max-width: 1000px;
    width: 90%;
    padding: 60px 20px;
    box-sizing: border-box;
    margin: 0 auto;
}

/* A wider version of the main wrapper, useful for large elements like maps. */
.container.wide {
    max-width: 1600px;
    width: 95%;
}

/* Uses flexbox to place the profile picture and bio side-by-side. */
.hero {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

/* Ensures the text portion of the hero section expands to fill available space. */
.bio-content {
    flex: 1;
    min-width: 300px;
}

/* Aligns small pieces of data or buttons in a centered, horizontal row. */
.metadata-row, .action-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 20px;
    font-size: 16px;
}

/* ==========================================================================
   4. NAVIGATION
   ========================================================================== */

/* Styles the top navigation bar, spacing out the links and adding a bottom border. */
.top-nav {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 30px;
    padding: 20px;
    background: #21222c;
    border-bottom: 1px solid var(--current-line);
    font-size: 14px;
    box-sizing: border-box;
}

/* Removes standard link styling from navigation links. */
.top-nav a {
    text-decoration: none;
    transition: 0.3s;
}

/* Forces navigation links to turn pink on hover, overriding default link hover. */
.top-nav a:hover {
    color: var(--pink) !important;
}

/* ==========================================================================
   5. COMPONENTS (Cards, Buttons, Tags, Images)
   ========================================================================== */

/* Formats the main headers for sections like 'Projects' or 'Experience'. */
.section-header {
    font-size: 24px;
    margin-bottom: 20px;
    font-weight: bold;
}

/* Styles individual content blocks with a darker background and a purple left border. */
.card {
    background-color: #21222c;
    border-left: 4px solid var(--purple);
    padding: 20px;
    margin-bottom: 20px;
}

/* Styles the primary title text inside a card element. */
.card-title {
    color: var(--cyan);
    font-size: 18px;
}

/* Styles the secondary information (like dates or locations) inside a card. */
.card-meta {
    color: var(--comment);
    font-size: 13px;
    margin-bottom: 10px;
}

/* Styles small navigational text paths (e.g., Home > About). */
.breadcrumb {
    font-size: 12px;
    color: var(--comment);
    margin-bottom: 30px;
}

/* Rounds the corners and adds a shadow to the profile image. */
.profile-pic {
    width: 280px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

/* Creates a small, rounded badge to display skills or technologies. */
.tag {
    background-color: var(--current-line);
    padding: 2px 8px;
    margin: 2px;
    border-radius: 4px;
    font-size: 13px;
    display: inline-block;
}

/* Styles actionable buttons with a solid outline and bold text. */
.download-btn {
    background-color: #21222c;
    color: var(--purple);
    padding: 8px 15px;
    border-radius: 5px;
    border: 1px solid var(--purple);
    font-weight: bold;
    text-align: center;
    transition: all 0.3s ease;
}

/* Adds a glowing pink effect and changes text color when hovering over the button. */
.download-btn:hover {
    border-color: var(--pink);
    color: var(--pink);
    box-shadow: 0 0 10px var(--pink);
}

/* ==========================================================================
   6. MAP INTERFACE
   ========================================================================== */

/* A container that holds both the map and the sidebar list side-by-side. */
.travel-wrapper {
    display: flex;
    gap: 20px;
    height: 75vh;
    margin-top: 20px;
}

/* Locks the sidebar list to a specific width so it doesn't compress. */
.location-sidebar {
    flex: 0 0 275px;
    background: transparent;
    border: none;
    padding: 0;
}

/* Instructs the map to fill all remaining horizontal space next to the sidebar. */
#map {
    flex: 1;
    border: 1px solid var(--current-line);
    border-radius: 4px;
    background-color: var(--background);
    z-index: 1;
}

/* Removes default bullet points and spacing from the location list. */
#location-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Styles each clickable location in the sidebar to look like a small card. */
.menu-item {
    background-color: #21222c;
    border-left: 4px solid var(--orange);
    padding: 15px;
    margin-bottom: 15px;
    cursor: pointer;
    list-style: none;
    transition: all 0.3s ease;
}

/* Shifts the menu item slightly to the right and turns the border pink on hover. */
.menu-item:hover {
    border-color: var(--pink);
    transform: translateX(8px);
    background-color: #282a36;
}

/* Overrides the default card-title size for tighter fit inside the sidebar menu. */
.menu-item .card-title {
    color: var(--cyan);
    font-weight: normal;
    font-size: 15px;
    margin-bottom: 4px;
}

/* Overrides the default card-meta font specifically for the sidebar menu. */
.menu-item .card-meta {
    color: var(--comment);
    font-size: 11px;
    font-family: 'Meslo LG L', monospace;
}

/* Overrides the default popup colours, following the Dracula colours. */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    background-color: #282a36 !important;
    color: #f8f8f2 !important;
    border: 1px solid #44475a;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
}

/* ==========================================================================
   7. MOBILE RESPONSIVENESS
   ========================================================================== */

/* These rules only apply when the screen width is 768px or smaller (tablets/phones). */
@media (max-width: 768px) {
    /* Stacks the map and sidebar vertically instead of side-by-side. */
    .travel-wrapper {
        flex-direction: column;
        height: auto;
    }

    /* Allows the sidebar to shrink and adds a scroll limit so the map stays visible. */
    .location-sidebar {
        flex: auto;
        max-height: 250px;
    }

    /* Sets a fixed height for the map on smaller screens. */
    #map {
        height: 400px;
    }

    /* Collapse wiki grid to single column on mobile */
    .wiki-grid {
        grid-template-columns: 1fr;
    }

    .wiki-card {
        border-top: none;
        border-left: 4px solid var(--purple);
        border-radius: 0;
    }

    .wiki-card:hover {
        transform: translateX(10px);
        border-left-color: var(--pink);
        box-shadow: none;
    }
}

/* ==========================================================================
   8. CAD GALLERY & MODAL
   ========================================================================== */

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.gallery-card {
    background-color: #21222c;
    border: 1px solid var(--current-line);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    aspect-ratio: 1 / 1;
}

.gallery-card:hover {
    transform: translateY(-5px);
    border-color: var(--pink);
    box-shadow: 0 5px 15px rgba(255, 121, 198, 0.2);
}

.gallery-card video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px;
    background: linear-gradient(transparent, rgba(33, 34, 44, 0.9));
    color: var(--foreground);
}

.gallery-card-title {
    font-size: 14px;
    font-weight: bold;
    color: var(--cyan);
}

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

.modal-content {
    background-color: #21222c;
    margin: 5% auto;
    padding: 30px;
    border: 1px solid var(--purple);
    width: 80%;
    max-width: 1000px;
    border-radius: 8px;
    position: relative;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    color: var(--comment);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}

.close-btn:hover {
    color: var(--pink);
}

.modal-header {
    margin-bottom: 20px;
    border-bottom: 1px solid var(--current-line);
    padding-bottom: 15px;
}

.modal-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    background: transparent;
    border: 1px solid var(--comment);
    color: var(--comment);
    padding: 5px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    transition: all 0.3s;
}

.tab-btn.active {
    border-color: var(--green);
    color: var(--green);
}

.tab-btn:hover:not(.active) {
    border-color: var(--cyan);
    color: var(--cyan);
}

.modal-body-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-media-container {
    width: 100%;
    background: #000;
    border-radius: 4px;
    overflow: hidden;
}

.modal-media-container video, 
.modal-media-container img {
    width: 100%;
    display: block;
}

.modal-description {
    color: var(--foreground);
    font-size: 14px;
    line-height: 1.6;
}

/* ==========================================================================
   9. WIKI & PROJECT REPORTS
   ========================================================================== */

.wiki-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 20px;
}

.wiki-card {
    background-color: #21222c;
    border-top: 4px solid var(--purple);
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.wiki-card:hover {
    transform: translateY(-4px);
    background-color: #282a36;
    border-top-color: var(--pink);
    box-shadow: 0 8px 25px rgba(189, 147, 249, 0.15);
}

.wiki-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.wiki-card-title {
    font-size: 18px;
    font-weight: bold;
    color: var(--cyan);
}

.wiki-tag-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.wiki-card-body {
    font-size: 14px;
    color: var(--foreground);
    margin-bottom: 10px;
    line-height: 1.5;
}

/* Specific Modal Adjustment for long reports */
.modal-content.wide {
    max-width: 1200px;
    width: 90%;
}

/* Split View for Gallery Projects */
.split-view {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.split-media {
    flex: 1;
    min-width: 300px;
}

.split-specs {
    flex: 0 0 35%;
    min-width: 250px;
    background: #1a1b26;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid var(--current-line);
    max-height: 60vh;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .split-view {
        flex-direction: column;
    }
    .split-specs {
        flex: 1;
        width: 100%;
        max-height: none;
    }
}

/* Pinterest Grid for Gallery */
.pinterest-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.pinterest-item {
    background: #1a1b26;
    border: 1px solid var(--current-line);
    border-radius: 6px;
    padding: 8px;
    overflow: hidden;
}

.pinterest-item img,
.pinterest-item video {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}

.pinterest-caption {
    font-size: 11px;
    color: var(--comment);
    margin-top: 8px;
    text-align: center;
}

.pinterest-hero {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    align-items: flex-start;
}

.pinterest-hero .hero-media {
    flex: 1 1 50%;
}

.pinterest-hero .hero-specs {
    flex: 1 1 50%;
    background: #1a1b26;
    padding: 18px;
    border-radius: 6px;
    border: 1px solid var(--current-line);
    font-size: 16px;
}

@media (max-width: 768px) {
    .pinterest-hero {
        flex-direction: column;
    }
    .pinterest-hero .hero-media,
    .pinterest-hero .hero-specs {
        max-width: 100%;
        flex: 1 1 100%;
    }
}

.project-report {
    margin-top: 20px;
}

.report-phase {
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--current-line);
}

.report-phase:last-child {
    border-bottom: none;
}

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

.media-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 15px 0;
}

.media-grid-vary {
    display: grid;
    grid-template-columns: 2fr 2fr 1fr;
    gap: 10px;
    margin: 15px 0;
}

.media-grid-wide {
    display: grid;
    grid-template-columns: 1fr 1fr 3.5fr;
    gap: 10px;
    margin: 15px 0;
}

.media-grid-full {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 15px 0;
}

.media-grid-3 .figure-container,
.media-grid-vary .figure-container,
.media-grid-wide .figure-container {
    margin-bottom: 0;
    padding: 6px;
}

.media-grid-full .figure-container {
    margin-bottom: 0;
    padding: 6px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.media-grid-3 .figure-container img,
.media-grid-vary .figure-container img,
.media-grid-wide .figure-container img {
    width: 100%;
    height: 200px;
    object-fit: contain;
    display: block;
    background: #1a1b26;
}

.media-grid-wide .figure-container:last-child img {
    height: 340px;
}

.media-grid-full .figure-container img {
    width: 100%;
    height: auto;
    max-height: 350px;
    object-fit: contain;
    display: block;
    background: #1a1b26;
}

.media-grid-3 .figure-caption,
.media-grid-wide .figure-caption,
.media-grid-full .figure-caption {
    font-size: 10px;
    margin-top: 6px;
}

.figure-container {
    background: #1a1b26;
    border: 1px solid var(--current-line);
    border-radius: 6px;
    padding: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.figure-container img, 
.figure-container video {
    width: 100%;
    height: auto;
    border-radius: 4px;
    display: block;
}

.figure-caption {
    font-size: 11px;
    color: var(--comment);
    margin-top: 10px;
    font-family: 'Meslo LG L', monospace;
    text-align: center;
}

.text-block {
    margin-bottom: 20px;
    font-size: 15px;
}

.markdown-body {
    color: var(--foreground);
    font-size: 14px;
    line-height: 1.7;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
    color: var(--purple);
    margin-top: 24px;
    margin-bottom: 12px;
}

.markdown-body h1 { font-size: 20px; }
.markdown-body h2 { font-size: 17px; border-bottom: 1px solid var(--current-line); padding-bottom: 6px; }
.markdown-body h3 { font-size: 15px; }

.markdown-body p {
    margin-bottom: 12px;
}

.markdown-body strong {
    color: var(--pink);
}

.markdown-body ul,
.markdown-body ol {
    padding-left: 20px;
    margin-bottom: 12px;
}

.markdown-body li {
    margin-bottom: 4px;
}

.markdown-body code {
    background: #1a1b26;
    color: var(--green);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Meslo LG L', monospace;
    font-size: 13px;
}

.markdown-body pre {
    background: #1a1b26;
    border: 1px solid var(--current-line);
    border-radius: 4px;
    padding: 12px 16px;
    overflow-x: auto;
    margin-bottom: 16px;
}

.markdown-body pre code {
    background: none;
    padding: 0;
    color: var(--foreground);
}

.markdown-body hr {
    border: none;
    border-top: 1px solid var(--current-line);
    margin: 20px 0;
}

.markdown-body blockquote {
    border-left: 3px solid var(--orange);
    padding: 8px 16px;
    margin: 12px 0;
    background: rgba(255, 184, 108, 0.05);
    color: var(--comment);
    font-size: 13px;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
    font-size: 13px;
}

.markdown-body th,
.markdown-body td {
    padding: 8px 12px;
    border: 1px solid var(--current-line);
    text-align: left;
}

.markdown-body th {
    background: #21222c;
    color: var(--purple);
    font-weight: bold;
}

.markdown-body td {
    color: var(--foreground);
}

.markdown-body a {
    color: var(--cyan);
}

.markdown-body a:hover {
    color: var(--pink);
}
