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

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8fafc;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    padding: 1rem 0;
    transition: all 0.3s ease;
}

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

.nav-logo {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #2563eb;
}

.nav-logo i {
    margin-right: 0.5rem;
    font-size: 1.8rem;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

.nav-link:hover {
    color: #2563eb;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: #2563eb;
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: #333;
    margin: 3px 0;
    transition: 0.3s;
}

/* Hero Section */
.hero {
    padding: 120px 0 30px; /* Increased top padding to account for fixed navbar */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    min-height: 35vh;
    display: flex;
    align-items: center;
}

.hero-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.hero-stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #fbbf24;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

.stat-date {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.25rem;
    font-weight: 400;
}

.cta-button {
    display: inline-block;
    background: #fbbf24;
    color: #1f2937;
    padding: 1rem 2rem;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(251, 191, 36, 0.3);
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(251, 191, 36, 0.4);
}

.hero-visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

.golf-photo-container {
    width: 100%;
    max-width: 400px;
    height: 300px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    transition: transform 0.3s ease;
}

.golf-photo-container:hover {
    transform: translateY(-5px);
}

.golf-photo-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 20px;
}

/* Section Styles */
.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1rem;
    color: #1f2937;
}

/* About Section */
.about {
    padding: 80px 0;
    background: white;
}

.about-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 4rem;
    align-items: center;
}

.about-text p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    color: #4b5563;
}

.investment-philosophy h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #1f2937;
}

.investment-philosophy ul {
    list-style: none;
}

.investment-philosophy li {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    color: #4b5563;
}

.investment-philosophy i {
    color: #10b981;
    margin-right: 0.5rem;
    font-size: 0.9rem;
}

.image-placeholder {
    width: 100%;
    height: 300px;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #9ca3af;
}

.image-placeholder i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Portfolio Section */
.portfolio {
    padding: 60px 0;
    background: #f8fafc;
    position: relative;
    overflow: visible;
}

.portfolio .section-title {
    text-align: center;
    margin-bottom: 30px;
    font-size: 2.5rem;
    font-weight: 700;
    color: #1f2937;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    padding-top: 20px;
    margin-top: 0;
    width: 100%;
}

/* Portfolio Allocation Section */
.allocation {
    padding: 100px 0 80px 0; /* Reduced bottom padding to minimize whitespace */
    background: #f8fafc; /* Grey background to match alternating sections */
    margin-top: 0;
    position: relative;
    overflow: visible; /* Allow callouts to extend beyond container */
    min-height: 900px; /* Reduced minimum height */
}

.allocation .section-title {
    text-align: center;
    margin-bottom: 30px;
    font-size: 2.5rem;
    font-weight: 700;
    color: #1f2937;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    padding-top: 20px;
    margin-top: 0;
    width: 100%;
}

