/* ============================================
   BIOGRAPHY WEBSITE - STYLE.CSS
   ============================================
   
   TABLE OF CONTENTS:
   1. Font Face Declarations
   2. CSS Custom Properties (Variables)
   3. Reset & Base Styles
   4. Typography
   5. Layout & Container
   6. Profile Section
   7. Social Links
   8. Theme Toggle
   9. Footer
   10. RTL Support
   11. Responsive Design
   12. Accessibility & Animations
   
   ============================================ */


/* ============================================
   1. FONT FACE DECLARATIONS
   ============================================ */

@font-face {
    font-family: 'Rubik';
    src: url('fonts/Rubik-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Rubik';
    src: url('fonts/Rubik-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}


/* ============================================
   2. CSS CUSTOM PROPERTIES (VARIABLES)
   ============================================ */

:root {
    /* Light Mode Colors */
    --color-primary: #6B7A99;
    --color-primary-hover: #4A5568;
    --color-text: #2C2C2C;
    --color-text-muted: #6B6B6B;
    --color-background: #F9F6F0;
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --spacing-xxl: 4rem;
    
    /* Typography */
    --font-family-base: 'Rubik', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-family-heading: Georgia, "Times New Roman", serif;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.5rem;
    --font-size-xxl: 2rem;
    --line-height-base: 1.6;
    --line-height-heading: 1.3;
    
    /* Layout */
    --max-width-content: 800px;
    --portrait-size: 200px;
    --portrait-size-mobile: 150px;
    
    /* Transitions */
    --transition-speed: 0.3s;
    --transition-easing: ease-in-out;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Dark Mode Colors */
[data-theme="dark"] {
    --color-primary: #9AADCC;
    --color-primary-hover: #B4C7E7;
    --color-text: #E8E8E8;
    --color-text-muted: #A0A0A0;
    --color-background: #1A1A1A;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.4);
}


/* ============================================
   3. RESET & BASE STYLES
   ============================================ */

/* Box sizing reset */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Remove default margins and paddings */
* {
    margin: 0;
    padding: 0;
}

/* Root element */
html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

/* Body */
body {
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    color: var(--color-text);
    background-color: var(--color-background);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color var(--transition-speed) var(--transition-easing),
                color var(--transition-speed) var(--transition-easing);
}

/* Images */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Links */
a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-speed) var(--transition-easing);
}

a:hover,
a:focus {
    color: var(--color-primary-hover);
}

/* Focus styles for accessibility */
a:focus,
button:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Remove focus outline for mouse users, keep for keyboard users */
a:focus:not(:focus-visible),
button:focus:not(:focus-visible) {
    outline: none;
}


/* ============================================
   4. TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family-base);
    line-height: var(--line-height-heading);
    font-weight: 700;
}

h1 {
    font-size: 2rem;
}

h2 {
    font-size: 1.75rem;
    margin-top: var(--spacing-xl);
    margin-bottom: var(--spacing-lg);
}

h3 {
    font-size: 1.4rem;
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
}

p {
    margin-bottom: var(--spacing-sm);
}

p:last-child {
    margin-bottom: 0;
}


/* ============================================
   5. LAYOUT & CONTAINER
   ============================================ */

/* Main container */
.container {
    flex: 1;
    width: 100%;
    max-width: var(--max-width-content);
    margin: 0 auto;
    padding: var(--spacing-xl) var(--spacing-md);
    display: flex;
    align-items: center;
    justify-content: center;
}


/* ============================================
   6. PROFILE SECTION
   ============================================ */

.profile {
    width: 100%;
    text-align: center;
    animation: fadeIn 0.6s var(--transition-easing);
}

/* Portrait wrapper */
.portrait-wrapper {
    margin: 0 auto var(--spacing-lg);
    width: var(--portrait-size);
    height: var(--portrait-size);
}

/* Portrait image */
.portrait {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-primary);
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-speed) var(--transition-easing),
                box-shadow var(--transition-speed) var(--transition-easing);
}

.portrait:hover {
    transform: scale(1.02);
}

/* Name/Title */
.name {
    font-size: var(--font-size-xxl);
    margin-bottom: var(--spacing-xs);
    color: var(--color-text);
}

/* Birth and Death Dates */
.dates {
    font-size: var(--font-size-base);
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-md);
    font-weight: 400;
}

.dates-separator {
    margin: 0 var(--spacing-xs);
}

/* Biography text */
.biography {
    font-size: var(--font-size-lg);
    line-height: 1.8;
    color: var(--color-text);
    margin-bottom: var(--spacing-lg);
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.biography h2 {
    text-align: center;
}

.biography h3 {
    text-align: right;
}

.biography p {
    text-align: justify;
    margin-bottom: var(--spacing-md);
}


/* ============================================
   7. SOCIAL LINKS
   ============================================ */

.social-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    color: var(--color-primary);
    transition: color var(--transition-speed) var(--transition-easing),
                transform var(--transition-speed) var(--transition-easing);
}

.social-link:hover,
.social-link:focus {
    color: var(--color-primary-hover);
    transform: translateY(-3px);
}

.social-icon {
    width: 28px;
    height: 28px;
}


/* ============================================
   8. THEME TOGGLE
   ============================================ */

.theme-toggle-container {
    position: fixed;
    top: var(--spacing-md);
    right: var(--spacing-md);
    z-index: 1000;
}

