/* Dr. Millad Mikhail — shared styles for the Arabic (/) and English (/en/) pages */

:root {
  --paper: #f5f7f4;
  --surface: #ffffff;
  --mist: #dfe9e4;
  --ink: #18233a;
  --muted: #566274;
  --line: #d6dfda;
  --eucalyptus: #2f6f62;
  --eucalyptus-ink: #ffffff;
  --amber: #b9862a;
  --focus: #2f6f62;

  --body-ar: "IBM Plex Sans Arabic", "IBM Plex Sans", system-ui, sans-serif;
  --body-en: "IBM Plex Sans", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --display-ar: "Noto Naskh Arabic", "Newsreader", Georgia, serif;
  --display-en: "Newsreader", "Noto Naskh Arabic", Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #111a2a;
    --surface: #18233a;
    --mist: #1f3040;
    --ink: #e8ecef;
    --muted: #a3afbd;
    --line: #2a3a4d;
    --eucalyptus: #7fc1b1;
    --eucalyptus-ink: #0f1a24;
    --amber: #e2b35a;
    --focus: #7fc1b1;
  }
}
:root[data-theme="dark"] {
  --paper: #111a2a; --surface: #18233a; --mist: #1f3040; --ink: #e8ecef;
  --muted: #a3afbd; --line: #2a3a4d; --eucalyptus: #7fc1b1; --eucalyptus-ink: #0f1a24;
  --amber: #e2b35a; --focus: #7fc1b1;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.75;
}
html[lang="ar"] body { font-family: var(--body-ar); }
html[lang="en"] body { font-family: var(--body-en); line-height: 1.65; }
:lang(en) { --display: var(--display-en); }
:lang(ar) { --display: var(--display-ar); }

img, svg { display: block; max-width: 100%; }
a { color: inherit; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }

.wrap { width: 100%; max-width: 1080px; margin-inline: auto; padding-inline: 20px; }

/* ---------- top bar ---------- */
.topbar { border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { font-family: var(--display); font-weight: 700; font-size: 18px; text-decoration: none; white-space: nowrap; }
.nav { display: flex; align-items: center; gap: 22px; font-size: 15px; }
.nav a { text-decoration: none; color: var(--muted); }
.nav a:hover { color: var(--ink); }
.nav .lang {
  color: var(--eucalyptus); font-weight: 600;
  border: 1px solid currentColor; border-radius: 999px; padding: 3px 14px;
}
@media (max-width: 760px) { .nav a:not(.lang) { display: none; } }

/* ---------- hero ---------- */
.hero { padding-block: 56px 40px; }
.hero .wrap { display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; }
@media (max-width: 860px) {
  .hero { padding-block: 32px 24px; }
  .hero .wrap { grid-template-columns: 1fr; gap: 28px; }
}

.hero h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(38px, 7vw, 62px);
  line-height: 1.2;
  letter-spacing: -.01em;
}
.alt-name { margin: 8px 0 0; font-family: var(--display); font-weight: 600; font-size: clamp(22px, 4vw, 30px); color: var(--eucalyptus); }
.aka { margin: 10px 0 0; color: var(--muted); font-size: 15px; }
.lead { margin: 26px 0 0; font-size: clamp(19px, 2.4vw, 22px); line-height: 1.7; max-width: 34em; }
.lead strong { font-weight: 600; }
.sublead { margin: 12px 0 0; color: var(--muted); max-width: 36em; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 46px; padding: 10px 18px;
  border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
  font-weight: 500; font-size: 15.5px; text-decoration: none;
}
.btn svg { width: 20px; height: 20px; flex: none; }
.btn:hover { border-color: var(--eucalyptus); }
.btn.primary { background: var(--eucalyptus); border-color: var(--eucalyptus); color: var(--eucalyptus-ink); }

