/*
 * Theme Name:  MACI Theme
 * Theme URI:   https://maci.co.id
 * Description: Custom WordPress theme untuk PT Mega Andalan Cleanroom Industri.
 *              Hybrid: Elementor (Homepage) + Native PHP (Header, Footer, Archive, Single).
 * Version:     1.4.0
 * Author:      MACI Dev Team
 * Author URI:  https://maci.co.id
 * Text Domain: maci-theme
 * License:     GPL-2.0-or-later
 */

/* ==========================================================================
   1. CSS CUSTOM PROPERTIES (Design Tokens)
   ========================================================================== */
:root {
	--maci-blue:        #4e9ad6;
	--maci-teal:        #5bbe9f;
	--maci-gradient:    linear-gradient( 135deg, #4e9ad6, #5bbe9f );
	--color-ink:        #0f172a;
	--color-muted:      #64748b;
	--color-muted-rgba: rgba( 15, 23, 42, 0.72 );
	--bg-light:         #f5f9ff;
	--bg-teal-light:    #f4fdfa;
	--bg-topbar:        #0f172a;
	--radius-card:      18px;
	--radius-btn:       14px;
	--shadow-card:      0 10px 30px rgba( 0, 0, 0, 0.05 );
	--shadow-md:        0 20px 60px rgba( 2, 10, 20, 0.10 );
	--glass-bg:         rgba( 255, 255, 255, 0.6 );
	--glass-blur:       blur( 16px );
	--glass-border:     rgba( 15, 23, 42, 0.08 );
	--container-max:    1140px;
	--section-gap:      80px;
}

/* ==========================================================================
   2. RESET & BASE
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	font-size: 15px; font-weight: 400; color: var(--color-ink);
	background: #fff; line-height: 1.6; -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; transition: opacity 0.2s ease; }
a:hover { opacity: 0.85; }
ul, ol { list-style: none; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
	outline: 2px solid var(--maci-blue);
	outline-offset: 2px;
}
.maci-skip-link {
	position: absolute;
	left: 12px;
	top: -120px;
	background: #111827;
	color: #fff;
	padding: 10px 14px;
	border-radius: 10px;
	z-index: 9999;
}
.maci-skip-link:focus {
	top: 12px;
}

/* ==========================================================================
   3. LAYOUT UTILITIES
   ========================================================================== */
.maci-container { width: 100%; max-width: var(--container-max); margin-inline: auto; padding-inline: 24px; }
.maci-row { display: flex; align-items: center; }
.maci-section { padding-block: var(--section-gap); }

/* ==========================================================================
   4. TOPBAR
   ========================================================================== */
.maci-topbar {
	background: rgba(255,255,255,0.92); color: var(--color-muted);
	font-size: 12px; font-weight: 500; letter-spacing: 0.02em;
	padding-block: 9px; position: relative; z-index: 200;
	border-bottom: 1px solid var(--glass-border);
}
.maci-topbar .maci-row { justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.maci-topbar__left, .maci-topbar__right { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.maci-topbar a { color: var(--color-muted); white-space: nowrap; transition: color 0.2s ease; }
.maci-topbar a:hover { color: var(--color-ink); opacity: 1; }
.maci-lang-switcher { font-weight: 700; font-size: 12px; letter-spacing: 0.06em; color: var(--color-muted); border-left: 1px solid var(--glass-border); padding-left: 16px; }

/* ==========================================================================
   5. NAVBAR
   ========================================================================== */
.maci-header {
	position: sticky; top: 0; z-index: 100;
	background: var(--glass-bg); backdrop-filter: var(--glass-blur);
	-webkit-backdrop-filter: var(--glass-blur);
	border-bottom: 1px solid var(--glass-border);
	box-shadow: 0 2px 20px rgba(0,0,0,0.04); transition: box-shadow 0.3s ease;
}
.maci-header.is-scrolled { background: rgba(255,255,255,0.88); box-shadow: 0 4px 24px rgba(0,0,0,0.08); }
.maci-header .maci-row { justify-content: space-between; gap: 24px; height: 68px; }
.maci-brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; text-decoration: none; }
.maci-brand .custom-logo { width: var(--maci-header-logo-width, 140px); height: auto; max-width: none; }
.maci-brand__logo { width: var(--maci-header-logo-width, 140px); height: auto; max-width: none; }
.maci-brand__name strong { display: block; font-size: 13px; font-weight: 800; color: var(--color-ink); line-height: 1.2; }
.maci-brand__name small { display: block; font-size: 11px; font-weight: 500; color: var(--color-muted); margin-top: 2px; }
.maci-nav-menu { display: flex; align-items: center; gap: 4px; }
.maci-nav-menu ul { display: flex; align-items: center; gap: 4px; list-style: none; }
.maci-nav-menu ul li a { display: block; padding: 8px 14px; font-size: 13px; font-weight: 700; letter-spacing: 0.04em; color: var(--color-ink); border-radius: 10px; transition: background 0.2s ease, color 0.2s ease; }
.maci-nav-menu ul li a:hover,
.maci-nav-menu ul li.current-menu-item > a,
.maci-nav-menu ul li.current_page_item > a { background: rgba(78,154,214,0.10); color: var(--maci-blue); opacity: 1; }
.maci-btn-cta {
	display: inline-flex; align-items: center; justify-content: center;
	padding: 10px 20px; border-radius: var(--radius-btn);
	font-size: 13px; font-weight: 800; letter-spacing: 0.03em;
	color: #fff; background: var(--maci-gradient); border: none; cursor: pointer;
	white-space: nowrap; box-shadow: 0 8px 24px rgba(78,154,214,0.28);
	transition: transform 0.2s ease, box-shadow 0.2s ease; text-decoration: none; flex-shrink: 0;
}
.maci-btn-cta:hover { transform: translateY(-1px); box-shadow: 0 12px 32px rgba(78,154,214,0.36); opacity: 1; color: #fff; }
.maci-hamburger { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 6px; }
.maci-hamburger span { display: block; width: 24px; height: 2px; background: var(--color-ink); border-radius: 2px; transition: transform 0.3s ease, opacity 0.3s ease; }
.maci-hamburger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.maci-hamburger.is-open span:nth-child(2) { opacity: 0; }
.maci-hamburger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ==========================================================================
   6. FOOTER
   ========================================================================== */
.maci-footer { background: var(--maci-gradient); color: rgba(255,255,255,0.92); padding-top: 56px; }
.maci-footer__grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; padding-bottom: 48px; }
.maci-footer__brand { display: flex; flex-direction: column; gap: 20px; }
.maci-footer__logo { width: var(--maci-footer-logo-width, 140px); height: auto; max-width: none; }
.maci-footer__tagline { font-size: 14px; font-weight: 600; color: rgba(255,255,255,0.80); line-height: 1.6; max-width: 240px; }
.maci-footer__social { display: flex; gap: 12px; }
.maci-footer__social a { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,0.18); border: 1px solid rgba(255,255,255,0.20); transition: background 0.2s ease; }
.maci-footer__social a:hover { background: rgba(255,255,255,0.30); opacity: 1; }
.maci-footer__social img, .maci-footer__social svg { width: 18px; height: 18px; filter: brightness(0) invert(1); }
.maci-footer__col h4 { font-size: 11px; font-weight: 900; letter-spacing: 0.12em; color: rgba(255,255,255,0.70); margin-bottom: 16px; }
.maci-footer__address p { font-size: 14px; color: rgba(255,255,255,0.85); line-height: 1.75; }
.maci-footer-menu ul { display: flex; flex-direction: column; gap: 10px; list-style: none; }
.maci-footer-menu ul li a { font-size: 14px; color: rgba(255,255,255,0.85); transition: color 0.2s ease; }
.maci-footer-menu ul li a:hover { color: #fff; opacity: 1; }
.maci-footer__bottom { border-top: 1px solid rgba(255,255,255,0.18); padding-block: 18px; text-align: center; font-size: 12px; color: rgba(255,255,255,0.70); }

/* ==========================================================================
   7. ARCHIVE GRID
   ========================================================================== */
.maci-archive-header { padding-block: 56px 32px; text-align: center; }
.maci-archive-header h1 { font-size: clamp(28px,4vw,42px); font-weight: 900; letter-spacing: -0.03em; color: var(--color-ink); margin-bottom: 12px; }
.maci-archive-header p { font-size: 15px; color: var(--color-muted); max-width: 600px; margin-inline: auto; line-height: 1.7; }
.maci-post-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; padding-bottom: var(--section-gap); }
.maci-post-card { background: #fff; border-radius: var(--radius-card); box-shadow: var(--shadow-card); border: 1px solid rgba(15,23,42,0.06); overflow: hidden; transition: transform 0.25s ease, box-shadow 0.25s ease; display: flex; flex-direction: column; }
.maci-post-card:hover { transform: translateY(-4px); box-shadow: 0 20px 50px rgba(0,0,0,0.10); }
.maci-post-card__thumb { aspect-ratio: 16/9; overflow: hidden; border-radius: 16px 16px 0 0; }
.maci-post-card__thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.maci-post-card:hover .maci-post-card__thumb img { transform: scale(1.04); }
.maci-post-card__thumb-placeholder { aspect-ratio: 16/9; background: linear-gradient(135deg, rgba(78,154,214,0.12), rgba(91,190,159,0.10)); display: flex; align-items: center; justify-content: center; color: var(--color-muted); font-size: 13px; }
.maci-post-card__body { padding: 22px 24px 26px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.maci-post-card__meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.maci-post-card__cat { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: 0.08em; background: linear-gradient(135deg, rgba(78,154,214,0.12), rgba(91,190,159,0.10)); border: 1px solid rgba(78,154,214,0.14); color: var(--maci-blue); }
.maci-post-card__date { font-size: 12px; color: var(--color-muted); font-weight: 500; }
.maci-post-card__title { font-size: 17px; font-weight: 800; letter-spacing: -0.02em; color: var(--color-ink); line-height: 1.35; }
.maci-post-card__title a { color: inherit; transition: color 0.2s ease; }
.maci-post-card__title a:hover { color: var(--maci-blue); opacity: 1; }
.maci-post-card__excerpt { font-size: 13.5px; color: var(--color-muted); line-height: 1.7; flex: 1; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.maci-post-card__read-more { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--maci-blue); margin-top: 4px; }
.maci-post-card__read-more::after { content: '→'; transition: transform 0.2s ease; }
.maci-post-card:hover .maci-post-card__read-more::after { transform: translateX(4px); }
.maci-pagination { display: flex; justify-content: center; padding-bottom: var(--section-gap); }
.maci-pagination .nav-links { display: flex; gap: 8px; }
.maci-pagination .page-numbers { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; font-size: 14px; font-weight: 700; color: var(--color-ink); background: #fff; border: 1px solid rgba(15,23,42,0.10); transition: all 0.2s ease; }
.maci-pagination .page-numbers.current,
.maci-pagination .page-numbers:hover { background: var(--maci-gradient); color: #fff; border-color: transparent; opacity: 1; }

/* ==========================================================================
   8. SINGLE POST
   ========================================================================== */
.maci-single { padding-block: 56px var(--section-gap); }
.maci-single__inner { max-width: 800px; margin-inline: auto; }
.maci-single__header { margin-bottom: 32px; }
.maci-single__cat { display: inline-block; padding: 5px 12px; border-radius: 999px; font-size: 11px; font-weight: 900; letter-spacing: 0.10em; background: linear-gradient(135deg, rgba(78,154,214,0.12), rgba(91,190,159,0.10)); border: 1px solid rgba(78,154,214,0.18); color: var(--maci-blue); margin-bottom: 16px; }
.maci-single__title { font-size: clamp(26px,4vw,38px); font-weight: 800; letter-spacing: -0.03em; color: var(--color-ink); line-height: 1.2; margin-bottom: 18px; }
.maci-single__byline { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--color-muted); }
.maci-single__byline span { display: inline-flex; align-items: center; gap: 5px; }
.maci-single__divider { height: 1px; background: rgba(15,23,42,0.08); margin-block: 28px; }
.maci-single__featured { border-radius: 16px; overflow: hidden; margin-bottom: 40px; aspect-ratio: 16/9; }
.maci-single__featured img { width: 100%; height: 100%; object-fit: cover; }
.maci-single__content { font-size: 1.125rem; line-height: 1.8; color: #334155; }
.maci-single__content h2, .maci-single__content h3, .maci-single__content h4 { color: var(--color-ink); font-weight: 800; letter-spacing: -0.02em; margin-top: 2em; margin-bottom: 0.75em; }
.maci-single__content h2 { font-size: 1.5rem; }
.maci-single__content h3 { font-size: 1.25rem; }
.maci-single__content h4 { font-size: 1.1rem; }
.maci-single__content p { margin-bottom: 1.5em; }
.maci-single__content ul, .maci-single__content ol { margin-bottom: 1.5em; padding-left: 1.5em; }
.maci-single__content ul { list-style: disc; }
.maci-single__content ol { list-style: decimal; }
.maci-single__content li { margin-bottom: 0.5em; }
.maci-single__content a { color: var(--maci-blue); text-decoration: underline; text-underline-offset: 3px; }
.maci-single__content blockquote { border-left: 4px solid var(--maci-blue); padding: 16px 20px; background: rgba(78,154,214,0.06); border-radius: 0 12px 12px 0; font-style: italic; margin-block: 2em; }
.maci-single__content img { border-radius: 12px; margin-block: 1.5em; }

/* ==========================================================================
   9. REVEAL ANIMATION
   ========================================================================== */
.maci-reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.6s ease, transform 0.6s ease; }
.maci-reveal.is-visible { opacity: 1; transform: translateY(0); }

/* ==========================================================================
   10. RESPONSIVE
   ========================================================================== */
@media (max-width: 980px) {
	.maci-footer__grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
	.maci-nav-menu { display: none; position: absolute; top: 100%; left: 0; right: 0; background: rgba(255,255,255,0.96); backdrop-filter: blur(12px); border-top: 1px solid var(--glass-border); padding: 16px 24px; box-shadow: 0 16px 40px rgba(0,0,0,0.08); }
	.maci-nav-menu.is-open { display: block; }
	.maci-nav-menu ul { flex-direction: column; gap: 4px; }
	.maci-hamburger { display: flex; }
	.maci-btn-cta { display: none; }
	.maci-footer__grid { grid-template-columns: 1fr; gap: 32px; }
	.maci-post-grid { grid-template-columns: 1fr; }
	:root { --section-gap: 48px; }
}

/* ============================================================
 * MACI Theme — Responsive Fix
 * Append ke bagian PALING BAWAH file style.css
 * ============================================================ */

/* ── Tablet: 768px – 980px ── */
@media ( max-width: 980px ) {

	/* Single Certification: stack kolom info + preview */
	.is-cert-single .maci-container > div[style*="grid-template-columns:1fr 1.3fr"],
	.is-cert-single .maci-container > div[style*="grid-template-columns: 1fr 1.3fr"] {
		display: block !important;
	}

	/* Single Certification: preview muncul di bawah info */
	.is-cert-single div[style*="sticky"] {
		position: static !important;
		margin-top: 32px;
	}

	/* Single Project: hero grid stack */
	.is-project-single section > .maci-container > div[style*="grid-template-columns:1fr auto"],
	.is-project-single section > .maci-container > div[style*="grid-template-columns: 1fr auto"] {
		display: block !important;
	}

	/* Filter region sticky di tablet */
	.maci-region-filter {
		top: 0 !important;
	}
}

/* ── Mobile: max 768px ── */
@media ( max-width: 768px ) {

	/* Container padding lebih kecil */
	.maci-container {
		padding-inline: 16px;
	}

	/* Section gap lebih kecil */
	:root {
		--section-gap: 40px;
	}

	/* CTA button mobile — tampilkan kembali, lebih kecil */
	.maci-btn-cta {
		display: inline-flex !important;
		padding: 8px 14px;
		font-size: 12px;
		margin-left: auto;
	}

	/* Gallery grid: 2 kolom di mobile */
	.maci-gallery-grid {
		grid-template-columns: repeat( 2, 1fr ) !important;
		gap: 8px !important;
	}

	/* Cert grid: 1 kolom di mobile */
	.maci-cert-grid {
		grid-template-columns: 1fr !important;
	}

	/* Post grid: pastikan 1 kolom */
	.maci-post-grid {
		grid-template-columns: 1fr !important;
	}

	/* Archive filter: scroll horizontal, tidak wrap */
	.maci-region-filter .maci-container {
		overflow-x: auto;
		flex-wrap: nowrap !important;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
		padding-bottom: 4px;
	}
	.maci-region-filter .maci-container::-webkit-scrollbar {
		display: none;
	}
	.maci-region-filter {
		top: 0 !important;
	}

	/* Footer: 1 kolom */
	.maci-footer__grid {
		grid-template-columns: 1fr !important;
		gap: 28px !important;
	}

	/* Single post navigation: stack */
	.maci-post-navigation {
		grid-template-columns: 1fr !important;
	}

	/* Single Certification: semua stack */
	.is-cert-single .maci-container > div[style*="grid-template-columns"] {
		display: block !important;
	}
	.is-cert-single div[style*="sticky"] {
		position: static !important;
		margin-top: 28px;
	}

	/* Single Project: stack semua */
	.is-project-single section > .maci-container > div[style*="grid-template-columns"] {
		display: block !important;
	}
	.is-project-single div[style*="flex-shrink:0"] {
		margin-top: 16px;
	}

	/* Lightbox controls lebih mudah diklik di mobile */
	.maci-lb-close,
	#maciCertModalClose {
		top: 12px !important;
		right: 12px !important;
		width: 40px !important;
		height: 40px !important;
		font-size: 22px !important;
	}
	.maci-lb-prev {
		left: 8px !important;
		width: 40px !important;
		height: 40px !important;
	}
	.maci-lb-next {
		right: 8px !important;
		width: 40px !important;
		height: 40px !important;
	}

	/* Search form: full width */
	.maci-search-form {
		width: 100%;
	}

	/* Hero section padding lebih kecil */
	section[style*="padding-block:56px"] {
		padding-block: 36px 24px !important;
	}

	/* Brand name hide description di mobile */
	.maci-brand__name small {
		display: none;
	}
}

/* ── Small Mobile: max 480px ── */
@media ( max-width: 480px ) {

	/* Gallery: 1 kolom di HP sangat kecil */
	.maci-gallery-grid {
		grid-template-columns: 1fr !important;
	}

	/* Cert card footer: tombol full width */
	.maci-cert-card__footer {
		flex-direction: column;
	}
	.maci-cert-btn {
		width: 100%;
		justify-content: center;
	}

	/* Contact form grid: 1 kolom */
	.maci-form-grid {
		grid-template-columns: 1fr !important;
	}

	/* Single post byline lebih kecil */
	.maci-single__byline {
		gap: 8px;
		font-size: 12px;
		flex-wrap: wrap;
	}

	/* Footer: tagline lebih pendek */
	.maci-footer__tagline {
		max-width: 100% !important;
	}

	/* Footer bottom copyright */
	.maci-footer__bottom {
		font-size: 11px;
		padding-block: 14px;
	}

	/* Post card body padding kecil */
	.maci-post-card__body {
		padding: 16px 18px 20px;
	}

	/* Pagination numbers lebih kecil */
	.maci-pagination .page-numbers {
		width: 34px;
		height: 34px;
		font-size: 13px;
	}
}

/* ── Print ── */
@media print {
	.maci-topbar,
	.maci-header,
	.maci-footer,
	.maci-hamburger,
	.maci-btn-cta,
	.maci-cert-card__footer,
	.maci-pagination,
	#maciCertModal,
	#maci-lightbox {
		display: none !important;
	}
	.main { margin-left: 0; }
	body { color: #000; }
}
