/*
 * maikelvlasman.com
 *
 * Nordic dusk, set like an editorial: the sunset cover sets the mood, the
 * accent is the sun. Every colour below comes from the site's original
 * palette; only the composition and typography changed.
 */

/* Fonts ------------------------------------------------------------------ */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("./fonts/bricolage-grotesque.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

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

@font-face {
  font-family: "Newsreader";
  src: url("./fonts/newsreader-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* Tokens ----------------------------------------------------------------- */

:root {
  /* Original palette */
  --white: #fff;
  --black: #000;
  --ink: #222426;
  --graphite: #3b3d40;
  --stone: #73777d;
  --mist: #909499;
  --haze: #e1e3e6;
  --paper: #eee;
  --sun: #d95736;
  --sun-deep: #bf4526;
  --glow: #ffc336;

  /* Roles, light scheme */
  --bg: var(--white);
  --text: var(--ink);
  --heading: var(--black);
  --muted: var(--stone);
  --line: var(--haze);
  --band-work: var(--ink);

  --font-sans: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --font-serif: "Newsreader", ui-serif, Georgia, serif;

  --wrap: 75rem;
  --gutter: clamp(1.25rem, 5vw, 3rem);
  --section-space: clamp(5rem, 12vw, 10rem);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--ink);
    --text: var(--haze);
    --heading: var(--white);
    --muted: var(--mist);
    --line: var(--graphite);
    --band-work: var(--black);
  }
}

/* Base ------------------------------------------------------------------- */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

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

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

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible {
  outline: 2px solid var(--sun);
  outline-offset: 4px;
  border-radius: 2px;
}

::selection {
  background: var(--sun);
  color: var(--white);
}

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Shared pieces ---------------------------------------------------------- */

.section-title {
  color: var(--heading);
  font-size: clamp(1.75rem, 3.2vw, 2.75rem);
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.section {
  padding-block: var(--section-space);
}

/* Hero ------------------------------------------------------------------- */

.hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: min(100vh, 62rem);
  min-height: min(100svh, 62rem);
  overflow: hidden;
  background: var(--black);
  color: var(--white);
  isolation: isolate;
}

.hero__photo {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  /* Keeps the island of pines in frame on narrow screens. */
  object-position: 30% 55%;
  animation: hero-settle 2.8s var(--ease-out) both;
}

/* Legibility gradient plus a faint film grain over the photo. */
.hero::before,
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.hero::before {
  background:
    linear-gradient(to top, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.42) 34%, rgba(0, 0, 0, 0) 68%),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0) 22%);
}

.hero::after {
  opacity: 0.09;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.hero__inner {
  display: grid;
  justify-items: start;
  gap: clamp(1.25rem, 2.4vw, 2rem);
  padding-block: clamp(4rem, 9vw, 7.5rem) clamp(3rem, 7vw, 6rem);
}

.hero__avatar {
  width: clamp(4.5rem, 7vw, 6rem);
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 2px var(--white), 0 0.75rem 2.5rem rgba(0, 0, 0, 0.333);
  animation: rise 1.1s var(--ease-out) 0.35s both;
}

.hero__name {
  display: flex;
  flex-wrap: wrap;
  column-gap: 0.22em;
  font-size: clamp(4rem, 12.5vw, 11.5rem);
  font-weight: 700;
  line-height: 0.86;
  letter-spacing: -0.032em;
  font-variation-settings: "opsz" 96;
}

.hero__name span {
  display: block;
  animation: rise 1.2s var(--ease-out) both;
}

.hero__name span:nth-child(1) {
  animation-delay: 0.5s;
}

.hero__name span:nth-child(2) {
  animation-delay: 0.62s;
}

.hero__tagline {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(1.375rem, 2.5vw, 2.125rem);
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.8);
  animation: rise 1.2s var(--ease-out) 0.8s both;
}

/* The sun on the horizon. */
.hero__tagline::before {
  content: "";
  flex: none;
  width: 0.55em;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--sun);
  box-shadow: 0 0 0 0.3em rgba(217, 87, 54, 0.28), 0 0 1.6em 0.2em rgba(255, 195, 54, 0.45);
}

