/* Classic Academic CV Styling */
@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,500;0,600;1,400&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'EB Garamond', serif;
    font-size: 12pt;
    line-height: 1.4;
    color: #2c2c2c;
    background-color: #ffffff;
    max-width: 10.5in;
    margin: 0 auto;
    padding: 0.75in;
}

.cv-container {
    width: 100%;
}

/* Header Styling */
.cv-header {
    margin-bottom: 1.5em;
    border-bottom: 2px solid #2c2c2c;
    padding-bottom: 1em;
}

.header-content {
    text-align: center;
}

.header-text {
    text-align: center;
}

.cv-header h1 {
    font-size: 24pt;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 0.3em;
    text-transform: uppercase;
}

.contact-info {
    font-size: 11pt;
    color: #555;
}

.contact-info p {
    margin: 0.2em 0;
}

.contact-info .title {
    font-size: 12pt;
    font-weight: 500;
    color: #2c2c2c;
    margin-bottom: 0.3em;
    line-height: 1.3;
}

.contact-info .subtitle {
    font-size: 11pt;
    color: #666;
    margin-bottom: 0.4em;
}

.contact-info .contact-details {
    font-size: 10pt;
    color: #666;
}

.contact-link {
    color: #2c2c2c;
    text-decoration: none;
}

.contact-link:hover {
    text-decoration: underline;
}

.qr-code {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 1em;
    padding-top: 1em;
    border-top: 1px solid #e9ecef;
}