/* Toggle Button Styles */
.allocation-toggle {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.toggle-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 0.9rem;
    color: #6b7280;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-btn:hover {
    border-color: #2563eb;
    color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.toggle-btn.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* Portfolio Toggle Button Styles */
.portfolio-toggle {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

/* Sortable Header Styles */
.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
    position: relative;
}

.sortable:hover {
    background-color: rgba(37, 99, 235, 0.1);
}

.sortable:active {
    background-color: rgba(37, 99, 235, 0.2);
}

.allocation-content {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.allocation-chart {
    width: 100%;
    max-width: 820px; /* Larger desktop pie */
    height: 640px; /* Larger desktop pie */
    margin: 0 auto;
    margin-top: 120px; /* Increased margin to center vertically */
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}



/* Portfolio Controls */
.portfolio-controls {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.view-toggle {
    display: flex;
    gap: 0.5rem;
}

.view-btn {
    padding: 0.5rem;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-btn.active,
.view-btn:hover {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.portfolio-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    max-width: 100%;
    margin-top: 60px; /* Reduced spacing between title and table */
}

/* Portfolio Grid Container - Scrollable after 10 rows */
.portfolio-grid {
    max-height: calc(4.8em + 9 * (1.5rem * 2 + 2.4rem + 1.2px)) !important; /* Increased by 20% - header height (4.8em) + 9 data rows */
    overflow-y: auto !important;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    display: block !important; /* Override any flex display */
}

.portfolio-grid::-webkit-scrollbar {
    width: 8px;
}

.portfolio-grid::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.portfolio-grid::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.portfolio-grid::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.portfolio-item {
    background: white;
    padding: 1.25rem 2rem;
    border-bottom: 1px solid #e5e7eb;
    display: grid;
    width: 100%;
    max-width: 100%;
    grid-template-columns: 50px minmax(120px, 1.5fr) minmax(70px, 0.9fr) minmax(70px, 0.9fr) minmax(75px, 1fr) minmax(80px, 1.2fr) minmax(85px, 1.3fr) minmax(70px, 0.9fr) minmax(80px, 1.1fr) minmax(80px, 1.1fr) minmax(80px, 1.1fr);
    gap: 1rem;
    align-items: center;
    transition: background-color 0.3s ease;
    text-align: center; /* Center all text in portfolio items */
}

/* Left-align only the Symbol column and company name for better readability */
.portfolio-symbol {
    text-align: left !important;
}

.portfolio-name {
    text-align: left !important;
}

.portfolio-item:hover {
    background-color: #f8fafc;
}

.portfolio-item:first-child {
    background: #f8fafc;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #d1d5db;
    border-radius: 8px 8px 0 0;
}

.portfolio-item:last-child {
    border-bottom: none;
    border-radius: 0 0 8px 8px;
}

.portfolio-logo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: contain;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #6b7280;
}

.portfolio-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
}

.portfolio-symbol {
    font-weight: 700;
    color: #1f2937;
}

.portfolio-name {
    color: #6b7280;
    font-size: 0.9rem;
    white-space: normal; /* Allow text wrapping */
    line-height: 1.2; /* Better line spacing for wrapped text */
    word-wrap: break-word; /* Break long words if needed */
    overflow-wrap: break-word; /* Modern property for word breaking */
}

.portfolio-shares,
.portfolio-price,
.portfolio-cost,
.portfolio-value,
.portfolio-weight,
.portfolio-return,
.portfolio-pe2026,
.portfolio-pfcf2026 {
    text-align: center;
    font-weight: 600;
    min-width: 80px; /* Increased width for better icon fit */
    width: 80px; /* Fixed width for consistent alignment */
    max-width: 80px; /* Prevent expansion */
    padding-left: 4px;
    padding-right: 4px;
    font-size: 0.9rem; /* Consistent font size */
}

.portfolio-first-buy,
.portfolio-last-buy {
    text-align: center;
    font-weight: 600;
    min-width: 70px; /* Reduced width for better fit */
    max-width: 90px; /* Reduced max width for dates */
    overflow: visible; /* Allow text to wrap */
    text-overflow: unset; /* Remove ellipsis */
    white-space: normal; /* Allow text wrapping */
    padding-left: 0px;
    font-size: 0.9rem; /* Consistent font size */
    line-height: 1.2; /* Better line spacing for wrapped text */
}

.portfolio-fwd-rev-cagr {
    text-align: center;
    font-weight: 600;
    min-width: 70px;
    max-width: 90px;
    overflow: visible;
    text-overflow: unset;
    white-space: normal;
    padding-left: 0px;
    font-size: 0.9rem;
    line-height: 1.2;
}

.portfolio-pe2026-watchlist {
    text-align: center;
    font-weight: 600;
    min-width: 80px;
    max-width: 100px;
    overflow: visible;
    text-overflow: unset;
    white-space: normal;
    padding-left: 0px;
    font-size: 0.9rem;
    line-height: 1.2;
}

/* Standardize all header styles */
.portfolio-item:first-child {
    background: #f8fafc !important;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #d1d5db;
    border-radius: 8px 8px 0 0;
    font-size: 0.9rem; /* Standard font size for all headers */
    line-height: 1.2;
    height: auto; /* Allow header to expand for wrapped text */
    min-height: 3em; /* Ensure minimum height for wrapped headers */
    /* CRITICAL: Ensure header uses same grid layout as data rows */
    min-width: 100% !important; /* Ensure header extends full width */
    width: 100% !important;
    max-width: none !important; /* Remove max-width constraint for full background */
    display: grid !important;
    grid-template-columns: 50px minmax(120px, 1.5fr) minmax(70px, 0.9fr) minmax(70px, 0.9fr) minmax(75px, 1fr) minmax(80px, 1.2fr) minmax(85px, 1.3fr) minmax(70px, 0.9fr) minmax(80px, 1.1fr) minmax(80px, 1.1fr) minmax(80px, 1.1fr) !important;
    gap: 1rem !important;
    align-items: center !important;
    /* Sticky header positioning with solid background */
    position: sticky !important;
    top: 0 !important;
    z-index: 100 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important; /* Add shadow for better separation */
}



.portfolio-item:first-child .portfolio-logo {
    visibility: hidden;
}

/* Ensure ALL header columns use the same font size and uniform formatting */
.portfolio-item:first-child .portfolio-symbol,
.portfolio-item:first-child .portfolio-name,
.portfolio-item:first-child .portfolio-sector,
.portfolio-item:first-child .portfolio-weight,
.portfolio-item:first-child .portfolio-return,
.portfolio-item:first-child .portfolio-pe2026,
.portfolio-item:first-child .portfolio-pfcf2026,
.portfolio-item:first-child .portfolio-first-buy,
.portfolio-item:first-child .portfolio-last-buy,
.portfolio-item:first-child .portfolio-fwd-rev-cagr,
.portfolio-item:first-child .portfolio-pe2026-watchlist,
.portfolio-item:first-child .portfolio-price,
.portfolio-item:first-child .portfolio-shares,
.portfolio-item:first-child .portfolio-cost,
.portfolio-item:first-child .portfolio-value {
    font-size: 0.9rem !important; /* Force consistent font size for all headers */
    line-height: 1.2;
    text-align: center !important; /* Center all header text */
    white-space: normal !important; /* Allow text wrapping for all headers */
    overflow: visible !important; /* Allow content to be visible */
    text-overflow: unset !important; /* Remove ellipsis */
    height: auto !important; /* Allow height to expand */
    min-height: 2.4em !important; /* Ensure minimum height for wrapped text */
    word-wrap: break-word !important; /* Force word wrapping */
    overflow-wrap: break-word !important; /* Modern word wrapping */
    max-width: none !important; /* Remove any max-width constraints */
    hyphens: auto !important; /* Allow hyphenation */
    word-break: break-all !important; /* Force breaking at any character */
    line-height: 1.1 !important; /* Tighter line spacing for wrapped text */
    white-space: pre-line !important; /* Respect \n line breaks */
}

/* Center all header text except Symbol */
.portfolio-item:first-child .portfolio-return,
.portfolio-item:first-child .portfolio-pe2026,
.portfolio-item:first-child .portfolio-pfcf2026,
.portfolio-item:first-child .portfolio-first-buy,
.portfolio-item:first-child .portfolio-last-buy,
.portfolio-item:first-child .portfolio-fwd-rev-cagr,
.portfolio-item:first-child .portfolio-pe2026-watchlist,
.portfolio-item:first-child .portfolio-price,
.portfolio-item:first-child .portfolio-weight {
    text-align: center !important; /* Center all headers */
}

/* Left-align Symbol and company name headers */
.portfolio-item:first-child .portfolio-symbol {
    text-align: left !important;
}

.portfolio-item:first-child .portfolio-name {
    text-align: left !important;
}

/* All header formatting is now handled by the uniform rules above */

/* Text wrapping is now handled directly in JavaScript with line breaks */




.portfolio-sector {
    text-align: center;
    font-weight: 600;
    min-width: 75px;
    max-width: 95px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    padding-right: 0px;
    line-height: 1.1;
    font-size: 0.9rem; /* Consistent font size */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.portfolio-weight {
    text-align: center;
    font-weight: 600;
    min-width: 80px; /* Ensure consistent width for alignment */
    width: 80px; /* Fixed width for consistent alignment */
    max-width: 80px; /* Prevent expansion */
    font-size: 0.9rem; /* Consistent font size */
}

.portfolio-shares,
.portfolio-cost,
.portfolio-value {
    display: none;
}

.portfolio-return.positive {
    color: #15803d;
}

.portfolio-return.negative {
    color: #dc2626;
}

.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.sortable:hover {
    background-color: #f3f4f6;
    border-radius: 4px;
    padding: 2px 4px;
    margin: -2px -4px;
}

.sort-icon {
    margin-left: 6px;
    color: #9ca3af;
}

.cash-summary {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%) !important;
    border-top: 2px solid #0ea5e9;
    font-weight: 600;
}

.cash-summary:hover {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%) !important;
}

.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: #6b7280;
}

