/*
Theme Name:  Amir Rafiee Academic v2 (CPT)
Theme URI:   https://amirrafiee.com.au
Author:      Amir Ali Rafiee
Description: v2 — Native PHP templates with CPTs (Publications, Conferences) and ACF Options for editable content. No Elementor on Home/About/Contact. Identical visual output.
Version:     2.0.0-dev
License:     GNU General Public License v2 or later
Text Domain: amir-rafiee
Tags:        academic, portfolio, elementor, dark
*/

/* =========================================
   CSS VARIABLES — global design tokens
   All Elementor widgets inherit these
   ========================================= */
:root {
  --ar-navy:        #080C14;
  --ar-navy-mid:    #0D1220;
  --ar-navy-card:   #111827;
  --ar-border:      rgba(196,160,82,0.18);
  --ar-gold:        #C4A052;
  --ar-gold-light:  #D4B472;
  --ar-gold-pale:   rgba(196,160,82,0.12);
  --ar-cream:       #F5F0E8;
  --ar-muted:       rgba(245,240,232,0.55);
  --ar-font-serif:  'Libre Baskerville', Georgia, serif;
  --ar-font-sans:   'IBM Plex Sans', 'Helvetica Neue', sans-serif;
  --ar-font-mono:   'IBM Plex Mono', 'Courier New', monospace;
  --ar-transition:  all 0.3s cubic-bezier(0.4,0,0.2,1);
}

/* =========================================
   RESET & BASE
   ========================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--ar-font-sans);
  background: var(--ar-navy);
  color: var(--ar-cream);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--ar-gold); text-decoration: none; transition: var(--ar-transition); }
a:hover { color: var(--ar-gold-light); }
ul { list-style: none; }

/* =========================================
   CANVAS PARTICLE BACKGROUND
   ========================================= */
#ar-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.3;
}
#page-wrap { position: relative; z-index: 1; }

/* =========================================
   HEADER
   ========================================= */
#site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 9999;
  height: 72px;
  display: flex;
  align-items: center;
  background: rgba(8,12,20,0.97);
  /* No backdrop-filter here: it would create a containing block for any
     position:fixed descendants (e.g. the mobile nav dropdown), breaking
     full-viewport positioning. Bg is already 97% opaque so the visual
     loss is negligible. */
  border-bottom: 1px solid var(--ar-border);
  transition: background 0.4s ease;
}
#site-header.scrolled {
  background: rgba(8,12,20,0.99);
}
.ar-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* Logo — monogram + text (matches approved amir-home-5 preview) */
.ar-logo {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
  flex-shrink: 0;
}
.ar-logo-monogram {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: transparent;
  border: 1.75px solid var(--ar-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ar-font-serif);
  font-size: 1rem;
  font-weight: 700;
  color: var(--ar-gold);
  flex-shrink: 0;
  letter-spacing: 0.04em;
}
.ar-logo-name { line-height: 1.1; display: inline-block; }
.ar-logo-name-main {
  font-family: var(--ar-font-serif);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ar-cream);
  letter-spacing: 0.01em;
  display: block;
  white-space: nowrap;
}
.ar-logo-name-sub {
  font-family: var(--ar-font-sans);
  font-size: 0.42rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--ar-gold);
  display: block;
  margin-top: 0.18rem;
  white-space: nowrap;
  text-align: justify;
  text-align-last: justify;
  /* width is set to match title width via JS in main.js */
}
.ar-logo-img {
  height: clamp(42px, 5vw, 56px);
  width: auto;
  max-width: 240px;
  display: block;
}
@media (max-width: 480px) {
  .ar-header-inner { padding: 0 1rem; }
  .ar-logo-monogram { width: 36px; height: 36px; font-size: 0.92rem; }
  .ar-logo-name-main { font-size: 0.82rem; }
  .ar-logo-name-sub { font-size: 0.38rem; }
  .ar-logo-img { height: 44px; max-width: 200px; }
}

