/* =====================================================================
   haideralzaidi.com — main stylesheet (home + shared parts)
   Pale paper, deep navy ink, one violet accent, rounded shapes.
   Layout uses logical properties, so Arabic (RTL) mirrors automatically.
   ===================================================================== */

:root {
  --paper: #f5f6fa;
  --ink: #01033e;
  --ink-soft: #46496f;
  --violet: #6f5da7;
  --violet-deep: #2b1b5e;
  --mist: #d4d6e2;
  --mist-soft: #e6e8f1;
  --on-dark-soft: #aeb1d6;
  --white: #ffffff;
  --gutter: clamp(16px, 4vw, 56px);
  --sec: clamp(4rem, 9vw, 8rem);
  --radius: 24px;
  --header-h: 72px;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
  --font-display: "Inter Tight", "Inter", sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-arabic: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { overflow-x: clip; scroll-behavior: smooth; scroll-padding-top: var(--header-h); }
body {
  font-family: var(--font-body); background: var(--paper); color: var(--ink);
  font-size: 1.0625rem; line-height: 1.6; overflow-x: clip;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
[dir="rtl"] body { font-family: var(--font-arabic); line-height: 1.9; --font-display: var(--font-arabic); }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
ul, ol { list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; border-radius: 6px; }

.skip-link { position: absolute; inset-inline-start: 1rem; top: -4rem; z-index: 50; background: var(--ink); color: #fff; padding: 0.6rem 1rem; border-radius: 10px; transition: top 0.2s; }
.skip-link:focus { top: 0.75rem; }

.wrap { padding-inline: var(--gutter); }
.display { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.035em; line-height: 0.98; }
[dir="rtl"] .display { letter-spacing: 0; line-height: 1.35; font-weight: 700; }
.h2 { font-size: clamp(2rem, 4.2vw, 3.5rem); }

/* ---------- buttons and links ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem; height: 3rem; padding-inline: 1.4rem; border-radius: 999px; font-weight: 500; white-space: nowrap; transition: background-color 0.25s, color 0.25s, transform 0.25s var(--ease); }
.btn:active { transform: scale(0.97); }
.btn-ink { background: var(--ink); color: #fff; }
.btn-ink:hover { background: var(--violet-deep); }
.btn-violet { background: var(--violet); color: #fff; }
.btn-violet:hover { background: var(--violet-deep); }
.dark .btn-violet:hover { background: #fff; color: var(--ink); }
.btn-text { padding-inline: 1rem; }
.btn-text:hover { color: var(--violet); }
.more { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 500; font-size: 0.95rem; border-block-end: 1px solid currentColor; padding-block-end: 2px; }
.more:hover { color: var(--violet); }

/* ---------- header ---------- */
.header { position: sticky; top: 0; z-index: 20; height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; background: color-mix(in srgb, var(--paper) 88%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: 0.6rem; font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; letter-spacing: -0.02em; white-space: nowrap; }
[dir="rtl"] .brand { letter-spacing: 0; }
.brand i { display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 10px; background: var(--ink); color: #fff; font-style: normal; font-size: 0.9rem; font-weight: 700; letter-spacing: 0; font-family: "Inter Tight", sans-serif; }
.nav { display: flex; gap: clamp(1.2rem, 2.4vw, 2.2rem); color: var(--ink-soft); font-weight: 500; }
.nav a { position: relative; padding-block: 0.4rem; white-space: nowrap; }
.nav a:hover, .nav a[aria-current] { color: var(--ink); }
.nav a[aria-current]::after { content: ""; position: absolute; inset-inline-start: 50%; bottom: -4px; width: 5px; height: 5px; margin-inline-start: -2.5px; border-radius: 50%; background: var(--violet); }
.header-end { display: flex; align-items: center; gap: 1rem; }
.lang { color: var(--ink-soft); font-size: 0.95rem; padding: 0.4rem; }
.lang:hover { color: var(--ink); }
.lang[lang="ar"] { font-family: var(--font-arabic); }
.lang[lang="en"] { font-family: var(--font-body); }
.nav-toggle { display: none; width: 2.75rem; height: 2.75rem; border-radius: 50%; background: var(--white); position: relative; }
.nav-toggle span { position: absolute; inset-inline: 0.8rem; height: 2px; border-radius: 2px; background: var(--ink); transition: transform 0.3s var(--ease), top 0.3s var(--ease); }
.nav-toggle span:nth-child(1) { top: 1.1rem; }
.nav-toggle span:nth-child(2) { top: 1.55rem; }
.nav-toggle.is-open span:nth-child(1) { top: 1.32rem; transform: rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { top: 1.32rem; transform: rotate(-45deg); }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: end; gap: 2rem; padding-block: clamp(2.5rem, 7vh, 5.5rem) 0; min-height: min(calc(100vh - var(--header-h)), 780px); }
.hero-copy { align-self: center; padding-block-end: clamp(2.5rem, 7vh, 5rem); position: relative; z-index: 1; }
.hero h1 { font-weight: inherit; }
.hero h1 .name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.9rem; margin-block-end: clamp(1rem, 2vw, 1.75rem); font-family: var(--font-display); font-weight: 600; font-size: clamp(1.5rem, 2.6vw, 2.4rem); letter-spacing: -0.02em; line-height: 1.3; color: var(--violet-deep); }
.hero h1 .name [lang="ar"] { font-family: var(--font-arabic); letter-spacing: 0; }
.hero h1 .name [lang="en"] { font-family: "Inter Tight", sans-serif; letter-spacing: -0.02em; }
.hero h1 .name span + span { color: var(--ink-soft); font-weight: 500; }
.hero h1 .display { display: block; font-size: clamp(2.75rem, 7vw, 6.9rem); max-width: 11ch; }
[dir="rtl"] .hero h1 .display { font-size: clamp(2.6rem, 6vw, 5.8rem); max-width: 12ch; }
.hero .sub { display: block; margin-block-start: 1.5rem; max-width: 36ch; color: var(--ink-soft); font-size: clamp(1.075rem, 1.4vw, 1.3rem); line-height: 1.5; }
[dir="rtl"] .hero .sub { line-height: 1.8; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-block-start: 2rem; }
.hero-art { position: relative; z-index: 1; align-self: end; }
.hero-art::before { content: ""; position: absolute; inset-inline: 4% 0; inset-block: 14% 0; border-radius: var(--radius); background: var(--mist-soft); }
.hero-art img { position: relative; width: 100%; height: auto; }
.hero-art .chip { position: absolute; inset-inline-start: 0; inset-block-end: 2rem; background: var(--white); border-radius: 14px; padding: 0.7rem 1rem; box-shadow: 0 10px 30px rgba(1, 3, 62, 0.12); line-height: 1.35; }
.hero-art .chip b { display: block; font-family: var(--font-display); font-weight: 600; }
.hero-art .chip span { font-size: 0.85rem; color: var(--ink-soft); }
/* The name in the other language, large and faint behind the hero */

@media (prefers-reduced-motion: no-preference) {
  .rise { animation: rise 1s var(--ease) both; }
  .rise.d1 { animation-delay: 0.12s; }
  .rise.d2 { animation-delay: 0.22s; }
  .rise.d3 { animation-delay: 0.3s; }
}
@keyframes rise { from { opacity: 0; transform: translateY(24px); } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---------- three cards ---------- */
.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(10px, 1.4vw, 20px); padding-block-start: clamp(10px, 1.4vw, 20px); }
.card { position: relative; overflow: hidden; border-radius: var(--radius); aspect-ratio: 16 / 10; color: #fff; display: flex; align-items: flex-end; padding: 1.1rem; transition: transform 0.5s var(--ease); }
.card:hover { transform: translateY(-6px); }
.card svg.art { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; }
.card .tag { position: relative; background: var(--white); color: var(--ink); border-radius: 10px; padding: 0.45rem 0.8rem; font-size: 0.9rem; font-weight: 500; line-height: 1.3; }
[dir="rtl"] .card .tag { line-height: 1.6; }
.card .tag small { display: block; font-size: 0.78rem; color: var(--ink-soft); font-weight: 400; }
.k1 { background: #05061f; }
.k2 { background: var(--ink); }
.k3 { background: var(--violet-deep); }

/* ---------- sections ---------- */
.sec { padding-block: var(--sec); }
.sec-tight { padding-block: var(--sec) 0; }
.head { display: flex; align-items: end; justify-content: space-between; gap: 1rem 2rem; flex-wrap: wrap; margin-block-end: clamp(1.5rem, 3vw, 2.5rem); }

/* ---------- about ---------- */
.about { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 2rem clamp(2rem, 6vw, 6rem); }
.about .lede { font-family: var(--font-display); font-weight: 500; font-size: clamp(1.4rem, 2.5vw, 2.2rem); line-height: 1.25; letter-spacing: -0.02em; text-wrap: pretty; }
[dir="rtl"] .about .lede { line-height: 1.7; letter-spacing: 0; }
.about .body { margin-block: 1.5rem 2rem; color: var(--ink-soft); max-width: 60ch; font-size: 1.125rem; }

/* ---------- what I do (dark) ---------- */
.dark { background: var(--ink); color: #fff; }
.flow { font-family: var(--font-display); font-weight: 500; font-size: clamp(1.6rem, 3.5vw, 3.1rem); line-height: 1.28; letter-spacing: -0.03em; max-width: 26ch; color: var(--on-dark-soft); margin-block-start: clamp(1.5rem, 3vw, 2.5rem); }
[dir="rtl"] .flow { letter-spacing: 0; line-height: 1.75; max-width: 28ch; }
.flow b { font-weight: 600; color: #fff; border-block-end: 2px solid var(--violet); padding-inline: 0.12em; border-radius: 4px 4px 0 0; transition: background-color 0.25s; }
.flow b:hover { background: var(--violet); }
.do-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 2.5rem 4rem; align-items: end; }
.stack { border-block-start: 1px solid rgba(255, 255, 255, 0.18); }
.stack li { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: 1rem; padding-block: 0.9rem; border-block-end: 1px solid rgba(255, 255, 255, 0.18); }
.stack h3 { font-size: 1rem; font-weight: 600; }
.stack p { color: var(--on-dark-soft); font-size: 0.95rem; line-height: 1.55; unicode-bidi: plaintext; }
[dir="rtl"] .stack p { line-height: 1.8; }

/* ---------- what you can expect from me ---------- */
.promises { border-block-start: 1.5px solid var(--ink); }
.promises li { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.035em; line-height: 1.05; font-size: clamp(1.9rem, 4.6vw, 4.2rem); padding-block: clamp(1.1rem, 2.2vw, 1.9rem); border-block-end: 1px solid var(--mist); }
[dir="rtl"] .promises li { letter-spacing: 0; line-height: 1.4; }

/* ---------- experience ---------- */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(10px, 1.2vw, 16px); }
.tile { background: var(--white); border-radius: 20px; padding: 1.4rem; display: flex; flex-direction: column; gap: 0.5rem; min-height: 15rem; transition: transform 0.4s var(--ease), box-shadow 0.4s; }
.posts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); gap: clamp(10px, 1.2vw, 16px); }
.posts .tile { min-height: 12rem; }
.tile:hover { transform: translateY(-4px); box-shadow: 0 18px 40px rgba(1, 3, 62, 0.08); }
.tile time, .tile .when { font-size: 0.88rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.tile h3 { font-family: var(--font-display); font-weight: 600; font-size: 1.35rem; letter-spacing: -0.02em; line-height: 1.15; }
[dir="rtl"] .tile h3 { font-family: "Inter Tight", var(--font-arabic); letter-spacing: 0; line-height: 1.4; }
.tile .role { color: var(--violet); font-weight: 500; font-size: 0.95rem; }
.tile p { margin-block-start: auto; padding-block-start: 0.75rem; color: var(--ink-soft); font-size: 0.95rem; line-height: 1.5; }
[dir="rtl"] .tile p { line-height: 1.8; }

/* ---------- follow chips (also used on the About page) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.chips a { display: inline-flex; align-items: center; gap: 0.6rem; background: var(--white); border-radius: 999px; padding: 0.7rem 1.2rem; font-weight: 500; transition: background-color 0.25s, color 0.25s; }
.chips a::before { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--violet); transition: background-color 0.25s; }
.chips a:hover { background: var(--ink); color: #fff; }
.chips a:hover::before { background: #fff; }

/* ---------- contact footer ---------- */
.contact { border-radius: var(--radius) var(--radius) 0 0; padding-block-start: var(--sec); }
.contact h2 { font-size: clamp(2.75rem, 8vw, 7.5rem); max-width: 12ch; }
.contact .lead { margin-block-start: 1.25rem; max-width: 46ch; color: var(--on-dark-soft); }
.contact-row { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 2rem; margin-block: 2rem 4rem; }
.mail { font-family: "Inter Tight", sans-serif; font-size: clamp(1.2rem, 2.4vw, 1.9rem); font-weight: 500; letter-spacing: -0.02em; direction: ltr; color: var(--on-dark-soft); }
.mail:hover { color: #fff; }
.fine { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 2rem; border-block-start: 1px solid rgba(255, 255, 255, 0.18); padding-block: 1.5rem; color: var(--on-dark-soft); font-size: 0.9rem; }
.fine a { border-block-end: 1px solid currentColor; }
.fine a:hover { color: #fff; }
.fine-end { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }

/* ---------- smaller screens ---------- */
@media (max-width: 1000px) {
  .nav-toggle { display: block; }
  .nav { display: none; position: absolute; top: var(--header-h); inset-inline: 0; flex-direction: column; gap: 0; padding: 0.5rem var(--gutter) 1.25rem; background: var(--paper); box-shadow: 0 24px 40px rgba(1, 3, 62, 0.1); }
  .nav.is-open { display: flex; }
  .nav a { padding-block: 0.9rem; font-size: 1.15rem; border-block-end: 1px solid var(--mist-soft); }
  .nav a[aria-current]::after { inset-inline-start: auto; inset-inline-end: 0.25rem; bottom: 50%; margin: 0 0 -2.5px; }
}
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; min-height: 0; }
  .hero-copy { padding-block-end: 0; }
  .hero-art { max-width: 420px; margin-inline: auto; width: 100%; }
  .trio, .about, .do-grid { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .card { aspect-ratio: 16 / 9; }
}
@media (max-width: 520px) {
  .tiles { grid-template-columns: 1fr; }
  .tile { min-height: 0; }
  .header .btn { display: none; }
  .hero .actions .btn { flex: 1; }
  .stack li { grid-template-columns: 1fr; gap: 0.2rem; }
}

/* Keep the footer at the bottom on short pages */
body { min-height: 100vh; display: flex; flex-direction: column; }
body > main { flex: 1 0 auto; }

/* Dates stay left-to-right inside Arabic text */
time { direction: ltr; unicode-bidi: isolate; }
