:root {
    --apple-black: #1d1d1f;
    --apple-grey: #f5f5f7;
    --apple-blue: #0071e3;
    --victoria-blue: #0098D4;
    --context-orange: #f39200;
    --glass: rgba(255, 255, 255, 0.85);
    --dot-size: 20px;
    --line-height: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-font-smoothing: antialiased; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", sans-serif;
    background-color: #ffffff;
    color: var(--apple-black);
    line-height: 1.5;
    overflow-x: hidden;
}

/* --- Navigation --- */
nav.top-nav {
    background: var(--glass);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    position: sticky;
    top: 0;
    z-index: 9999;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.container { max-width: 1000px; margin: 0 auto; padding: 0 24px; }

.nav-flex {
    height: 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-name { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; text-transform: uppercase; }
.brand-name span { color: var(--context-orange); }

.contact-header {
    display: flex;
    gap: 25px;
    font-size: 13px;
    font-weight: 500;
    color: #86868b;
}

/* --- Global Link Reset & Nav Hover --- */
a { text-decoration: none; color: inherit; transition: all 0.2s ease; }

.contact-header a:hover { 
    color: var(--apple-blue); 
}

.contact-header span:hover {
    color: var(--apple-black);
}

header { padding: 160px 0 40px; text-align: center; }
header h1 { font-size: 56px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; margin-bottom: 15px; }
header .tagline { font-size: 19px; color: #86868b; font-weight: 400; max-width: 850px; margin: 0 auto; line-height: 1.5; }

/* --- Tabs --- */
.tab-wrapper {
    display: flex;
    justify-content: center;
    background: var(--apple-grey);
    padding: 6px;
    border-radius: 14px;
    width: fit-content;
    margin: 30px auto 30px;
    flex-wrap: wrap;
    gap: 4px;
}

.tab-btn {
    border: none;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
    color: var(--apple-black);
}

.tab-btn:not(.active):hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--apple-blue);
}

.tab-btn.active { 
    background: #ffffff; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.08); 
    color: var(--apple-blue);
}

/* --- Content Section --- */
.content-section { 
    display: none; 
    opacity: 0; 
    transform: translateY(20px); 
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    padding-top: 40px; 
}
.content-section.active { display: block; opacity: 1; transform: translateY(0); }

/* --- Grid Layouts & Cards --- */
.grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 20px; 
}

.card {
    background: var(--apple-grey);
    padding: 30px;
    border-radius: 24px;
    transition: transform 0.3s ease;
    color: inherit;
    display: flex;
    flex-direction: column;
}
.card:hover { transform: translateY(-5px); }

#samples .card p {
    flex-grow: 1; 
    margin-bottom: 20px;
}

#education .card, #memberships .card {
    height: 100%;
}

#education .card p, #memberships .card p {
    margin-top: auto; 
    padding-top: 15px;
}

.card h3 { 
    font-size: 18px; 
    margin-bottom: 0; 
    font-weight: 600; 
    color: var(--victoria-blue); 
    line-height: 1.2;
}

.card .year { font-size: 12px; font-weight: 700; color: #86868b; text-transform: uppercase; display: block; margin-bottom: 2px; }
.card p { color: #424245; font-size: 14px; line-height: 1.6; margin-top: 10px; }

/* Lists logic */
.card ul { list-style: none; margin-top: 10px; flex-grow: 0; }
.card li { 
    font-size: 14px; 
    margin-bottom: 8px; 
    color: #1d1d1f; 
    font-weight: 500; 
    position: relative;
    padding-left: 20px;
}
.card li::before { 
    content: ""; 
    position: absolute;
    left: 0;
    top: 8px;
    width: 6px;
    height: 6px;
    background-color: var(--victoria-blue);
    border-radius: 50%;
}

/* --- View Application Button --- */
.view-app-btn {
    align-self: flex-start;
    background-color: var(--victoria-blue);
    color: white !important;
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 10px rgba(0, 152, 212, 0.15);
}

.view-app-btn:hover {
    background-color: var(--apple-blue);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 113, 227, 0.25);
}

/* --- Inline Icon Headers --- */
.sample-card-header { 
    display: flex; 
    align-items: flex-start; 
    gap: 15px; 
    margin-bottom: 15px; 
}

.sample-icon-box { 
    width: 50px; height: 50px; 
    background: #ffffff; 
    border-radius: 12px; 
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    flex-shrink: 0;
    margin-top: -4px; 
}
.sample-icon-box i { font-size: 22px; color: var(--victoria-blue); }

.more-link { color: var(--victoria-blue); cursor: pointer; font-weight: 700; margin-left: 4px; }

/* --- Experience Viewport --- */
.experience-viewport {
    background: transparent;
    margin: 0; 
    display: flex;
    flex-direction: column; 
    align-items: center;
    justify-content: center;
    min-height: 380px; 
    position: relative;
}

.map-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between; /* Changed to space-between for 5 stations */
    position: relative;
    width: 100%;
    max-width: 850px;
    margin: 0 auto;
}

.station {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: 20%; /* Evenly split 5 stations */
    flex-shrink: 0;
    cursor: pointer;
}

