/* ==========================================================================\n   GGtheme v1.4 — Light / Dark Contrast Normalization\n   Loaded after all feature styles so the complete public frontend uses one\n   predictable contrast system without changing the v1.3 layout geometry.\n   ========================================================================== */

[x-cloak] { display: none !important; }

:root {
    --gg-bg: #f7f9fc;
    --gg-surface: #ffffff;
    --gg-surface-raised: #ffffff;
    --gg-surface-subtle: #f1f5f9;
    --gg-text: #0f172a;
    --gg-text-soft: #334155;
    --gg-muted: #5b687a;
    --gg-faint: #7c899a;
    --gg-border: #dce3eb;
    --gg-border-soft: #e9eef4;
    --gg-shadow: 0 14px 40px rgba(15, 23, 42, .055);
    color-scheme: light;
}

html.dark {
    --gg-bg: #0b1220;
    --gg-surface: #111827;
    --gg-surface-raised: #162033;
    --gg-surface-subtle: #1b2638;
    --gg-text: #f8fafc;
    --gg-text-soft: #e2e8f0;
    --gg-muted: #c1cada;
    --gg-faint: #94a3b8;
    --gg-border: rgba(148, 163, 184, .20);
    --gg-border-soft: rgba(148, 163, 184, .13);
    --gg-shadow: 0 16px 46px rgba(0, 0, 0, .22);
    color-scheme: dark;
}

