/*
Theme Name:  Kaweh Kerami Academic
Theme URI:   https://kawehkerami.com
Author:      Kaweh Kerami
Description: Personal academic website theme — clean two-column layout with sidebar profile card.
Version:     1.0.0
License:     GNU General Public License v2 or later
Text Domain: kawehkerami
*/

/* ── RESET & BASE ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --cream: #faf9f7;
  --white: #ffffff;
  --ink: #1a1a18;
  --mid: #4a4a46;
  --muted: #8a8a84;
  --rule: #e0ddd8;
  --accent: #2c5f6e;
  --accent-light: #e8f1f4;
  --nav-h: 56px;
  --sidebar-w: 260px;
  --radius: 4px;
  --shadow: 0 2px 20px rgba(0,0,0,0.07);
}

html { scroll-behavior: smooth; }

body {
  background: var(--cream);
  color: var(--ink);
  font-family: 'Source Sans 3', sans-serif;
  font-size: 16px;
  line-height: 1.7;
  min-height: 100vh;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); }

/* ── NAV ─────────────────────────────────────────────────── */
#site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--rule);
  height: var(--nav-h);
  display: flex;
  align-items: center;
}
.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  width: 100%;
  padding: 0 2rem;
  display: flex;
  align-items: center;
}
.nav-brand {
  font-family: 'Lora', serif;
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
  letter-spacing: 0.01em;
}
.nav-brand:hover { color: var(--accent); }

/* WordPress nav menu */
.nav-links {
  display: flex;
  list-style: none;
  gap: 0.1rem;
  flex-wrap: wrap;
}
.nav-links li { position: relative; }
.nav-links a {
  display: block;
  padding: 0.35rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mid);
  text-decoration: none;
  border-radius: var(--radius);
  transition: color 0.18s, background 0.18s;
}
.nav-links a:hover,
.nav-links li.current-menu-item > a,
.nav-links li.current_page_item > a {
  color: var(--accent);
  background: var(--accent-light);
}

/* ── BANNER ──────────────────────────────────────────────── */
.site-banner {
  width: 100%;
  height: 220px;
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, #1a3440 0%, #2c5f6e 35%, #4a8fa0 65%, #7fb8c8 100%);
  background-size: cover;
  background-position: center;
}
.banner-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.12;
  background-image:
    radial-gradient(circle at 20% 50%, white 1px, transparent 1px),
    radial-gradient(circle at 60% 20%, white 1px, transparent 1px),
    radial-gradient(circle at 80% 70%, white 1px, transparent 1px),
    radial-gradient(circle at 40% 80%, white 1px, transparent 1px);
  background-size: 40px 40px, 60px 60px, 50px 50px, 70px 70px;
}
.banner-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 60%, rgba(250,249,247,0.6) 100%);
}
/* inner pages — shorter banner */
.page:not(.home) .site-banner,
.single .site-banner {
  height: 120px;
}

/* ── PAGE LAYOUT ─────────────────────────────────────────── */
.page-wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 2rem 4rem;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  gap: 3rem;
  align-items: start;
}

/* ── SIDEBAR ─────────────────────────────────────────────── */
#sidebar {
  position: sticky;
  top: calc(var(--nav-h) + 2rem);
}
.profile-card {
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: 6px;
  box-shadow: var(--shadow);
  padding: 1.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-top: -60px;
  position: relative;
  z-index: 10;
}
.home .profile-card { margin-top: -60px; }
.page:not(.home) .profile-card { margin-top: -44px; }

.avatar-wrap {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--white);
  box-shadow: 0 3px 16px rgba(0,0,0,0.15);
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #2c5f6e, #4a8fa0);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.avatar-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar-initials {
  font-family: 'Lora', serif;
  font-size: 2.2rem;
  font-weight: 600;
  color: white;
}
.profile-name {
  font-family: 'Lora', serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  margin-bottom: 0.3rem;
}
.profile-title {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 400;
  line-height: 1.4;
}
.profile-divider {
  width: 100%;
  height: 1px;
  background: var(--rule);
  margin: 1.1rem 0;
}
.social-links {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.social-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.38rem 0.5rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--mid);
  font-size: 0.8rem;
  font-weight: 500;
  transition: color 0.18s, background 0.18s;
}
.social-link:hover {
  color: var(--accent);
  background: var(--accent-light);
}
.social-link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.65;
}
.social-link:hover svg { opacity: 1; }
.affil-badge {
  margin-top: 1.1rem;
  background: var(--accent-light);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
  font-size: 0.76rem;
  color: var(--accent);
  font-weight: 500;
  line-height: 1.5;
  text-align: left;
  width: 100%;
}
.affil-badge strong {
  display: block;
  font-weight: 600;
  margin-bottom: 0.1rem;
}

/* ── MAIN CONTENT ────────────────────────────────────────── */
#main-content {
  padding-top: 2.5rem;
  min-width: 0;
}
.page-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.page-header h1 {
  font-family: 'Lora', serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.page-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rule);
}

