/* ---------------------------------------------------------------
   Adham Al-Arar — portfolio

   Concept: Otl Aicher's Munich 1972 pictograms reduced a person to
   points joined by segments on a 90/45 degree grid. MediaPipe pose
   landmarks do the same thing fifty years later. The site is built
   in that system: flat colour fields, a strict grid, no shadows,
   and a landmark figure as the only ornament.

   Type: Archivo variable (weight + width), served from this domain,
   so no third-party font request leaves the visitor's browser.
   --------------------------------------------------------------- */

@font-face {
  font-family: "Archivo";
  src: url("font/archivo-latin.woff2") format("woff2-variations");
  font-weight: 400 700;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;

  --paper:  #efefec;
  --panel:  #ffffff;
  --ink:    #000000;
  --ink-2:  #4a4e54;
  --rule:   #d6d6d0;
  --field:  #121316;

  --interface:  #0b6fb8;
  --perception: #5b4599;
  --services:   #3e7b27;
  --infra:      #d24b00;

  --sans: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  --gap: clamp(1rem, 2.2vw, 1.5rem);
  --bleed: clamp(1.1rem, 4vw, 2.5rem);
}

/* The dark palette, written twice on purpose: once for the OS preference
   (which also covers visitors without JavaScript, where the toggle is
   hidden) and once for an explicit pick of dark. Keep the two in sync. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --paper:  #121316;
    --panel:  #1b1d21;
    --ink:    #f7f7f5;
    --ink-2:  #a7abb2;
    --rule:   #32353a;
    --field:  #000000;

    --interface:  #4ea8e8;
    --perception: #a78bde;
    --services:   #6cb84a;
    --infra:      #ff7a3d;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --paper:  #121316;
  --panel:  #1b1d21;
  --ink:    #f7f7f5;
  --ink-2:  #a7abb2;
  --rule:   #32353a;
  --field:  #000000;

  --interface:  #4ea8e8;
  --perception: #a78bde;
  --services:   #6cb84a;
  --infra:      #ff7a3d;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  font-variation-settings: "wdth" 100;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

p, h1, h2, h3, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; }

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

.skip { position: absolute; left: -9999px; }
.skip:focus {
  left: var(--bleed); top: .75rem; z-index: 2;
  background: var(--ink); color: var(--paper); padding: .6rem 1rem;
}

.page {
  width: min(100%, 74rem);
  margin-inline: auto;
  padding-inline: var(--bleed);
}

/* ---------------- type scale ---------------- */

.name {
  font-size: clamp(2.9rem, 9.5vw, 6rem);
  font-variation-settings: "wdth" 115;
  font-weight: 600;
  line-height: .9;
  letter-spacing: -.035em;
}
/* the surname must never break at its hyphen */
.name span { white-space: nowrap; }

.lede {
  margin-top: 1.25rem;
  max-width: 34ch;
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
  line-height: 1.5;
  color: var(--ink-2);
}

.heading {
  font-size: clamp(1.7rem, 3.6vw, 2.6rem);
  font-variation-settings: "wdth" 108;
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: -.03em;
  max-width: 22ch;
}

.sub {
  margin-top: .6rem;
  max-width: 46ch;
  font-size: .9375rem;
  color: var(--ink-2);
}

.prose { max-width: 64ch; color: var(--ink-2); }

.data {
  font-size: .75rem;
  font-variation-settings: "wdth" 88;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--ink-2);
}

/* ---------------- top bar ---------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.1rem;
}

.mark {
  font-size: .8125rem;
  font-variation-settings: "wdth" 88;
  font-weight: 600;
  text-decoration: none;
}
.mark::before {
  content: "";
  display: inline-block;
  width: 9px; height: 9px;
  margin-right: .5rem;
  background: var(--services);
  vertical-align: baseline;
}

.tools { display: flex; align-items: center; gap: .6rem; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font: inherit;
  font-size: .8125rem;
  font-variation-settings: "wdth" 88;
  font-weight: 600;
  padding: .35rem .8rem;
  background: none;
  border: 1px solid var(--rule);
  color: var(--ink-2);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink); }
/* The markup ships it hidden and the script unhides it. */
.theme-toggle[hidden] { display: none; }
.theme-icon { display: inline-flex; }

