/* Syria Oil — Base + Components + Layout
 * Ported/adapted from ministry-portal (base-standalone.css, components.css, layout.css)
 * and extended for native WordPress markup (nav menus, submenus, pagination).
 */

/* ========================================================================
 * 1. BASE / RESET
 * ==================================================================== */
body {
  margin: 0;
  font-family: var(--font-ar);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-ink);
  background: var(--color-bg);
  text-rendering: optimizeLegibility;
}

[lang="en"] body,
body[lang="en"] {
  font-family: var(--font-en);
}

img,
svg,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--duration) var(--ease);
}

a:hover {
  color: var(--color-primary-dark);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--font-display);
  line-height: var(--leading-snug);
  color: var(--color-ink);
  font-weight: 700;
}

h1 { font-size: clamp(1.35rem, 2.2vw, 1.85rem); font-weight: 700; }
h2 { font-size: clamp(1.2rem, 1.8vw, 1.5rem); font-weight: 700; }
h3 { font-size: clamp(1rem, 1.2vw, 1.1rem); font-weight: 600; }
h4 { font-size: var(--text-lg); }

p { margin: 0; }

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

.skip-link {
  position: absolute;
  inset-inline-start: var(--space-4);
  top: -100px;
  z-index: 1000;
  background: var(--color-primary);
  color: var(--white);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
}

.skip-link:focus {
  top: var(--space-4);
}

/* ========================================================================
 * 2. LAYOUT PRIMITIVES
 * ==================================================================== */
.container {
  width: min(100% - 2rem, var(--container));
  margin-inline: auto;
}

.container-wide {
  width: min(100% - 2rem, var(--container-wide));
  margin-inline: auto;
}

.section { padding-block: var(--space-16); }
.section-sm { padding-block: var(--space-12); }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.section-head .eyebrow {
  color: var(--color-primary);
  font-weight: 600;
  font-size: var(--text-sm);
  margin-bottom: var(--space-2);
}

.section-head p {
  color: var(--color-muted);
  max-width: 42rem;
  margin-top: var(--space-2);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.text-muted { color: var(--color-muted); }
.text-center { text-align: center; }
.bg-white { background: var(--white); }
.bg-soft { background: var(--gray-50); }
.bg-green-soft { background: var(--green-50); }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-6); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-6); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-6); }

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .grid-2,
  .grid-3,
  .grid-4 { grid-template-columns: 1fr; }
  .section { padding-block: var(--space-12); }
}

/* ========================================================================
 * 3. BUTTONS
 * ==================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 48px;
  padding: 0.75rem 1.35rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--text-sm);
  line-height: 1;
  border: 1px solid transparent;
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease),
    border-color var(--duration) var(--ease), transform var(--duration) var(--ease),
    box-shadow var(--duration) var(--ease);
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; }

.btn-primary {
  background: var(--color-primary);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--color-primary-dark); color: var(--white); }

.btn-secondary {
  background: var(--white);
  color: var(--color-ink);
  border-color: var(--color-border);
}
.btn-secondary:hover { border-color: var(--color-primary); color: var(--color-primary); }

.btn-accent { background: var(--color-accent); color: var(--white); }
.btn-accent:hover { background: var(--red-700); color: var(--white); }

.btn-ghost {
  background: transparent;
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.35);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.1); color: var(--white); }

.btn-sm { min-height: 40px; padding: 0.5rem 1rem; font-size: var(--text-xs); }
.btn-lg { min-height: 56px; padding: 0.9rem 1.6rem; font-size: var(--text-base); }
.btn-block { width: 100%; }

/* ========================================================================
 * 4. CARDS
 * ==================================================================== */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: box-shadow var(--duration) var(--ease), transform var(--duration) var(--ease);
  display: flex;
  flex-direction: column;
}

.card:hover { box-shadow: var(--shadow-md); border-color: #c5dccf; }

.card > a { color: inherit; display: flex; flex-direction: column; height: 100%; }

.card-body { padding: var(--space-6); }
.card-media {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--gray-100);
}
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease);
}
.card:hover .card-media img { transform: scale(1.03); }

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  color: var(--color-muted);
  font-size: var(--text-xs);
  margin-bottom: var(--space-2);
}

.card h3 {
  font-size: clamp(0.95rem, 1.1vw, 1.05rem);
  font-weight: 600;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card .text-muted {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ========================================================================
 * 5. BADGES / ALERTS / MISC COMPONENTS
 * ==================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--color-primary-soft);
  color: var(--color-primary-dark);
}

.badge-red { background: var(--red-100); color: var(--red-700); }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }

.alert {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--white);
  font-size: var(--text-sm);
}

