/* hamedmalek.com: the styles every page needs, and the home page. Other pages add pages.css.
   One typeface, one accent colour.
   The accent marks measured figures and nothing else, so links stay in ink. */

@font-face {
  font-family: "Charis SIL";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: local("Charis SIL"), url("/fonts/charis-sil-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Charis SIL";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: local("Charis SIL Italic"), url("/fonts/charis-sil-latin-400-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Charis SIL";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: local("Charis SIL Bold"), url("/fonts/charis-sil-latin-700-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Charis SIL";
  font-style: italic;
  font-weight: 700;
  font-display: swap;
  src: local("Charis SIL Bold Italic"), url("/fonts/charis-sil-latin-700-italic.woff2") format("woff2");
}

:root {
  color-scheme: light dark;
  --paper: #ffffff;
  --ink: #1b1c1e;
  --quiet: #5f636a;
  --rule: #dcdee1;
  --wash: #f4f4f2;
  --measure: #a4122e;
  --string: #2c5b4c;
  /* Charter ships with Apple devices. Everyone else downloads Charis SIL, the open version. */
  --serif: Charter, "Bitstream Charter", "Charis SIL", "Sitka Text", Cambria, Georgia, serif;
  /* The statement on the home page only: the device's own sans-serif, which has a light weight and costs
     no download (SF on Apple, Segoe UI on Windows, Roboto on Android). */
  --display: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --side: 11rem;
  --gap: 2.5rem;
  --text: 38rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #17191c;
    --ink: #e8e6e1;
    --quiet: #a2a6ac;
    --rule: #383c42;
    --wash: #202328;
    --measure: #ff9a94;
    --string: #9fd0bb;
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.55;
  font-kerning: normal;
  font-variant-numeric: lining-nums;
}

@media (min-width: 52rem) {
  body {
    font-size: 1.1875rem;
  }
}

.page {
  max-width: 66rem;
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 3.5rem);
  padding-bottom: clamp(1rem, 4vh, 4.5rem);
}

p,
ul,
ol,
blockquote,
pre,
table,
figure {
  margin: 0 0 1em;
}

p {
  text-wrap: pretty;
}

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-color: var(--quiet);
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-color: currentColor;
  text-decoration-thickness: 0.11em;
}

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

::selection {
  background: color-mix(in srgb, var(--measure) 20%, transparent);
}

.measured {
  color: var(--measure);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: -100rem;
  top: 0.5rem;
  padding: 0.4rem 0.8rem;
  background: var(--paper);
}

.skip:focus {
  left: 0.5rem;
}

/* Site header and footer */

.site-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-top: clamp(1.5rem, 4vw, 2.5rem);
}

.wordmark {
  margin: 0;
  font-size: 1.05em;
  font-weight: 700;
  line-height: 1.3;
}

.wordmark a,
.site-nav a {
  text-decoration-line: none;
}

.site-nav {
  display: flex;
  gap: 1.75rem;
}

/* Email, LinkedIn and YouTube, as icons beside the name. */
.identity {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
}

.social {
  display: flex;
  gap: 0.9rem;
  margin: 0;
}

.social a {
  display: block;
  width: 1.15rem;
  height: 1.15rem;
  background: var(--quiet);
  -webkit-mask: var(--glyph) center / contain no-repeat;
  mask: var(--glyph) center / contain no-repeat;
}

.social a:hover {
  background: var(--ink);
}

.social .mail { --glyph: url("/icons/mail.svg"); }
.social .linkedin { --glyph: url("/icons/linkedin.svg"); }
.social .youtube { --glyph: url("/icons/youtube.svg"); }

/* On a phone the name, the icons and the menu share one line. */
@media (max-width: 30rem) {
  .site-head {
    column-gap: 1rem;
  }

  .wordmark {
    font-size: 1em;
  }

  .identity {
    column-gap: 0.8rem;
  }

  .social {
    gap: 0.65rem;
  }

  .social a {
    width: 1.05rem;
    height: 1.05rem;
  }

  .site-nav {
    gap: 1rem;
  }
}

.site-nav a:hover,
.site-nav a[aria-current] {
  text-decoration-line: underline;
}

/* Home page. Spaced by the screen's height, so that it fits on one laptop screen without scrolling. */

/* The statement, with the photo beside it (above it on a phone). */
.intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem 2.5rem;
  /* As wide as the text below, so the photo lines up with its right edge. */
  max-width: 50rem;
  margin-block: clamp(1.75rem, 7vh, 6rem) clamp(1.75rem, 6vh, 5rem);
}

.intro > p {
  flex: none;
  margin: 0;
}

.portrait {
  display: block;
  width: clamp(4.5rem, 2.5rem + 7vw, 10rem);
  height: auto;
  border-radius: 20%;
}

@media (max-width: 40rem) {
  .intro {
    flex-direction: column-reverse;
    align-items: flex-start;
  }
}

/* Light text, with the words that matter in a heavy weight (the user, 19 Nov 2026). */
.statement {
  max-width: 27ch;
  font-family: var(--display);
  font-size: clamp(2rem, 1.1rem + 3.7vw, 3.5rem);
  font-weight: 300;
  line-height: 1.12;
  letter-spacing: -0.022em;
  text-wrap: balance;
}

.statement strong {
  font-weight: 600;
}

.statement p {
  margin: 0;
  text-wrap: inherit;
}

/* Each row has an icon in place of a word. The heading text stays in the page for screen readers,
   pushed out of its box; the icon is drawn from a file in /icons/, in the page's own colour. */

.kind-home main > section {
  display: grid;
  grid-template-columns: var(--icon) minmax(0, 1fr);
  column-gap: 1.1rem;
  align-items: start;
  margin-bottom: clamp(0.85rem, 2.6vh, 2rem);
  --icon: 1.3rem;
}

.kind-home main > section:last-child {
  margin-bottom: 0;
}

.kind-home main > section > h2 {
  grid-column: 1;
  grid-row: 1;
  position: relative;
  width: var(--icon);
  height: var(--icon);
  /* Centre the icon on the first line of text: 1.55em is the line's height. */
  margin: calc((1.55em - var(--icon)) / 2) 0 0;
  overflow: hidden;
  font-size: 1em;
  white-space: nowrap;
  text-indent: 200%;
}

.kind-home main > section > h2::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--quiet);
  -webkit-mask: var(--glyph) center / contain no-repeat;
  mask: var(--glyph) center / contain no-repeat;
}

#research { --glyph: url("/icons/research.svg"); }
#work { --glyph: url("/icons/work.svg"); }
#leadership { --glyph: url("/icons/leadership.svg"); }

.kind-home main > section > :not(h2) {
  grid-column: 2;
  max-width: 50rem;
  margin-bottom: 0.4em;
}

.kind-home main > section > :last-child {
  margin-bottom: 0;
}

/* The links here are two or three words; keep each on one line. */
.kind-home main > section a {
  white-space: nowrap;
}

/* On wide screens the icons hang in the margin, so the text lines up with the statement above it. */
@media (min-width: 64rem) {
  .kind-home main > section {
    margin-left: calc(-1 * (var(--icon) + 1.1rem));
  }
}

@media print {
  .skip,
  .site-nav {
    display: none;
  }

  body {
    font-size: 10.5pt;
  }

  a {
    text-decoration-line: none;
  }
}