.station-link { text-decoration: none; color: inherit; display: block; }

/* Connector lines - centered on the dots */
.station:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 50%; /* Start line at center of station */
    width: 100%; /* Stretch to center of next station */
    height: var(--line-height);
    background-color: var(--victoria-blue);
    z-index: 1;
    border-top: 2px solid white;
    border-bottom: 2px solid white;
}

/* Left-side entry tail */
.station:first-child::before {
    content: "";
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 50%;
    width: 60px; 
    height: var(--line-height);
    background: linear-gradient(to left, var(--victoria-blue), transparent);
    z-index: 1;
    mask-image: linear-gradient(to right, black 50%, transparent 50%);
    mask-size: 12px 100%;
    -webkit-mask-image: linear-gradient(to right, black 50%, transparent 50%);
    -webkit-mask-size: 12px 100%;
}

.dot {
    width: var(--dot-size);
    height: var(--dot-size);
    background-color: white;
    border: 5px solid var(--victoria-blue);
    border-radius: 50%;
    z-index: 2; /* Ensures dot sits on top of lines */
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.station:hover .dot { transform: scale(1.2); background-color: var(--apple-blue); border-color: var(--apple-blue); }
.station:hover .station-name { color: var(--apple-blue); transition: color 0.2s ease; }

.label-wrapper {
    position: absolute;
    bottom: 30px; 
    left: 50%;
    transform: rotate(-45deg);
    transform-origin: bottom left;
    width: 180px;
    text-align: left;
}

.station-date { display: block; font-size: 10px; letter-spacing: 1px; color: #666; font-weight: 700; text-transform: uppercase; margin-bottom: 2px; }
.station-name { font-weight: 800; font-size: 14px; color: var(--apple-black); display: block; line-height: 1.2; }

.service-status {
    position: relative;
    margin-top: 20px; 
    align-self: flex-end; 
    background: var(--apple-grey);
    padding: 6px 14px;
    border-radius: 6px;
    border-left: 4px solid #00b01c;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* --- Modals --- */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0; top: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.modal-content {
    background: #ffffff;
    margin: 5vh auto;
    width: 90%;
    max-width: 650px;
    padding: 40px;
    border-radius: 28px;
    position: relative;
    max-height: 85vh; /* Fixed: Slightly increased to match HTML flex logic */
    overflow-y: hidden; /* Fixed: Prevents double scrollbars */
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.close-btn { position: absolute; right: 25px; top: 25px; cursor: pointer; color: #d2d2d7; font-size: 22px; z-index: 10; }

@media (max-width: 850px) {
    header h1 { font-size: 38px; }
    .contact-header { display: none; }
    .tab-wrapper { width: 100%; }
}

/* --- Full-Width Footer Styling --- */
.footer {
    width: 100%; 
    padding: 30px 0;
    background: var(--glass);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid rgba(0,0,0,0.1); 
    text-align: center;
    margin-top: 10px;
    position: relative;
}

.footer p {
    font-size: 12px;
    color: #86868b;
    font-weight: 500;
    letter-spacing: -0.01em;
    max-width: 1000px; 
    margin: 0 auto;
    padding: 0 24px;
}

/* --- Insights Accordion --- */
.insights-wrapper {
    max-width: 850px;
    margin: 0 auto 40px;
}

.insight-item {
    background: var(--apple-grey);
    border-radius: 20px;
    margin-bottom: 16px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    border: 1px solid transparent;
}

.insight-header {
    padding: 24px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.insight-header:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.insight-meta h3 {
    font-size: 19px;
    color: var(--victoria-blue);
    margin-bottom: 4px;
    font-weight: 600;
}

/* This targets the icon in both Insights and Downloads */
.insight-icon {
    width: 36px;
    height: 36px;
    min-width: 36px; /* Added to ensure it never gets smaller than 36px */
    min-height: 36px; /* Added to ensure it never gets smaller than 36px */
    background: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--victoria-blue);
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    
    /* THE CRITICAL FIX */
    flex-shrink: 0; 
    
    /* Ensures the icon stays centered */
    line-height: 1;
}

.article-year {
    font-size: 11px;
    font-weight: 700;
    color: #86868b;
    text-transform: uppercase;
    display: block;
    margin-bottom: 2px;
}

.article-summary {
    font-size: 14px;
    color: #424245;
    margin: 0;
    line-height: 1.4;
}

.insight-icon {
    width: 36px;
    height: 36px;
    background: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--victoria-blue);
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* Body hidden by default */
.insight-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.insight-content {
    padding: 0 30px 30px 30px;
    font-size: 15px;
    color: #1d1d1f;
    line-height: 1.6;
    border-top: 1px solid rgba(0,0,0,0.05);
    padding-top: 20px;
}

.insight-content p {
    margin-bottom: 15px;
}

/* Active State Styles */
.insight-item.active {
    background: #ffffff;
    border-color: rgba(0, 152, 212, 0.2);
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

.insight-item.active .insight-icon {
    transform: rotate(45deg); /* Plus becomes an 'x' */
    background: var(--victoria-blue);
    color: #ffffff;
}

/* FIXED SCROLLBAR CONTAINERS: overflow-y set to auto */

#talkingnews-scroll-container {
    overflow-y: auto; 
}
#talkingnews-scroll-container::-webkit-scrollbar {
    width: 8px;
}
#talkingnews-scroll-container::-webkit-scrollbar-track {
    background: #f1f1f1; 
    border-radius: 4px;
}
#talkingnews-scroll-container::-webkit-scrollbar-thumb {
    background: var(--victoria-blue, #2a4b8d); 
    border-radius: 4px;
}
#talkingnews-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #555; 
}

#cwc-scroll-container {
    overflow-y: auto;
}
#cwc-scroll-container::-webkit-scrollbar {
    width: 8px;
}
#cwc-scroll-container::-webkit-scrollbar-track {
    background: #f1f1f1; 
    border-radius: 4px;
}
#cwc-scroll-container::-webkit-scrollbar-thumb {
    background: var(--victoria-blue, #2a4b8d); 
    border-radius: 4px;
}
#cwc-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #555; 
}