.qr-code img {
    width: 80px;
    height: 80px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

.qr-code small {
    font-size: 8pt;
    color: #666;
    margin-top: 0.3em;
    text-align: center;
    line-height: 1.2;
}

.portfolio-link {
    color: #2c2c2c;
    text-decoration: none;
}

.portfolio-link:hover {
    text-decoration: underline;
}

/* Instructions */
.instructions {
    text-align: center;
    margin: 1.2em 0;
    padding: 0.8em;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    font-size: 10.5pt;
    color: #555;
    line-height: 1.4;
}

.instructions p {
    margin: 0;
}

/* Controls */
.controls {
    text-align: center;
    margin: 1.5em 0;
    display: flex;
    justify-content: center;
    gap: 1em;
    flex-wrap: wrap;
}

.toggle-btn {
    background: #f8f9fa;
    border: 1px solid #ddd;
    padding: 0.5em 1em;
    font-family: 'EB Garamond', serif;
    font-size: 11pt;
    cursor: pointer;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    transition: all 0.2s ease;
}

.toggle-btn:hover {
    background: #e9ecef;
    border-color: #999;
}

.toggle-icon {
    transition: transform 0.2s ease;
}

.toggle-btn.expanded .toggle-icon {
    transform: rotate(180deg);
}

/* Main Content */
.cv-main {
    margin-top: 1em;
}

/* Category Sections */
.category-section {
    margin-bottom: 2em;
}

/* Main Categories (1.2, 1.3, etc.) */
.category-title {
    font-size: 14pt;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.8em;
    padding-bottom: 0.3em;
    border-bottom: 2px solid #2c2c2c;
    margin-top: 1.5em;
}

/* Subcategories (1.2.1, 1.3.1, etc.) */
.category-title.subcategory {
    font-size: 12pt;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    margin-bottom: 0.6em;
    padding-bottom: 0.2em;
    border-bottom: 1px solid #666;
    margin-top: 1em;
}

/* Sub-subcategories (1.3.1.1, etc.) */
.category-title.sub-subcategory {
    font-size: 11pt;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    margin-bottom: 0.5em;
    padding-bottom: 0.1em;
    border-bottom: 1px dotted #999;
    margin-top: 0.8em;
    font-style: italic;
}

/* Year Groups */
.year-group {
    margin-bottom: 1.2em;
}

.year-title {
    font-size: 11pt;
    font-weight: 500;
    margin-bottom: 0.6em;
    margin-top: 0.5em;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding-left: 0.5em;
    border-left: 2px solid #999;
    display: inline-block;
}

/* CV Items */
.cv-item {
    margin-bottom: 0.8em;
    margin-left: 1em;
}

.cv-item h3 {
    font-size: 13pt;
    font-weight: 600;
    margin-bottom: 0.2em;
    line-height: 1.3;
    color: #1a1a1a;
}

.cv-item h3 a {
    color: #1a1a1a;
    text-decoration: none;
    position: relative;
}

.cv-item h3 a:hover {
    text-decoration: underline;
}

/* Add a subtle link indicator */
.cv-item h3 a::after {
    content: "↗";
    font-size: 9pt;
    color: #0000EE;
    margin-left: 0.3em;
    opacity: 0.6;
    vertical-align: super;
}

.cv-item p {
    font-size: 11pt;
    margin-bottom: 0.3em;
    line-height: 1.3;
}

/* Properties styling */
.cv-item .properties {
    margin-bottom: 0.4em;
}

.cv-item .property-line {
    font-size: 10pt;
    color: #666;
    line-height: 1.4;
    margin-bottom: 0.2em;
}

.cv-item .property-line strong {
    color: #444;
    font-weight: 500;
    font-size: 9.5pt;
}

.cv-item .description {
    font-size: 10.5pt;
    color: #555;
    margin-bottom: 0.4em;
    line-height: 1.4;
}

.cv-item .meta {
    font-style: italic;
    color: #666;
    font-size: 10.5pt;
}

.cv-item .page-content {
    margin-top: 0.6em;
    padding: 0.8em;
    background: #f8f9fa;
    border-left: 3px solid #dee2e6;
    font-size: 10pt;
    line-height: 1.5;
    display: none;
}

.cv-item .page-content.expanded {
    display: block;
}

/* Page content formatting */
.page-content h4, .page-content h5, .page-content h6 {
    margin: 0.8em 0 0.4em 0;
    font-weight: 600;
    color: #2c2c2c;
}

.page-content h4 {
    font-size: 11pt;
}

.page-content h5 {
    font-size: 10.5pt;
}

.page-content h6 {
    font-size: 10pt;
}

.page-content p {
    margin: 0.5em 0;
}

.page-content ul, .page-content ol {
    margin: 0.5em 0;
    padding-left: 1.2em;
}

.page-content li {
    margin: 0.2em 0;
}

/* Image and video containers */
.image-container, .video-container {
    margin: 1em 0;
    text-align: center;
}

.image-container img {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
}

.video-container iframe,
.video-container video {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
}

.image-caption, .video-caption {
    margin-top: 0.5em;
    font-size: 9pt;
    color: #6c757d;
    font-style: italic;
    line-height: 1.3;
}

/* Table containers */
.table-container {
    margin: 1em 0;
    overflow-x: auto;
}

.notion-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #dee2e6;
    background: #ffffff;
    font-size: 9.5pt;
}

.notion-table th,
.notion-table td {
    padding: 0.4em 0.6em;
    text-align: left;
    border: 1px solid #dee2e6;
    vertical-align: top;
}

.notion-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #2c2c2c;
}

.notion-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.notion-table tr:hover {
    background-color: #e9ecef;
}

.table-error {
    color: #8b0000;
    font-style: italic;
    padding: 1em;
    border: 1px solid #d3d3d3;
    background-color: #fafafa;
    text-align: center;
}

/* Loading and Error States */
.loading {
    text-align: center;
    font-style: italic;
    color: #666;
    padding: 2em;
    font-size: 11pt;
}