/* hero illustration: the analyst's couch */
.art { position: relative; }
.art-disc { aspect-ratio: 1 / 1; border-radius: 50%; background: var(--mist); display: grid; place-items: center; max-width: 420px; margin-inline: auto; }
.art-disc svg { width: 86%; height: auto; overflow: visible; }
@media (max-width: 860px) { .art-disc { max-width: 280px; } }
.art figcaption { text-align: center; margin-top: 12px; font-size: 14px; color: var(--muted); }
.art figcaption a { color: var(--eucalyptus); text-decoration: none; font-weight: 600; }

.couch path, .couch line { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.couch .accent { stroke: var(--eucalyptus); }
.couch .warm { stroke: var(--amber); }
.couch .floor { stroke: var(--line); stroke-width: 2; }
.couch .draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.8s cubic-bezier(.6,.1,.3,1) forwards; }
.couch .d2 { animation-delay: .5s; }
.couch .d3 { animation-delay: 1s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .couch .draw { animation: none; stroke-dashoffset: 0; }
}

/* ---------- sections ---------- */
.section { padding-block: 56px; border-top: 1px solid var(--line); }
.section-head { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.section-head svg { width: 34px; height: 34px; flex: none; color: var(--eucalyptus); }
.section-head h2 { margin: 0; font-family: var(--display); font-weight: 700; font-size: clamp(26px, 3.4vw, 32px); line-height: 1.3; }
.section-intro { margin: -14px 0 28px; color: var(--muted); max-width: 40em; }

.icon path, .icon circle, .icon rect, .icon line { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* about */
.about-text { max-width: 40em; font-size: 18px; }
.about-text p { margin: 0 0 14px; }
.interests { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 30px 0 0; padding: 0; list-style: none; border-block: 1px solid var(--line); }
.interests li { padding: 20px 18px; border-inline-start: 1px solid var(--line); }
.interests li:first-child { border-inline-start: 0; }
.interests svg { width: 40px; height: 40px; color: var(--eucalyptus); margin-bottom: 10px; }
.interests b { display: block; font-weight: 600; font-size: 16.5px; }
.interests span { display: block; font-size: 14.5px; color: var(--muted); margin-top: 2px; }
@media (max-width: 860px) {
  .interests { grid-template-columns: 1fr 1fr; }
  .interests li:nth-child(3) { border-inline-start: 0; }
  .interests li:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 420px) {
  .interests { grid-template-columns: 1fr; }
  .interests li { border-inline-start: 0; }
  .interests li + li { border-top: 1px solid var(--line); }
}

/* credentials timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 84px 1fr; gap: 20px; padding-block: 18px; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline .year { font-family: var(--display-en); font-weight: 600; font-size: 26px; line-height: 1.2; color: var(--amber); font-variant-numeric: lining-nums; }
.timeline h3 { margin: 0; font-size: 18.5px; font-weight: 600; line-height: 1.5; }
.timeline .inst { margin: 2px 0 0; color: var(--muted); font-size: 15.5px; }
.timeline .meta { margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 8px; font-size: 13.5px; }
.timeline .meta span { padding: 1px 10px; border-radius: 999px; background: var(--mist); }
.timeline .meta .wes { background: transparent; border: 1px solid var(--eucalyptus); color: var(--eucalyptus); }
.timeline li.top h3 { font-family: var(--display); font-size: 22px; font-weight: 700; }
@media (max-width: 520px) { .timeline li { grid-template-columns: 1fr; gap: 4px; } }
.note { margin: 18px 0 0; font-size: 14px; color: var(--muted); }

/* research */
.thesis { border-radius: 14px; padding: 26px; margin-bottom: 16px; background: var(--surface); border: 1px solid var(--line); }
.thesis.doctoral { background: var(--mist); border-color: transparent; padding: 32px; }
.thesis .kind { margin: 0 0 10px; font-size: 14.5px; font-weight: 600; color: var(--eucalyptus); }
.thesis h3 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 21px; line-height: 1.65; max-width: 36em; }
.thesis.doctoral h3 { font-size: clamp(22px, 3vw, 27px); }
.thesis .translated { margin: 12px 0 0; font-family: var(--display-en); font-style: italic; font-size: 16.5px; line-height: 1.55; direction: ltr; text-align: left; max-width: 44em; color: var(--muted); }
html[lang="en"] .thesis .translated { font-family: var(--display-ar); font-style: normal; direction: rtl; text-align: right; margin-inline-start: auto; }
.thesis dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 18px 0 0; font-size: 15px; }
.thesis dt { color: var(--muted); }
.thesis dd { margin: 0; }