/* WordPress editor content styles */
.entry-content {
  color: var(--mid);
  font-size: 0.96rem;
}
.entry-content p { margin-bottom: 1.1rem; }
.entry-content p:last-child { margin-bottom: 0; }
.entry-content strong { color: var(--ink); font-weight: 600; }
.entry-content em { font-style: italic; }
.entry-content a { color: var(--accent); text-decoration: none; }
.entry-content a:hover { text-decoration: underline; }

.entry-content h2 {
  font-family: 'Lora', serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  margin: 2rem 0 0.7rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
}
.entry-content h3 {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 1.8rem 0 0.6rem;
}
.entry-content ul, .entry-content ol {
  padding-left: 1.4rem;
  margin-bottom: 1rem;
}
.entry-content li { margin-bottom: 0.35rem; }

/* About page lead paragraph */
.about-lead {
  font-family: 'Lora', serif;
  font-size: 1.1rem;
  font-style: italic;
  color: var(--mid);
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
  line-height: 1.65;
}

/* Award strip */
.award-strip {
  margin-top: 2rem;
  background: linear-gradient(135deg, #fdf8ee, #fef5d8);
  border: 1px solid #e8d89a;
  border-radius: 6px;
  padding: 0.9rem 1.1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  font-size: 0.83rem;
  color: #6b5a1e;
  line-height: 1.5;
}
.award-medal { font-size: 1.4rem; flex-shrink: 0; }

/* Research tags */
.theme-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.8rem 0 1.6rem;
}
.theme-tag {
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.28rem 0.7rem;
  border-radius: 20px;
  letter-spacing: 0.02em;
}

/* Publications list */
.pub-list { list-style: none; }
.pub-item {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 0 1.2rem;
  padding: 1.2rem 0;
  border-bottom: 1px solid var(--rule);
}
.pub-year {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.05em;
  padding-top: 0.2rem;
}
.pub-title {
  font-family: 'Lora', serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.25rem;
  line-height: 1.4;
}
.pub-meta {
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
}

/* CV entries — hardened against WordPress wpautop */
.cv-content { font-size: 0.96rem; }

/* Kill any stray <p> tags WordPress injects inside cv blocks */
.cv-section > p,
.cv-entry > p,
.cv-content > p:empty { display: none; }

.cv-section {
  margin-bottom: 2.2rem;
  /* Clear floats / collapsed parents from WP interference */
  overflow: visible;
}
.cv-section h3 {
  font-family: 'Lora', serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 0.9rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
  text-transform: none;
  letter-spacing: 0;
  /* Reset any entry-content h3 overrides */
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}
.cv-entry {
  display: grid !important;
  grid-template-columns: 110px 1fr;
  gap: 0 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px dashed var(--rule);
  /* Prevent WP collapsing the grid */
  align-items: start;
}
.cv-entry + .cv-entry { }
.cv-section .cv-entry:last-of-type { border-bottom: none; }

.cv-date {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
  line-height: 1.45;
  padding-top: 0.2rem;
  /* Stay in column 1 */
  grid-column: 1;
}
.cv-entry > div {
  grid-column: 2;
  min-width: 0;
}
/* Kill <p> wrapping WP adds inside the right-hand div */
.cv-entry > div > p { display: none; }

.cv-role {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 0.12rem;
  display: block;
}
.cv-org {
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
  display: block;
  margin: 0;
}

/* Contact items */
.contact-list { list-style: none; display: flex; flex-direction: column; gap: 0.6rem; }
.contact-list a {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.85rem 1.1rem;
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: 6px;
  text-decoration: none;
  color: var(--mid);
  font-size: 0.87rem;
  transition: border-color 0.18s, box-shadow 0.18s, color 0.18s;
}
.contact-list a:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(44,95,110,0.1);
  color: var(--accent);
}
.contact-label { font-weight: 600; font-size: 0.83rem; color: var(--ink); display: block; }
.contact-sub { font-size: 0.78rem; color: var(--muted); }
.contact-arrow { margin-left: auto; font-size: 1rem; color: var(--muted); }

/* ── FOOTER ──────────────────────────────────────────────── */
#site-footer {
  border-top: 1px solid var(--rule);
  padding: 1.4rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1080px;
  margin: 0 auto;
  font-size: 0.75rem;
  color: var(--muted);
}
#site-footer a { color: var(--muted); text-decoration: none; }
#site-footer a:hover { color: var(--accent); }

/* ── ANIMATIONS ──────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.profile-card { animation: fadeUp 0.45s ease both; }
#main-content { animation: fadeUp 0.5s 0.08s ease both; }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 720px) {
  .page-wrap {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0 1.2rem 3rem;
  }
  #sidebar { position: static; }
  .profile-card,
  .home .profile-card,
  .page:not(.home) .profile-card { margin-top: -40px; }
  .site-banner { height: 140px; }
  .nav-links a { padding: 0.3rem 0.55rem; font-size: 0.75rem; }
  #site-footer { flex-direction: column; gap: 0.4rem; text-align: center; }
}