@keyframes hero-settle {
  from {
    opacity: 0;
    transform: scale(1.08);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(1.25rem);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Intro ------------------------------------------------------------------ */

.intro__hello {
  color: var(--heading);
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  line-height: 1;
  letter-spacing: -0.02em;
}

.intro__lead {
  max-width: 34ch;
  margin-top: clamp(1.25rem, 2.5vw, 2rem);
  color: var(--heading);
  font-family: var(--font-serif);
  font-size: clamp(1.375rem, 2.6vw, 2.125rem);
  line-height: 1.32;
  letter-spacing: -0.005em;
  text-wrap: pretty;
}

.links {
  margin-top: clamp(3rem, 6vw, 4.5rem);
  border-top: 1px solid var(--line);
}

.links li {
  border-bottom: 1px solid var(--line);
}

.links a {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 1rem;
  padding-block: 1.25rem;
  transition: color 0.25s ease;
}

.links__label {
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.links__handle {
  color: var(--heading);
  font-size: clamp(1.25rem, 2.4vw, 1.625rem);
  font-weight: 500;
  letter-spacing: -0.015em;
  transition: color 0.25s ease;
}

/* The arrow points out of the page, and swings level on hover. */
.links__arrow {
  /* A centred 1em square, so the rotated glyph stays inside the row. */
  display: inline-block;
  width: 1em;
  text-align: center;
  color: var(--muted);
  font-size: 1.75rem;
  line-height: 1;
  transform: rotate(-45deg);
  transition: transform 0.35s var(--ease-out), color 0.25s ease;
}

.links a:hover .links__handle,
.links a:focus-visible .links__handle,
.links a:hover .links__arrow,
.links a:focus-visible .links__arrow {
  color: var(--sun);
}

.links a:hover .links__arrow,
.links a:focus-visible .links__arrow {
  transform: none;
}

.links a:active .links__handle {
  color: var(--sun-deep);
}

@media (min-width: 52rem) {
  .intro {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: 2rem;
  }

  .intro__body {
    grid-column: 1 / span 9;
  }
}

/* Tools ------------------------------------------------------------------ */

/* The band stays light in both schemes: most logos are dark artwork. */
.tools {
  --text: var(--ink);
  --heading: var(--black);
  --tile-line: var(--haze);

  padding-block: var(--section-space);
  background: var(--paper);
  color: var(--text);
}

.tools .section-title {
  max-width: 18ch;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

.tools__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--tile-line);
  border-left: 1px solid var(--tile-line);
}

.tools__grid li {
  border-right: 1px solid var(--tile-line);
  border-bottom: 1px solid var(--tile-line);
}

/*
 * Column counts are fixed so the 17 tiles always fill whole rows in source
 * order: 3 and 6 columns hold 15 tiles, a two-tile Rancher Desktop and Home
 * Assistant exactly. At 2 columns the odd last tile spans the row instead.
 */
.tools__grid li:last-child:nth-child(odd) {
  grid-column: span 2;
}

.tools__grid li.is-wide img {
  max-width: min(100%, 15rem);
}

@media (min-width: 40rem) {
  .tools__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tools__grid li:last-child:nth-child(odd) {
    grid-column: auto;
  }

  .tools__grid li.is-wide {
    grid-column: span 2;
  }
}

@media (min-width: 64rem) {
  .tools__grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.tools__grid a {
  display: grid;
  place-items: center;
  height: 100%;
  min-height: clamp(8rem, 13vw, 10.5rem);
  padding: clamp(1.25rem, 2.2vw, 1.75rem);
  transition: background-color 0.3s ease;
}

.tools__grid img {
  max-height: 6rem;
  width: auto;
  object-fit: contain;
  transition: transform 0.45s var(--ease-out);
}

.tools__grid a:hover,
.tools__grid a:focus-visible {
  background: var(--white);
}

.tools__grid a:hover img,
.tools__grid a:focus-visible img {
  transform: scale(1.07);
}

.tools__grid a:focus-visible {
  outline-offset: -2px;
  border-radius: 0;
}

/* Clients and previous employers ---------------------------------------- */

/* A dark band: the ASML and Moose marks are white artwork. */
.work {
  --heading: var(--white);
  --muted: var(--mist);

  padding-block: var(--section-space);
  background: var(--band-work);
  color: var(--haze);
}

.work__inner {
  display: grid;
  gap: clamp(4rem, 8vw, 6rem);
}

.work__group {
  display: grid;
  align-content: start;
  gap: 1.25rem;
}

.work__logos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem 3.5rem;
  margin-top: clamp(1.5rem, 3vw, 2.5rem);
  padding-top: clamp(1.5rem, 3vw, 2.5rem);
  border-top: 1px solid var(--graphite);
}

.work__logos img {
  height: 3rem;
  width: auto;
  transition: transform 0.45s var(--ease-out), opacity 0.3s ease;
}

/* ASML and Moose ship as white marks; render EDSN the same way. */
.work__logos img.is-dark-artwork {
  filter: brightness(0) invert(1);
}

.work__logos a:hover img,
.work__logos a:focus-visible img {
  transform: translateY(-0.2rem);
}

@media (min-width: 52rem) {
  .work__inner {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: 2rem;
  }

  .work__group:first-child {
    grid-column: 1 / span 6;
  }

  .work__group:last-child {
    grid-column: 8 / span 5;
  }
}

/* DjangoCon -------------------------------------------------------------- */

.talk__figure {
  display: grid;
  gap: 1.25rem;
}

.talk__photo {
  width: 100%;
  border-radius: 2px;
  background: var(--line);
}

.talk__caption {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  max-width: 36ch;
  color: var(--muted);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.1875rem;
  line-height: 1.4;
}

.talk__caption::before {
  content: "";
  flex: none;
  width: 2.5rem;
  height: 1px;
  background: var(--sun);
  transform: translateY(-0.3em);
}

/* Magazine spread: a lead photo, and a second one stepping down beside it. */
@media (min-width: 52rem) {
  .talk__figure {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-template-rows: auto auto;
    column-gap: 2rem;
    row-gap: 1.75rem;
  }

  .talk__photo--lead {
    grid-column: 1 / span 8;
    grid-row: 1;
  }

  /* Shares the lead photo's bottom edge. */
  .talk__photo--side {
    grid-column: 9 / span 4;
    grid-row: 1;
    align-self: end;
  }

  .talk__caption {
    grid-column: 1 / span 6;
    grid-row: 2;
  }
}

/* Sign-off: the sun setting into the water, closing the page ------------- */

.sign-off {
  position: relative;
  width: 3.5rem;
  height: 2.6rem;
  margin: 0 auto var(--section-space);
}

.sign-off::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 2.25rem;
  height: 1.125rem;
  translate: -50% 0;
  border-radius: 2.25rem 2.25rem 0 0;
  background: linear-gradient(to bottom, var(--glow), var(--sun));
}

/* Two reflections on the water, the lower one shorter. */
.sign-off::after {
  content: "";
  position: absolute;
  left: 0;
  top: 1.5rem;
  width: 100%;
  height: 1.05rem;
  background:
    linear-gradient(var(--sun), var(--sun)) center top / 100% 0.3rem no-repeat,
    linear-gradient(var(--sun), var(--sun)) center bottom / 55% 0.3rem no-repeat;
}

/* Motion preferences ----------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
  }
}
