/**
 * Easy AMP Pro - AMP Frontend Styles
 * 
 * Custom styles for AMP pages
 * Maximum size: 50KB (AMP limitation)
 */

/* Reset and Base Styles */
* {
    box-sizing: border-box;
}

html {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
}

body {
    margin: 0;
    padding: 0;
    background-color: #fff;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Container */
.amp-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

@media (max-width: 768px) {
    .amp-container {
        padding: 0 15px;
    }
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-top: 0;
    margin-bottom: 1rem;
    color: #1a1a1a;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

h5 {
    font-size: 1.1rem;
}

h6 {
    font-size: 1rem;
}

@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.75rem;
    }
    
    h3 {
        font-size: 1.5rem;
    }
}

p {
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

a {
    color: #0073aa;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover,
a:focus {
    color: #005a87;
    text-decoration: underline;
}

/* Header */
.amp-header {
    background-color: #fff;
    border-bottom: 1px solid #e1e1e1;
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.amp-site-title {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
}

.amp-site-title a {
    color: #1a1a1a;
    text-decoration: none;
}

.amp-site-title a:hover {
    color: #0073aa;
}

.amp-site-description {
    margin: 5px 0 0 0;
    font-size: 0.9rem;
    color: #666;
    font-weight: 400;
}

@media (max-width: 768px) {
    .amp-header {
        padding: 15px 0;
    }
    
    .amp-site-title {
        font-size: 1.5rem;
    }
}

/* Main Content */
.amp-main {
    padding: 40px 0;
    min-height: 60vh;
}

@media (max-width: 768px) {
    .amp-main {
        padding: 30px 0;
    }
}

/* Article Styles */
.amp-article {
    margin-bottom: 40px;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.amp-article-header {
    padding: 30px;
    border-bottom: 1px solid #f0f0f0;
}

.amp-article-title {
    margin: 0 0 15px 0;
    font-size: 2.25rem;
    line-height: 1.2;
    color: #1a1a1a;
}

.amp-article-title a {
    color: inherit;
    text-decoration: none;
}

.amp-article-title a:hover {
    color: #0073aa;
}

.amp-article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.9rem;
    color: #666;
    margin-top: 15px;
}

.amp-article-meta time {
    font-weight: 500;
}

.amp-article-author {
    color: #0073aa;
}

@media (max-width: 768px) {
    .amp-article-header {
        padding: 20px;
    }
    
    .amp-article-title {
        font-size: 1.75rem;
    }
    
    .amp-article-meta {
        flex-direction: column;
        gap: 5px;
    }
}

/* Featured Image */
.amp-article-featured-image,
.amp-article-thumbnail {
    margin-bottom: 20px;
}

.amp-article-featured-image amp-img,
.amp-article-thumbnail amp-img {
    border-radius: 8px;
    overflow: hidden;
}

/* Article Content */
.amp-article-content {
    padding: 30px;
}

.amp-article-content > *:first-child {
    margin-top: 0;
}

.amp-article-content > *:last-child {
    margin-bottom: 0;
}

.amp-article-content img,
.amp-article-content amp-img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 20px 0;
}

.amp-article-content blockquote {
    border-left: 4px solid #0073aa;
    padding-left: 20px;
    margin: 30px 0;
    font-style: italic;
    font-size: 1.1rem;
    color: #555;
}

.amp-article-content pre {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.5;
}

.amp-article-content code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
    color: #d14;
}

.amp-article-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.amp-article-content ul,
.amp-article-content ol {
    padding-left: 30px;
    margin-bottom: 20px;
}

.amp-article-content li {
    margin-bottom: 5px;
}

.amp-article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    border: 1px solid #e1e1e1;
}

.amp-article-content th,
.amp-article-content td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e1e1e1;
}

.amp-article-content th {
    background-color: #f8f9fa;
    font-weight: 600;
}

@media (max-width: 768px) {
    .amp-article-content {
        padding: 20px;
    }
    
    .amp-article-content blockquote {
        padding-left: 15px;
        margin: 20px 0;
    }
    
    .amp-article-content pre {
        padding: 15px;
    }
    
    .amp-article-content ul,
    .amp-article-content ol {
        padding-left: 20px;
    }
}

/* Article Excerpt */
.amp-article-excerpt {
    padding: 20px 30px;
    border-top: 1px solid #f0f0f0;
}

.amp-read-more {
    display: inline-block;
    margin-top: 10px;
    color: #0073aa;
    font-weight: 600;
    text-decoration: none;
}

.amp-read-more:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .amp-article-excerpt {
        padding: 15px 20px;
    }
}

/* Article Footer */
.amp-article-footer {
    padding: 20px 30px;
    background: #f8f9fa;
    border-top: 1px solid #e1e1e1;
}

.amp-article-categories,
.amp-article-tags {
    margin-bottom: 15px;
}

.amp-article-categories:last-child,
.amp-article-tags:last-child {
    margin-bottom: 0;
}