.loading i {
    font-size: 2rem;
    margin-bottom: 1rem;
}

/* Performance Section */
.performance {
    padding: 40px 0 60px 0; /* Reduced top padding to bring title closer */
    background: white;
    border-top: 1px solid #e5e7eb;
    position: relative;
    overflow: visible; /* Allow title to extend beyond container */
}

.performance .section-title {
    text-align: center;
    margin-bottom: 30px;
    font-size: 2.5rem;
    font-weight: 700;
    color: #1f2937;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    padding-top: 20px;
    margin-top: 0;
    width: 100%;
}

/* Events Section */
.events {
    padding: 60px 0;
    background: white;
    position: relative;
    overflow: visible;
}

.events .section-title {
    text-align: center;
    margin-bottom: 30px;
    font-size: 2.5rem;
    font-weight: 700;
    color: #1f2937;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    padding-top: 20px;
    margin-top: 0;
    width: 100%;
}

.events-content {
    max-width: 800px;
    margin: 0 auto;
    margin-top: 70px; /* Account for absolutely positioned title */
}

.events-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* News Section */
.news {
    padding: 60px 0;
    background: #f8fafc;
    position: relative;
    overflow: visible;
}

.news .section-title {
    text-align: center;
    margin-bottom: 30px;
    font-size: 2.5rem;
    font-weight: 700;
    color: #1f2937;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    padding-top: 20px;
    margin-top: 0;
    width: 100%;
}

.news-content {
    max-width: 800px;
    margin: 0 auto;
    margin-top: 70px; /* Account for absolutely positioned title */
}

.news-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 600px;
    overflow-y: auto;
    padding-right: 8px;
}

/* Custom scrollbar for news list */
.news-list::-webkit-scrollbar {
    width: 8px;
}

.news-list::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.news-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.news-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.event-item {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.event-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: #2563eb;
}

.event-logo {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    overflow: hidden;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.event-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 10px;
}

.event-info {
    flex: 1;
    min-width: 0;
}

.event-company {
    font-weight: 700;
    font-size: 1.1rem;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.event-name {
    font-size: 1rem;
    color: #4b5563;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.event-date {
    font-size: 0.9rem;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.event-date i {
    color: #2563eb;
}

.event-actions {
    flex-shrink: 0;
}

.event-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: #2563eb;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
}

/* News Item Styles */
.news-item {
    background: white;
    border-radius: 16px;
    padding: 1.25rem 1.25rem; /* reduced vertical padding */
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 1.25rem; /* reduced gap to match events */
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    min-height: 120px; /* reduced from 160px */
}

.news-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: #2563eb;
}

.news-logo {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    overflow: hidden;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.news-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 10px;
    max-width: 100%;
    max-height: 100%;
}

.news-info {
    flex: 1;
    min-width: 0;
}

.news-company {
    font-weight: 700;
    font-size: 1.2rem;
    color: #1f2937;
    margin-top: 0.25rem; /* add small top margin */
    margin-bottom: 0.25rem; /* further reduced for tighter spacing */
}

.news-headline {
    font-size: 1rem;
    color: #4b5563;
    margin-bottom: 0.25rem; /* further reduced for tighter spacing */
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Limit to 2 lines for desktop */
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis; /* Show ... for overflow */
}

.news-date {
    font-size: 0.9rem;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.news-date i {
    color: #2563eb;
}

.news-actions {
    flex-shrink: 0;
}

.news-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: #2563eb;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.news-link:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}



.event-link:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

.no-events {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
}

.no-events i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #d1d5db;
}

.no-events p {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: #4b5563;
}

.no-events small {
    color: #9ca3af;
}

.events-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.cache-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.cache-status small {
    color: #6b7280;
    font-weight: 500;
}

.refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.refresh-btn:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

.refresh-btn i {
    font-size: 0.8rem;
}

.performance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-top: 100px; /* Account for absolutely positioned title */
}

.performance-card {
    background: #f8fafc;
    border-radius: 15px;
    padding: 2rem;
    border: 1px solid #e5e7eb;
}

.performance-card h3 {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    color: #1f2937;
}

.top-performers,
.top-laggards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Ensure laggards items have the same spacing as performers */
.top-laggards .performer-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: white;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    margin-bottom: 0;
}

.performer-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: white;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
}

.performer-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.performer-symbol {
    font-weight: 700;
    color: #1f2937;
}

.performer-name {
    color: #6b7280;
    font-size: 0.9rem;
}

.performer-return {
    font-weight: 600;
}

.performer-return.positive {
    color: #15803d;
}

.performer-return.negative {
    color: #dc2626;
}

.benchmark-performance {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.benchmark-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: white;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
}

