/**
 * DigiAi SEO Pro — Frontend stylesheet.
 *
 * Renders the TL;DR box and FAQ accordion injected into the_content.
 *
 * THEME STRATEGY — inheritance, not detection.
 * Earlier versions tried to guess the theme via prefers-color-scheme and
 * body/html dark-mode classes. That guessing breaks whenever the OS setting
 * and the active WordPress theme disagree (e.g. dark OS + light theme made
 * the text light on a light page = unreadable).
 *
 * This version never guesses. Text colour is INHERITED from the theme, so
 * the component is always the same colour as the surrounding article text.
 * Surfaces, borders and dividers are derived from `currentColor` at low
 * opacity, so they sit slightly darker than a light theme and slightly
 * lighter than a dark theme — always producing contrast, on any theme,
 * with zero detection logic.
 *
 * @package DigiAi_SEO_Pro
 * @since 1.0.5
 */

.digiai-aeo-container {
    /* The single source of truth: the component adopts the theme's text
       colour. Everything else is derived from this via currentColor. */
    color: inherit;
    margin: 40px 0;
    font-family: inherit;
    line-height: 1.6;
}

/* ---- Accent colour ---- */
/* The cyan/purple accents are brand colours and stay fixed — they read
   acceptably on both light and dark backgrounds. Only neutral text and
   surfaces inherit from the theme. */

/* ---- TL;DR box ---- */
.digiai-tldr-box {
    /* Surface derived from the theme's text colour at very low opacity:
       darkens a light theme, lightens a dark theme. */
    background: rgba(127, 127, 127, 0.08);
    border-left: 4px solid #00b8c4;
    padding: 25px;
    border-radius: 0 12px 12px 0;
    margin: 0 0 35px;
    color: inherit;
}
.digiai-tldr-title {
    display: flex;
    align-items: center;
    gap: 10px;
    /* Inherit the theme text colour — no hard-coded dark value. */
    color: inherit;
    font-weight: 800;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}
.digiai-tldr-title span {
    background: #00b8c4;
    color: #ffffff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
}
.digiai-tldr-content {
    /* Slightly muted relative to the inherited colour, but still the theme's
       own colour — readable on light and dark alike. */
    color: inherit;
    opacity: 0.85;
    font-size: 16px;
    font-style: italic;
}

/* ---- FAQ accordion ---- */
.digiai-faq-section {
    margin-top: 50px;
    border-top: 1px solid rgba(127, 127, 127, 0.25);
    padding-top: 40px;
    color: inherit;
}
.digiai-faq-heading {
    color: inherit;
    margin-bottom: 25px;
    font-size: 24px;
    font-weight: 800;
}
.digiai-faq-item {
    /* Surface + border derived from currentColor — always offset from the
       page background regardless of theme. */
    background: rgba(127, 127, 127, 0.05);
    border: 1px solid rgba(127, 127, 127, 0.22);
    border-radius: 12px;
    margin-bottom: 15px;
    overflow: hidden;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.digiai-faq-item:hover {
    border-color: #8a2be2;
    box-shadow: 0 10px 25px rgba(138, 43, 226, 0.08);
}

/* The toggle is a <button> for keyboard + screen-reader support. */
.digiai-faq-question {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    padding: 18px 25px;
    font-weight: 700;
    /* Inherit theme text colour — readable on any background. */
    color: inherit;
    font-size: 17px;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.digiai-faq-question:focus-visible {
    outline: 2px solid #8a2be2;
    outline-offset: -2px;
}
.digiai-faq-question .digiai-faq-icon {
    color: #8a2be2;
    font-size: 20px;
    line-height: 1;
    transition: transform 0.3s;
    flex-shrink: 0;
}
.digiai-faq-question[aria-expanded="true"] .digiai-faq-icon {
    transform: rotate(45deg);
}

.digiai-faq-answer {
    padding: 0 25px 20px;
    /* Inherit + slight mute: stays the theme's colour, just softer. */
    color: inherit;
    opacity: 0.8;
    font-size: 15px;
    border-top: 1px solid rgba(127, 127, 127, 0.18);
}
.digiai-faq-answer[hidden] {
    display: none;
}
.digiai-faq-answer:not([hidden]) {
    padding-top: 15px;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .digiai-aeo-container { margin: 28px 0; }
    .digiai-tldr-box {
        padding: 18px;
        border-radius: 0 8px 8px 0;
    }
    .digiai-tldr-content { font-size: 15px; }
    .digiai-faq-section {
        margin-top: 36px;
        padding-top: 28px;
    }
    .digiai-faq-heading { font-size: 20px; }
    .digiai-faq-question {
        padding: 14px 18px;
        font-size: 15px;
    }
    .digiai-faq-answer { padding: 0 18px 16px; font-size: 14px; }
    .digiai-faq-answer:not([hidden]) { padding-top: 12px; }
}

@media (max-width: 480px) {
    .digiai-tldr-box {
        padding: 14px;
    }
    .digiai-tldr-title {
        font-size: 12px;
        letter-spacing: 0.5px;
    }
    .digiai-faq-question {
        padding: 12px 14px;
        font-size: 14px;
    }
    .digiai-faq-question .digiai-faq-icon {
        font-size: 18px;
    }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    .digiai-faq-item,
    .digiai-faq-question .digiai-faq-icon {
        transition: none;
    }
}
