/* import tailwindcss */
@import "tailwind.css";

/* Classic Value Investment Color Palette */
:root {
    --navy-primary: #1a2332;
    --navy-dark: #0f1419;
    --burgundy: #8b2635;
    --burgundy-dark: #6b1d28;
    --burgundy-light: #a83a4a;
    --cream-bg: #faf8f3;
    --cream-light: #fefcf8;
    --charcoal: #2c2c2c;
    --charcoal-light: #4a4a4a;
    --gold-accent: #c9a961;

    --header-footer: #fefcf8;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    background-color: var(--cream-bg);
    min-height: 100%;
    height: 100%;
    scroll-padding-top: 100px; /* Account for sticky header */
}

body {
    /* Classic serif font for old-school value investment feel */
    font-family: Georgia, 'Times New Roman', serif;
    background-color: var(--cream-bg);
    color: var(--charcoal);
    line-height: 1.7;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    height: 100%;
}

main {
    background-color: var(--cream-bg);
}

/* Language switcher styles */
.lang-btn {
    background-color: transparent;
    border: none;
    cursor: pointer;
    font-weight: var(--font-weight-medium);
    color: var(--color-slate-500);
    padding: calc(var(--spacing) * 1) calc(var(--spacing) * 2);
    border-radius: var(--radius-md);
}

.lang-btn:hover {
    background-color: var(--color-slate-100);
}

.lang-btn:focus-visible {
    outline: 2px solid var(--burgundy);
    outline-offset: 2px;
    border-radius: 4px;
}

.lang-btn.active {
    background-color: #f5e6e8;
    color: var(--burgundy);
    font-weight: var(--font-weight-semibold);
}

/* Guide page styles */
.guide-nav-link.active {
    background-color: #f5e6e8;
    color: var(--burgundy-dark);
    font-weight: var(--font-weight-semibold);
}

/* 
  Prose styles for markdown content (Investment Guide, Letters, etc.)
  These styles match Tailwind utility classes for consistent design
*/
.prose p {
    font-size: 1rem; /* text-base */
    line-height: 1.75; /* Improved readability */
    margin-top: 1.25rem; /* Better spacing */
    margin-bottom: 1.25rem;
    text-align: justify;
}

.prose p:first-child {
    margin-top: 0;
}

.prose p:last-child {
    margin-bottom: 0;
}

.prose h1 {
    font-size: 1.875rem; /* text-3xl */
    font-weight: 700; /* font-bold */
    color: var(--navy-primary);
    margin-top: 1rem; /* mt-12 */
}

@media (min-width: 768px) {
    .prose h1 {
        font-size: 2.25rem; /* md:text-4xl */
    }
}

.prose h2 {
    font-size: 1.5rem; /* text-2xl */
    font-weight: 600; /* font-semibold */
    color: var(--navy-primary);
    margin-top: 2rem; /* Better spacing */
    margin-bottom: 1rem;
    line-height: 1.3;
}

@media (min-width: 768px) {
    .prose h2 {
        font-size: 1.875rem; /* md:text-3xl */
    }
}