#bickgreen-scroll-container {
    overflow-y: auto;
}
#bickgreen-scroll-container::-webkit-scrollbar {
    width: 8px;
}
#bickgreen-scroll-container::-webkit-scrollbar-track {
    background: #f1f1f1; 
    border-radius: 4px;
}
#bickgreen-scroll-container::-webkit-scrollbar-thumb {
    background: var(--victoria-blue, #2a4b8d); 
    border-radius: 4px;
}
#bickgreen-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #555; 
}

#context-scroll-container {
    overflow-y: auto;
}
#context-scroll-container::-webkit-scrollbar {
    width: 8px;
}
#context-scroll-container::-webkit-scrollbar-track {
    background: #f1f1f1; 
    border-radius: 4px;
}
#context-scroll-container::-webkit-scrollbar-thumb {
    background: var(--victoria-blue, #2a4b8d); 
    border-radius: 4px;
}
#context-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #555; 
}

#rovisions-scroll-container {
    overflow-y: auto;
}
#rovisions-scroll-container::-webkit-scrollbar {
    width: 8px;
}
#rovisions-scroll-container::-webkit-scrollbar-track {
    background: #f1f1f1; 
    border-radius: 4px;
}
#rovisions-scroll-container::-webkit-scrollbar-thumb {
    background: var(--victoria-blue, #2a4b8d); 
    border-radius: 4px;
}
#rovisions-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #555; 
}

#c64-scroll-container {
    overflow-y: auto;
}
#c64-scroll-container::-webkit-scrollbar {
    width: 8px;
}
#c64-scroll-container::-webkit-scrollbar-track {
    background: #f1f1f1; 
    border-radius: 4px;
}
#c64-scroll-container::-webkit-scrollbar-thumb {
    background: var(--victoria-blue, #0098D4); 
    border-radius: 4px;
}
#c64-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #555; 
}

/* ============================================================
   NEW UPDATES: MOBILE DIALOG & SPINE FIX
   ============================================================ */

/* --- COMPACT MOBILE WARNING DIALOG --- */
#mobile-warning-dialog {
    border: none;
    border-radius: 24px;
    padding: 0;
    background: white;
    width: 85%;
    max-width: 320px;
    
    /* Crucial: Height fits content, not the whole screen */
    height: auto;
    max-height: fit-content; 
    
    /* Perfect Centering Logic */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

#mobile-warning-dialog .modal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 30px 24px;
}

/* Heading for the dialog */
#mobile-warning-dialog h3 {
    color: var(--victoria-blue);
    margin-bottom: 10px;
    font-size: 1.25rem;
    font-weight: 600;
}

/* Specific Backdrop (Blurred background) */
#mobile-warning-dialog::backdrop {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Icon box styling */
.sample-icon-box {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: var(--apple-grey);
    border-radius: 14px;
    margin-bottom: 20px;
}

/* 3. THE MOBILE SPINE FIX (The Tube Line) */
@media screen and (max-width: 768px) {
    .experience-viewport {
        display: block;
        padding: 40px 20px;
        min-height: auto;
    }

    .map-container {
        display: flex;
        flex-direction: column;
        position: relative;
        padding-left: 30px; 
        border-left: 6px solid var(--victoria-blue); /* The Spine */
        margin-left: 20px; 
        gap: 40px; 
        width: calc(100% - 40px);
    }

    /* Kill old desktop fragments */
    .map-container::before, .map-container::after, .experience-line, 
    .station::after, .station::before { 
        display: none !important; 
    }

    .station {
        width: 100%;
        display: flex !important;
        flex-direction: row !important;
        align-items: center;
        justify-content: flex-start;
        position: relative;
        left: 0 !important;
        transform: none !important;
    }

    .dot {
        position: absolute;
        left: -43px; /* Pin to the 6px border spine */
        margin: 0 !important;
        width: 20px !important;
        height: 20px !important;
        background-color: white !important;
        border: 5px solid var(--victoria-blue) !important;
        border-radius: 50%;
        z-index: 10;
    }

    .label-wrapper {
        position: static !important;
        transform: none !important;
        padding-left: 15px;
        text-align: left !important;
    }
}