/*
 * Cek K3 — Corporate/HSE design system
 * Extends the CLS-guard token block inlined in app/View/Layouts/default.ctp
 * (same --brand-* / --text-* / --bg-body names — do not rename those, other
 * inline styles across the app already reference them). Loaded once, right
 * after theme.min.css, in default.ctp.
 *
 * Sections below: 1) tokens  2) hero/section primitives  3) stats
 * 4) content cards  5) pills/badges  6) accordion polish  7) footer/nav
 * 8) utilities  9) responsive/accessibility guards
 */

/* 1) Tokens — supersedes/extends the inline :root in default.ctp */
:root {
    --brand-primary: #0F172A;   /* Deep Navy */
    --brand-secondary: #334155; /* Slate */
    --brand-accent: #0270a8;    /* Professional Blue — darkened from the original
                                    #0284c7 spec to clear 4.5:1 WCAG AA against
                                    both white and navy (0284c7 only hit 4.10:1) */
    --brand-hse: #F59E0B;       /* Safety Amber — badges/CTAs only, used sparingly */
    --brand-hse-dark: #B45309;
    --bg-body: #F8FAFC;
    --bg-alt: #F1F5F9;
    --text-main: #0F172A;
    --text-muted: #475569;
    --text-on-dark: rgba(255, 255, 255, 0.92);
    --text-on-dark-muted: rgba(255, 255, 255, 0.72);
    --border-color: rgba(15, 23, 42, 0.08);
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;        /* Edupath-style generous card radius */
    --radius-pill: 999px;
    --shadow-card: 0 8px 24px rgba(15, 23, 42, 0.06);
    --shadow-card-hover: 0 16px 40px rgba(15, 23, 42, 0.12);
    --shadow-soft: 0 4px 16px rgba(15, 23, 42, 0.05);

    /*
     * Bootstrap's compiled theme.min.css ships --bs-primary as #0ABF53 (a
     * generic SaaS green) — completely off-brand for a navy/slate HSE site.
     * .text-primary/.bg-primary/.border-primary already reference
     * var(--bs-primary-rgb) in the compiled CSS, so overriding these two
     * root vars re-colors every use of those utilities site-wide with zero
     * per-template edits. (.btn-primary/.btn-outline-primary/.link-primary
     * bake the hex in directly — overridden explicitly below.)
     */
    --bs-primary: #0270a8;
    --bs-primary-rgb: 2, 112, 168;
}

/* Bootstrap primary button/link states — these bake the old green hex
   directly into component-scoped vars, so a root override alone doesn't
   reach them. */
.btn-primary {
    --bs-btn-bg: #0270a8;
    --bs-btn-border-color: #0270a8;
    --bs-btn-hover-bg: #025c89;
    --bs-btn-hover-border-color: #025c89;
    --bs-btn-active-bg: #014a6f;
    --bs-btn-active-border-color: #014a6f;
    --bs-btn-disabled-bg: #0270a8;
    --bs-btn-disabled-border-color: #0270a8;
    --bs-btn-focus-shadow-rgb: 2, 112, 168;
}

.btn-outline-primary {
    --bs-btn-color: #0270a8;
    --bs-btn-border-color: #0270a8;
    --bs-btn-hover-bg: #0270a8;
    --bs-btn-hover-border-color: #0270a8;
    --bs-btn-active-bg: #0270a8;
    --bs-btn-active-border-color: #0270a8;
    --bs-btn-disabled-color: #0270a8;
    --bs-btn-disabled-border-color: #0270a8;
    --bs-btn-focus-shadow-rgb: 2, 112, 168;
}

.link-primary { color: var(--brand-accent) !important; }

/* .text-navy is used across several templates but was never actually
   defined in theme.min.css (a dead/no-op class) — give it real brand
   color instead of leaving it invisible. */
.text-navy { color: var(--brand-primary) !important; }
.bg-navy { background-color: var(--brand-primary) !important; }

/* 2) Hero / section primitives — replaces one-off hero styles
   (previously duplicated with different colors in Faq/index.ctp and
   Kamus/index.ctp) */
.section-hero {
    background: linear-gradient(125deg, var(--brand-primary) 0%, var(--brand-secondary) 55%, var(--brand-accent) 100%);
    color: var(--text-on-dark);
    position: relative;
    overflow: hidden;
}

.section-hero .eyebrow {
    text-transform: uppercase;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--text-on-dark-muted);
}

.section-hero h1,
.section-hero .hero-title {
    color: #fff;
    font-weight: 700;
}

.section-hero p,
.section-hero .hero-subtitle {
    color: var(--text-on-dark-muted);
}

.section-hero .breadcrumb-item a { color: var(--text-on-dark-muted); }
.section-hero .breadcrumb-item.active { color: #fff; }

.section-title {
    font-size: clamp(1.75rem, 1.4rem + 1.2vw, 2.5rem);
    font-weight: 700;
    color: var(--text-main);
}

.section-subtitle {
    color: var(--text-muted);
    max-width: 640px;
}

/* Hero search bar (FAQ, and anywhere else a pill search is needed) */
.hero-search {
    background: #fff;
    border-radius: var(--radius-pill);
    padding: 6px;
    box-shadow: 0 10px 40px rgba(15, 23, 42, 0.18);
    max-width: 600px;
    margin: 0 auto;
}

.hero-search .form-control {
    border: none;
    border-radius: var(--radius-pill);
    padding: 0.85rem 1.25rem;
}

.hero-search .form-control:focus { box-shadow: none; }

.hero-search .btn {
    border-radius: var(--radius-pill);
    padding: 0.85rem 1.5rem;
    background: var(--brand-accent);
    border: none;
    color: #fff;
    font-weight: 600;
}

.hero-search .btn:hover { background: var(--brand-primary); }

/* 3) Stats strip — generic, reusable (Faq previously had its own copy) */
.stats-strip {
    background: var(--bg-alt);
}

.stats-strip .stat-item { text-align: center; padding: 1.5rem 0.75rem; }

.stats-strip .stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--brand-accent);
    display: block;
    line-height: 1.1;
}