.prose h3 {
    font-size: 1.25rem; /* text-xl */
    font-weight: 500; /* font-medium */
    color: var(--burgundy);
    margin-top: 1.5rem; /* Better spacing */
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

@media (min-width: 768px) {
    .prose h3 {
        font-size: 1.5rem; /* md:text-2xl */
    }
}

.prose ol {
    font-size: 1rem; /* text-base */
    list-style-type: decimal; /* list-decimal */
    padding-left: 1.5rem; /* pl-6 */
    margin-top: 1rem; /* mt-4 */
}

.prose ul {
    font-size: 1rem; /* text-base */
    list-style-type: disc; /* list-disc */
    padding-left: 1.5rem; /* pl-6 */
    margin-top: 1rem; /* mt-4 */
}

.prose li {
    font-size: 1rem; /* text-base */
    line-height: 1.625; /* leading-relaxed */
}

.prose ul ul {
    margin-top: 0;
}

/* Button Styles - Classic Value Investment Theme */
.btn-primary {
    background-color: var(--burgundy);
    color: #faf8f3;
    border: 1px solid var(--burgundy);
    font-weight: var(--font-weight-semibold);
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    position: relative;
}

.btn-primary:hover {
    background-color: var(--burgundy-dark);
    border-color: var(--burgundy-dark);
    color: #faf8f3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(139, 38, 53, 0.25);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(139, 38, 53, 0.2);
}

.btn-primary:focus {
    outline: 2px solid var(--burgundy);
    outline-offset: 2px;
}

.btn-primary:focus:not(:focus-visible) {
    outline: none;
}

/* Hero Section */
.hero-section {
    background-color: var(--cream-bg);
    border-bottom: 2px solid #d4d0c5;
}

.hero-title {
    color: var(--navy-primary);
}

.hero-text {
    color: var(--charcoal-light);
}

/* Performance Section */
.performance-section {
    background-color: var(--cream-bg);
}

/* Performance Cards */
.performance-card {
    background-color: #fefcf8;
    border: 2px solid #d4d0c5;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.performance-card:hover {
    border-color: var(--burgundy);
    box-shadow: 0 4px 12px rgba(139, 38, 53, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* Group hover for clickable cards */
.group:hover .performance-card {
    border-color: var(--burgundy);
    box-shadow: 0 4px 12px rgba(139, 38, 53, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.performance-label {
    color: var(--burgundy);
}

.performance-return {
    color: #2d5016; /* Forest green for returns */
}

.performance-text {
    color: var(--charcoal-light);
}

/* Chart Section */
.chart-section {
    background-color: var(--cream-bg);
}

.chart-container {
    background-color: #fefcf8;
    border: 2px solid #d4d0c5;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.chart-container:hover {
    border-color: var(--burgundy);
    box-shadow: 0 2px 8px rgba(139, 38, 53, 0.1);
}

/* Navigation Links */
.nav-link {
    color: var(--charcoal-light);
    transition: all 0.2s ease;
    position: relative;
}

/* Active navigation link style */
.nav-link.active {
    color: var(--burgundy);
    font-weight: var(--font-weight-semibold);
    border-bottom: 2px solid var(--burgundy);
}

.nav-link:hover {
    color: var(--navy-primary);
}

.nav-link:focus-visible {
    outline: 2px solid var(--burgundy);
    outline-offset: 4px;
    border-radius: 2px;
}

/* Mobile Navigation Links */
.nav-link.mobile {
    border-color: transparent;
    transition: all 0.2s ease;
}

.nav-link.mobile:hover {
    color: var(--navy-primary);
    background-color: var(--cream-bg);
    border-color: var(--burgundy);
}

/* Back to Top Button */
.back-to-top {
    background-color: var(--burgundy);
    color: #faf8f3;
    border: 1px solid var(--burgundy);
    transition: all 0.2s ease;
}

.back-to-top:hover {
    background-color: var(--burgundy-dark);
    border-color: var(--burgundy-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(139, 38, 53, 0.25);
}

.back-to-top:focus-visible {
    outline: 2px solid var(--burgundy);
    outline-offset: 2px;
}

/* Team Member Titles */
.team-title {
    color: var(--burgundy);
}

/* About page goal callout */
.about-goal-card {
    background-color: #fefcf8;
    border: 2px solid #d4d0c5;
}


.about-founder-photo {
    width: 35%;
    height: auto;
    object-fit: cover;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    margin-top: 1rem;
}

/* Section Headings */
.section-heading {
    color: var(--navy-primary);
}

.section-text {
    color: var(--charcoal-light);
}

.section-text-light {
    color: #6b6b6b;
}

/* Header Styles */
.header {
    background-color: var(--header-footer);
    border-bottom: 1px solid #d4d0c5;
}

/* Mobile Menu Button */
.mobile-menu-button {
    color: #6b6b6b;
    transition: all 0.2s ease;
}

.mobile-menu-button:hover {
    color: var(--navy-primary);
    background-color: var(--cream-bg);
}

/* Language Switcher Separator */
.lang-separator {
    color: #d4d0c5;
}

/* Footer Styles */
.footer {
    background-color: var(--header-footer);
    border-top: 2px solid #d4d0c5;
    color: var(--charcoal-light);
    margin-top: 4rem; /* mt-16 equivalent */
}

.footer-text {
    color: var(--charcoal-light);
}

.footer-heading {
    color: var(--navy-primary);
}

.footer-border {
    border-top: 1px solid #d4d0c5;
}

.footer-copyright {
    color: #6b6b6b;
}

/* Footer Links */
.footer-link {
    color: var(--charcoal-light);
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: var(--burgundy);
}

.footer-link:focus-visible {
    outline: 2px solid var(--burgundy);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Mobile Menu Border */
.mobile-menu-border {
    border-top: 1px solid #d4d0c5;
}

/* Mobile Menu Animation */
#mobile-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    opacity: 0;
}

#mobile-menu:not(.hidden) {
    max-height: 1000px;
    opacity: 1;
    transition: max-height 0.3s ease-in, opacity 0.3s ease-in;
}

/* Letter Back Link */
.letter-back-link {
    color: var(--burgundy);
    text-decoration: none;
    transition: all 0.2s ease;
}

.letter-back-link:hover {
    color: var(--burgundy-dark);
    text-decoration: underline;
}

.letter-back-link:focus-visible {
    outline: 2px solid var(--burgundy);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Language Detection Banner */
@keyframes lang-banner-slide-in {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.lang-banner {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: linear-gradient(135deg, var(--navy-primary) 0%, #2a3548 100%);
    color: var(--cream-bg);
    padding: 20px 24px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    max-width: 300px;
    animation: lang-banner-slide-in 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.lang-banner__text {
    margin: 0 0 14px 0;
    font-size: 15px;
    line-height: 1.5;
    padding-right: 20px;
}

.lang-banner__close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--cream-bg);
    cursor: pointer;
    font-size: 14px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    line-height: 1;
}

.lang-banner__close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lang-banner__link {
    display: inline-block;
    background: var(--burgundy);
    color: var(--cream-bg);
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s ease, transform 0.2s ease;
}

.lang-banner__link:hover {
    background: var(--burgundy-light);
    transform: translateY(-1px);
}

/* Enhanced Focus States for Accessibility */
a:focus-visible,
button:focus-visible,
.nav-link:focus-visible,
.lang-btn:focus-visible {
    outline: 2px solid var(--burgundy);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Smooth page transitions */
main {
    animation: fadeIn 0.4s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Chart loading state */
.chart-container {
    position: relative;
}

.chart-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid #d4d0c5;
    border-top-color: var(--burgundy);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    opacity: 0;
    pointer-events: none;
    z-index: 1;
}

.chart-container.loading::before {
    opacity: 1;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Improved letter card spacing on letters page */
.letters-page .performance-card {
    margin-bottom: 1.5rem;
}

/* Stagger animation for letter cards */
.letters-page a {
    animation: fadeInUp 0.5s ease-out backwards;
}

.letters-page a:nth-child(1) {
    animation-delay: 0.1s;
}

.letters-page a:nth-child(2) {
    animation-delay: 0.2s;
}

.letters-page a:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print Styles for Letters */
@media print {
    /* Hide navigation and footer */
    header,
    footer,
    .back-to-top,
    .lang-banner,
    .btn-primary {
        display: none !important;
    }

    /* Optimize letter layout for printing */
    main {
        padding: 0 !important;
        margin: 0 !important;
    }

    .prose {
        max-width: 100% !important;
        padding: 0 !important;
    }

    .prose h1,
    .prose h2,
    .prose h3 {
        page-break-after: avoid;
    }

    .prose p,
    .prose li {
        page-break-inside: avoid;
    }

    /* Ensure good contrast for printing */
    body {
        background: white !important;
        color: black !important;
    }

    .performance-card,
    .chart-container {
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }

    /* Remove hover effects in print */
    a {
        text-decoration: underline;
        color: inherit;
    }

    /* Page breaks */
    .prose h2 {
        page-break-before: auto;
    }
}

/* Improved mobile typography */
@media (max-width: 640px) {
    .prose h1 {
        font-size: 1.5rem;
        line-height: 1.3;
    }

    .prose h2 {
        font-size: 1.25rem;
        line-height: 1.3;
    }

    .prose h3 {
        font-size: 1.125rem;
        line-height: 1.4;
    }

    .prose p {
        font-size: 0.9375rem;
        line-height: 1.7;
    }
}

/* Enhanced link transitions */
a {
    transition: color 0.2s ease;
}

/* Better spacing for letter content sections */
.prose > * + * {
    margin-top: 1.25rem;
}

.prose > h2 + *,
.prose > h3 + * {
    margin-top: 0.75rem;
}

/* Letter page button alignment */
.letter-buttons-container {
    display: flex !important;
    justify-content: flex-end !important;
    width: 100% !important;
}

.letter-buttons-container > div {
    gap: 0.75rem !important;
}
