/* Mohamed Abouelkhair. Mobile first, one page. */

:root {
  --bg: #faf9f6;
  --fg: #141414;
  --muted: #6b6a66;
  --line: #e4e2dc;
  --card: #ffffff;
  --accent: #b4530a;
  --btn-bg: #141414;
  --btn-fg: #faf9f6;
  --shadow: 0 1px 2px rgba(20, 20, 20, .04), 0 8px 24px rgba(20, 20, 20, .05);
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e10;
    --fg: #ececea;
    --muted: #9b9a95;
    --line: #26262a;
    --card: #141417;
    --accent: #f0b35a;
    --btn-bg: #ececea;
    --btn-fg: #0e0e10;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0e10;
  --fg: #ececea;
  --muted: #9b9a95;
  --line: #26262a;
  --card: #141417;
  --accent: #f0b35a;
  --btn-bg: #ececea;
  --btn-fg: #0e0e10;
  --shadow: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .2s ease, color .2s ease;
}
a { color: inherit; text-decoration: none; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 400; }

/* Layout column */
.top, main, .foot {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
}

/* Top bar */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 20px;
  padding-bottom: 8px;
}
.mark {
  font-family: var(--serif);
  font-style: italic;
  font-size: 28px;
  line-height: 1;
}
.topnav { display: none; gap: 22px; font-size: 15px; color: var(--muted); }
.topnav a:hover { color: var(--fg); }
.theme {
  appearance: none;
  background: none;
  border: 1px solid var(--line);
  color: var(--fg);
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.theme:hover { border-color: var(--muted); }
.theme .moon { display: none; }
:root[data-theme="dark"] .theme .sun { display: none; }
:root[data-theme="dark"] .theme .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme .sun { display: none; }
  :root:not([data-theme="light"]) .theme .moon { display: block; }
}

/* Hero */
.hero { padding: 48px 0 24px; }
.photo {
  width: 92px;
  height: 92px;
  border-radius: 999px;
  object-fit: cover;
  display: block;
  margin-bottom: 28px;
}
.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--muted);
  color: var(--muted);
  font-family: var(--serif);
  font-size: 30px;
  letter-spacing: .02em;
}
h1 {
  font-family: var(--serif);
  font-size: clamp(44px, 11vw, 72px);
  line-height: 1;
  letter-spacing: -.015em;
  margin-bottom: 18px;
}
.line {
  color: var(--muted);
  font-size: 17px;
  max-width: 54ch;
  margin-bottom: 22px;
}
.about {
  font-size: 19px;
  line-height: 1.55;
  max-width: 48ch;
  margin-bottom: 30px;
}

/* Buttons */
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { flex: 0 0 auto; }
.btn {
  display: inline-flex;
  align-items: center;
  height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 15px;
  font-weight: 500;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease, transform .15s ease;
}
.btn:hover { border-color: var(--fg); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--btn-bg);
  color: var(--btn-fg);
  border-color: var(--btn-bg);
}
.btn.primary:hover { opacity: .9; }

/* Sections */
.block {
  padding: 44px 0 8px;
  border-top: 1px solid var(--line);
  margin-top: 32px;
}
h2 {
  font-family: var(--serif);
  font-size: 34px;
  line-height: 1.1;
  margin-bottom: 26px;
  display: flex;
  align-items: baseline;
  gap: 14px;
}
.num {
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: .14em;
  color: var(--muted);
}

/* Cards */
.cards { display: grid; grid-template-columns: 1fr; gap: 14px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 22px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color .15s ease;
}
.card:hover { border-color: var(--muted); }
.card-head, .entry-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
h3 {
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1.1;
}
h3 a { border-bottom: 1px solid transparent; transition: border-color .15s ease; }
h3 a:hover { border-color: var(--accent); color: var(--accent); }
.years {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: .02em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.role {
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-top: -4px;
}
.card p:not(.role) { font-size: 16px; line-height: 1.55; }
.stat { color: var(--muted); }

/* Experience */
.entry { display: flex; flex-direction: column; gap: 8px; max-width: 60ch; }
.entry p { font-size: 16px; }

/* Involvement */
.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
}
.list li:last-child { border-bottom: 0; }
.list-main { line-height: 1.45; }

/* Contact */
.contact .about { margin-bottom: 22px; }

/* Footer */
.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 20px;
  padding-top: 40px;
  padding-bottom: 36px;
  margin-top: 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

/* Larger screens */
@media (min-width: 720px) {
  .top { padding-top: 28px; }
  .topnav { display: flex; }
  .hero { padding: 72px 0 32px; }
  .photo { width: 108px; height: 108px; margin-bottom: 36px; }
  .line { font-size: 18px; }
  .about { font-size: 21px; }
  .block { padding-top: 56px; margin-top: 40px; }
  h2 { font-size: 40px; margin-bottom: 30px; }
  .cards { grid-template-columns: 1fr 1fr; gap: 16px; }
  .card { padding: 26px 26px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