.stats-strip .stat-label {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

/* 4) Content cards — thin, consistent skin layered on top of the theme's
   existing .card-ghost (already used across Lsp/Trainings/Blog/Kamus
   listings) so we don't have to touch every card's markup right away.
   Scoped to `a.content-card` specifically (not bare `.content-card`) —
   app/View/Jadwal/pembinaan.ctp already uses `.content-card` as a plain
   <div> info-box wrapper with its own local styling; keeping the
   selector link-specific avoids leaking hover-lift/height/color onto it. */
a.content-card {
    display: block;
    height: 100%;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    color: var(--text-main);
    text-decoration: none;
}

a.content-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover);
    color: var(--text-main);
}

a.content-card .content-card-body { padding: 1.5rem; }

a.content-card .content-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

a.content-card .content-card-excerpt {
    color: var(--text-muted);
    font-size: 0.9rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

a.content-card .content-card-cta {
    color: var(--brand-accent);
    font-weight: 600;
    font-size: 0.85rem;
}

.card-ghost {
    border-radius: var(--radius-xl);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-ghost:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover);
}

/* Edupath-style icon-in-tinted-circle feature block (used for the 5
   risk-instrument cards on the homepage and similar feature grids).
   Pass a modifier (.icon-badge-circle--accent / --hse) for the tint;
   default is the brand-accent blue. */
.icon-badge-circle {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-pill);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    background: rgba(2, 112, 168, 0.1);
    color: var(--brand-accent);
    margin-bottom: 1rem;
}

.icon-badge-circle--hse {
    background: rgba(245, 158, 11, 0.12);
    color: var(--brand-hse-dark);
}

.icon-badge-circle--navy {
    background: rgba(15, 23, 42, 0.06);
    color: var(--brand-primary);
}

/* Edupath-style feature/detail card: larger radius, soft shadow, no
   hard border — a softer alternative to .content-card/.card-ghost for
   non-clickable feature blocks (e.g. the 5 risk-instrument cards). */
.feature-card-soft {
    background: #fff;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-soft);
    padding: 1.75rem;
    height: 100%;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feature-card-soft:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover);
}

/* 5) Pills / badges */
.pill-link {
    border: 1px solid var(--border-color);
    background: #fff;
    border-radius: var(--radius-pill);
    padding: 0.45rem 0.9rem;
    font-size: 0.85rem;
    color: var(--brand-accent);
    text-decoration: none;
    display: inline-flex;
    margin: 0.25rem;
    transition: background 0.15s ease, color 0.15s ease;
}

.pill-link:hover {
    background: var(--brand-accent);
    color: #fff;
}

.badge-hse {
    background: var(--brand-hse);
    color: var(--brand-primary);
    font-weight: 700;
    border-radius: var(--radius-pill);
    padding: 0.3rem 0.7rem;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
}

/* 6) Accordion polish — keeps Bootstrap 5's structure, just aligns colors */
.accordion-button:not(.collapsed) {
    color: var(--brand-primary);
    background-color: var(--bg-alt);
}

.accordion-button:focus {
    box-shadow: 0 0 0 0.2rem rgba(2, 132, 199, 0.25);
}

/* 7) Footer / nav accents */
.footer-corporate { background: var(--brand-primary); color: var(--text-on-dark-muted); }
.footer-corporate a { color: var(--text-on-dark-muted); }
.footer-corporate a:hover { color: #fff; }

/* Edupath-style softer, larger-radius dropdown/mega-menu panels — CSS
   only, no markup/JS changes (hs-mega-menu's behavior is untouched). */
#header .dropdown-menu,
#header .hs-mega-menu {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card-hover);
    padding: 0.75rem;
}

#header .dropdown-item {
    border-radius: var(--radius-md);
}

#header .dropdown-item:hover,
#header .dropdown-item:focus {
    background-color: var(--bg-alt);
    color: var(--brand-accent);
}

#header .nav-pills .nav-link.dropdown-toggle {
    border-radius: var(--radius-pill);
    font-weight: 600;
}

#header .nav-pills .nav-link.dropdown-toggle:hover {
    background-color: var(--bg-alt);
    color: var(--brand-accent);
}

/* .bg-gradient-primary is used as the whole footer's background
   (app/View/Elements/footer.ctp) but was never actually defined anywhere
   in theme.min.css/styles.css — it silently no-op'd to a blank background.
   Give it the real corporate navy→slate gradient. */
.bg-gradient-primary {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%) !important;
}

/* Light counterpart — subtle body/alt gradient for cards/sections that need
   a soft background instead of the dark navy one above. */
.bg-gradient-light {
    background: linear-gradient(135deg, var(--bg-body) 0%, var(--bg-alt) 100%) !important;
}

/* 8) Utilities */
.text-brand-accent { color: var(--brand-accent) !important; }
.bg-brand-primary { background: var(--brand-primary) !important; }
.bg-brand-alt { background: var(--bg-alt) !important; }

/* 9) Responsive / accessibility guards */
@media (max-width: 768px) {
    .section-hero { padding-block: 3.5rem 2.5rem; }
    .hero-title, .section-hero h1 { font-size: 2rem; }
}

/* Tap targets: WhatsApp/CTA buttons must stay >=44px tall on touch */
.btn, .hero-search .btn, .pill-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