.alert-success { background: var(--green-50); border-color: #a7f3d0; color: var(--green-900); }
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e3a8a; }

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  font-size: var(--text-sm);
  color: var(--color-muted);
  margin-bottom: var(--space-6);
}
.breadcrumb a { color: var(--color-muted); }
.breadcrumb a:hover { color: var(--color-primary); }
.breadcrumb .sep { opacity: 0.5; }
.breadcrumb [aria-current="page"] { color: var(--color-ink); font-weight: 600; }

/* Forms */
.form-control,
.form-select,
.form-textarea,
input[type="text"],
input[type="email"],
input[type="search"],
input[type="url"],
textarea {
  width: 100%;
  min-height: 48px;
  padding: 0.7rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--white);
  transition: border-color var(--duration) var(--ease);
}

.form-control:focus,
.form-textarea:focus,
input:focus,
textarea:focus { border-color: var(--color-primary); }

.search-box {
  display: flex;
  gap: var(--space-2);
  background: var(--white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-2);
  box-shadow: var(--shadow-sm);
}

.search-box input {
  flex: 1;
  border: 0;
  min-height: 44px;
  padding-inline: var(--space-4);
  background: transparent;
}
.search-box input:focus { outline: none; box-shadow: none; }

/* Stat card */
.stat-card {
  background: var(--white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-xs);
}
.stat-card .value {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 2.5vw, 2.2rem);
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1.1;
}
.stat-card .label { margin-top: var(--space-2); color: var(--color-muted); font-size: var(--text-sm); }

/* Progress */
.progress {
  height: 8px;
  background: var(--gray-100);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--green-700), var(--green-600));
  border-radius: inherit;
}

/* ========================================================================
 * 6. HEADER / TOP BAR / NAVIGATION
 * ==================================================================== */
.top-bar {
  background: var(--black-900);
  color: rgba(255, 255, 255, 0.86);
  font-size: var(--text-xs);
}

.top-bar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 40px;
  padding-block: var(--space-2);
}

.top-bar a { color: rgba(255, 255, 255, 0.86); }
.top-bar a:hover { color: var(--white); }

.top-meta { display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: center; }
.top-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-xs);
}

.header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 84px;
  padding-block: var(--space-3);
}

.brand-group { display: flex; align-items: center; gap: var(--space-4); }
.brand { display: flex; align-items: center; gap: var(--space-3); color: inherit; }
.brand:hover { color: inherit; }

.brand-logo-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: var(--radius-md);
  background: var(--white);
  border: 1px solid var(--color-border);
  flex-shrink: 0;
}

.brand-text strong {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(0.95rem, 1.5vw, 1.1rem);
  font-weight: 800;
  line-height: 1.3;
}
.brand-text span {
  display: block;
  color: var(--color-muted);
  font-size: var(--text-xs);
  margin-top: 2px;
}

.header-tools { display: flex; align-items: center; gap: var(--space-3); }

.header-search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: min(280px, 30vw);
  background: var(--gray-50);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: 0.25rem 0.35rem 0.25rem 0.9rem;
}
.header-search input {
  flex: 1;
  border: 0;
  background: transparent;
  min-height: 36px;
  font-size: var(--text-sm);
}
.header-search input:focus { outline: none; box-shadow: none; }

.nav-wrap { border-top: 1px solid var(--gray-100); }

.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  padding-block: var(--space-2);
  align-items: center;
}

/* WordPress nav menu list reset */
.main-nav ul { display: flex; flex-wrap: wrap; gap: 0.15rem; align-items: center; }
.main-nav .menu-item { position: relative; }

.main-nav a {
  color: var(--gray-700);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.main-nav a:hover,
.main-nav .current-menu-item > a,
.main-nav .current_page_item > a,
.main-nav a.is-active {
  background: var(--green-50);
  color: var(--color-primary-dark);
}

/* Desktop submenus */
.main-nav .sub-menu {
  position: absolute;
  top: 100%;
  inset-inline-start: 0;
  min-width: 220px;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: var(--space-2);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity var(--duration) var(--ease), transform var(--duration) var(--ease),
    visibility var(--duration) var(--ease);
}

.main-nav .menu-item-has-children:hover > .sub-menu,
.main-nav .menu-item-has-children:focus-within > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.main-nav .sub-menu .menu-item { width: 100%; }
.main-nav .sub-menu a { width: 100%; white-space: normal; }

/* Submenu expand toggle (mobile only visibility handled in mobile.css) */
.submenu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  color: var(--gray-700);
  flex-shrink: 0;
}
.submenu-toggle svg { width: 14px; height: 14px; transition: transform var(--duration) var(--ease); }
.menu-item-has-children.is-expanded > .submenu-toggle svg { transform: rotate(180deg); }

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  background: var(--white);
}
.nav-toggle span { width: 18px; height: 2px; background: var(--color-ink); border-radius: 2px; }