.benchmark-symbol {
    font-weight: 700;
    color: #1f2937;
    font-size: 1.1rem;
}

.benchmark-performance-value {
    font-weight: 600;
    font-size: 1.1rem;
}

.benchmark-performance-value.positive {
    color: #15803d;
}

.benchmark-performance-value.negative {
    color: #dc2626;
}

.risk-metrics {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: white;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
}

.portfolio-multiples {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.multiple-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: white;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
}

.multiple-label {
    font-weight: 700;
    color: #1f2937;
    font-size: 1.1rem;
}

.multiple-value {
    font-weight: 600;
    font-size: 1.1rem;
    color: #1f2937;
}

.metric-label {
    color: #6b7280;
}

.metric-value {
    font-weight: 600;
    color: #1f2937;
}

/* Contact Section */
.contact {
    padding: 80px 0;
    background: #f8fafc;
}

.contact-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: white;
    border-radius: 15px;
    border: 1px solid #e5e7eb;
}

.contact-item i {
    font-size: 1.5rem;
    color: #2563eb;
    width: 40px;
    text-align: center;
}

.contact-item h3 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
    color: #1f2937;
}

.contact-item p {
    color: #6b7280;
}

.contact-item a {
    color: #6b7280;
    text-decoration: none;
    transition: color 0.3s ease;
}

.contact-item a:hover {
    color: #2563eb;
}

.contact-form {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    border: 1px solid #e5e7eb;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2563eb;
}

.submit-btn {
    width: 100%;
    padding: 1rem;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.submit-btn:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
}

/* Footer */
.footer {
    background: #1f2937;
    color: white;
    padding: 3rem 0 1rem;
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 4rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.footer-section h3 {
    margin-bottom: 1rem;
    color: #fbbf24;
    text-align: center;
    min-height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.footer-section ul {
    list-style: none;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: #d1d5db;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section a:hover {
    color: #fbbf24;
}

.social-links {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex: 1;
    align-items: center;
}

.social-links a {
    display: inline-block;
    width: 40px;
    height: 40px;
    background: #374151;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.social-links a:hover {
    background: #fbbf24;
    color: #1f2937;
}

.substack-embed {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 0.5rem;
    text-align: center;
}

.substack-embed iframe {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #374151;
    color: #9ca3af;
}

/* Responsive Design */
/* iPhone Pro Max and large mobile screens optimization */
@media (max-width: 430px) {
    .portfolio-item {
        min-width: 850px; /* Much wider for better readability - horizontal scroll is fine */
        grid-template-columns: 45px minmax(110px, 1.4fr) minmax(65px, 0.8fr) minmax(65px, 0.8fr) minmax(70px, 0.9fr) minmax(75px, 1.1fr) minmax(80px, 1.2fr) minmax(65px, 0.8fr) minmax(75px, 1fr) minmax(75px, 1fr) minmax(75px, 1fr);
        gap: 0.8rem;
        padding: 1rem 1.5rem;
        font-size: 0.8rem;
    }
    
    .portfolio-item:first-child {
        min-width: 850px !important; /* Match data row width */
        width: 100% !important; /* Use full container width */
        max-width: none !important; /* Remove max-width constraint */
        grid-template-columns: 45px minmax(110px, 1.4fr) minmax(65px, 0.8fr) minmax(65px, 0.8fr) minmax(70px, 0.9fr) minmax(75px, 1.1fr) minmax(80px, 1.2fr) minmax(65px, 0.8fr) minmax(75px, 1fr) minmax(75px, 1fr) minmax(75px, 1fr) !important;
        gap: 0.8rem !important;
        font-size: 0.8rem;
        padding: 1rem 1.5rem !important;
    }


    
    .portfolio-logo {
        width: 22px;
        height: 22px;
        font-size: 0.55rem;
    }
    
    .portfolio-sector {
        font-size: 0.65rem;
        min-width: 60px;
        max-width: 75px;
    }
    
    .portfolio-first-buy,
    .portfolio-last-buy {
        font-size: 0.6rem;
        min-width: 60px;
        max-width: 75px;
    }
}

@media (max-width: 768px), (max-width: 1024px) {
    .hamburger {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: white;
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.05);
        padding: 2rem 0;
    }

    .nav-menu.active {
        left: 0;
    }

    .hero {
        padding: 100px 0 30px; /* Reduced top padding for mobile */
    }

    /* Reduce whitespace on mobile */
    .allocation {
        padding: 40px 0 60px 0 !important; /* Much reduced padding for mobile */
        min-height: 500px !important; /* Much reduced minimum height */
    }

    .allocation .section-title {
        margin-bottom: 15px !important; /* Reduced margin for mobile */
        font-size: 2rem !important; /* Smaller title for mobile */
    }

    /* Mobile Toggle Button Styles */
    .allocation-toggle {
        top: 60px !important; /* Adjusted position for mobile */
        gap: 0.5rem;
    }

    .toggle-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
        border-radius: 8px;
    }

    .hero-container {
        grid-template-columns: 1fr;
        text-align: center;
        padding: 2rem 1rem;
    }

    .hero-title {
        font-size: 2rem;
        line-height: 1.2;
    }

    .hero-stats {
        justify-content: center;
        flex-wrap: wrap;
        gap: 1rem;
    }

    .about-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    /* Mobile Events Section Optimization */
    .events {
        padding: 30px 0;
    }

    .events-content {
        padding: 0 1rem;
    }

    /* Mobile News Section Optimization */
    .news {
        padding: 30px 0;
    }

    .news-content {
        padding: 0 1rem;
    }

    /* Mobile Pie Chart Optimizations */
    .allocation-content {
        overflow-x: auto; /* allow horizontal scroll when callouts overflow */
        overflow-y: visible; /* allow vertical overflow so top labels can show */
        display: flex;
        justify-content: center;
        padding: 0 20px;
    }

    /* Enforce sizing for consolidated chart container on mobile */
    #allocation .allocation-chart {
        max-width: 100vw;
        min-width: 620px; /* larger for mobile */
        height: 420px; /* larger for mobile */
        overflow: visible;
        margin: 0 auto;
        position: relative;
        transform: scale(0.90);
        transform-origin: center center;
        margin-top: 48px; /* Add vertical breathing room under titles so top labels have space */
    }

    /* Mobile chart callout optimizations */
    .chart-callout {
        font-size: 6px !important; /* Much smaller for mobile */
        padding: 2px 4px !important;
        min-width: 40px !important;
        max-width: 55px !important;
        border-radius: 4px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
        backdrop-filter: blur(8px) !important;
    }

    /* Branch styling optimizations */
    .chart-branch {
        height: 1px !important;
        opacity: 0.6 !important;
    }

    /* Portfolio allocation callouts - can be slightly larger */