.error {
    text-align: center;
    color: #8b0000;
    padding: 2em;
    font-size: 11pt;
    border: 1px solid #d3d3d3;
    background-color: #fafafa;
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
    body {
        padding: 1em;
        max-width: 100%;
    }
    
    /* Mobile header adjustments */
    .header-content {
        text-align: center;
    }
    
    .qr-code {
        margin-top: 0.8em;
        padding-top: 0.8em;
    }
    
    .cv-header h1 {
        font-size: 20pt;
    }
    
    .category-title {
        font-size: 13pt;
    }
}

/* PDF and Print Styles */
@media print {
    /* Hide interactive elements */
    .controls {
        display: none !important;
    }
    
    /* Hide specific text that references interactive elements */
    .hide-in-print {
        display: none !important;
    }
    
    /* Keep instructions visible in print */
    .instructions {
        margin: 8pt 0;
        padding: 6pt;
        font-size: 9pt;
        line-height: 1.3;
        background: #f8f9fa;
        border: 0.5pt solid #e9ecef;
    }
    
    /* Page setup for US Letter (8.5" x 11") */
    @page {
        size: letter;
        margin: 0.5in 0.6in;
    }
    
    /* Clean print layout without scaling */
    body {
        font-size: 11pt;
        line-height: 1.3;
        max-width: none;
        margin: 0;
        padding: 0;
    }
    
    .cv-container {
        max-width: none;
        width: 100%;
        margin: 0;
        padding: 0;
    }
    
    /* Header adjustments */
    .cv-header {
        margin-bottom: 14pt;
        padding-bottom: 8pt;
        border-bottom: 1.5pt solid #2c2c2c;
    }
    
    .cv-header h1 {
        font-size: 18pt;
        margin-bottom: 6pt;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.3pt;
    }
    
    .contact-info .title {
        font-size: 10pt;
        margin-bottom: 4pt;
        font-weight: 500;
    }
    
    .contact-info .subtitle {
        font-size: 9pt;
        margin-bottom: 3pt;
    }
    
    .contact-info .contact-details {
        font-size: 8.5pt;
    }
    
    .qr-code {
        margin-top: 8pt;
        padding-top: 8pt;
    }
    
    .qr-code img {
        width: 55pt;
        height: 55pt;
    }
    
    .qr-code small {
        font-size: 7pt;
        margin-top: 3pt;
    }
    
    /* Category and section titles */
    .category-title {
        font-size: 12pt;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5pt;
        margin: 12pt 0 8pt 0;
        padding-bottom: 3pt;
        border-bottom: 1.5pt solid #2c2c2c;
    }
    
    .category-title.subcategory {
        font-size: 10.5pt;
        font-weight: 500;
        text-transform: none;
        letter-spacing: 0;
        margin: 10pt 0 6pt 0;
        padding-bottom: 2pt;
        border-bottom: 1pt solid #666;
    }
    
    .category-title.sub-subcategory {
        font-size: 9.5pt;
        font-weight: 500;
        font-style: italic;
        text-transform: none;
        letter-spacing: 0;
        margin: 8pt 0 5pt 0;
        padding-bottom: 1pt;
        border-bottom: 0.5pt dotted #999;
    }
    
    .year-title {
        font-size: 9pt;
        font-weight: 500;
        margin: 6pt 0 5pt 0;
        color: #555;
        text-transform: uppercase;
        letter-spacing: 0.2pt;
        padding-left: 4pt;
        border-left: 1.5pt solid #999;
        display: inline-block;
    }
    
    /* CV Items */
    .cv-item {
        margin-bottom: 8pt;
        margin-left: 8pt;
    }
    
    .cv-item h3 {
        font-size: 10pt;
        font-weight: 600;
        margin-bottom: 3pt;
        line-height: 1.2;
        color: #1a1a1a;
    }
    
    .cv-item .properties {
        margin-bottom: 4pt;
    }
    
    .cv-item .property-line {
        font-size: 8.5pt;
        color: #666;
        line-height: 1.3;
        margin-bottom: 2pt;
    }
    
    .cv-item .property-line strong {
        color: #444;
        font-weight: 500;
        font-size: 8pt;
    }
    
    .cv-item .description {
        font-size: 9pt;
        color: #555;
        margin-bottom: 4pt;
        line-height: 1.3;
    }
    
    .cv-item .meta {
        font-style: italic;
        color: #666;
        font-size: 8.5pt;
    }
    
    /* Page content in print - respect toggle state */
    .cv-item .page-content {
        margin-top: 5pt;
        padding: 6pt;
        background: #f8f9fa;
        border-left: 2pt solid #dee2e6;
        font-size: 8.5pt;
        line-height: 1.4;
        /* Don't force display - respect current toggle state */
        page-break-inside: avoid;
        overflow: visible;
        position: relative;
    }
    
    /* Only expanded content shows in print */
    .cv-item .page-content.expanded {
        display: block !important;
        page-break-inside: auto; /* Allow breaks within long content */
    }
    
    /* Hidden content stays hidden in print */
    .cv-item .page-content:not(.expanded) {
        display: none !important;
    }
    
    /* Hide expand/collapse functionality in print */
    .expandable-content {
        display: block !important;
        max-height: none !important;
    }
    
    .expand-link {
        display: none !important;
    }
    
    /* Page content formatting */
    .page-content h4, .page-content h5, .page-content h6 {
        margin: 6pt 0 3pt 0;
        font-weight: 600;
        color: #2c2c2c;
    }
    
    .page-content h4 {
        font-size: 9pt;
    }
    
    .page-content h5 {
        font-size: 8.5pt;
    }
    
    .page-content h6 {
        font-size: 8pt;
    }
    
    .page-content p {
        margin: 4pt 0;
        font-size: 8.5pt;
        line-height: 1.3;
    }
    
    .page-content ul, .page-content ol {
        margin: 4pt 0;
        padding-left: 10pt;
    }
    
    .page-content li {
        margin: 2pt 0;
        font-size: 8.5pt;
        line-height: 1.3;
    }
    
    /* Ensure images and media fit well */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Remove borders and shadows from images in print */
    .image-container img,
    .page-content img,
    img {
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
        display: block !important;
        margin: 6pt auto !important;
    }
    
    /* Image containers need proper spacing in print */
    .image-container,
    .page-content .image-container {
        margin: 8pt 0 !important;
        text-align: center !important;
        page-break-inside: auto !important; /* Allow images to be cut across pages to prevent blank space */
        clear: both !important;
    }
    
    /* Ensure proper spacing around images to prevent text overlay */
    .page-content p + .image-container,
    .page-content .image-container + p,
    .page-content h4 + .image-container,
    .page-content h5 + .image-container,
    .page-content h6 + .image-container {
        margin-top: 8pt !important;
        margin-bottom: 8pt !important;
    }
    
    /* Remove borders from videos too */
    .video-container iframe,
    .video-container video,
    .page-content iframe,
    .page-content video {
        border: none !important;
        box-shadow: none !important;
    }
    
    /* Video containers need proper spacing in print */
    .video-container,
    .page-content .video-container {
        margin: 8pt 0 !important;
        text-align: center !important;
        page-break-inside: auto !important; /* Allow videos to be cut across pages to prevent blank space */
        clear: both !important;
    }
    
    /* Prevent floating issues that cause text overlay */
    .page-content * {
        float: none !important;
        position: static !important;
    }
    
    /* Ensure proper text flow around media elements */
    .page-content::after {
        content: "";
        display: block;
        clear: both;
    }
    
    /* Better table formatting for print */
    table {
        width: 100%;
        border-collapse: collapse;
        font-size: 8pt;
        margin: 4pt 0;
    }
    
    table th,
    table td {
        padding: 2pt 4pt;
        border: 0.5pt solid #ddd;
        font-size: 8pt;
        line-height: 1.2;
    }
    
    table th {
        font-weight: 600;
        background-color: #f8f9fa;
    }
}
