/* ============================================
   Ali Yaareb — Personal Site · Editorial theme
   Bilingual EN/AR · Light & Dark
   Inspired by minimalist editorial portfolio covers:
   paper white, ink typography, large B&W portrait,
   ghost display text, hairline rules, index numbers.
   ============================================ */

:root {
  --bg: #faf9f6;
  --bg-soft: #f1efe9;
  --card: #ffffff;
  --text: #16181b;
  --text-muted: #6b6f76;
  --accent: #0e7a72;
  --accent-strong: #0a5f59;
  --accent-soft: #e3f1ef;
  --border: #e3e0d8;
  --ghost: rgba(20, 24, 27, 0.05);
  --shadow: 0 1px 2px rgba(22, 24, 27, 0.04);
  --shadow-lift: 0 14px 34px rgba(22, 24, 27, 0.09);
  --max-width: 1200px;
  --radius: 6px;
  --radius-sm: 2px;
  --radius-pill: 999px;
  --danger: #c0392b;
  /* Label scale: small uppercase meta text (nav, dates, read-more, footer).
     Arabic never uses uppercase/tracking, so it gets its own pair. */
  --fs-label: 0.76rem;
  --track-label: 0.16em;
  --fs-label-ar: 0.86rem;
  --track-label-ar: 0.03em;
  /* Spacing scale — 4px base grid */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 28px;
  --sp-8: 32px;
  --sp-9: 36px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-14: 56px;
  --sp-16: 64px;
  --sp-18: 72px;
  /* Logo keeps the editorial serif on every page (brand mark) */
  --font-logo-en: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-logo-ar: "Amiri", "IBM Plex Sans Arabic", serif;
  --font-en: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-ar: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --serif-en: "Playfair Display", Georgia, "Times New Roman", serif;
  --serif-ar: "Amiri", "IBM Plex Sans Arabic", serif;
}

[data-theme="dark"] {
  --bg: #101214;
  --bg-soft: #17191c;
  --card: #141619;
  --text: #eae7e0;
  --text-muted: #9ba0a6;
  --accent: #46c2b5;
  --accent-strong: #6ad4c9;
  --accent-soft: rgba(70, 194, 181, 0.12);
  --danger: #e07b6e;
  --border: #26292e;
  --ghost: rgba(255, 255, 255, 0.045);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lift: 0 14px 34px rgba(0, 0, 0, 0.5);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-en);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 17px;
  transition: background 0.25s, color 0.25s;
}

::selection { background: var(--accent-soft); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Language switching ---------- */
.ar { display: none; }
body.lang-ar .ar { display: revert; }
body.lang-ar .en { display: none; }
body.lang-ar { font-family: var(--font-ar); direction: rtl; }

/* B2B pages (CV & Services): headings drop the editorial serif for the
   working sans — the serif stays on the blog, and the logo is pinned
   separately via --font-logo-*. */
body.page-cv, body.page-services {
  --serif-en: var(--font-en);
  --serif-ar: var(--font-ar);
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--sp-7);
}

/* ---------- Header / Nav ---------- */
header {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 10;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-7);
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.nav .logo {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  font-family: var(--font-logo-en);
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--text);
}
body.lang-ar .nav .logo { font-family: var(--font-logo-ar); font-weight: 700; letter-spacing: 0; }

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  background: var(--text);
  color: var(--bg);
  font-family: var(--font-en);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.logo-img {
  height: 34px;
  width: auto;
  max-width: 170px;
  object-fit: contain;
  display: block;
}
.logo-dark { display: none; }
[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark { display: block; }

.nav ul {
  display: flex;
  gap: 4px;
  list-style: none;
  align-items: center;
  flex-wrap: wrap;
}

.nav ul a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  padding: var(--sp-2) var(--sp-3);
  transition: color 0.15s, box-shadow 0.15s;
}
body.lang-ar .nav ul a { letter-spacing: var(--track-label-ar); font-size: var(--fs-label-ar); text-transform: none; }