.allocation-chart .chart-callout {
    font-size: 7px !important;
    min-width: 45px !important;
    max-width: 60px !important;
}

/* Desktop branch styling - simplified and consistent */
.chart-branch {
    height: 1px !important;
    opacity: 0.6 !important;
    background: linear-gradient(90deg, currentColor, currentColor) !important;
}

/* Target SVG paths in branches */
.chart-branch svg path {
    stroke-width: 1 !important;
    opacity: 0.6 !important;
}

    /* Sector weight callouts - smaller for longer text */
    .sector-allocation-chart .chart-callout {
        font-size: 5px !important;
        min-width: 35px !important;
        max-width: 50px !important;
    }

    /* Remove forced relative positioning on mobile callouts to prevent drift */
    /* (callout absolute positions are computed in JS) */

    .chart-callout img {
        width: 18px !important;
        height: 18px !important;
        border-radius: 3px !important;
    }

    /* Optimize branch lines for mobile - consistent with desktop */
    .chart-branch {
        height: 1px !important;
        opacity: 0.6 !important;
    }

    .chart-branch svg path {
        stroke-width: 1 !important;
        opacity: 0.6 !important;
    }

    /* Ensure chart containers are properly sized */
    .chart-container {
        position: relative;
        width: 100%;
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .performance-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-top: 80px; /* Reduced from 100px for mobile */
    }

    /* Performance Section Mobile Optimizations */
    .performance {
        padding: 40px 0 60px 0; /* Reduced padding for mobile */
    }

    .performance .section-title {
        font-size: 1.8rem; /* Reduced from 2.5rem for mobile */
        margin-bottom: 20px; /* Reduced from 60px */
        padding-top: 15px; /* Reduced from 20px */
    }

    .performance-card {
        padding: 1.5rem; /* Reduced from 2rem for mobile */
        border-radius: 12px; /* Slightly reduced for mobile */
    }

    .performance-card h3 {
        font-size: 1.1rem; /* Reduced from 1.3rem for mobile */
        margin-bottom: 1rem; /* Reduced from 1.5rem */
    }

    /* Performance card content mobile optimizations */
    .performer-item,
    .benchmark-item {
        padding: 0.75rem; /* Reduced from 1rem for mobile */
        border-radius: 8px; /* Reduced from 10px */
    }

    .performer-symbol,
    .benchmark-symbol {
        font-size: 1rem; /* Reduced from default for mobile */
    }

    .performer-name {
        font-size: 0.8rem; /* Reduced from 0.9rem for mobile */
    }

    .performer-return,
    .benchmark-performance-value {
        font-size: 1rem; /* Reduced from 1.1rem for mobile */
    }

    /* Portfolio multiples mobile optimization */
    .portfolio-multiples {
        gap: 0.75rem; /* Reduced gap for mobile */
    }

    .multiple-stat {
        padding: 0.75rem; /* Reduced padding for mobile */
        border-radius: 8px; /* Reduced border radius */
    }

    .multiple-label {
        font-size: 0.85rem; /* Reduced font size for mobile */
    }

    .multiple-value {
        font-size: 1rem; /* Reduced font size for mobile */
    }

    .portfolio-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .filter-buttons {
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .portfolio-grid {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        margin-top: 50px; /* Reduced mobile spacing */
        width: 100%;
        max-width: 100vw; /* Ensure it doesn't exceed viewport width */
    }

    /* Portfolio Grid Container - Tablet */
    .portfolio-grid {
        max-height: calc((3.6em + 8 * (0.9rem * 2 + 1.2rem + 1.2px)) * 2) !important; /* Show 8 rows without scrolling - doubled height for mobile */
    }

    .portfolio-item {
        min-width: 750px; /* Reduced from 800px for better mobile fit */
        grid-template-columns: 35px minmax(90px, 1.4fr) minmax(55px, 0.8fr) minmax(55px, 0.8fr) minmax(65px, 1fr) minmax(70px, 1.1fr) minmax(75px, 1.2fr) minmax(55px, 0.8fr) minmax(65px, 1fr) minmax(65px, 1fr) minmax(65px, 1fr);
        gap: 0.6rem;
        padding: 0.75rem 1rem;
        font-size: 0.8rem;
    }

    .portfolio-item:first-child {
        display: grid; /* Show header on mobile but make it scrollable */
        font-size: 0.75rem;
        padding: 0.5rem 1rem;
        height: auto; /* Allow header to expand for wrapped text */
        min-height: 2.5em; /* Ensure minimum height for wrapped headers */
        background: #f8fafc !important; /* Solid background for sticky headers */
        /* CRITICAL: Ensure header uses same grid layout as data rows on tablet */
        min-width: 750px !important; /* Match data row width */
        width: 100% !important; /* Use full container width */
        max-width: none !important; /* Remove max-width constraint for full background */
        grid-template-columns: 35px minmax(90px, 1.4fr) minmax(55px, 0.8fr) minmax(55px, 0.8fr) minmax(65px, 1fr) minmax(70px, 1.1fr) minmax(75px, 1.2fr) minmax(55px, 0.8fr) minmax(65px, 1fr) minmax(65px, 1fr) minmax(65px, 1fr) !important;
        gap: 0.75rem !important;
        align-items: center !important;
        /* Sticky header positioning with solid background */
        position: sticky !important;
        top: 0 !important;
        z-index: 100 !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important; /* Add shadow for better separation */
    }



    /* Ensure ALL header columns use the same font size and uniform formatting on mobile */
    .portfolio-item:first-child .portfolio-symbol,
    .portfolio-item:first-child .portfolio-name,
    .portfolio-item:first-child .portfolio-sector,
    .portfolio-item:first-child .portfolio-weight,
    .portfolio-item:first-child .portfolio-return,
    .portfolio-item:first-child .portfolio-pe2026,
    .portfolio-item:first-child .portfolio-pfcf2026,
    .portfolio-item:first-child .portfolio-first-buy,
    .portfolio-item:first-child .portfolio-last-buy,
    .portfolio-item:first-child .portfolio-fwd-rev-cagr,
    .portfolio-item:first-child .portfolio-pe2026-watchlist,
    .portfolio-item:first-child .portfolio-price,
    .portfolio-item:first-child .portfolio-shares,
    .portfolio-item:first-child .portfolio-cost,
    .portfolio-item:first-child .portfolio-value {
        font-size: 0.75rem !important; /* Force consistent font size for all headers */
        text-align: center !important; /* Center all header text */
        white-space: normal !important; /* Allow text wrapping for all headers */
        overflow: visible !important; /* Allow content to be visible */
        text-overflow: unset !important; /* Remove ellipsis */
        height: auto !important; /* Allow height to expand */
        min-height: 2.2em !important; /* Slightly smaller for mobile */
        word-wrap: break-word !important; /* Force word wrapping */
        overflow-wrap: break-word !important; /* Modern word wrapping */
    }

    /* Center all header text on tablet except Symbol */
    .portfolio-item:first-child .portfolio-return,
    .portfolio-item:first-child .portfolio-pe2026,
    .portfolio-item:first-child .portfolio-pfcf2026,
    .portfolio-item:first-child .portfolio-first-buy,
    .portfolio-item:first-child .portfolio-last-buy,
    .portfolio-item:first-child .portfolio-fwd-rev-cagr,
    .portfolio-item:first-child .portfolio-pe2026-watchlist,
    .portfolio-item:first-child .portfolio-price,
    .portfolio-item:first-child .portfolio-weight {
        text-align: center !important; /* Center all headers */
    }

    /* Left-align Symbol and company name headers on tablet */
    .portfolio-item:first-child .portfolio-symbol {
        text-align: left !important;
    }

    .portfolio-item:first-child .portfolio-name {
        text-align: left !important;
    }

    /* All header formatting is now handled by the uniform rules above */

    .portfolio-logo {
        width: 30px;
        height: 30px;
        font-size: 0.7rem;
    }

    .portfolio-symbol {
        font-size: 0.9rem;
    }

    .portfolio-name {
        font-size: 0.75rem;
        white-space: normal; /* Ensure text wrapping on mobile */
        line-height: 1.1; /* Tighter line spacing for mobile */
    }

    .portfolio-sector {
        font-size: 0.75rem;
        min-width: 65px;
        max-width: 80px;
    }

    .portfolio-shares,
    .portfolio-price,
    .portfolio-cost,
    .portfolio-value,
    .portfolio-weight,
    .portfolio-return,
    .portfolio-pe2026,
    .portfolio-pfcf2026 {
        font-size: 0.75rem;
        min-width: 60px;
        max-width: 70px;
    }

    .portfolio-first-buy,
    .portfolio-last-buy {
        font-size: 0.7rem;
        min-width: 50px;
        max-width: 65px;
        white-space: normal; /* Allow text wrapping on mobile */
        line-height: 1.1; /* Tighter line spacing for mobile */
    }

    .portfolio-fwd-rev-cagr {
        font-size: 0.7rem;
        min-width: 55px;
        max-width: 70px;
        white-space: normal;
        line-height: 1.1;
    }

    .portfolio-pe2026-watchlist {
        font-size: 0.7rem;
        min-width: 70px;
        max-width: 80px;
        white-space: normal;
        line-height: 1.1;
    }

    /* Events and News Mobile Styles */
    .events-list, .news-list {
        max-height: 600px; /* Increased height for better mobile scrolling */
        overflow-y: auto;
        gap: 0.75rem;
        padding: 0.5rem 0;
    }

    .event-item, .news-item {
        flex-direction: row; /* Keep horizontal layout for better space usage */
        text-align: left;
        padding: 0.75rem;
        gap: 0.75rem;
        min-height: auto;
    }

    .event-logo, .news-logo {
        width: 45px;
        height: 45px;
        flex-shrink: 0;
        border-radius: 8px;
    }

    .event-info, .news-info {
        flex: 1;
        min-width: 0;
    }

    .event-company, .news-company {
        font-size: 0.95rem;
        margin-bottom: 0.25rem;
        font-weight: 600;
    }

    .event-name, .news-headline {
        font-size: 0.85rem;
        margin-bottom: 0.25rem;
        line-height: 1.3;
        color: #4b5563;
        display: -webkit-box;
        -webkit-line-clamp: 3; /* Limit to exactly 3 lines for uniform formatting */
        line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis; /* Show ... for overflow */
    }

    .event-date, .news-date {
        font-size: 0.75rem;
        color: #6b7280;
    }

    .event-actions, .news-actions {
        flex-shrink: 0;
        align-self: flex-start;
    }

    .event-link, .news-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
        border-radius: 6px;
    }

    /* Additional mobile overrides for news items */
    .news-item {
        min-height: 144px !important; /* Increased by 20% from 120px to 144px */
        gap: 1.2rem !important; /* Increased by 20% from 1rem to 1.2rem */
        padding: 1.2rem !important; /* Increased by 20% from 1rem to 1.2rem */
        flex-direction: row !important;
        align-items: center !important; /* Center align all items vertically */
        margin-bottom: 1rem !important; /* Increased spacing between items */
    }

    .news-logo {
        width: 40px !important; /* Further reduced from 50px to 40px for better mobile fit */
        height: 40px !important;
        border-radius: 8px !important; /* Slightly reduced border radius */
        flex-shrink: 0 !important;
    }

    .news-info {
        flex: 1 !important;
        min-width: 0 !important;
        padding-right: 0.5rem !important;
    }

    .news-company {
        font-size: 0.9rem !important; /* Reduced from 1.1rem to 0.9rem for smaller mobile text */
        margin-bottom: 0.4rem !important; /* Slightly reduced margin */
        font-weight: 700 !important;
        color: #1f2937 !important;
    }

    .news-headline {
        font-size: 0.75rem !important; /* Reduced from 0.85rem to 0.75rem for smaller mobile text */
        margin-bottom: 0.25rem !important; /* Match events section margin */
        line-height: 1.3 !important; /* Match events section line height */
        display: -webkit-box !important;
        -webkit-line-clamp: 4 !important; /* Increased to 4 lines since text is smaller */
        line-clamp: 4 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        color: #4b5563 !important;
        text-overflow: ellipsis !important; /* Show ... for overflow */
    }

    .news-date {
        font-size: 0.75rem !important; /* Match article title font size for consistency */
        color: #6b7280 !important;
        margin-top: 0.3rem !important; /* Keep margin to ensure dates are visible */
    }

    .news-actions {
        flex-shrink: 0 !important;
        align-self: center !important; /* Center align the button vertically */
        display: flex !important;
        justify-content: center !important; /* Center the button horizontally */
    }

    .news-link {
        padding: 0.4rem 0.6rem !important; /* Reduced padding for smaller button */
        font-size: 0.65rem !important; /* Reduced font size for smaller button */
        border-radius: 5px !important; /* Slightly smaller border radius */
    }
    


    .event-link, .news-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    /* Make Read Article button font smaller on mobile */
    .news-link {
        font-size: 0.75rem !important;
    }
}