.flag-line {
  display: flex;
  width: 72px;
  height: 6px;
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-5);
}
.flag-line span { flex: 1; }
.flag-line span:nth-child(1) { background: var(--green-700); }
.flag-line span:nth-child(2) { background: var(--white); }
.flag-line span:nth-child(3) { background: var(--black-900); }

/* ========================================================================
 * 7. FOOTER
 * ==================================================================== */
.site-footer {
  background: var(--black-900);
  color: rgba(255, 255, 255, 0.78);
  padding-top: var(--space-16);
  margin-top: var(--space-16);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: var(--space-8);
  padding-bottom: var(--space-10);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.site-footer a { color: rgba(255, 255, 255, 0.78); }
.site-footer a:hover { color: var(--white); }
.site-footer h3 { color: var(--white); font-size: var(--text-sm); margin-bottom: var(--space-4); }
.site-footer ul li { margin-bottom: var(--space-2); font-size: var(--text-sm); }

.footer-brand p {
  margin-top: var(--space-4);
  font-size: var(--text-sm);
  max-width: 28rem;
  line-height: var(--leading-relaxed);
}

.social-row { display: flex; gap: var(--space-2); margin-top: var(--space-5); }
.social-row a {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: grid;
  place-items: center;
  font-size: var(--text-xs);
  font-weight: 700;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-6);
  font-size: var(--text-xs);
}

/* ========================================================================
 * 8. HOME HERO + SINGLE / ARCHIVE
 * ==================================================================== */
.home-hero {
  position: relative;
  min-height: clamp(480px, 70vh, 680px);
  display: grid;
  align-items: center;
  overflow: hidden;
  color: var(--white);
  background: var(--black-900, #0f1419);
}

.home-hero-media {
  position: absolute;
  inset: 0;
}

.home-hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.home-hero-content {
  position: relative;
  z-index: 2;
  padding-block: var(--space-16);
}

.home-hero h1,
.home-hero h1 a {
  color: var(--white);
}

.home-hero .lede {
  color: rgba(255, 255, 255, 0.88);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.btn-ghost {
  background: transparent;
  color: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.45);
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
}

.page-hero {
  background:
    linear-gradient(120deg, rgba(0, 77, 39, 0.92), rgba(0, 122, 61, 0.78));
  color: var(--white);
  padding: var(--space-16) 0 var(--space-12);
}
.page-hero h1 { color: var(--white); margin-bottom: var(--space-3); }
.page-hero p { color: rgba(255, 255, 255, 0.88); max-width: 40rem; }
.page-hero .breadcrumb,
.page-hero .breadcrumb a,
.page-hero .breadcrumb [aria-current="page"] { color: rgba(255, 255, 255, 0.85); }

.layout-sidebar {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-w);
  gap: var(--space-8);
  align-items: start;
}

.sidebar .widget {
  background: var(--white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
}
.sidebar .widget h2,
.sidebar .widget h3 {
  font-size: var(--text-base);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 2px solid var(--color-primary);
}
.sidebar .widget ul li { padding: var(--space-2) 0; border-bottom: 1px solid var(--gray-100); font-size: var(--text-sm); }
.sidebar .widget ul li:last-child { border-bottom: 0; }

/* Single article */
.article-hero-img {
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: var(--space-6);
  aspect-ratio: 21 / 9;
}
.article-hero-img img { width: 100%; height: 100%; object-fit: cover; }

.article-body {
  background: var(--white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
}
.article-body p,
.entry-content p {
  margin-bottom: var(--space-4);
  color: var(--gray-700);
  line-height: var(--leading-relaxed);
}
.entry-content h2 { margin: var(--space-6) 0 var(--space-3); }
.entry-content ul,
.entry-content ol { margin: 0 0 var(--space-4); padding-inline-start: var(--space-6); }
.entry-content ul { list-style: disc; }
.entry-content ol { list-style: decimal; }
.entry-content img { border-radius: var(--radius-lg); margin: var(--space-4) 0; }

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  color: var(--color-muted);
  font-size: var(--text-sm);
  margin: var(--space-3) 0 var(--space-5);
}

/* ========================================================================
 * 9. PAGINATION (WordPress the_posts_pagination)
 * ==================================================================== */
.pagination,
.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: center;
  margin-top: var(--space-10);
}

.pagination .page-numbers,
.nav-links .page-numbers {
  min-width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--white);
  color: var(--color-ink);
  font-size: var(--text-sm);
  font-weight: 600;
}

.pagination .page-numbers:hover,
.pagination .page-numbers.current,
.nav-links .page-numbers:hover,
.nav-links .page-numbers.current {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--white);
}

/* ========================================================================
 * 10. MOBILE BOTTOM NAV + BACKDROP (base state; visibility in mobile.css)
 * ==================================================================== */
.nav-backdrop { display: none; }
.bottom-nav { display: none; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