.nav ul a:hover { color: var(--text); }
.nav ul a.active { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }

#lang-toggle, #theme-toggle {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
}

#theme-toggle {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

#lang-toggle:hover, #theme-toggle:hover { border-color: var(--text); }

/* ---------- Editorial hero (full-screen cover, like the reference) ---------- */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(24px, 4vw, 64px);
  align-items: center;
  max-width: none;
  padding: 24px clamp(24px, 6vw, 96px) 48px;
  min-height: calc(100vh - 68px);
  min-height: calc(100svh - 68px);
  overflow: hidden;
}

.hero-ghost {
  position: absolute;
  z-index: 0;
  top: 6px;
  inset-inline-start: -6px;
  font-family: var(--serif-en);
  font-weight: 800;
  font-size: clamp(7rem, 20vw, 22rem);
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: var(--ghost);
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
}
body.lang-ar .hero-ghost { font-family: var(--serif-ar); letter-spacing: 0; line-height: 1.1; }

.hero-text { position: relative; z-index: 1; }

.hero-index {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  color: var(--text-muted);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  margin-bottom: var(--sp-5);
}
body.lang-ar .hero-index { letter-spacing: var(--track-label-ar); font-size: var(--fs-label-ar); text-transform: none; }

.hero-index .num {
  font-family: var(--serif-en);
  font-style: italic;
  font-weight: 400;
  font-size: 1.05rem;
  letter-spacing: 0;
  color: var(--accent);
}

.hero-index::after {
  content: "";
  width: 64px;
  height: 1px;
  background: var(--text);
  opacity: 0.3;
}

.hero h1 {
  font-family: var(--serif-en);
  font-size: clamp(3rem, 7.5vw, 5.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.04;
  margin-bottom: var(--sp-5);
}
body.lang-ar .hero h1 {
  font-family: var(--serif-ar);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.3;
}

.hero .tagline {
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--sp-4);
}
body.lang-ar .hero .tagline { letter-spacing: 0.02em; font-size: 0.95rem; text-transform: none; }

.hero p.summary {
  color: var(--text-muted);
  max-width: 48ch;
  font-size: 1.04rem;
}

.hero .location {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--sp-4);
  color: var(--text-muted);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
}

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

/* Portrait photo (editorial B&W) */
.hero-photo {
  position: relative;
  z-index: 1;
  height: min(68vh, 600px);
}

.hero-photo img.portrait {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  filter: grayscale(1) contrast(1.05);
  display: block;
}

.hero-photo .photo-rule {
  position: absolute;
  bottom: -14px;
  inset-inline-start: 14px;
  width: 40%;
  height: 3px;
  background: var(--accent);
}

/* Cutout portrait (transparent PNG) — the subject stands on the page itself,
   anchored to the section divider, exactly like the editorial reference */
.hero.has-cutout { align-items: end; padding-bottom: 0; grid-template-columns: 0.9fr 1.1fr; }
.hero.has-cutout .hero-text { align-self: center; padding-bottom: var(--sp-18); }

.hero-photo.cutout {
  height: 100%;
  align-self: end;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: var(--sp-4);
}

/* White studio backdrop behind the cutout subject */
.photo-panel {
  background: #ffffff;
  border: 1px solid var(--border);
  border-bottom: none;
  width: 100%;
  max-width: 560px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.hero-photo.cutout img.portrait {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: min(80vh, 780px);
  object-fit: contain;
  object-position: bottom center;
  filter: grayscale(1) contrast(1.06);
  display: block;
}

/* The motto standing beside the photo, spine-style */
.motto-side {
  writing-mode: vertical-rl;
  margin: 0 0 10px;
  align-self: flex-end;
  white-space: nowrap;
}
.motto-side::before { width: 1px; height: 30px; }

/* Personal motto under the name (the model's tiny caption) */
.motto {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-family: var(--serif-en);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--text-muted);
  margin: -6px 0 var(--sp-5);
}
.motto::before { content: ""; width: 30px; height: 1px; background: var(--accent); flex-shrink: 0; }
body.lang-ar .motto { font-family: var(--serif-ar); font-style: normal; font-size: 1.1rem; }