@media (max-width: 480px) {
    .hero-stats {
        flex-direction: column;
        gap: 1rem;
    }

    /* Performance Section Extra Small Mobile Optimizations */
    .performance {
        padding: 20px 0 40px 0; /* Further reduced padding for very small screens */
    }

    .performance .section-title {
        font-size: 1.5rem; /* Further reduced for very small screens */
        margin-bottom: 30px;
        padding-top: 10px;
    }

    .performance-grid {
        margin-top: 60px; /* Further reduced margin */
        gap: 0.75rem; /* Reduced gap for very small screens */
    }

    .performance-card {
        padding: 1.25rem; /* Further reduced padding */
        border-radius: 10px;
    }

    .performance-card h3 {
        font-size: 1rem; /* Further reduced font size */
        margin-bottom: 0.75rem;
    }

    .performer-item,
    .benchmark-item {
        padding: 0.6rem; /* Further reduced padding */
        border-radius: 6px;
    }

    .performer-symbol,
    .benchmark-symbol {
        font-size: 0.9rem; /* Further reduced font size */
    }

    .performer-name {
        font-size: 0.75rem; /* Further reduced font size */
    }

    .performer-return,
    .benchmark-performance-value {
        font-size: 0.9rem; /* Further reduced font size */
    }

    .multiple-stat {
        padding: 0.6rem; /* Further reduced padding */
        border-radius: 6px;
    }

    .multiple-label {
        font-size: 0.8rem; /* Further reduced font size */
    }

    .multiple-value {
        font-size: 0.9rem; /* Further reduced font size */
    }

    /* Extra small screen chart optimizations */
    #allocation .allocation-chart,
    #sector-allocation .allocation-chart {
        min-width: 580px;
        height: 380px;
        transform: scale(0.88);
    }

    .chart-callout {
        font-size: 5px !important; /* even smaller text */
        padding: 1px 3px !important;
        min-width: 30px !important;
        max-width: 45px !important;
    }

    /* Portfolio allocation callouts - slightly larger on very small screens */
    .allocation-chart .chart-callout {
        font-size: 6px !important;
        min-width: 40px !important;
        max-width: 55px !important;
    }

    /* Sector weight callouts - smaller for longer text on very small screens */
    .sector-allocation-chart .chart-callout {
        font-size: 4px !important;
        min-width: 25px !important;
        max-width: 40px !important;
    }

    .chart-callout img {
        width: 14px !important;
        height: 14px !important;
    }

    /* Portfolio Grid Container - Mobile */
    .portfolio-grid {
        max-height: calc((3em + 8 * (0.6rem * 2 + 0.9rem + 1.2px)) * 2) !important; /* Show 8 rows without scrolling - doubled height for mobile */
    }

    .portfolio-item {
        min-width: 900px; /* Much wider for better readability - horizontal scroll is fine */
        grid-template-columns: 50px minmax(120px, 1.5fr) minmax(70px, 0.9fr) minmax(70px, 0.9fr) minmax(75px, 1fr) minmax(80px, 1.2fr) minmax(85px, 1.3fr) minmax(70px, 0.9fr) minmax(80px, 1.1fr) minmax(80px, 1.1fr) minmax(80px, 1.1fr);
        gap: 1rem;
        padding: 1.25rem 2rem;
        font-size: 0.9rem;
    }

    /* CRITICAL: Ensure header uses same grid layout as data rows on mobile */
    .portfolio-item:first-child {
        min-width: 900px !important; /* Match data row width */
        width: 100% !important; /* Use full container width */
        max-width: none !important; /* Remove max-width constraint */
        grid-template-columns: 50px minmax(120px, 1.5fr) minmax(70px, 0.9fr) minmax(70px, 0.9fr) minmax(75px, 1fr) minmax(80px, 1.2fr) minmax(85px, 1.3fr) minmax(70px, 0.9fr) minmax(80px, 1.1fr) minmax(80px, 1.1fr) minmax(80px, 1.1fr) !important;
        gap: 1rem !important;
        align-items: center !important;
        background: #f8fafc !important; /* Solid background for sticky headers */
        /* Sticky header positioning with solid background */
        position: sticky !important;
        top: 0 !important;
        z-index: 100 !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important; /* Add shadow for better separation */
        padding: 1.25rem 2rem !important;
    }



    .portfolio-logo {
        width: 25px;
        height: 25px;
        font-size: 0.6rem;
    }

    .portfolio-symbol {
        font-size: 0.8rem;
    }

    /* Ensure ALL header columns use the same font size and uniform formatting on very small screens */
    .portfolio-item:first-child .portfolio-symbol,
    .portfolio-item:first-child .portfolio-name,
    .portfolio-item:first-child .portfolio-sector,
    .portfolio-item:first-child .portfolio-weight,
    .portfolio-item:first-child .portfolio-return,
    .portfolio-item:first-child .portfolio-pe2026,
    .portfolio-item:first-child .portfolio-pfcf2026,
    .portfolio-item:first-child .portfolio-first-buy,
    .portfolio-item:first-child .portfolio-last-buy,
    .portfolio-item:first-child .portfolio-fwd-rev-cagr,
    .portfolio-item:first-child .portfolio-pe2026-watchlist,
    .portfolio-item:first-child .portfolio-price,
    .portfolio-item:first-child .portfolio-shares,
    .portfolio-item:first-child .portfolio-cost,
    .portfolio-item:first-child .portfolio-value {
        font-size: 0.75rem !important; /* Force consistent font size for all headers */
        text-align: center !important; /* Center all header text */
        white-space: normal !important; /* Allow text wrapping for all headers */
        overflow: visible !important; /* Allow content to be visible */
        text-overflow: unset !important; /* Remove ellipsis */
        height: auto !important; /* Allow height to expand */
        min-height: 2.0em !important; /* Even smaller for very small screens */
        word-wrap: break-word !important; /* Force word wrapping */
        overflow-wrap: break-word !important; /* Modern word wrapping */
    }

    /* Center all header text on very small mobile except Symbol */
    .portfolio-item:first-child .portfolio-return,
    .portfolio-item:first-child .portfolio-pe2026,
    .portfolio-item:first-child .portfolio-pfcf2026,
    .portfolio-item:first-child .portfolio-first-buy,
    .portfolio-item:first-child .portfolio-last-buy,
    .portfolio-item:first-child .portfolio-fwd-rev-cagr,
    .portfolio-item:first-child .portfolio-pe2026-watchlist,
    .portfolio-item:first-child .portfolio-price,
    .portfolio-item:first-child .portfolio-weight {
        text-align: center !important; /* Center all headers */
    }

    /* Left-align Symbol and company name headers on very small mobile */
    .portfolio-item:first-child .portfolio-symbol {
        text-align: left !important;
    }

    .portfolio-item:first-child .portfolio-name {
        text-align: left !important;
    }

    .portfolio-name {
        font-size: 0.7rem;
        white-space: normal; /* Ensure text wrapping on very small screens */
        line-height: 1.0; /* Very tight line spacing for small screens */
    }

    .portfolio-sector {
        font-size: 0.65rem;
        min-width: 45px;
        max-width: 55px;
    }

    .portfolio-shares,
    .portfolio-price,
    .portfolio-cost,
    .portfolio-value,
    .portfolio-weight,
    .portfolio-return,
    .portfolio-pe2026,
    .portfolio-pfcf2026 {
        font-size: 0.7rem;
        min-width: 55px;
        max-width: 65px;
    }

    .portfolio-first-buy,
    .portfolio-last-buy {
        font-size: 0.65rem;
        min-width: 45px;
        max-width: 60px;
        white-space: normal; /* Allow text wrapping on very small screens */
        line-height: 1.0; /* Very tight line spacing for small screens */
    }

    .portfolio-fwd-rev-cagr {
        font-size: 0.65rem;
        min-width: 40px;
        max-width: 55px;
        white-space: normal;
        line-height: 1.0;
    }

    .portfolio-pe2026-watchlist {
        font-size: 0.65rem;
        min-width: 60px;
        max-width: 70px;
        white-space: normal;
        line-height: 1.0;
    }

    /* Mobile footer optimizations */
    .footer-content {
        flex-direction: column;
        gap: 2rem;
        text-align: center;
    }

    .footer-section {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 200px;
}

    .substack-embed {
    margin-top: 1rem;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .substack-embed iframe {
        width: 100% !important;
        max-width: 320px !important;
        height: 220px !important;
        margin: 0 auto;
    }

    /* Extra small screen chart optimizations */
    .allocation-chart,
    .sector-allocation-chart {
        height: 250px; /* Slightly reduced for better mobile scaling */
        margin: 0 auto;
    }

    .chart-callout {
        font-size: 10px !important;
        padding: 5px 8px !important;
        min-width: 60px !important;
        max-width: 80px !important;
        border-radius: 6px !important;
    }

    .chart-callout img {
        width: 14px !important;
        height: 14px !important;
        border-radius: 2px !important;
    }

    /* Further optimize branch lines for very small screens - consistent */
    .chart-branch {
        height: 1px !important;
        opacity: 0.6 !important;
    }

    .chart-branch svg path {
        stroke-width: 1 !important;
        opacity: 0.6 !important;
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.portfolio-item,
.performance-card,
.contact-item {
    animation: fadeInUp 0.6s ease forwards;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}