.vh {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.lang { display: flex; }
.lang button {
  font: inherit;
  font-size: .8125rem;
  font-variation-settings: "wdth" 88;
  font-weight: 600;
  padding: .35rem .8rem;
  background: none;
  border: 1px solid var(--rule);
  color: var(--ink-2);
  cursor: pointer;
}
.lang button + button { border-left: 0; }
.lang button[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

/* ---------------- hero ---------------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: var(--gap);
  align-items: end;
  padding-top: clamp(1.5rem, 5vw, 3.5rem);
  padding-bottom: clamp(1.5rem, 4vw, 2.5rem);
  border-top: 2px solid var(--ink);
}

.hero-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.75rem; }

.figure { justify-self: end; width: min(100%, 20rem); }

/* ---------------- availability band ---------------- */

.band {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--field);
  color: #fff;
}

.band > div {
  padding: 1.15rem clamp(1rem, 2vw, 1.4rem) 1.3rem;
  border-left: 1px solid rgba(255, 255, 255, .17);
}
.band > div:first-child { border-left: 0; }

.band .data { color: rgba(255, 255, 255, .62); }
.band strong {
  display: block;
  margin-top: .3rem;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.3;
}
.band .live { color: #6cd44a; }

/* ---------------- buttons ---------------- */

.btn {
  font: inherit;
  font-size: .9375rem;
  font-weight: 600;
  padding: .7rem 1.3rem;
  border: 2px solid var(--ink);
  background: none;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 150ms, color 150ms;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn.solid { background: var(--ink); color: var(--paper); }
.btn.solid:hover { background: var(--interface); border-color: var(--interface); color: #fff; }

/* ---------------- sections ---------------- */

.strip { padding-block: clamp(3rem, 7vw, 5rem); }
.strip + .strip { border-top: 1px solid var(--rule); }

.strip-head { margin-bottom: clamp(1.5rem, 3vw, 2.25rem); }

.about {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: var(--gap) clamp(2rem, 6vw, 4.5rem);
  align-items: start;
}
.about .prose { font-size: 1.0625rem; }

/* ---------------- stack layers ---------------- */

.layers { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); }

.layer {
  display: flex;
  flex-direction: column;
  gap: .55rem;
  min-height: 9.5rem;
  padding: 1.1rem 1.2rem 1.25rem;
  text-align: left;
  font: inherit;
  background: var(--panel);
  color: var(--ink);
  border: 0;
  border-top: 6px solid var(--tint);
  cursor: pointer;
  transition: background-color 150ms, color 150ms;
}
.layer[data-layer="interface"]  { --tint: var(--interface); }
.layer[data-layer="perception"] { --tint: var(--perception); }
.layer[data-layer="services"]   { --tint: var(--services); }
.layer[data-layer="infra"]      { --tint: var(--infra); }

.layer-name {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -.01em;
}
.layer-tech { font-size: .875rem; line-height: 1.45; color: var(--ink-2); }
.layer-count { margin-top: auto; }

.layer:hover:not(:disabled) { background: var(--tint); color: #fff; }
.layer:hover:not(:disabled) .layer-tech,
.layer:hover:not(:disabled) .data { color: rgba(255, 255, 255, .78); }

.layer[aria-pressed="true"] { background: var(--tint); color: #fff; }
.layer[aria-pressed="true"] .layer-tech,
.layer[aria-pressed="true"] .data { color: rgba(255, 255, 255, .78); }

.layer:disabled { cursor: default; opacity: .72; }

/* ---------------- work ---------------- */

.filterbar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.clear {
  font: inherit;
  font-size: .8125rem;
  font-weight: 600;
  padding: .25rem .75rem;
  border: 1px solid var(--rule);
  background: none;
  color: var(--ink);
  cursor: pointer;
}
.clear:hover { border-color: var(--ink); }

.work { border-top: 1px solid var(--rule); }

.project {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr) 10rem;
  gap: clamp(1rem, 3vw, 2.5rem);
  padding-block: 1.9rem;
  border-bottom: 1px solid var(--rule);
}

.project h3 {
  font-size: 1.35rem;
  font-variation-settings: "wdth" 104;
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.15;
}
.project .meta { margin-top: .45rem; }
.project .prose { font-size: .9688rem; }
.project .built { margin-top: .7rem; font-size: .875rem; color: var(--ink-2); }

.edge { display: flex; align-items: center; gap: 0; margin-top: .25rem; }
.edge i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }
.edge i.off { background: var(--rule); }
.edge s { flex: 1; height: 1px; background: var(--rule); display: block; }

.empty { padding-block: 2.5rem; color: var(--ink-2); }

/* ---------------- tabular history ---------------- */

.entry {
  display: grid;
  grid-template-columns: 9rem 15rem minmax(0, 1fr);
  gap: clamp(.75rem, 3vw, 2.5rem);
  padding-block: 1.5rem;
  border-bottom: 1px solid var(--rule);
}
.history { border-top: 1px solid var(--rule); }
.entry .who { font-size: 1.0625rem; font-weight: 600; letter-spacing: -.01em; }
.entry .role { margin-top: .2rem; font-size: .9375rem; color: var(--ink-2); }
.entry .prose { font-size: .9375rem; }
.entry .when { padding-top: .2rem; }

/* ---------------- volunteering ---------------- */

.helped { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.helped li { padding-top: .9rem; border-top: 3px solid var(--rule); }
.helped strong { display: block; margin-top: .35rem; font-size: 1rem; font-weight: 600; }
.helped p { margin-top: .3rem; font-size: .875rem; color: var(--ink-2); }

/* ---------------- contact ---------------- */

.contact {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: var(--gap) clamp(2rem, 6vw, 4rem);
  align-items: end;
  padding: clamp(1.75rem, 4vw, 2.75rem);
  background: var(--field);
  color: #fff;
}
.contact .heading { max-width: 16ch; }
.contact .data { color: rgba(255, 255, 255, .62); }
.contact .btn { border-color: #fff; color: #fff; }
.contact .btn:hover { background: #fff; color: var(--field); }
.contact .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-top: 1.5rem; }

.elsewhere li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .6rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, .17);
  font-size: .9375rem;
}
.elsewhere a { font-weight: 600; text-decoration: none; }
.elsewhere a:hover { text-decoration: underline; text-underline-offset: 3px; }
.elsewhere span { color: rgba(255, 255, 255, .62); }

/* ---------------- footer ---------------- */

footer { padding: 2rem 0 2.5rem; }
footer p { font-size: .8125rem; color: var(--ink-2); }
footer p + p { margin-top: .25rem; }

/* ---------------- landmark figure ---------------- */

.fig { display: block; width: 100%; height: auto; overflow: visible; }
.fig .bone { fill: none; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.fig .joint { stroke: none; }
.fig .ground { stroke: var(--infra); stroke-width: 2; opacity: .45; }
.fig [data-part="perception"] { stroke: var(--perception); fill: var(--perception); }
.fig [data-part="interface"]  { stroke: var(--interface); fill: var(--interface); }
.fig [data-part="services"]   { stroke: var(--services);  fill: var(--services); }
.fig [data-part="infra"]      { stroke: var(--infra);     fill: var(--infra); }
.fig g { transition: opacity 250ms; }
/* the dim rule ties on specificity with the lit ones, so it has to come first */
.fig[data-active] [data-part] { opacity: .14; }
.fig[data-active="interface"]  [data-part="interface"],
.fig[data-active="perception"] [data-part="perception"],
.fig[data-active="services"]   [data-part="services"],
.fig[data-active="infra"]      [data-part="infra"] { opacity: 1; }

/* the single piece of motion on the page: the figure assembles once */
.js .fig .bone { stroke-dasharray: 1; stroke-dashoffset: 1; }
.js .fig .joint { transform: scale(0); transform-origin: center; transform-box: fill-box; }
.js .fig.drawn .bone { animation: draw .9s cubic-bezier(.65, 0, .35, 1) forwards; }
.js .fig.drawn .joint { animation: pop .35s cubic-bezier(.34, 1.56, .64, 1) forwards; }

@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop  { to { transform: scale(1); } }

/* ---------------- responsive ---------------- */

@media (max-width: 64rem) {
  .layers, .helped { grid-template-columns: repeat(2, 1fr); }
  .project { grid-template-columns: 7rem minmax(0, 1fr); }
  .project .side { grid-column: 1 / -1; }
  .entry { grid-template-columns: 8rem minmax(0, 1fr); }
  .entry .prose { grid-column: 2; }
}

@media (max-width: 48rem) {
  .hero { grid-template-columns: 1fr; align-items: start; }
  .figure { justify-self: start; width: min(60%, 13rem); order: -1; }
  .band { grid-template-columns: repeat(2, 1fr); }
  .band > div:nth-child(3) { border-left: 0; }
  .band > div:nth-child(n+3) { border-top: 1px solid rgba(255, 255, 255, .17); }
  .about, .contact { grid-template-columns: 1fr; }
  .contact { align-items: start; }
}

@media (max-width: 34rem) {
  .layers, .helped { grid-template-columns: 1fr; }
  .project, .entry { grid-template-columns: 1fr; gap: .5rem; }
  .project .side, .entry .prose { grid-column: auto; }
  .band { grid-template-columns: 1fr; }
  .band > div { border-left: 0; }
  .band > div + div { border-top: 1px solid rgba(255, 255, 255, .17); }
  /* icon only; the word stays for screen readers */
  .theme-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .fig .bone { stroke-dashoffset: 0; }
  .js .fig .joint { transform: none; }
}
