/**
 * Custom CSS for Oxford Principles of Language Learning website
 *
 * Includes OUP brand styling, custom animations, and component-specific styles
 * Version: 1.0.0
 */

/* ==========================================================================
   Base Styles & Typography
   ========================================================================== */

body {
    font-family: 'Open Sans', sans-serif;
    color: #011e41; /* Oxford Blue */
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'DM Serif Display', serif;
}

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

/* ==========================================================================
   Principle Tile Colors
   ========================================================================== */

.principle-tile[data-principle="1"] .principle-color-accent {
    background-color: #0043e0; /* Electric Blue */
}

.principle-tile[data-principle="2"] .principle-color-accent {
    background-color: #9b1827; /* Ruskin Red */
}

.principle-tile[data-principle="3"] .principle-color-accent {
    background-color: #005145; /* Mallard Green */
}

.principle-tile[data-principle="4"] .principle-color-accent {
    background-color: #fd5821; /* Madrid Orange */
}

.principle-tile[data-principle="5"] .principle-color-accent {
    background-color: #82745e; /* Walton Stone */
}

.principle-tile[data-principle="6"] .principle-color-accent {
    background-color: #c8dc00; /* Big Apple Green */
}

.principle-tile[data-principle="7"] .principle-color-accent {
    background-color: #5f4261; /* Scholar Purple */
}

.principle-tile[data-principle="8"] .principle-color-accent {
    background-color: #ffe12d; /* Kipper Yellow */
}

.principle-tile[data-principle="9"] .principle-color-accent {
    background-color: #f3a7b8; /* Isadora Pink */
}

.principle-tile[data-principle="10"] .principle-color-accent {
    background-color: #011e41; /* Oxford Blue */
}

/* ==========================================================================
   Principle Tile Image Sections
   ========================================================================== */

/* Image container base styling */
.principle-image-container {
    position: relative;
    background-color: #f2eeda; /* Neutral stone fallback during load */
}

/* Ensure images maintain aspect ratio while filling container */
.principle-image-container img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Colored bottom borders for each principle using ::after pseudo-element */
.principle-tile[data-principle="1"] .principle-image-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 5px;
    background-color: #0043e0; /* Electric Blue */
}

.principle-tile[data-principle="2"] .principle-image-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 5px;
    background-color: #9b1827; /* Ruskin Red */
}

.principle-tile[data-principle="3"] .principle-image-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 5px;
    background-color: #005145; /* Mallard Green */
}

.principle-tile[data-principle="4"] .principle-image-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 5px;
    background-color: #fd5821; /* Madrid Orange */
}

.principle-tile[data-principle="5"] .principle-image-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 5px;
    background-color: #82745e; /* Walton Stone */
}

.principle-tile[data-principle="6"] .principle-image-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 5px;
    background-color: #c8dc00; /* Big Apple Green */
}

.principle-tile[data-principle="7"] .principle-image-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 5px;
    background-color: #5f4261; /* Scholar Purple */
}

.principle-tile[data-principle="8"] .principle-image-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 5px;
    background-color: #ffe12d; /* Kipper Yellow */
}

.principle-tile[data-principle="9"] .principle-image-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 5px;
    background-color: #f3a7b8; /* Isadora Pink */
}

.principle-tile[data-principle="10"] .principle-image-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 5px;
    background-color: #011e41; /* Oxford Blue */
}

/* ==========================================================================
   Animations
   ========================================================================== */

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Slide up animation */
@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Scale in animation */
@keyframes scaleIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Apply animations */
.animate-fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

.animate-slide-up {
    animation: slideUp 0.4s ease-out;
}

.animate-scale-in {
    animation: scaleIn 0.3s ease-out;
}

/* ==========================================================================
   Modal Styles (for Phase 3)
   ========================================================================== */

.modal-overlay {
    backdrop-filter: blur(2px);
}

.modal-content {
    max-height: 90vh;
    overflow-y: auto;
}

/* Custom scrollbar for modal */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #cad7d8; /* Neutral Blue */
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: #0043e0; /* Electric Blue */
}

/* ==========================================================================
   Expandable Sections (for Phase 4)
   ========================================================================== */

.expandable-section {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-in-out;
}

.expandable-section.expanded {
    max-height: 3000px;
}

/* Smooth expand/collapse for sub-principles */
.sub-principle-content {
    transition: all 0.3s ease-in-out;
}

/* ==========================================================================
   Pill Buttons
   ========================================================================== */

.pill-button {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
}

.pill-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.pill-button-primary {
    background-color: #0043e0; /* Electric Blue */
    color: white;
}

.pill-button-primary:hover {
    background-color: #011e41; /* Oxford Blue */
}

.pill-button-secondary {
    background-color: #cad7d8; /* Neutral Blue */
    color: #011e41; /* Oxford Blue */
}

.pill-button-secondary:hover {
    background-color: #0043e0; /* Electric Blue */
    color: white;
}