.hero-photo-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: min(50vh, 420px);
}

/* Initials fallback (used when no photo is set) */
.hero-avatar {
  width: 140px;
  height: 140px;
  border-radius: 4px;
  background: var(--text);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif-en);
  font-size: 2.4rem;
  font-weight: 800;
  flex-shrink: 0;
}
body.lang-ar .hero-avatar { font-family: var(--serif-ar); }

img.hero-avatar { object-fit: cover; background: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: var(--sp-3) var(--sp-7);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  font-family: var(--font-en);
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
body.lang-ar .btn { letter-spacing: var(--track-label-ar); font-size: var(--fs-label-ar); text-transform: none; font-family: var(--font-ar); }

.btn-primary { background: var(--text); color: var(--bg); border: 1px solid var(--text); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

.btn-outline { border: 1px solid var(--text); background: transparent; color: var(--text); }
.btn-outline:hover { background: var(--text); color: var(--bg); }

/* ---------- Sections ---------- */
section { padding: var(--sp-18) 0; border-top: 1px solid var(--border); }

section h2 {
  font-family: var(--serif-en);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: var(--sp-9);
  display: flex;
  align-items: baseline;
  gap: var(--sp-4);
}
body.lang-ar section h2 { font-family: var(--serif-ar); font-weight: 700; letter-spacing: 0; }

.sec-num {
  font-family: var(--serif-en);
  font-style: italic;
  font-weight: 400;
  font-size: 1.05rem;
  color: var(--accent);
}

section h2::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--border);
  align-self: center;
}

/* ---------- Blog list (editorial rows) ---------- */
.post-card {
  display: grid;
  grid-template-columns: 150px 1fr auto;
  gap: var(--sp-7);
  align-items: baseline;
  padding: var(--sp-7) var(--sp-2);
  margin: 0;
  background: transparent;
  border: none;
  border-top: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
  text-decoration: none;
  color: inherit;
  transition: background 0.18s;
}

.post-card:last-of-type { border-bottom: 1px solid var(--border); }

.post-card:hover { background: var(--bg-soft); }

.post-card .post-date {
  color: var(--text-muted);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}
body.lang-ar .post-card .post-date { letter-spacing: var(--track-label-ar); font-size: var(--fs-label-ar); }

.post-card h3 {
  font-family: var(--serif-en);
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: var(--sp-2);
  transition: color 0.15s;
}
body.lang-ar .post-card h3 { font-family: var(--serif-ar); font-weight: 700; letter-spacing: 0; }

.post-card:hover h3 { color: var(--accent); }

.post-card p { color: var(--text-muted); font-size: 0.97rem; }

.post-card .read-more {
  color: var(--accent);
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  white-space: nowrap;
}
body.lang-ar .post-card .read-more { letter-spacing: var(--track-label-ar); font-size: var(--fs-label-ar); }

.empty-posts {
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: var(--sp-8);
  text-align: center;
}

/* ---------- Article page ---------- */
.article { padding: var(--sp-16) var(--sp-7); max-width: 820px; margin: 0 auto; }

.article .post-date {
  color: var(--text-muted);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}
body.lang-ar .article .post-date { letter-spacing: var(--track-label-ar); font-size: var(--fs-label-ar); }

