/*
 * helbawi.dev
 *
 * One page, one stylesheet, no script.
 *
 * Wide screens: the opening uses two columns, with the portrait on the left and
 * the name, headline and profile links centred on its height on the right.
 * Everything after it stacks in one column at the reading width.
 * Narrow screens: the portrait and name share a row, then everything stacks.
 */

@font-face {
  font-family: "Archivo";
  src: url("/assets/fonts/archivo.e3a28eade2.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Newsreader";
  src: url("/assets/fonts/newsreader.6e4f2958c3.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --paper: #f3f5f2;
  --ink: #111b2a;
  --ink-soft: #4a5668;
  --rule: #ccd4ce;
  --accent: #1f3bd1;

  --sans: "Archivo", "Arial Nova", Arial, sans-serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;

  --gutter: 1.25rem;
  --portrait: clamp(7rem, 36vw, 12rem);
  --section-gap: clamp(2.5rem, 8vw, 3.25rem);
  /* Space on each side of a hairline between bands. */
  --band-gap: clamp(2rem, 7vw, 2.75rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1826;
    --ink: #e9edf1;
    --ink-soft: #a3aebd;
    --rule: #2a3649;
    --accent: #a9b9ff;
  }
}

@media (min-width: 40rem) {
  :root {
    --gutter: 2.5rem;
  }
}

*,
*::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.6;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
}

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

@media (min-width: 58rem) {
  body {
    font-size: 1.25rem;
  }
}

::selection {
  background: var(--accent);
  color: var(--paper);
}

h1,
h2,
h3,
p,
ul,
figure {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

p {
  /* Avoids a lone last word on its own line where the browser supports it. */
  text-wrap: pretty;
}

a {
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.2em;
  transition: text-underline-offset 160ms ease;
}

a:hover {
  text-decoration-thickness: 0.1em;
  text-underline-offset: 0.3em;
}

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

/* Sans title lines borrow the serif's ampersand; the sans one reads like a numeral. */
.amp {
  font-family: var(--serif);
  font-size: 1.08em;
}

.nowrap {
  white-space: nowrap;
}

/* The shared frame */

.frame {
  display: grid;
  grid-template-columns: var(--portrait) minmax(0, 1fr);
  column-gap: 1.25rem;
  max-width: 42rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

main.frame {
  grid-template-areas:
    "portrait identity"
    "intro intro"
    "find find"
    "rule1 rule1"
    "working working"
    "vision vision"
    "rule2 rule2"
    "experience experience"
    "credentials credentials";
  align-items: start;
  padding-top: clamp(2rem, 7vw, 4rem);
}

main.frame--plain {
  grid-template-areas:
    "identity identity"
    "intro intro"
    "find find"
    "rule1 rule1"
    "working working"
    "vision vision"
    "rule2 rule2"
    "experience experience"
    "credentials credentials";
}

.portrait {
  grid-area: portrait;
  /* Anchors the corner marks. */
  position: relative;
  aspect-ratio: 4 / 5;
}

.identity {
  grid-area: identity;
  align-self: end;
}

.headline {
  grid-area: intro;
  margin-top: clamp(1.5rem, 5vw, 2rem);
}

.find {
  grid-area: find;
  margin-top: clamp(1.25rem, 4vw, 1.5rem);
  /* "Let's connect" at the foot of the page jumps here. */
  scroll-margin-top: 1.5rem;
}

/* The block is a jump target, not a control, so it takes focus without a ring. */
.find:focus-visible {
  outline: none;
}

/* Hairlines between the bands of the page. */
.rule {
  width: 100%;
  height: 0;
  margin: var(--band-gap) 0 0;
  border: 0;
  border-top: 1px solid var(--rule);
}

.rule--1 {
  grid-area: rule1;
}

.rule--2 {
  grid-area: rule2;
}

.working {
  grid-area: working;
  margin-top: var(--band-gap);
}

.vision {
  grid-area: vision;
  margin-top: var(--section-gap);
}

.experience {
  grid-area: experience;
  margin-top: var(--band-gap);
}

.credentials {
  grid-area: credentials;
  margin-top: var(--section-gap);
}

.closing {
  grid-column: 1 / -1;
}

@media (min-width: 58rem) {
  .frame {
    grid-template-columns: minmax(0, 20fr) minmax(0, 38fr);
    column-gap: clamp(3rem, 6vw, 4.5rem);
    max-width: 66rem;
  }

  /*
   * The two flexible rows centre the name, headline and profile links on the
   * portrait. Below the opening every block has its own row, so they stack.
   */
  main.frame {
    --band-gap: 3.25rem;
    grid-template-areas:
      "portrait ."
      "portrait identity"
      "portrait intro"
      "portrait find"
      "portrait ."
      "rule1 rule1"
      "working working"
      "vision vision"
      "rule2 rule2"
      "experience experience"
      "credentials credentials";
    grid-template-rows: minmax(0, 1fr) auto auto auto minmax(0, 1fr);
    padding-top: clamp(3.5rem, 10vh, 6rem);
  }

  main.frame--plain {
    grid-template-areas:
      ". identity"
      ". intro"
      ". find"
      "rule1 rule1"
      "working working"
      "vision vision"
      "rule2 rule2"
      "experience experience"
      "credentials credentials";
    grid-template-rows: auto;
  }

  .identity {
    align-self: start;
  }

  .headline {
    margin-top: 1.5rem;
  }

  /* The stacked blocks keep the reading width they have on narrower screens. */
  .working,
  .vision,
  .experience,
  .credentials {
    max-width: 37rem;
  }
}

/* Portrait */

.portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Viewfinder corners: a small nod to the work, and the page's only ornament. */
.tick {
  position: absolute;
  width: 0.875rem;
  height: 0.875rem;
  border: 0 solid var(--ink);
}

.tick--tl {
  top: -0.5rem;
  left: -0.5rem;
  border-top-width: 1.5px;
  border-left-width: 1.5px;
  --from: -0.625rem, -0.625rem;
}

.tick--tr {
  top: -0.5rem;
  right: -0.5rem;
  border-top-width: 1.5px;
  border-right-width: 1.5px;
  --from: 0.625rem, -0.625rem;
}

.tick--bl {
  bottom: -0.5rem;
  left: -0.5rem;
  border-bottom-width: 1.5px;
  border-left-width: 1.5px;
  --from: -0.625rem, 0.625rem;
}

.tick--br {
  right: -0.5rem;
  bottom: -0.5rem;
  border-right-width: 1.5px;
  border-bottom-width: 1.5px;
  --from: 0.625rem, 0.625rem;
}

@media (min-width: 58rem) {
  .tick {
    width: 1.25rem;
    height: 1.25rem;
  }

  .tick--tl,
  .tick--tr {
    top: -0.75rem;
  }

  .tick--bl,
  .tick--br {
    bottom: -0.75rem;
  }

  .tick--tl,
  .tick--bl {
    left: -0.75rem;
  }

  .tick--tr,
  .tick--br {
    right: -0.75rem;
  }
}

/* Name and role */

.name {
  font-family: var(--sans);
  font-size: clamp(1.25rem, 5.4vw, 1.75rem);
  font-weight: 620;
  font-stretch: 106%;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.role {
  margin-top: 0.45rem;
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 0.9375rem;
  line-height: 1.4;
}

@media (min-width: 58rem) {
  .name {
    font-size: 1.75rem;
  }

  .role {
    font-size: 1rem;
  }
}

/* Headline */

.headline {
  font-size: clamp(1.75rem, 7.4vw, 2.5rem);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.018em;
  text-wrap: balance;
}

@media (min-width: 58rem) {
  .headline {
    font-size: clamp(2.125rem, 3.1vw, 2.625rem);
  }
}

/* Sections */

.section-title {
  font-family: var(--sans);
  font-size: 1.0625rem;
  font-weight: 620;
  line-height: 1.3;
  letter-spacing: -0.005em;
}

.section-title + p {
  margin-top: 0.7rem;
}

/* Vision: the statement is set larger, a sentence to a line, with its paragraph directly beneath. */

.vision-line {
  font-size: clamp(1.625rem, 6.8vw, 2rem);
  line-height: 1.14;
  letter-spacing: -0.016em;
}

.section-title + .vision-line {
  margin-top: 0.8rem;
}

.vision-line span {
  display: block;
  text-wrap: balance;
}

.vision-text {
  margin-top: 1rem;
}

@media (min-width: 58rem) {
  .vision-line {
    font-size: clamp(1.75rem, 2.4vw, 2.125rem);
  }
}

/* Experience */

.post {
  margin-top: 0.8rem;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 540;
  line-height: 1.4;
}

.post + p {
  margin-top: 0.5rem;
}

.experience p + p {
  margin-top: 1.1em;
}

/* Credentials */

.credential-list {
  margin-top: 0.9rem;
}

.credential-list li + li {
  margin-top: 0.85rem;
}

.credential-name {
  display: block;
  line-height: 1.3;
}

.credential-provider {
  display: block;
  margin-top: 0.2rem;
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 0.875rem;
  line-height: 1.4;
}

.more {
  margin-top: 0.6rem;
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 500;
}

.more a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
}

@media (min-width: 58rem) {
  /* In the narrow left column the titles read a step quieter than the paragraphs beside them. */
  .credential-name {
    font-size: 1.125rem;
  }
}

/* Profile links */

.find-label {
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 0.9375rem;
  line-height: 1.4;
}

.profiles {
  display: flex;
  flex-wrap: wrap;
  column-gap: clamp(1.25rem, 6vw, 2rem);
  margin-top: 0.125rem;
}

/* Each link is at least 44px tall and wide, so it is easy to hit on a phone. */
.profile {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 2.75rem;
  min-height: 2.75rem;
  /* Side padding gives the focus ring room; the negative margin keeps the logo on the text edge. */
  margin-inline: -0.5rem;
  padding-inline: 0.5rem;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 520;
  text-decoration-line: none;
  transition: color 160ms ease;
}

.profile svg {
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
  fill: currentColor;
}

.profile span {
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--rule);
  text-underline-offset: 0.35em;
  transition: text-decoration-color 160ms ease;
}

.profile:hover,
.profile:focus-visible {
  color: var(--accent);
}

/* Drawn inside the tall tap target so the ring hugs the logo and name. */
.profile:focus-visible {
  outline-offset: -4px;
}

.profile:hover span,
.profile:focus-visible span {
  text-decoration-color: currentColor;
}

/* Footer */

.closing {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 2rem;
  margin-top: var(--band-gap);
  padding-block: 1rem 2.5rem;
  border-top: 1px solid var(--rule);
}

.lets-connect {
  font-size: clamp(1.25rem, 5vw, 1.5rem);
  line-height: 1.2;
}

.lets-connect a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
}

.colophon {
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 0.875rem;
}

@media (min-width: 58rem) {
  .closing {
    --band-gap: 3.25rem;
  }
}

/* One load sequence: the corners settle onto the portrait as the opening arrives. */

@media (prefers-reduced-motion: no-preference) {
  /* "Let's connect" glides back up to the profile links. */
  html {
    scroll-behavior: smooth;
  }

  .tick {
    animation: settle 900ms cubic-bezier(0.2, 0.7, 0.2, 1) 200ms both;
  }

  .portrait img,
  .identity,
  .headline,
  .find {
    animation: arrive 600ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }

  .identity {
    animation-delay: 80ms;
  }

  .headline {
    animation-delay: 160ms;
  }

  .find {
    animation-delay: 240ms;
  }
}

@keyframes settle {
  from {
    opacity: 0;
    transform: translate(var(--from));
  }
}

@keyframes arrive {
  from {
    opacity: 0;
    transform: translateY(0.4rem);
  }
}

/* 404 */

.not-found {
  max-width: 42rem;
  margin-inline: auto;
  padding: 22vh var(--gutter);
}

.not-found > * + * {
  margin-top: 1.5rem;
}

@media print {
  .tick {
    display: none;
  }
}
