:root {
  --bg: #fafafa;
  --fg: #171717;
  --muted: #737373;
  --rule: #e7e7e5;
  --panel: #ffffff;
  --chip: #f0f0ee;
  --thumb: #e4e4e2;
  --col: 600px;
  --radius: 14px;
  --sans: "Inter", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #111111;
  --fg: #fafafa;
  --muted: #a3a3a3;
  --rule: #2a2a28;
  --panel: #171717;
  --chip: #232322;
  --thumb: #262625;
  color-scheme: dark;
}

:root[lang="ar"] { --sans: "IBM Plex Sans Arabic", "Inter", system-ui, sans-serif; }

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s, color 0.25s;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
img { display: block; }

:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; border-radius: 6px; }

.page {
  max-width: var(--col);
  margin: 0 auto;
  padding: 24px 16px 56px;
}

.card {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: 0 0 0 1px var(--rule);
  transition: background-color 0.25s, box-shadow 0.2s;
}

/* ---------- Hero ---------- */
.hero { padding: 24px; }

.hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--chip);
  box-shadow: 0 0 0 1px var(--rule);
  font: 500 24px/1 var(--sans);
  letter-spacing: 0.02em;
  color: var(--muted);
  overflow: hidden;
  flex: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.controls { display: flex; align-items: center; gap: 8px; }

/* Language switch: always LTR so EN sits left, AR right */
.lang {
  direction: ltr;
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border-radius: 12px;
  background: var(--chip);
  box-shadow: inset 0 0 0 1px var(--rule);
}
.lang button {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 40px;
  height: 32px;
  padding: 0;
  border: 0;
  background: none;
  opacity: 0.55;
  transition: opacity 0.2s;
}
.lang button[aria-pressed="true"] { opacity: 1; }
.lang-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 40px;
  height: 32px;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 0 0 1px var(--rule), 0 1px 2px rgba(0, 0, 0, 0.08);
  transition: transform 0.28s cubic-bezier(0.3, 0.7, 0.2, 1);
}
:root[lang="ar"] .lang-thumb { transform: translateX(40px); }

.theme {
  display: grid;
  place-items: center;
  width: 44px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: var(--chip);
  box-shadow: inset 0 0 0 1px var(--rule);
  color: var(--fg);
  transition: transform 0.15s, background-color 0.25s;
}
.theme:active { transform: scale(0.95); }
.theme .i-moon { display: none; }
:root[data-theme="dark"] .theme .i-sun { display: none; }
:root[data-theme="dark"] .theme .i-moon { display: block; }

.name {
  margin: 24px 0 0;
  font-size: 26px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.bio { margin: 8px 0 0; max-width: 48ch; font-size: 16px; line-height: 1.5; }
.meta {
  margin: 12px 0 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px 12px;
  color: var(--muted);
  font-size: 14px;
}
.meta a { transition: color 0.2s; }
.meta a:hover { color: var(--fg); }
.sep { display: none; width: 1px; height: 16px; background: var(--rule); }

/* ---------- Sections ---------- */
.section { margin-top: 28px; }

.label {
  margin: 0 0 12px;
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}
/* hairline that runs out from the label */
.label::after { content: ""; flex: 1; height: 1px; background: var(--rule); align-self: center; }

/* ---------- Contact tiles ---------- */
.tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 132px;
  padding: 16px;
  border: 0;
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 0 0 1px var(--rule);
  text-align: start;
  transition: background-color 0.2s, transform 0.15s;
}
/* Glass icon: gradient body, top sheen, bright rim. No glow */
.tile-icon {
  --c1: #888; --c2: #555;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 10px;
  margin-bottom: auto;
  color: #fff;
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0) 55%),
    linear-gradient(160deg, var(--c1), var(--c2));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    inset 0 0 0 1px rgba(255, 255, 255, 0.2),
    inset 0 -7px 10px -5px rgba(0, 0, 0, 0.2),
    0 1px 2px rgba(0, 0, 0, 0.12);
}
.tile-wa .tile-icon   { --c1: #62e68d; --c2: #1fab55; }
.tile-li .tile-icon   { --c1: #3a8fe0; --c2: #0a58b0; }
.tile-cv .tile-icon   { --c1: #ffb865; --c2: #f26a1b; }
.tile-mail .tile-icon { --c1: #62ccff; --c2: #1b82f0; }
.tile-title { margin-top: 16px; font-size: 15px; font-weight: 600; }
.tile-sub { font-size: 13px; color: var(--muted); }
.arrow { display: inline-block; transition: transform 0.2s; }


@media (hover: hover) {
  .tile:hover { background: var(--chip); }
  .tile-cv:hover .arrow { transform: translateY(2px); }
  .project:hover { background: var(--chip); }
  .project:hover .arrow { transform: translate(2px, -2px); }
}
.tile:active { transform: scale(0.98); }

/* ---------- Projects ---------- */
.list { overflow: hidden; }

.project {
  display: flex;
  gap: 16px;
  padding: 16px;
  transition: background-color 0.2s;
}
.project + .project { border-top: 1px solid var(--rule); }

.thumb {
  flex: none;
  width: 96px;
  height: 96px;
  border-radius: 8px;
  background: var(--thumb);
  box-shadow: 0 0 0 1px var(--rule);
  object-fit: cover;
}

.project-body { min-width: 0; display: flex; flex-direction: column; }
.project-body h3 { margin: 4px 0 0; font-size: 15px; font-weight: 600; }
.project-body p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.visit { margin-top: auto; padding-top: 12px; font-size: 14px; font-weight: 500; }

/* ---------- Footer ---------- */
.foot {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 12px;
}

.license { margin: 0 0 8px; }
.foot-row { display: flex; justify-content: space-between; gap: 4px 16px; flex-wrap: wrap; }
.clock { font-variant-numeric: tabular-nums; }

/* ---------- Blur-in ---------- */
.js [data-reveal] {
  opacity: 0;
  filter: blur(10px);
  transform: translateY(10px);
  transition: opacity 0.7s ease, filter 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1),
    box-shadow 0.2s, background-color 0.25s;
  transition-delay: calc(var(--d, 0) * 80ms), calc(var(--d, 0) * 80ms), calc(var(--d, 0) * 80ms), 0s, 0s;
}
.js [data-reveal].is-in { opacity: 1; filter: none; transform: none; }

/* Once shown, drop the delay so hover feels instant */
.js [data-reveal].is-done { transition-delay: 0s; }

@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1; filter: none; transform: none; transition: none; }
  * { transition-duration: 0.01ms !important; }
}

/* ---------- Larger screens ---------- */
@media (min-width: 560px) {
  .page { padding: 56px 24px 72px; }
  .hero { padding: 28px; }
  .avatar { width: 104px; height: 104px; font-size: 28px; }
  .name { font-size: 30px; }
  .meta { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sep { display: block; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .thumb { width: 120px; height: 120px; }
  .project { padding: 20px; gap: 20px; }
}