/* ==========================================================================
   Focus States & Accessibility
   ========================================================================== */

/* Custom focus ring for better visibility */
*:focus-visible {
    outline: 2px solid #0043e0; /* Electric Blue */
    outline-offset: 2px;
}

/* Skip to content link (for screen readers) */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: #011e41;
    color: white;
    padding: 8px;
    z-index: 100;
}

.skip-to-content:focus {
    top: 0;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

/* Text color utilities for OUP colors */
.text-oxford-blue {
    color: #011e41;
}

.text-electric-blue {
    color: #0043e0;
}

.text-neutral-blue {
    color: #cad7d8;
}

/* Background color utilities */
.bg-oxford-blue {
    background-color: #011e41;
}

.bg-electric-blue {
    background-color: #0043e0;
}

.bg-neutral-stone {
    background-color: #f2eeda;
}

/* Hover effects */
.hover-lift {
    transition: transform 0.2s ease-in-out;
}

.hover-lift:hover {
    transform: translateY(-4px);
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

/* Mobile-specific styles */
@media (max-width: 640px) {
    .principle-tile {
        margin-bottom: 1rem;
    }

    .modal-content {
        max-height: 95vh;
    }
}

/* Tablet-specific styles */
@media (min-width: 641px) and (max-width: 1024px) {
    .principle-tile {
        margin-bottom: 1.5rem;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .no-print {
        display: none !important;
    }

    body {
        color: black;
    }

    a {
        text-decoration: underline;
    }
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0043e0;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Key Concepts Page Styles
   ========================================================================== */

.concept-card {
    background: white;
    border: 1px solid #e3e1e0; /* neutral-grey */
    border-radius: 0.75rem;
    padding: 1.5rem;
    transition: all 0.3s ease-in-out, grid-column 0.4s ease-in-out;
    cursor: pointer;
}

.concept-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(1, 30, 65, 0.1);
    border-color: #0043e0; /* electric-blue */
}

.concept-card.expanded {
    border-color: #0043e0; /* electric-blue */
    box-shadow: 0 10px 25px rgba(0, 67, 224, 0.15);
    margin-bottom: 1.5rem; /* Add spacing below expanded card */
}

/* Smooth grid column span transition for full-width expansion */
@media (min-width: 1024px) {
    .concept-card.lg\:col-span-3 {
        grid-column: span 3 / span 3;
    }
}

/* Visual separator for expanded card */
.concept-card.expanded {
    position: relative;
}

.concept-card.expanded::after {
    content: '';
    position: absolute;
    bottom: -1rem;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #0043e0 0%, transparent 100%);
    opacity: 0.3;
}

.concept-name {
    font-family: 'DM Serif Display', serif;
    font-size: 1.5rem;
    color: #011e41; /* oxford-blue */
    margin-bottom: 0.75rem;
}

.concept-explanation {
    background-color: #f2eeda; /* neutral-stone */
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-top: 1rem;
}

.references-section {
    margin-top: 1.5rem;
    border-top: 2px solid #e3e1e0;
    padding-top: 1.5rem;
}

/* Citation-Annotation Pair Container */
.citation-annotation-pair {
    background: white;
    border: 1px solid #cad7d8; /* neutral-blue */
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: all 0.2s ease-in-out;
}

.citation-annotation-pair:hover {
    border-color: #0043e0; /* electric-blue */
    box-shadow: 0 2px 8px rgba(0, 67, 224, 0.1);
}

/* Citation Text (Primary) */
.citation-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: #011e41; /* oxford-blue */
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

/* Annotation Text (Secondary) */
.annotation-text {
    font-size: 0.875rem;
    font-weight: 400;
    color: rgba(1, 30, 65, 0.7); /* oxford-blue 70% opacity */
    line-height: 1.6;
    padding-left: 1rem;
    border-left: 2px solid #cad7d8; /* neutral-blue */
}

/* Smooth expand animations */
.concept-expand-enter-active,
.concept-expand-leave-active {
    transition: all 0.3s ease-in-out;
}

.concept-expand-enter-from,
.concept-expand-leave-to {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
}

.concept-expand-enter-to,
.concept-expand-leave-from {
    opacity: 1;
    max-height: 2000px;
}

/* Mobile responsiveness */
@media (max-width: 640px) {
    .concept-card {
        padding: 1.25rem;
    }

    .concept-name {
        font-size: 1.25rem;
    }

    /* Mobile-specific adjustments for citations */
    .citation-annotation-pair {
        padding: 0.875rem;
    }

    .citation-text {
        font-size: 0.8125rem;
    }

    .annotation-text {
        font-size: 0.8125rem;
        padding-left: 0.75rem;
    }
}

/* Tablet adjustments */
@media (min-width: 641px) and (max-width: 1024px) {
    .citation-text {
        font-size: 0.875rem;
    }
}