.amp-article-categories span,
.amp-article-tags span {
    font-weight: 600;
    color: #555;
    margin-right: 10px;
}

.amp-article-categories a,
.amp-article-tags a {
    display: inline-block;
    background: #0073aa;
    color: #fff;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    text-decoration: none;
    margin-right: 8px;
    margin-bottom: 5px;
    transition: background-color 0.2s ease;
}

.amp-article-categories a:hover,
.amp-article-tags a:hover {
    background: #005a87;
}

@media (max-width: 768px) {
    .amp-article-footer {
        padding: 15px 20px;
    }
}

/* Archive/List View */
.amp-article-thumbnail {
    padding: 0 30px;
    margin-bottom: 0;
}

.amp-article-thumbnail a {
    display: block;
}

@media (max-width: 768px) {
    .amp-article-thumbnail {
        padding: 0 20px;
    }
}

/* Pagination */
.amp-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 40px;
    padding: 20px 0;
}

.amp-pagination a,
.amp-pagination span {
    display: inline-block;
    padding: 10px 15px;
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 4px;
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.amp-pagination a:hover {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

.amp-pagination .current {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

@media (max-width: 768px) {
    .amp-pagination {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .amp-pagination a,
    .amp-pagination span {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
}

/* No Posts */
.amp-no-posts {
    text-align: center;
    padding: 60px 30px;
    background: #f8f9fa;
    border-radius: 8px;
}

.amp-no-posts h2 {
    color: #666;
    margin-bottom: 10px;
}

.amp-no-posts p {
    color: #888;
    font-size: 1.1rem;
}

/* Footer */
.amp-footer {
    background-color: #1a1a1a;
    color: #ccc;
    padding: 40px 0;
    margin-top: 60px;
    text-align: center;
}

.amp-footer p {
    margin: 0 0 10px 0;
}

.amp-footer a {
    color: #fff;
    text-decoration: none;
}

.amp-footer a:hover {
    color: #0073aa;
    text-decoration: underline;
}

@media (max-width: 768px) {
    .amp-footer {
        padding: 30px 0;
        margin-top: 40px;
    }
}

/* AMP Components */
amp-img {
    background-color: #f0f0f0;
}

amp-video {
    background-color: #000;
}

amp-iframe {
    border: none;
}

/* Forms (if using amp-form) */
form {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 8px;
    margin: 20px 0;
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="tel"],
textarea,
select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    font-family: inherit;
    margin-bottom: 15px;
    transition: border-color 0.2s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="tel"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0,115,170,0.2);
}

button,
input[type="submit"] {
    background: #0073aa;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

button:hover,
input[type="submit"]:hover {
    background: #005a87;
}

/* Accessibility */
.screen-reader-text {
    position: absolute !important;
    clip: rect(1px, 1px, 1px, 1px);
    width: 1px !important;
    height: 1px !important;
    overflow: hidden;
}

/* Focus Styles */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .amp-header,
    .amp-footer,
    .amp-pagination {
        display: none;
    }
    
    .amp-article {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    a {
        text-decoration: underline;
    }
}

/* Dark Mode Support (if enabled by browser/system) */
@media (prefers-color-scheme: dark) {
    html {
        color: #e1e1e1;
    }
    
    body {
        background-color: #1a1a1a;
        color: #e1e1e1;
    }
    
    .amp-header {
        background-color: #2a2a2a;
        border-bottom-color: #444;
        box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    }
    
    .amp-site-title a {
        color: #fff;
    }
    
    .amp-site-title a:hover {
        color: #4f94cd;
    }
    
    .amp-site-description {
        color: #ccc;
    }
    
    .amp-article {
        background: #2a2a2a;
        box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    }
    
    .amp-article-header {
        border-bottom-color: #444;
    }
    
    .amp-article-title {
        color: #fff;
    }
    
    .amp-article-title a:hover {
        color: #4f94cd;
    }
    
    .amp-article-meta {
        color: #ccc;
    }
    
    .amp-article-author {
        color: #4f94cd;
    }
    
    .amp-article-footer {
        background: #333;
        border-top-color: #444;
    }
    
    .amp-article-categories a,
    .amp-article-tags a {
        background: #4f94cd;
    }
    
    .amp-article-categories a:hover,
    .amp-article-tags a:hover {
        background: #357abd;
    }
    
    .amp-no-posts {
        background: #333;
    }
    
    .amp-no-posts h2 {
        color: #ccc;
    }
    
    .amp-no-posts p {
        color: #aaa;
    }
    
    blockquote {
        border-left-color: #4f94cd;
        color: #ccc;
    }
    
    pre {
        background: #333;
    }
    
    code {
        background: #333;
        color: #ff6b6b;
    }
    
    table {
        border-color: #444;
    }
    
    th,
    td {
        border-bottom-color: #444;
    }
    
    th {
        background-color: #333;
    }
    
    form {
        background: #333;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="url"],
    input[type="tel"],
    textarea,
    select {
        background: #2a2a2a;
        border-color: #555;
        color: #e1e1e1;
    }
    
    input[type="text"]:focus,
    input[type="email"]:focus,
    input[type="url"]:focus,
    input[type="tel"]:focus,
    textarea:focus,
    select:focus {
        border-color: #4f94cd;
        box-shadow: 0 0 0 2px rgba(79,148,205,0.2);
    }
    
    button,
    input[type="submit"] {
        background: #4f94cd;
    }
    
    button:hover,
    input[type="submit"]:hover {
        background: #357abd;
    }
    
    .amp-pagination a,
    .amp-pagination span {
        background: #2a2a2a;
        border-color: #444;
        color: #4f94cd;
    }
    
    .amp-pagination a:hover {
        background: #4f94cd;
        color: #fff;
        border-color: #4f94cd;
    }
    
    .amp-pagination .current {
        background: #4f94cd;
        color: #fff;
        border-color: #4f94cd;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .amp-article {
        border: 2px solid;
    }
    
    a {
        text-decoration: underline;
    }
    
    button,
    input[type="submit"] {
        border: 2px solid;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Custom Animations for AMP */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.amp-article {
    animation: fadeIn 0.6s ease-out;
}

/* AMP Lightbox (if used) */
amp-lightbox {
    background: rgba(0, 0, 0, 0.9);
}

/* AMP Carousel (if used) */
amp-carousel {
    border-radius: 8px;
    overflow: hidden;
}

amp-carousel .amp-carousel-button {
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
}

amp-carousel .amp-carousel-button:hover {
    background: rgba(0, 0, 0, 0.7);
}

/* AMP Social Share (if used) */
amp-social-share {
    border-radius: 4px;
    margin: 0 5px;
}

/* Custom Utility Classes */
.amp-text-center {
    text-align: center;
}

.amp-text-left {
    text-align: left;
}

.amp-text-right {
    text-align: right;
}

.amp-mb-0 {
    margin-bottom: 0 !important;
}

.amp-mb-10 {
    margin-bottom: 10px !important;
}

.amp-mb-20 {
    margin-bottom: 20px !important;
}

.amp-mb-30 {
    margin-bottom: 30px !important;
}

.amp-mt-0 {
    margin-top: 0 !important;
}

.amp-mt-10 {
    margin-top: 10px !important;
}

.amp-mt-20 {
    margin-top: 20px !important;
}

.amp-mt-30 {
    margin-top: 30px !important;
}

.amp-hidden {
    display: none !important;
}

.amp-visible {
    display: block !important;
}

/* Performance Optimizations */
amp-img[layout="responsive"] {
    display: block;
    max-width: 100%;
}

/* Fix for common AMP validation issues */
amp-img img {
    object-fit: cover;
}

/* WordPress specific classes support */
.alignleft {
    float: left;
    margin: 0 20px 20px 0;
}

.alignright {
    float: right;
    margin: 0 0 20px 20px;
}

.aligncenter {
    display: block;
    margin: 20px auto;
}

.wp-caption {
    max-width: 100%;
    background: #f8f9fa;
    border-radius: 4px;
    padding: 10px;
    margin: 20px 0;
}

.wp-caption-text {
    font-size: 0.9rem;
    color: #666;
    text-align: center;
    margin: 10px 0 0 0;
    font-style: italic;
}

@media (max-width: 768px) {
    .alignleft,
    .alignright {
        float: none;
        margin: 20px auto;
        display: block;
    }
}

/* Gallery Support */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.gallery-item {
    background: #f8f9fa;
    border-radius: 4px;
    overflow: hidden;
    transition: transform 0.2s ease;
}

.gallery-item:hover {
    transform: translateY(-2px);
}

.gallery-caption {
    padding: 10px;
    font-size: 0.85rem;
    color: #666;
    text-align: center;
}

@media (max-width: 768px) {
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }
}

/* Comments (if enabled) */
.amp-comments {
    margin-top: 40px;
    padding-top: 40px;
    border-top: 2px solid #e1e1e1;
}

.amp-comments h3 {
    margin-bottom: 20px;
}

.amp-comment {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 4px solid #0073aa;
}

.amp-comment-author {
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 5px;
}

.amp-comment-date {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 10px;
}

.amp-comment-content {
    line-height: 1.6;
}

/* Breadcrumbs (if used) */
.amp-breadcrumbs {
    background: #f8f9fa;
    padding: 10px 0;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.amp-breadcrumbs a {
    color: #0073aa;
    text-decoration: none;
}

.amp-breadcrumbs a:hover {
    text-decoration: underline;
}

.amp-breadcrumbs span {
    color: #666;
    margin: 0 5px;
}

/* Final optimizations */
h1, h2, h3, h4, h5, h6 {
    font-display: swap;
}

/* Ensure proper font loading */
@font-face {
    font-display: swap;
    font-family: system-ui;
    src: local('system-ui');
}