/* ============================================================
   J&P PDF Tools — Directory, Mega Menu and Shared SEO Guide
   Compatible with style.css (unified 19-tool edition).
   Layout for .tabs / .all-tool-tabs is intentionally owned by
   style.css. No conflicting grid-column or !important overrides.
   ============================================================ */

/* ------------------------------------------------------------
   1. Header mega menu — presentation only
   The open/close behavior and base positioning remain in header.php.
   ------------------------------------------------------------ */
.top .mega-content {
    width: min(1580px, 100%);
    min-width: 0;
    padding: 24px;
}
.top .mega-group { min-width: 0; }
.top .mega-heading {
    margin: 0 0 10px;
    min-height: 24px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
    white-space: normal;
}
.top .mega-items { gap: 5px; }
.top .mega-items a,
.top .mega-unavailable {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 9px;
    width: 100%;
    min-width: 0;
    min-height: 40px;
    padding: 8px 6px;
    line-height: 1.45;
    font-size: 13px;
    text-align: left;
    overflow-wrap: break-word;
}
.top .mega-items a > span:last-child,
.top .mega-label { min-width: 0; overflow-wrap: break-word; }
.top .mega-icon {
    flex: 0 0 25px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 25px;
    height: 25px;
    border-radius: 5px;
    background: #f46b52;
    color: #fff;
    font-size: 13px;
    line-height: 1;
}
.top .mega-group:nth-child(2) .mega-icon { background: #83ba56; color: #fff; }
.top .mega-group:nth-child(3) .mega-icon { background: #eabd28; color: #fff; }
.top .mega-group:nth-child(4) .mega-icon { background: #5d8ac3; color: #fff; }
.top .mega-group:nth-child(5) .mega-icon { background: #b16f9e; color: #fff; }
.top .mega-group:nth-child(6) .mega-icon { background: #447eae; color: #fff; }
.top .mega-group:nth-child(7) .mega-icon { background: #8b60df; color: #fff; }
.top .mega-unavailable { color: #687384; cursor: not-allowed; opacity: .72; }
.top .mega-label { display: flex; flex-direction: column; gap: 1px; }
.top .mega-label small { font-size: 10px; color: #8c96a2; }
.top .mega-panel {
    max-height: calc(100vh - 85px);
    max-height: calc(100dvh - 85px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* ------------------------------------------------------------
   2. Homepage directory of tools
   ------------------------------------------------------------ */
.tool-directory { padding: 20px 0 40px; }
.tool-directory-heading { margin: 0 0 25px; text-align: center; }
.tool-directory-heading h2 { margin: 0 0 8px; font-size: clamp(22px, 2.6vw, 29px); line-height: 1.4; }
.tool-directory-heading p { margin: 0; color: #67778a; }
.tool-directory-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
}
.tool-directory-grid > * { min-width: 0; }
.tool-directory-card {
    display: block;
    min-width: 0;
    min-height: 175px;
    padding: 23px 19px;
    border: 1px solid #dce3eb;
    border-radius: 16px;
    background: #fff;
    color: #28313c;
    text-decoration: none;
    box-shadow: 0 2px 5px rgba(15, 40, 70, .02);
    overflow-wrap: break-word;
}
.tool-directory-card.is-live { transition: transform .15s, box-shadow .15s, border-color .15s; }
.tool-directory-card.is-live:hover {
    border-color: #719ac2;
    box-shadow: 0 10px 25px rgba(25, 64, 100, .1);
    transform: translateY(-2px);
}
.tool-directory-card.is-live:focus-visible { outline: 3px solid #c6a05b; outline-offset: 2px; }
.tool-directory-card.is-planned { background: #fafbfc; color: #778390; }
.tool-directory-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 43px;
    height: 43px;
    margin-bottom: 20px;
    border-radius: 7px;
    background: #f36b50;
    color: #fff;
    font-size: 22px;
    font-weight: 700;
}
.tool-directory-card[data-group="optimize"] .tool-directory-card-icon { background: #80b950; }
.tool-directory-card[data-group="convert-in"] .tool-directory-card-icon { background: #e6b92d; }
.tool-directory-card[data-group="convert-out"] .tool-directory-card-icon { background: #578fc3; }
.tool-directory-card[data-group="edit"] .tool-directory-card-icon { background: #b16f9e; }
.tool-directory-card[data-group="security"] .tool-directory-card-icon { background: #447eae; }
.tool-directory-card[data-group="ai"] .tool-directory-card-icon { background: #9061db; }
.tool-directory-card[data-group="image"] .tool-directory-card-icon { background: #398f88; }
.tool-directory-card strong { display: block; margin-bottom: 8px; font-size: 19px; line-height: 1.35; }
.tool-directory-card p { margin: 0; font-size: 13px; color: #737f8b; line-height: 1.55; }
.tool-directory-tag {
    display: inline-block;
    margin-top: 10px;
    padding: 2px 9px;
    border-radius: 20px;
    background: #e9edf2;
    color: #697481;
    font-size: 11px;
}
.tool-directory-subhead { margin: 30px 0 15px; font-size: 23px; }

/* ------------------------------------------------------------
   3. Shared SEO guide / FAQ / related links
   Content remains ordinary server-rendered HTML.
   ------------------------------------------------------------ */
.seo-tool-guide {
    width: 100%;
    max-width: 1100px;
    margin: 28px auto 64px;
    padding: 28px 32px;
    border: 1px solid #e7edf3;
    border-radius: 16px;
    background: #fff;
    color: #23364a;
    line-height: 1.9;
}
.seo-tool-guide h2 {
    margin: 24px 0 10px;
    color: #173b5a;
    font-size: clamp(1.15rem, 2vw, 1.45rem);
    line-height: 1.5;
}
.seo-tool-guide p { margin: 8px 0 16px; }
.seo-steps { padding-left: 28px; list-style: decimal; }
.seo-steps li { padding: 4px 0; }
.seo-breadcrumb { margin-bottom: 12px; color: #64748b; font-size: .9rem; }
.seo-breadcrumb a { color: #12547c; }
.seo-faq { padding: 12px 0; border-bottom: 1px solid #e2e8f0; }
.seo-faq summary { font-weight: 600; cursor: pointer; }
.seo-related { display: flex; flex-wrap: wrap; gap: 10px; }
.seo-related a {
    padding: 6px 12px;
    border-radius: 9px;
    background: #eff6fb;
    color: #12547c;
    text-decoration: none;
}
.seo-related a:hover { text-decoration: underline; }

/* ------------------------------------------------------------
   4. All 19 tool tabs: cosmetic styles only.
   style.css controls columns, widths, spacing and breakpoints.
   ------------------------------------------------------------ */
.all-tool-tabs .tab > span:last-child { min-width: 0; }
.all-tool-tabs .tab strong,
.all-tool-tabs .tab small {
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: normal;
}
.all-tool-tabs .tab small {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    line-height: 1.45;
}

/* ------------------------------------------------------------
   5. Unified guide and FAQ
   tool-guide.php renders <section class="seo wrap unified-guide">.
   This section owns its own interior spacing even if the
   legacy .seo or .wrap declarations change.
   ------------------------------------------------------------ */
.seo.unified-guide,
.unified-guide {
    box-sizing: border-box;
    width: min(calc(100% - 32px), 1100px);
    max-width: 1100px;
    margin: 34px auto 46px;
    padding: 30px 34px;
    border: 1px solid #e3e9f0;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 6px 22px rgba(12, 36, 48, .04);
    color: #23364a;
    line-height: 1.9;
    overflow-wrap: break-word;
}
.unified-guide .seo-breadcrumb {
    margin: 0 0 20px;
    color: #64748b;
    font-size: 13px;
    line-height: 1.6;
}
.unified-guide h2 {
    margin: 28px 0 12px;
    color: #173b5a;
    font-size: clamp(19px, 2vw, 23px);
    line-height: 1.5;
}
.unified-guide > h2:first-of-type { margin-top: 0; }
.unified-guide h3 {
    margin: 24px 0 12px;
    color: #173b5a;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.5;
}
.unified-guide p {
    margin: 10px 0 16px;
    color: #5e7185;
    font-size: 14px;
    line-height: 1.9;
}
.unified-guide .seo-steps {
    margin: 12px 0 24px;
    padding: 0 0 0 28px;
    list-style: decimal outside;
}
.unified-guide .seo-steps li {
    padding: 5px 0 5px 2px;
    font-size: 14px;
    line-height: 1.8;
}
.unified-guide .faq { margin-top: 26px; }
.unified-guide .faq > h3 { margin-bottom: 14px; }
.unified-guide .faq details {
    margin: 9px 0;
    padding: 12px 16px;
    border: 1px solid #e2e9f0;
    border-radius: 10px;
    background: #fff;
}
.unified-guide .faq summary {
    cursor: pointer;
    color: #23364a;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.7;
}
.unified-guide .faq details p { margin: 10px 0 0; }
.unified-guide .seo-related-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-top: 26px;
}
.unified-guide .seo-related-tools h3 {
    flex: 0 0 100%;
    width: 100%;
    margin: 0 0 4px;
}
.unified-guide .seo-related-tools a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 7px 11px;
    border: 1px solid #dbe5ee;
    border-radius: 8px;
    color: #173b5a;
    background: #fff;
    font-size: 13px;
    text-decoration: none;
}
.unified-guide .seo-related-tools a:hover { background: #f4f8fc; }

.site-footer .footer-tool-links { display: block; columns: 2; }
.site-footer .footer-tool-links li { margin-bottom: 8px; break-inside: avoid; }

/* ------------------------------------------------------------
   6. Responsive rules: one breakpoint set per component.
   Never change .tabs columns here (style.css owns them).
   ------------------------------------------------------------ */
@media (max-width: 1250px) {
    .top .mega-content { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .tool-directory-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .top .mega-content { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tool-directory-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .seo-tool-guide { margin: 20px auto 48px; padding: 18px 16px; }
    .seo.unified-guide,
    .unified-guide {
        width: calc(100% - 24px);
        margin: 22px auto 36px;
        padding: 20px 16px;
    }
    .unified-guide h2 { font-size: 19px; }
    .unified-guide h3 { font-size: 16px; }
    .unified-guide p,
    .unified-guide .seo-steps li { font-size: 13px; }
    .unified-guide .faq summary { font-size: 13px; }
    .unified-guide .seo-steps { padding-left: 22px; }
}
@media (max-width: 600px) {
    .top .mega-content { display: block; padding: 12px; }
    .top .mega-panel { max-height: calc(100vh - 70px); max-height: calc(100dvh - 70px); }
    .tool-directory-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .tool-directory-card { min-height: 152px; padding: 15px 12px; }
    .tool-directory-card-icon { width: 35px; height: 35px; margin-bottom: 11px; font-size: 17px; }
    .tool-directory-card strong { font-size: 15px; }
    .tool-directory-card p { font-size: 12px; }
    .tool-directory-heading h2 { font-size: 23px; }
    .site-footer .footer-tool-links { columns: 1; }
}
@media (max-width: 380px) {
    .tool-directory-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (hover: none) {
    .tool-directory-card.is-live:hover { transform: none; }
}
