/*
 * app/assets/stylesheets/application.css
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

dialog[open] {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
  }

@keyframes flash-highlight {
  0%   { background-color: #fefcbf; }
  100% { background-color: transparent; }
}

.flash-highlight {
  animation: flash-highlight 2s ease-out;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    background-color: #444; /* your preferred color */
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    background-color: #444;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

input[type="range"]::-ms-thumb {
    background-color: #444;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

/* Hide scrollbar while keeping scroll functionality */
.scrollbar-hide {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;  /* Chrome, Safari and Opera */
}

.blog-cover-card {
    position: relative;
    display: flex;
    align-items: flex-end;
    width: 100%;
    height: 100%;
    min-height: 12rem;
    overflow: hidden;
    background:
        radial-gradient(circle at 88% 18%, color-mix(in srgb, var(--blog-cover-accent) 58%, transparent), transparent 28%),
        linear-gradient(135deg, var(--blog-cover-from), var(--blog-cover-to));
    color: #ffffff;
    isolation: isolate;
}

.blog-cover-card--large {
    min-height: 24rem;
    border-radius: 1rem;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18);
}

.blog-cover-card__pattern {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.16) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.16) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: linear-gradient(145deg, rgba(0, 0, 0, 0.45), transparent 70%);
    z-index: -2;
}

.blog-cover-card__rings {
    position: absolute;
    right: -5rem;
    top: -6rem;
    width: 20rem;
    height: 20rem;
    border: 1px solid rgba(255, 255, 255, 0.34);
    border-radius: 50%;
    box-shadow:
        0 0 0 4rem rgba(255, 255, 255, 0.08),
        0 0 0 8rem rgba(255, 255, 255, 0.05);
    z-index: -1;
}

.blog-cover-card__content {
    width: min(100%, 38rem);
    padding: 1.5rem;
}

.blog-cover-card--large .blog-cover-card__content {
    padding: clamp(2rem, 5vw, 4rem);
}

.blog-cover-card__content span {
    display: block;
    margin-bottom: 0.65rem;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.78);
}

.blog-cover-card__content strong {
    display: block;
    max-width: 36rem;
    font-size: 1.45rem;
    line-height: 1.18;
    font-weight: 850;
    letter-spacing: 0;
    text-wrap: balance;
    text-shadow: 0 2px 18px rgba(15, 23, 42, 0.24);
}

.blog-cover-card--large .blog-cover-card__content strong {
    font-size: clamp(2rem, 4vw, 4rem);
}

.blog-content {
    color: #374151;
    font-size: 1.0625rem;
    line-height: 1.8;
}

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

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

.blog-content h2 {
    margin: 2.5rem 0 0.9rem;
    color: #111827;
    font-size: 1.55rem;
    line-height: 1.28;
    font-weight: 800;
    letter-spacing: 0;
}

.blog-content h3 {
    margin: 2rem 0 0.75rem;
    color: #111827;
    font-size: 1.25rem;
    line-height: 1.35;
    font-weight: 800;
    letter-spacing: 0;
}

.blog-content p {
    margin: 0 0 1.25rem;
}

.blog-content ul,
.blog-content ol {
    margin: 0 0 1.5rem;
    padding-left: 1.5rem;
}

.blog-content li {
    margin: 0.4rem 0;
}

.blog-content a {
    color: #2563eb;
    font-weight: 650;
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

.blog-content strong {
    color: #111827;
    font-weight: 750;
}

.blog-content blockquote {
    margin: 2rem 0;
    padding: 1rem 1.25rem;
    border-left: 4px solid #14b8a6;
    border-radius: 0 0.5rem 0.5rem 0;
    background: #f8fafc;
    color: #1f2937;
}

.dark .blog-content {
    color: #d1d5db;
}

.dark .blog-content h2,
.dark .blog-content h3,
.dark .blog-content strong {
    color: #ffffff;
}

.dark .blog-content a {
    color: #60a5fa;
}

.dark .blog-content blockquote {
    background: #202426;
    color: #e5e7eb;
}

/* Smooth Turbo page transitions for mobile */
@media (max-width: 768px) {
    /* Ensure body maintains background during transitions */
    body {
        background-color: #f9fafb;
    }

    /* Smooth fade transition for Turbo visits */
    main {
        animation: fadeIn 0.15s ease-in;
    }

    @keyframes fadeIn {
        from {
            opacity: 0.95;
        }
        to {
            opacity: 1;
        }
    }

    /* Prevent white/black flash during page load */
    html {
        background-color: #f9fafb;
    }
}