/* Base canvas and reading contrast */
.gtheme-body {
    background-color: var(--gg-bg) !important;
    color: var(--gg-text-soft);
    transition: background-color .22s ease, color .22s ease;
}
.gtheme-content-shell,
.gtheme-prose,
.gtheme-prose p,
.gtheme-prose li,
.gtheme-prose dd,
.gtheme-prose td,
.gtheme-prose th {
    color: var(--gg-text-soft);
}
.gtheme-prose h1,
.gtheme-prose h2,
.gtheme-prose h3,
.gtheme-prose h4,
.gtheme-prose h5,
.gtheme-prose h6 {
    color: var(--gg-text) !important;
}
.gtheme-prose a { color: var(--gtheme-mid) !important; }
html.dark .gtheme-prose a { color: var(--gtheme-accent) !important; }
html.dark .gtheme-prose a:hover { color: #ffffff !important; }

/* Header: stronger separation in both appearances */
.header-gtheme {
    background: rgba(255,255,255,.96) !important;
    border-bottom-color: rgba(15,23,42,.09) !important;
}
.gtheme-nav-trigger { color: #3f4d60 !important; }
.gtheme-mobile-nav-link { color: #172033 !important; }
.gtheme-mobile-submenu-link { color: #526174 !important; }
.gtheme-theme-toggle,
.gtheme-search-button {
    background: #ffffff !important;
    color: #475569 !important;
    box-shadow: inset 0 0 0 1px rgba(15,23,42,.12), 0 6px 18px rgba(15,23,42,.055) !important;
}
html.dark .header-gtheme {
    background: rgba(11,18,32,.96) !important;
    border-bottom-color: var(--gg-border-soft) !important;
}
html.dark .gtheme-nav-trigger,
html.dark .gtheme-mobile-nav-link { color: #dbe4ef !important; }
html.dark .gtheme-mobile-submenu-link { color: #aebacc !important; }
html.dark .gtheme-theme-toggle,
html.dark .gtheme-search-button {
    background: #182235 !important;
    color: #e2e8f0 !important;
    box-shadow: inset 0 0 0 1px rgba(148,163,184,.20), 0 8px 22px rgba(0,0,0,.18) !important;
}
html.dark .gtheme-theme-toggle:hover,
html.dark .gtheme-search-button:hover {
    background: #223047 !important;
    color: #ffffff !important;
}
html.dark .gtheme-nav-dropdown {
    background: #111827 !important;
    border-color: var(--gg-border) !important;
}
html.dark .gtheme-nav-dropdown-link { color: #d5deea !important; }
html.dark .gtheme-nav-dropdown-link:hover { background: #1c293c !important; color: #fff !important; }

/* Homepage cards — keep layout unchanged, normalize legibility. */
.iit-quickfacts,
.iit-current-card,
.iit-passport,
.iit-announcement-wrap,
.iit-resource-list,
.iit-section-chip,
.iit-benefit-grid > div,
.iit-empty-state,
.iit-additional-content,
.gg-about-copy,
.gg-recent-card {
    background: var(--gg-surface) !important;
    border-color: var(--gg-border) !important;
    box-shadow: var(--gg-shadow);
}
.iit-section-head h2,
.iit-quickfact strong,
.iit-passport strong,
.iit-resource-list a,
.iit-section-chip strong,
.iit-benefit-grid h3,
.gg-recent-card-copy h3 {
    color: var(--gg-text) !important;
}
.iit-quickfact span,
.iit-passport span,
.iit-section-chip p,
.iit-benefit-grid p,
.iit-announcement-wrap,
.gg-about-copy,
.gg-recent-title {
    color: var(--gg-muted) !important;
}
html.dark .iit-current-card .obj_issue_toc .mt-8.space-y-6 > div > h2 {
    background: var(--gg-surface-subtle) !important;
    border-color: var(--gg-border) !important;
    color: var(--gg-text) !important;
}
html.dark .iit-current-card .obj_issue_toc ul[role="list"] h4,
html.dark .iit-current-card .obj_issue_toc ul[role="list"] h5,
html.dark .iit-current-card .obj_issue_toc ul[role="list"] h4 a,
html.dark .iit-current-card .obj_issue_toc ul[role="list"] h5 a {
    color: var(--gg-text) !important;
}
html.dark .iit-current-card .obj_issue_toc ul[role="list"] ul a {
    background: var(--gg-surface-raised) !important;
    border-color: var(--gg-border) !important;
    color: #dbeafe !important;
}

/* Sidebar follows the same surface/contrast vocabulary as homepage cards. */
.gtheme-sidebar-shell .pkp_block,
.gtheme-sidecard {
    background: var(--gg-surface) !important;
    border-color: var(--gg-border) !important;
    box-shadow: var(--gg-shadow) !important;
}
.gtheme-sidebar-shell .pkp_block > .title,
.gtheme-sidebar-shell .pkp_block > a:first-child,
.gtheme-sidecard__title,
.gtheme-side-people-label strong,
.gtheme-side-person__name {
    color: var(--gg-text) !important;
}
.gtheme-sidebar-shell .pkp_block .content,
.gtheme-side-person__role,
.gtheme-side-person__affiliation,
.gtheme-side-resource__copy small {
    color: var(--gg-muted) !important;
}
html.dark .gtheme-sidebar-shell .pkp_block .content > a,
html.dark .gtheme-sidebar-shell .pkp_block .content li > a,
html.dark .gtheme-sidebar-shell .pkp_block ul li > a,
html.dark .gtheme-side-nav__link,
html.dark .gtheme-side-resource,
html.dark .gtheme-sidebtn--secondary {
    color: #d6deea !important;
}
html.dark .gtheme-sidebtn--secondary,
html.dark .gtheme-side-resource,
html.dark .gtheme-side-logo,
html.dark .gtheme-side-stat a {
    background: var(--gg-surface-raised) !important;
    border-color: var(--gg-border) !important;
}

/* Archive / issue cards */
.gtheme-issue-card,
.gtheme-archive-empty {
    background: var(--gg-surface) !important;
    border-color: var(--gg-border) !important;
    box-shadow: var(--gg-shadow);
}
.gtheme-archive-heading h1,
.gtheme-prose .gtheme-issue-card__title a { color: var(--gg-text) !important; }
.gtheme-issue-card__description,
.gtheme-issue-card__description--fallback,
.gtheme-archive-empty p { color: var(--gg-muted) !important; }
html.dark .gtheme-prose a.gtheme-issue-card__cover { background: #0f172a !important; }
html.dark .gtheme-issue-card__cover img { background: #ffffff; }
html.dark .gtheme-prose a.gtheme-issue-card__action {
    background: var(--gg-surface-raised) !important;
    border-color: var(--gg-border) !important;
    color: var(--gtheme-accent) !important;
}

/* Article metadata */
.obj_article_details .gtheme-article-meta {
    background: var(--gg-surface) !important;
    border-color: var(--gg-border) !important;
    box-shadow: var(--gg-shadow) !important;
}
.obj_article_details .gtheme-article-meta__item { border-color: var(--gg-border-soft) !important; }
.obj_article_details .gtheme-article-meta__value,
.obj_article_details .gtheme-article-meta__link { color: var(--gg-text-soft) !important; }
.obj_article_details .gtheme-article-meta__license-terms { color: var(--gg-muted) !important; }
html.dark .obj_article_details .gtheme-article-meta__galleys .obj_galley_link,
html.dark .obj_article_details .gtheme-article-meta__galleys a {
    background: var(--gg-surface-raised) !important;
    border-color: var(--gg-border) !important;
    color: #e7eef8 !important;
}

/* About page */
.about-card {
    background: var(--gg-surface) !important;
    border-color: var(--gg-border) !important;
    box-shadow: var(--gg-shadow) !important;
}
.about-title-section h1,
.about-text h2 { color: var(--gg-text) !important; }
.about-text { color: var(--gg-text-soft) !important; }
html.dark .about-title-section { border-color: var(--gg-border) !important; }

/* Submission page custom cards */
.sub-wrapper { color: var(--gg-text-soft) !important; }
.section-main-title,
.step-title,
.guide-card h4,
.col-header h3,
.item-label,
.p-text { color: var(--gg-text) !important; }
.section-desc,
.step-text,
.guide-card ul,
.item-subtext { color: var(--gg-muted) !important; }
.process-card,
.guide-card,
.check-column,
.col-header {
    background: var(--gg-surface) !important;
    border-color: var(--gg-border) !important;
}
.check-item-row { border-color: var(--gg-border-soft) !important; }
.check-item-row:hover { background: var(--gg-surface-subtle) !important; }
html.dark .step-badge,
html.dark .col-icon,
html.dark .col-footer-progress {
    background: var(--gg-surface-subtle) !important;
    color: var(--gtheme-accent) !important;
}
html.dark .p-bar-bg { background: #334155 !important; }
html.dark .checkbox-custom { border-color: #64748b; background: #0f172a; }

/* Forms and native OJS controls */
.gtheme-content-shell input[type="text"],
.gtheme-content-shell input[type="email"],
.gtheme-content-shell input[type="password"],
.gtheme-content-shell input[type="url"],
.gtheme-content-shell input[type="search"],
.gtheme-content-shell input[type="number"],
.gtheme-content-shell select,
.gtheme-content-shell textarea {
    background: var(--gg-surface) !important;
    color: var(--gg-text) !important;
    border-color: var(--gg-border) !important;
}
.gtheme-content-shell input::placeholder,
.gtheme-content-shell textarea::placeholder { color: var(--gg-faint) !important; opacity: 1; }
.gtheme-content-shell input:focus,
.gtheme-content-shell select:focus,
.gtheme-content-shell textarea:focus {
    border-color: var(--gtheme-mid) !important;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--gtheme-mid) 18%, transparent) !important;
}
html.dark .gtheme-content-shell input:focus,
html.dark .gtheme-content-shell select:focus,
html.dark .gtheme-content-shell textarea:focus {
    border-color: var(--gtheme-accent) !important;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--gtheme-accent) 18%, transparent) !important;
}

/* Tables / rules */
.gtheme-content-shell table,
.gtheme-content-shell th,
.gtheme-content-shell td,
.gtheme-content-shell hr {
    border-color: var(--gg-border) !important;
}
html.dark .gtheme-content-shell thead,
html.dark .gtheme-content-shell th { background: var(--gg-surface-subtle); color: var(--gg-text); }

/* Breadcrumbs and generic muted UI */
html.dark .gtheme-content-shell .text-gray-500,
html.dark .gtheme-content-shell .text-gray-600,
html.dark .gtheme-content-shell .text-slate-400,
html.dark .gtheme-content-shell .text-slate-500,
html.dark .gtheme-content-shell .text-slate-600 { color: var(--gg-muted) !important; }
html.dark .gtheme-content-shell .text-gray-800,
html.dark .gtheme-content-shell .text-gray-900,
html.dark .gtheme-content-shell .text-slate-800,
html.dark .gtheme-content-shell .text-slate-900 { color: var(--gg-text) !important; }

/* Accessibility: keyboard focus remains visible in both modes. */
.gtheme-theme-toggle:focus-visible,
.gtheme-search-button:focus-visible,
.gtheme-nav-trigger:focus-visible,
.gtheme-content-shell a:focus-visible,
.gtheme-content-shell button:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--gtheme-mid) 40%, transparent);
    outline-offset: 3px;
}
html.dark .gtheme-theme-toggle:focus-visible,
html.dark .gtheme-search-button:focus-visible,
html.dark .gtheme-nav-trigger:focus-visible,
html.dark .gtheme-content-shell a:focus-visible,
html.dark .gtheme-content-shell button:focus-visible {
    outline-color: color-mix(in srgb, var(--gtheme-accent) 58%, transparent);
}

@media (prefers-reduced-motion: reduce) {
    .gtheme-body, .header-gtheme, .gtheme-theme-toggle, .gtheme-search-button {
        transition: none !important;
    }
}


/* Submission final call-to-action surface */
.submission-ready-card {
    background: var(--gg-surface-subtle) !important;
    border-color: color-mix(in srgb, var(--gtheme-mid) 42%, var(--gg-border)) !important;
}
.submission-ready-card h3 { color: var(--gg-text) !important; }
.submission-ready-card p { color: var(--gg-muted) !important; }
html.dark .submission-ready-card {
    background: var(--gg-surface-raised) !important;
    border-color: color-mix(in srgb, var(--gtheme-accent) 36%, var(--gg-border)) !important;
}