.article h1 {
  font-family: var(--serif-en);
  font-size: clamp(2.2rem, 5.5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.15;
  margin: var(--sp-3) 0 var(--sp-4);
  padding-bottom: var(--sp-6);
  border-bottom: 1px solid var(--border);
}
body.lang-ar .article h1 { font-family: var(--serif-ar); font-weight: 700; letter-spacing: 0; line-height: 1.4; }

.article h2 {
  font-family: var(--serif-en);
  font-size: 1.55rem;
  font-weight: 800;
  margin: var(--sp-10) 0 var(--sp-3);
}
body.lang-ar .article h2 { font-family: var(--serif-ar); font-weight: 700; }

.article p { margin-bottom: var(--sp-4); font-size: 1.03rem; line-height: 1.85; }

.article .back-link {
  display: inline-block;
  margin-bottom: var(--sp-7);
  color: var(--text-muted);
  text-decoration: none;
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}
body.lang-ar .article .back-link { letter-spacing: var(--track-label-ar); font-size: var(--fs-label-ar); }
.article .back-link:hover { color: var(--accent); }

/* ---------- Experience / Education timeline ---------- */
.timeline { position: relative; }

.timeline .item {
  position: relative;
  padding-inline-start: var(--sp-8);
  padding-bottom: var(--sp-8);
  border-inline-start: 1px solid var(--border);
}

.timeline .item:last-child { padding-bottom: 4px; }

.timeline .item::before {
  content: "";
  position: absolute;
  inset-inline-start: -4.5px;
  top: 9px;
  width: 8px;
  height: 8px;
  border-radius: 0;
  background: var(--accent);
}

.item .item-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.item h3 {
  font-family: var(--serif-en);
  font-size: 1.22rem;
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: -0.01em;
}
body.lang-ar .item h3 { font-family: var(--serif-ar); font-weight: 700; letter-spacing: 0; }

.item .place { color: var(--accent); font-weight: 500; font-size: 0.95rem; }

.item .dates {
  color: var(--text-muted);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  white-space: nowrap;
}
body.lang-ar .item .dates { letter-spacing: var(--track-label-ar); font-size: var(--fs-label-ar); }

.item p { color: var(--text-muted); font-size: 0.94rem; margin-top: 6px; }

/* ---------- Skills / chips ---------- */
.skills { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

.skill {
  background: transparent;
  color: var(--text);
  padding: var(--sp-2) var(--sp-5);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  border: 1px solid var(--border);
  transition: border-color 0.15s, color 0.15s;
}
.skill:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Services page ---------- */
.page-head {
  padding: var(--sp-16) var(--sp-7) 44px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.page-head h1 {
  font-family: var(--serif-en);
  font-size: clamp(2.6rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: var(--sp-2) 0 var(--sp-4);
}
body.lang-ar .page-head h1 { font-family: var(--serif-ar); font-weight: 700; letter-spacing: 0; line-height: 1.35; }

.page-head .summary { color: var(--text-muted); max-width: 60ch; font-size: 1.05rem; }

.service-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: var(--sp-7);
  align-items: baseline;
  padding: var(--sp-9) var(--sp-2);
  border-top: 1px solid var(--border);
  transition: background 0.18s;
}
.service-row:last-of-type { border-bottom: 1px solid var(--border); }
.service-row:hover { background: var(--bg-soft); }

.service-row .s-num {
  font-family: var(--serif-en);
  font-style: italic;
  font-weight: 400;
  font-size: 1.5rem;
  color: var(--accent);
}

.service-row h3 {
  font-family: var(--serif-en);
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: var(--sp-2);
}
body.lang-ar .service-row h3 { font-family: var(--serif-ar); font-weight: 700; letter-spacing: 0; }

.service-row p { color: var(--text-muted); font-size: 1rem; line-height: 1.85; max-width: 62ch; }

.services-cta {
  text-align: center;
  padding: var(--sp-6) 0 var(--sp-2);
}
.services-cta .btn { margin-top: var(--sp-4); }
.services-cta p { color: var(--text-muted); font-size: 1.02rem; }

@media (max-width: 760px) {
  .service-row { grid-template-columns: 1fr; gap: 6px; padding: 28px 4px; }
}

/* ---------- Summary / prose blocks ---------- */
.prose p { margin-bottom: var(--sp-4); color: var(--text); font-size: 1.03rem; line-height: 1.85; }
.prose p:last-child { margin-bottom: 0; }

/* ---------- Contact ---------- */
.contact-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--sp-3);
}

.contact-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--sp-4) var(--sp-5);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: border-color 0.15s, background 0.15s;
  direction: ltr;
}
body.lang-ar .contact-links a { flex-direction: row-reverse; }

