/* Reading Progress Bar */
.reading-progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.05);
    z-index: 9999;
}

.reading-progress-bar {
    height: 100%;
    background: rgb(151,216,196);
    width: 0%;
    transition: width 0.2s ease;
    box-shadow: 0 2px 4px rgba(151,216,196, 0.2);
}

/* Modern Post Layout */
.modern-post-content {
    width: 100%;
    margin: 0 auto;
    position: relative;
    /* Modified system font stack for better Safari consistency */
    font-family: system-ui, -apple-system, BlinkMacSystemFont, ".SFNSText-Regular", "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-display: swap;
}

.hero-section {
    position: relative;
    margin-bottom: 0;
    width: 100%;
}

.post-cover-image {
    width: 100%;
    height: 80vh;
    position: relative;
    overflow: hidden;
}

.post-cover-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-overlay {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 50%;
    padding: 4em 3em;
    background: linear-gradient(to right, transparent, rgba(0,0,0,0.85) 15%, rgba(0,0,0,0.95));
    color: white;
    text-align: left;
    min-width: 300px;
    z-index: 1;
}

.modern-post-title {
    font-family: inherit;
    font-size: 2.8em;
    line-height: 1.2;
    color: white;
    margin: 0.8em 0 0.5em;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.modern-post-excerpt {
    /* Modified serif stack for better Safari consistency */
    font-family: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
    font-size: 1.2em;
    line-height: 1.6;
    color: rgba(255,255,255,0.95);
    margin: 1.2em 0;
    font-weight: 400;
    font-style: italic;
    letter-spacing: -0.01em;
    text-shadow: 0 1px 1px rgba(0,0,0,0.1);
}

/* Post Actions Bar */
.post-actions-bar {
    display: flex;
    justify-content: center;
    gap: 2em;
    padding: 1em 2em;
    border-bottom: 1px solid #eee;
    background: white;
    max-width: 800px;
    margin: 0 auto;
    font-family: inherit;
}

.action-button {
    display: flex;
    align-items: center;
    gap: 0.7em;
    padding: 0.9em 1.6em;
    border: none;
    background: #f5f5f5;
    color: #333;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 8px;
    font-family: inherit;
}

.action-button:hover {
    background: #e8f7f3;
    color: rgb(151,216,196);
}

.action-icon {
    font-size: 26px;
    color: #333;
    transition: all 0.2s ease;
    margin-right: 12px;
    font-weight: 400;
    line-height: 1;
    display: inline-block;
    position: relative;
    top: 2px;
}

.action-button:hover .action-icon {
    color: rgb(151,216,196);
    transform: scale(1.15);
}

/* Content Layout */
.content-wrapper {
    max-width: 800px;
    margin: 3em auto;
    padding: 0 2em;
    position: relative;
}

.content-wrapper::after {
    content: '';
    display: block;
    clear: both;
}

.post-body {
    max-width: 800px;
    margin: 0 auto;
    /* Modified serif stack for better Safari consistency */
    font-family: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
    font-size: 1.1em;
    line-height: 1.8;
    color: #333;
    padding: 0;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s ease forwards;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Post Metadata */
.post-metadata {
    margin-bottom: 2em;
    font-family: inherit;
}

.post-categories {
    margin-bottom: 1.2em;
    display: flex;
    flex-wrap: wrap;
    gap: 0.8em;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 0.5em;
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 2;
}

.category-tag {
    display: inline-block;
    padding: 6px 14px;
    background-color: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 20px;
    font-size: 0.8em;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    backdrop-filter: blur(4px);
}

.category-tag:hover {
    background-color: rgba(255,255,255,0.95);
    color: #333;
    border-color: transparent;
}

.post-date {
    color: rgba(255,255,255,0.9);
    font-size: 0.9em;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.5em;
}

/* Author Section */
.post-author {
    float: left;
    width: 80px;
    margin: 0.3em 2em 1em 0;
    position: relative;
    z-index: 1;
    font-family: inherit;
}

.author-image {
    width: 80px;
    height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 0.8em;
}

.author-image img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.author-info {
    width: 80px;
}

.author-name {
    font-size: 1em;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
    letter-spacing: -0.01em;
    text-align: center;
    width: 100%;
}

.author-role {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 0.5em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.author-bio {
    font-size: 0.95em;
    color: #4a4a4a;
    line-height: 1.6;
    margin-top: 0.5em;
}

.post-body p:first-of-type {
    margin-top: 0;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Section structure */
.post-body .content-section {
    position: relative;
    margin: 3em 0 2em;
}

.post-body .content-section:first-child {
    margin-top: 0;
}

/* Section headers */
.post-body .section-header {
    font-family: inherit;
    font-size: 1.4em;
    color: #000;
    font-weight: 700;
    line-height: 1.4;
    padding-bottom: 0.5em;
    border-bottom: 2px solid rgba(151,216,196, 0.3);
    margin: 0;
    opacity: 0;
    transform: translateY(10px);
    animation: fadeInUp 0.6s ease forwards;
    animation-delay: 0.2s;
}

.post-body .content-section {
    opacity: 0;
    transform: translateY(15px);
    animation: fadeInUp 0.6s ease forwards;
    animation-delay: 0.3s;
}

/* Section breaks */
.post-body .section-break {
    display: block;
    height: 2em;
    opacity: 0;
}

/* Paragraphs */
.post-body p {
    margin: 0 0 1.5em;
    opacity: 0;
    transform: translateY(10px);
    animation: fadeInUp 0.6s ease forwards;
    animation-delay: 0.4s;
}

.post-body p:first-of-type::first-letter {
    float: left;
    font-size: 3.5em;
    line-height: 0.8;
    padding-right: 0.1em;
    color: rgb(151,216,196);
}

.post-body p:last-child {
    margin-bottom: 0;
}

/* Content flow */
.post-body .content-section {
    margin: 2.5em 0;
}

.post-body .content-section:first-child {
    margin-top: 0;
}

.post-body .content-section + p,
.post-body .content-section + ul,
.post-body .content-section + ol {
    margin-top: 1.5em;
}

/* Content breaks */
.post-body .content-break {
    display: block;
    height: 2em;
    margin: 0;
    clear: both;
}

.post-body .content-break + .content-break {
    display: none;
}

/* Section spacing */
.post-body .section-header {
    margin-bottom: 1.5em;
    padding-top: 1em;
}

.post-body .content-section {
    margin: 2em 0;
}

/* Lists */
.post-body ul,
.post-body ol {
    margin: 1.2em 0 2em;
    padding-left: 2em;
}

.post-body ol {
    list-style-type: decimal;
}

.post-body ul {
    list-style-type: disc;
}

.post-body li {
    margin-bottom: 0.8em;
    padding-left: 0.5em;
    line-height: 1.6;
}

.post-body li:last-child {
    margin-bottom: 0;
}

/* Links */
.post-body a {
    color: #007AFF;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s;
}

.post-body a:hover {
    border-bottom-color: #007AFF;
}

/* Images */
.post-content-image {
    margin: 2.5em auto;
    max-width: 100%;
}

.post-content-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
}

.post-content-image figcaption {
    font-family: inherit;
    text-align: center;
    color: #666;
    font-size: 0.9em;
    margin-top: 1em;
    font-style: italic;
}

/* Footer */
.post-footer {
    margin: 60px 0 20px;
    text-align: center;
    font-family: inherit;
}

.post-footer a {
    color: #000;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    font-size: 1.1em;
    font-weight: 500;
    padding: 14px 32px;
    border: 1px solid #D0D5DD;
    border-radius: 4px;
    background: #fff;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.post-footer a:hover {
    color: #fff;
}

.post-footer a::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgb(244,185,66);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 0;
}

.post-footer a:hover::before {
    transform: translateX(0);
}

.post-footer a span {
    position: relative;
    z-index: 1;
}

/* Container Layout */
.t2099 {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2em;
}

@media (max-width: 1023px) {
    .t2099 {
        padding: 0 1em;
    }
}

/* Resource Title and Description Styling */
.resource-title {
    margin-top: 0em;
    margin-bottom: 0em;
    font-size: 2em;
    line-height: 1.4;
    font-weight: 500;
    color: #333;
}

/* Loading and Error states */
.loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 1.1em;
    font-family: inherit;
}

.error {
    text-align: center;
    padding: 40px 20px;
    color: #d32f2f;
    font-size: 1.1em;
    font-family: inherit;
}

.error-container {
    text-align: center;
    padding: 40px 20px;
    font-family: inherit;
}

.error-container h2 {
    color: #d32f2f;
    margin-bottom: 20px;
}

/* Responsive adjustments */
/* Extra small devices */
@media (max-width: 479px) {
    .post-cover-image {
        height: 60vh;
    }

    .post-overlay {
        width: 100%;
        min-width: unset;
        background: linear-gradient(180deg, 
            transparent 0%,
            rgba(0,0,0,0.85) 25%,
            rgba(0,0,0,0.95) 100%);
        padding: 1.5em;
        bottom: 0;
    }

    .modern-post-title {
        font-size: 1.8em;
        margin: 0.5em 0 0.3em;
    }

    .modern-post-excerpt {
        font-size: 1em;
        margin: 0.8em 0;
    }
}

/* Small devices */
@media (min-width: 480px) and (max-width: 767px) {
    .post-cover-image {
        height: 65vh;
    }

    .post-overlay {
        width: 100%;
        background: linear-gradient(180deg, 
            transparent 0%,
            rgba(0,0,0,0.8) 30%,
            rgba(0,0,0,0.95) 100%);
        padding: 2em;
    }

    .modern-post-title {
        font-size: 2em;
        margin: 0.6em 0 0.4em;
    }

    .modern-post-excerpt {
        font-size: 1.1em;
        margin: 1em 0;
    }
}

/* Medium devices */
@media (min-width: 768px) and (max-width: 1023px) {
    .post-cover-image {
        height: 65vh;
    }

    .post-overlay {
        width: 100%;
        background: linear-gradient(180deg, 
            transparent 0%,
            rgba(0,0,0,0.8) 30%,
            rgba(0,0,0,0.95) 100%);
        padding: 2em;
    }

    .modern-post-title {
        font-size: 2em;
        margin: 0.6em 0 0.4em;
    }

    .modern-post-excerpt {
        font-size: 1.1em;
        margin: 1em 0;
    }
}

/* Large devices */
@media (min-width: 1024px) and (max-width: 1279px) {
    .post-cover-image {
        height: 75vh;
    }

    .post-overlay {
        width: 55%;
        background: linear-gradient(90deg, 
            transparent 0%,
            rgba(0,0,0,0.8) 15%,
            rgba(0,0,0,0.95) 100%);
        padding: 3em;
    }

    .modern-post-title {
        font-size: 2.5em;
        margin: 0.7em 0 0.4em;
    }

    .modern-post-excerpt {
        font-size: 1.2em;
        margin: 1.1em 0;
    }
}

/* Extra large devices */
@media (min-width: 1280px) {
    .post-cover-image {
        height: 80vh;
    }

    .post-overlay {
        width: 50%;
        padding: 4em;
        background: linear-gradient(90deg, 
            transparent 0%,
            rgba(0,0,0,0.8) 15%,
            rgba(0,0,0,0.95) 100%);
    }

    .modern-post-title {
        font-size: 2.8em;
        line-height: 1.2;
        margin: 0.8em 0 0.5em;
    }

    .modern-post-excerpt {
        font-size: 1.2em;
        line-height: 1.6;
        margin: 1.2em 0;
    }
}

/* Shared responsive styles */
@media (max-width: 1023px) {
    .content-wrapper {
        padding: 1em;
    }

    .post-body {
        max-width: 100%;
        font-size: 1em;
        padding: 0;
    }

    .post-author {
        float: none;
        width: 80px;
        margin: 0 auto 2em;
    }
}

@media (min-width: 1024px) {
    .content-wrapper {
        padding: 0 2em;
    }

    .post-body {
        max-width: 800px;
    }
}

/* Category tags responsive handling */
.post-categories {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    padding-bottom: 8px;
    margin: 0 -8px;
    padding: 0 8px;
    position: relative;
}

.post-categories::-webkit-scrollbar {
    display: none;
}

.post-categories::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 40px;
    background: linear-gradient(90deg, transparent, rgba(0,0,0,0.3));
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.post-categories:not(:hover)::-webkit-scrollbar-thumb {
    background: transparent;
}

.category-tag {
    flex: 0 0 auto;
    font-size: 0.8em;
    padding: 6px 14px;
    margin-right: 8px;
    white-space: nowrap;
}

.category-tag:last-child {
    margin-right: 0;
}