/* Primary nav */
#ar-primary-nav ul {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0; margin: 0;
  list-style: none;
}
#ar-primary-nav ul li a {
  display: block;
  padding: 8px 16px;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ar-muted);
  border: 1px solid transparent;
  transition: var(--ar-transition);
}
#ar-primary-nav ul li a:hover,
#ar-primary-nav ul li.current-menu-item > a,
#ar-primary-nav ul li.current_page_item > a {
  color: var(--ar-gold);
  border-color: rgba(196,160,82,0.2);
}
#ar-primary-nav ul li.menu-cta > a {
  background: var(--ar-gold);
  color: var(--ar-navy);
  font-weight: 600;
  border-radius: 6px;
  padding: 8px 22px;
  border-color: var(--ar-gold);
}
#ar-primary-nav ul li.menu-cta > a:hover {
  background: var(--ar-gold-light);
  color: var(--ar-navy);
  border-color: var(--ar-gold-light);
}

/* Hamburger */
.ar-menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.ar-menu-toggle span {
  display: block;
  width: 22px; height: 1.5px;
  background: var(--ar-cream);
  transition: var(--ar-transition);
}
.ar-menu-toggle.active span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.ar-menu-toggle.active span:nth-child(2) { opacity: 0; }
.ar-menu-toggle.active span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* =========================================
   PAGE WRAPPER — pushes content below header
   ========================================= */
.ar-page-content { padding-top: 72px; }

/* Elementor full-width pages override this */
.page-template-page-fullwidth .ar-page-content,
.elementor-editor-active .ar-page-content { padding-top: 72px; }

/* =========================================
   PUBLICATION CARDS
   (used on Elementor pages via shortcode)
   ========================================= */
.ar-pub-card {
  background: var(--ar-navy-card);
  border: 1px solid var(--ar-border);
  padding: 28px 32px;
  margin-bottom: 2px;
  position: relative;
  transition: var(--ar-transition);
}
.ar-pub-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(to bottom, var(--ar-gold), transparent);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.3s ease;
}
.ar-pub-card:hover { border-color: rgba(196,160,82,0.3); }
.ar-pub-card:hover::before { transform: scaleY(1); }
.ar-pub-year {
  font-family: var(--ar-font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--ar-gold);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ar-pub-year::after {
  content: '';
  flex: 1; max-width: 36px;
  height: 1px;
  background: rgba(196,160,82,0.3);
}
.ar-pub-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--ar-gold-pale);
  color: var(--ar-gold);
  border: 1px solid rgba(196,160,82,0.2);
  margin-bottom: 10px;
}
.ar-pub-title {
  font-family: var(--ar-font-serif);
  font-size: 1rem;
  color: var(--ar-cream);
  line-height: 1.4;
  margin-bottom: 8px;
  font-weight: 700;
}
.ar-pub-venue {
  font-size: 0.82rem;
  color: var(--ar-muted);
  font-style: italic;
  margin-bottom: 8px;
}
.ar-pub-authors {
  font-size: 0.76rem;
  color: rgba(245,240,232,0.3);
  margin-bottom: 12px;
}
.ar-pub-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.ar-pub-doi {
  font-family: var(--ar-font-mono);
  font-size: 0.68rem;
  color: var(--ar-gold);
  opacity: 0.75;
  border: 1px solid rgba(196,160,82,0.2);
  padding: 3px 10px;
  transition: var(--ar-transition);
}
.ar-pub-doi:hover { opacity: 1; color: var(--ar-gold); border-color: var(--ar-gold); }
.ar-pub-citations {
  font-size: 0.68rem;
  color: var(--ar-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* =========================================
   PRINCIPLE CARDS
   ========================================= */
.ar-principle-card {
  background: var(--ar-navy-card);
  border: 1px solid var(--ar-border);
  padding: 28px 28px;
  transition: var(--ar-transition);
}
.ar-principle-card:hover {
  border-color: rgba(196,160,82,0.3);
  box-shadow: 0 0 40px rgba(196,160,82,0.06);
}
.ar-principle-code {
  font-family: var(--ar-font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ar-gold);
  margin-bottom: 10px;
}
.ar-principle-title {
  font-family: var(--ar-font-serif);
  font-size: 0.95rem;
  color: var(--ar-cream);
  font-weight: 700;
  margin-bottom: 10px;
}
.ar-principle-desc {
  font-size: 0.84rem;
  color: var(--ar-muted);
  line-height: 1.7;
}
.ar-principles-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
}

/* =========================================
   STATS STRIP
   ========================================= */
.ar-stats-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--ar-border);
  border: 1px solid var(--ar-border);
  margin-bottom: 48px;
}
.ar-stat-block {
  background: var(--ar-navy-card);
  padding: 24px;
  text-align: center;
}
.ar-stat-num {
  font-family: var(--ar-font-serif);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--ar-gold);
  line-height: 1;
  margin-bottom: 5px;
}
.ar-stat-lbl {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ar-muted);
}