.contact-links a:hover { border-color: var(--text); background: var(--bg-soft); }

/* ---------- Social links ---------- */
.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: var(--sp-5);
}

.social-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.15s;
}

.social-links a svg { width: 21px; height: 21px; display: block; }
.social-links a img { width: 22px; height: 22px; object-fit: contain; display: block; }

.social-links a:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px);
}

.footer-social { justify-content: center; margin: 0 0 var(--sp-4); }
.footer-social a { width: 40px; height: 40px; }
.footer-social a svg { width: 18px; height: 18px; }
.footer-social a img { width: 19px; height: 19px; }

/* Copy-link button in the article share row — same look as the icon links */
.social-links .copy-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.15s;
}
.social-links .copy-link svg { width: 19px; height: 19px; display: block; }
.social-links .copy-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px);
}
.social-links .copy-link.copied { border-color: var(--accent); color: var(--accent); }

.share-row {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-top: var(--sp-8);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border);
}
.share-row .share-label {
  font-size: var(--fs-label);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--text-muted);
}
body.lang-ar .share-row .share-label {
  font-size: var(--fs-label-ar);
  letter-spacing: var(--track-label-ar);
}
.share-row .social-links { margin-top: 0; }

/* ---------- Contact form ---------- */
.contact-form { max-width: 560px; margin-top: var(--sp-6); }
.contact-form .cf-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}
@media (max-width: 560px) { .contact-form .cf-grid { grid-template-columns: 1fr; } }
.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  box-sizing: border-box;
}
.contact-form textarea { min-height: 120px; resize: vertical; line-height: 1.8; margin-bottom: var(--sp-3); }
.contact-form input::placeholder, .contact-form textarea::placeholder { color: var(--text-muted); }
.contact-form input:focus, .contact-form textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.contact-form button { border-radius: var(--radius-sm); }
.contact-form button:disabled { opacity: 0.6; cursor: wait; }
.contact-msg { margin-top: var(--sp-3); font-size: 0.9rem; min-height: 1.4em; color: var(--text-muted); }

/* ---------- Post cover images ---------- */
.post-card .card-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: var(--sp-4);
  display: block;
}
.article .post-cover {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: var(--sp-6);
  display: block;
}

/* ---------- Newsletter ---------- */
.newsletter-blurb { color: var(--text-muted); max-width: 560px; margin-bottom: var(--sp-5); }

.newsletter-form { display: flex; gap: var(--sp-2); flex-wrap: wrap; max-width: 560px; }

.newsletter-form input[type="email"] {
  flex: 1;
  min-width: 220px;
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font-family: var(--font-en);
  font-size: 0.95rem;
  direction: ltr;
}
.newsletter-form input[type="email"]::placeholder { color: var(--text-muted); }
.newsletter-form input[type="email"]:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.newsletter-form button { border-radius: var(--radius-sm); }
.newsletter-form button:disabled { opacity: 0.6; cursor: wait; }

.newsletter-msg { margin-top: var(--sp-3); font-size: 0.9rem; min-height: 1.4em; color: var(--text-muted); }
.newsletter-msg.ok { color: var(--accent-strong); font-weight: 600; }
.newsletter-msg.err { color: var(--danger); font-weight: 600; }

/* Compact signup box under each article */
.newsletter-cta {
  margin-top: var(--sp-14);
  padding: var(--sp-7);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}
.newsletter-cta h3 { font-size: 1.15rem; margin-bottom: 6px; }
.newsletter-cta p { color: var(--text-muted); font-size: 0.93rem; margin-bottom: var(--sp-4); }

/* ---------- Footer ---------- */
footer {
  border-top: 1px solid var(--border);
  padding: var(--sp-8) 0;
  text-align: center;
  color: var(--text-muted);
  font-size: var(--fs-label);
  letter-spacing: 0.1em;
}