.theme-toggle {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    background-color: var(--color-background);
    border: 2px solid var(--color-primary);
    border-radius: 50px;
    cursor: pointer;
    font-family: var(--font-family-base);
    font-size: 0.875rem;
    color: var(--color-text);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-speed) var(--transition-easing);
}

.theme-toggle:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--color-primary-hover);
}

.theme-toggle:active {
    transform: scale(0.98);
}

/* Toggle label text */
.theme-toggle-label {
    font-weight: 500;
    user-select: none;
    white-space: nowrap;
}

/* Toggle switch container */
.theme-toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background-color: var(--color-text-muted);
    border-radius: 12px;
    transition: background-color var(--transition-speed) var(--transition-easing);
    flex-shrink: 0;
}

/* Toggle slider */
.theme-toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background-color: var(--color-background);
    border-radius: 50%;
    transition: transform var(--transition-speed) var(--transition-easing);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Active state (dark mode) */
[data-theme="dark"] .theme-toggle-switch {
    background-color: var(--color-primary);
}

[data-theme="dark"] .theme-toggle-slider {
    transform: translateX(20px);
}


/* ============================================
   9. FOOTER
   ============================================ */

.footer {
    text-align: center;
    padding: var(--spacing-xl) var(--spacing-md);
    color: var(--color-text);
    font-size: 0.95rem;
    background-color: var(--color-background);
    border-top: 1px solid rgba(107, 122, 153, 0.2);
}

.footer-content {
    max-width: 700px;
    margin: 0 auto;
}

.footer p {
    margin-bottom: var(--spacing-md);
    line-height: 1.8;
}

.footer .last-updated {
    margin-top: var(--spacing-lg);
    font-size: 0.875rem;
    color: var(--color-text-muted);
}


/* ============================================
   10. RTL SUPPORT
   ============================================ */

/* RTL-specific adjustments */
[dir="rtl"] {
    direction: rtl;
}

[dir="rtl"] .theme-toggle-container {
    right: auto;
    left: var(--spacing-md);
}

/* RTL typography adjustments */
[dir="rtl"] body {
    text-align: right;
}

[dir="rtl"] .profile {
    text-align: center; /* Keep profile centered in RTL */
}


/* ============================================
   11. RESPONSIVE DESIGN
   ============================================ */

/* Tablet and below (768px) */
@media (max-width: 768px) {
    :root {
        --font-size-xxl: 1.75rem;
        --font-size-xl: 1.25rem;
        --font-size-lg: 1rem;
        --spacing-xl: 2rem;
        --spacing-xxl: 3rem;
    }
    
    .container {
        padding: var(--spacing-lg) var(--spacing-md);
    }
    
    .portrait-wrapper {
        width: var(--portrait-size-mobile);
        height: var(--portrait-size-mobile);
    }
    
    .social-link {
        width: 44px;
        height: 44px;
    }
    
    .social-icon {
        width: 24px;
        height: 24px;
    }
    
    .theme-toggle-container {
        top: var(--spacing-sm);
        right: var(--spacing-sm);
    }
    
    .theme-toggle {
        padding: 6px var(--spacing-xs);
        font-size: 0.8125rem;
    }
    
    .theme-toggle-switch {
        width: 40px;
        height: 22px;
    }
    
    .theme-toggle-slider {
        width: 18px;
        height: 18px;
    }
    
    [data-theme="dark"] .theme-toggle-slider {
        transform: translateX(18px);
    }
    
    [dir="rtl"] .theme-toggle-container {
        right: auto;
        left: var(--spacing-sm);
    }
}

/* Mobile (480px and below) */
@media (max-width: 480px) {
    :root {
        --font-size-xxl: 1.5rem;
        --font-size-xl: 1.125rem;
        --font-size-lg: 0.9375rem;
    }
    
    .container {
        padding: var(--spacing-md) var(--spacing-sm);
    }
    
    .social-link {
        width: 40px;
        height: 40px;
    }
    
    .social-icon {
        width: 22px;
        height: 22px;
    }
    
    .theme-toggle {
        padding: 5px 10px;
        font-size: 0.75rem;
    }
    
    .theme-toggle-switch {
        width: 36px;
        height: 20px;
    }
    
    .theme-toggle-slider {
        width: 16px;
        height: 16px;
    }
    
    [data-theme="dark"] .theme-toggle-slider {
        transform: translateX(16px);
    }
}

/* Very small screens (375px and below - iPhone SE) */
@media (max-width: 375px) {
    .theme-toggle-container {
        position: static;
        display: flex;
        justify-content: center;
        margin-bottom: var(--spacing-md);
        padding-top: var(--spacing-sm);
    }
    
    .container {
        padding-top: var(--spacing-sm);
    }
}


/* ============================================
   12. ACCESSIBILITY & ANIMATIONS
   ============================================ */

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Focus styles for keyboard navigation */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Reduced 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;
        scroll-behavior: auto !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --color-text: #000000;
        --color-background: #FFFFFF;
        --color-primary: #0000EE;
    }
    
    [data-theme="dark"] {
        --color-text: #FFFFFF;
        --color-background: #000000;
        --color-primary: #00FFFF;
    }
}

/* Print styles */
@media print {
    .theme-toggle-container {
        display: none;
    }
    
    .social-links {
        display: none;
    }
    
    body {
        background-color: white;
        color: black;
    }
    
    .portrait {
        border: 2px solid black;
    }
}