.papers-title { margin: 34px 0 12px; font-size: 18px; font-weight: 600; }
.papers { list-style: none; margin: 0; padding: 0; }
.papers li { padding: 14px 0; border-top: 1px solid var(--line); }
.papers b { display: block; font-weight: 600; line-height: 1.6; }
.papers span { display: block; font-size: 14.5px; color: var(--muted); margin-top: 2px; }

/* book */
.book { display: grid; grid-template-columns: 220px 1fr; gap: 40px; align-items: center; }
@media (max-width: 640px) { .book { grid-template-columns: 1fr; gap: 24px; } }
.cover {
  aspect-ratio: 2 / 3; width: 100%; max-width: 220px;
  border-radius: 4px 12px 12px 4px;
  background: var(--eucalyptus); color: var(--eucalyptus-ink);
  padding: 22px 18px; display: flex; flex-direction: column; justify-content: space-between;
  box-shadow: inset 8px 0 0 rgba(0,0,0,.12), 0 18px 34px -20px rgba(24,35,58,.6);
  direction: rtl;
}
.cover .t { font-family: var(--display-ar); font-weight: 700; font-size: 25px; line-height: 1.5; }
.cover svg { width: 64px; height: 64px; color: var(--eucalyptus-ink); opacity: .85; }
.cover .a { font-size: 12.5px; opacity: .85; font-family: var(--body-ar); }
.book h3 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 28px; line-height: 1.4; }
.book .sub { margin: 8px 0 0; color: var(--muted); max-width: 32em; }

/* footer */
.footer { border-top: 1px solid var(--line); padding-block: 36px 48px; font-size: 14.5px; color: var(--muted); }
.footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px; }
.footer .names { color: var(--ink); font-weight: 600; }
.footer ul { list-style: none; display: flex; flex-wrap: wrap; gap: 18px; margin: 0; padding: 0; }
.footer a { color: var(--muted); }
.footer p { margin: 2px 0; }

@media (max-width: 640px) {
  .thesis, .thesis.doctoral { padding: 20px; }
  .thesis dl { grid-template-columns: 1fr; gap: 0; }
  .thesis dd { margin-bottom: 8px; }
}
.art figcaption span { white-space: nowrap; }

/* portrait in hero */
.portrait { margin: 0; }
.portrait picture { display: block; max-width: 400px; margin-inline: auto; aspect-ratio: 1 / 1; border-radius: 50%; padding: 10px; background: var(--mist); box-shadow: 0 0 0 1px var(--line); }
.portrait img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
@media (max-width: 860px) { .portrait picture { max-width: 260px; } }

/* couch illustration next to the about text */
.about-grid { display: grid; grid-template-columns: 1fr 300px; gap: 40px; align-items: center; }
.art-small { margin: 0; }
.art-small .art-disc { max-width: 280px; }
@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; gap: 24px; }
  .art-small .art-disc { max-width: 220px; }
}
@media (max-width: 860px) { .hero .portrait { order: -1; } .portrait picture { max-width: 200px; } }

/* second book (coming soon) */
.book + .book { margin-top: 44px; padding-top: 44px; border-top: 1px solid var(--line); }
.cover-img { display: block; width: 100%; max-width: 220px; }
.cover-img img { width: 100%; height: auto; border-radius: 4px 12px 12px 4px; box-shadow: 0 18px 34px -20px rgba(24,35,58,.6); }
.badge { display: inline-block; margin: 0 0 10px; padding: 2px 12px; border-radius: 999px; background: var(--amber); color: #fff; font-size: 14px; font-weight: 600; }
@media (max-width: 640px) { .cover, .cover-img { max-width: 180px; } }