/* ---------- Motion & interaction ---------- */
@media (prefers-reduced-motion: no-preference) {
  @keyframes rise {
    from { opacity: 0; transform: translateY(26px); }
    to { opacity: 1; transform: none; }
  }
  @keyframes ghost-in {
    from { opacity: 0; }
    to { opacity: 1; }
  }
  .hero-index { animation: rise 0.7s 0.05s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .hero h1 { animation: rise 0.8s 0.14s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .motto { animation: rise 0.8s 0.2s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .hero .tagline { animation: rise 0.8s 0.22s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .hero p.summary { animation: rise 0.8s 0.28s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .hero .location { animation: rise 0.8s 0.33s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .hero .actions { animation: rise 0.8s 0.4s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .hero-photo { animation: rise 0.9s 0.2s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .hero-ghost { animation: ghost-in 1.6s 0.1s ease both; }
}

/* Portrait: B&W that comes alive on hover, subtle 3D tilt via JS */
.portrait { transition: filter 0.7s ease; }
.hero-photo:hover .portrait { filter: grayscale(0) contrast(1.02); }
.hero-photo.tilt { transition: transform 0.18s ease-out; will-change: transform; }

/* Scroll-in reveals (initial hidden state is applied BY JS, so content
   is always visible when JS is unavailable) */
.reveal-init {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.reveal-init.in { opacity: 1; transform: none; }

.post-card .read-more { transition: transform 0.25s ease; display: inline-block; }
.post-card:hover .read-more { transform: translateX(4px); }
body.lang-ar .post-card:hover .read-more { transform: translateX(-4px); }

/* ---------- Print (CV page → clean PDF) ---------- */
@media print {
  header, footer, .actions, #lang-toggle, #theme-toggle,
  .hero-photo, .hero-ghost, .social-links,
  .share-row, .contact-form, .contact-msg { display: none !important; }
  section, .hero { padding: 16px 0; min-height: auto; }
  .hero { display: block; }
  body { font-size: 11.5pt; background: #fff; color: #111; }
  .timeline .item { border-color: #ccc; }
  .post-card, .contact-links a { box-shadow: none; }
}

/* ---------- Tablet ---------- */
@media (min-width: 761px) and (max-width: 1100px) {
  .hero { padding: 20px 40px 40px; gap: 28px; }
  .hero-photo.cutout img.portrait { max-height: 62vh; }
  .hero h1 { font-size: clamp(2.6rem, 6.5vw, 4rem); }
  .hero-ghost { font-size: clamp(6rem, 18vw, 14rem); }
}

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 12px 20px 40px;
    min-height: calc(100vh - 118px);
    min-height: calc(100svh - 118px);
    align-content: start;
  }
  .hero-photo { order: -1; height: 62vw; max-height: 400px; }
  .hero.has-cutout { grid-template-columns: 1fr; }
  .hero-photo.cutout { height: auto; justify-content: center; gap: 12px; }
  .hero-photo.cutout img.portrait { max-height: 44vh; max-height: 44svh; }
  .photo-panel { max-width: none; }
  .hero.has-cutout { align-items: start; }
  .hero.has-cutout .hero-text { padding-bottom: 28px; }
  .hero-ghost { display: none; }
  .hero h1 { font-size: clamp(2.5rem, 12vw, 3.4rem); }
  .hero-index { margin-bottom: 12px; }
  .hero .actions { margin-top: 22px; }
  .nav { padding: 12px 20px; }
  .nav ul { gap: 0; }
  .nav ul a { padding: 6px 8px; font-size: 0.7rem; }
  body.lang-ar .nav ul a { font-size: 0.84rem; }
  .post-card { grid-template-columns: 1fr; gap: 8px; padding: 24px 4px; }
  .item .item-head { flex-direction: column; gap: 4px; }
  .item .dates { white-space: normal; }
  section { padding: 52px 0; }
}