/* =========================================
   SECTION LABELS (used globally)
   ========================================= */
.ar-section-label {
  font-family: var(--ar-font-sans);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ar-gold);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.ar-section-label::before {
  content: '';
  width: 24px; height: 1px;
  background: var(--ar-gold);
  flex-shrink: 0;
}

/* =========================================
   ELEMENTOR COMPATIBILITY
   — makes Elementor sections look right on dark bg
   ========================================= */
.elementor-section { position: relative; }
.elementor-widget-text-editor { color: var(--ar-cream); }
.elementor-widget-heading .elementor-heading-title { color: var(--ar-cream); }

/* Elementor full-width stretch */
.elementor-section.elementor-section-stretched {
  left: 0 !important;
  width: 100% !important;
}

/* =========================================
   MOBILE
   ========================================= */
@media (max-width: 768px) {
  .ar-menu-toggle { display: flex; }

  #ar-primary-nav {
    position: fixed;
    top: 72px; left: 0; right: 0; bottom: 0;
    background: rgba(8,12,20,0.98);
    backdrop-filter: blur(16px);
    padding: 1.5rem 1rem;
    display: none;
    overflow-y: auto;
    border-top: 1px solid var(--ar-border);
    z-index: 9998;
  }
  #ar-primary-nav.open { display: block; }
  #ar-primary-nav ul { flex-direction: column; gap: 0; }
  #ar-primary-nav ul li a {
    padding: 14px 16px;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(196,160,82,0.06);
    border-left: none; border-right: none; border-top: none;
  }

  .ar-principles-grid { grid-template-columns: 1fr; }
  .ar-stats-strip { grid-template-columns: 1fr; }
}


/* Desktop: nav sits inline in header */
@media (min-width: 769px) {
  #site-header #ar-primary-nav {
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    z-index: auto !important;
    height: auto !important;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    overflow: visible !important;
  }
}

/* Mobile: nav is a fullscreen dropdown panel toggled by hamburger */
@media (max-width: 768px) {
  #site-header #ar-primary-nav {
    position: fixed !important;
    top: 72px !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    height: auto !important;
    background: rgba(8,12,20,0.98) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border: none !important;
    border-top: 1px solid var(--ar-border) !important;
    padding: 1.5rem 1rem !important;
    margin: 0 !important;
    z-index: 9998 !important;
    overflow-y: auto !important;
    display: none !important;
  }
  #site-header #ar-primary-nav.open { display: block !important; }
  #site-header #ar-primary-nav ul {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0 !important;
  }
  #site-header #ar-primary-nav ul li.menu-cta > a {
    display: inline-block;
    margin-top: 12px;
  }
}

/* =========================================
   LAYOUT FIXES
   - Suppress stray WP/Elementor auto-rendered page titles
   - Offset fixed header below WP admin bar
   ========================================= */
.elementor-page .entry-title,
.elementor-page > .entry-header,
.elementor-page > .page-title,
.elementor-page-title-default,
.elementor-default-page-title,
body.page .ar-page-content > .entry-title,
body.page .ar-page-content > .entry-header,
body.page .ar-page-content > h1.entry-title,
body.page .ar-page-content > h1.page-title,
body.page-template-default .ar-page-content > h1:first-child {
  display: none !important;
}

@media screen and (min-width: 783px) {
  body.admin-bar #site-header { top: 32px; }
}
@media screen and (max-width: 782px) {
  body.admin-bar #site-header { top: 46px; }
}
