/* Thierry Dutoit — portfolio
   Black text on off-white paper, with red for the pen marks and blue for the foot of the page.
   One typeface, Newsreader: roman for reading, italic for the small stuff and for emphasis. */

:root {
  --paper: #f5f2ea;
  --ink: #191917;
  --soft: #6b6a64;
  --rule: rgba(25, 25, 23, 0.18);
  --blue: #1c2bbf;
  --red: #ee3d23;
  --navy: #17313b; /* from the volleyball site */
  --blurple: #5865f2; /* Discord's own */
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --gutter: clamp(20px, 5vw, 64px);
  --label: 11rem;
  --measure: 34rem;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.1875rem/1.55 var(--serif);
  font-optical-sizing: auto;
  font-synthesis: none;
  font-variant-numeric: oldstyle-nums;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* Paper grain, over everything. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  opacity: 0.045;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22220%22 height=%22220%22%3E%3Cfilter id=%22n%22%3E%3CfeTurbulence type=%22fractalNoise%22 baseFrequency=%22.85%22 numOctaves=%222%22 stitchTiles=%22stitch%22/%3E%3CfeColorMatrix values=%220 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0%22/%3E%3C/filter%3E%3Crect width=%22100%25%22 height=%22100%25%22 filter=%22url(%23n)%22/%3E%3C/svg%3E");
}

::selection {
  background: var(--red);
  color: #fff;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 150ms ease;
}

a:hover {
  color: var(--red);
}

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

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

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

strong {
  font-weight: 500;
}

code {
  font: 0.82em/1 ui-monospace, "SF Mono", Consolas, monospace;
}

.wrap {
  max-width: 76rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* The whole site hangs off one grid: a narrow column for labels, a wide one for content.
   Only the big headlines are allowed to start in the label column. */
.row {
  display: grid;
  grid-template-columns: var(--label) minmax(0, 1fr);
  column-gap: 2rem;
}

.meta {
  color: var(--soft);
  font-size: 1rem;
  font-style: italic;
  line-height: 1.45;
}

.meta a {
  color: var(--ink);
}

.meta a:hover {
  color: var(--red);
}

.lead {
  max-width: 30rem;
  text-wrap: pretty;
  font-size: 1.5rem;
  line-height: 1.35;
}

.display {
  grid-column: 1 / -1;
  max-width: 14em;
  font: 400 clamp(2.5rem, 1rem + 5.2vw, 5.25rem)/1 var(--serif);
  font-variant-numeric: lining-nums;
  letter-spacing: -0.03em;
  text-wrap: pretty;
}

.display em {
  letter-spacing: -0.035em;
}

/* The red pen stroke under a word in the headline. */
.mark {
  position: relative;
  display: inline-block;
  isolation: isolate;
}

.mark svg {
  position: absolute;
  z-index: -1;
  bottom: -0.1em;
  left: -0.04em;
  width: calc(100% - 0.12em);
  height: 0.26em;
  overflow: visible;
}

.mark path {
  fill: none;
  stroke: var(--red);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 900ms var(--ease) 500ms forwards;
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

/* Masthead */

.masthead {
  padding: 1.25rem 0;
  align-items: baseline;
  font-size: 1rem;
  line-height: 1.45;
}

.masthead a {
  display: inline-block;
  padding: 0.5rem 0;
}

.name {
  font-weight: 500;
  text-decoration: none;
}

.masthead div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 2rem;
  font-style: italic;
}

/* Intro */

.intro {
  padding: 5.5rem 0 7rem;
}

.intro .lead {
  grid-column: 2;
  margin-top: 2.75rem;
}

/* Sections */

.section {
  padding: 1rem 0 6.5rem;
  border-top: 1px solid var(--rule);
}

.section > h2 {
  position: sticky;
  top: 1rem;
  align-self: start;
  font: 500 1rem/1.45 var(--serif);
}

/* Work. Each project sits on a field in its own colour: the volleyball site's navy, Discord's blurple. */

.project {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 8fr);
  grid-template-rows: auto 1fr;
  column-gap: 2.5rem;
}

.project + .project {
  margin-top: 5rem;
}

.project .panel {
  grid-column: 2;
  grid-row: 1 / 3;
}

.project.feature {
  row-gap: 1.25rem;
}

.project.feature .panel {
  grid-column: 1 / -1;
  grid-row: 1;
}

.project.feature .project-head {
  grid-column: 1;
  grid-row: 2;
}

.project.feature .project-text {
  grid-column: 2;
  grid-row: 2;
  max-width: 28rem;
  padding-top: 0.15rem;
}

.project h3 {
  font: 500 1.5rem/1.2 var(--serif);
  font-variant-numeric: lining-nums;
  letter-spacing: -0.01em;
}

.project h3 a {
  text-decoration: none;
}

.project-head .meta {
  margin-top: 0.2rem;
}

.project:not(.feature) .project-text {
  max-width: 23rem;
  margin-top: 1rem;
}

.project-text .meta {
  margin-top: 0.75rem;
}

.panel {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 2.5rem;
  color: #fff;
  text-decoration: none;
}

.panel.navy {
  background: var(--navy);
}

.panel.blurple {
  background: var(--blurple);
}

.panel img,
.panel .discord {
  box-shadow: 0 1.25rem 2.75rem rgba(0, 0, 0, 0.3);
  transition: transform 500ms var(--ease);
}

.panel-desktop {
  width: 80%;
  margin: 1.25rem 12% 1.25rem 0;
  border-radius: 5px;
}

.panel-phone {
  position: absolute;
  right: 6%;
  bottom: -9%;
  width: 17.5%;
  border-radius: 12px;
  transform: rotate(4deg);
}

.panel .discord {
  width: 100%;
  max-width: 32rem;
  border-radius: 8px;
  transform: rotate(-1.5deg);
}

.project:hover .panel-desktop {
  transform: translateY(-6px);
}

.project:hover .panel-phone {
  transform: rotate(0deg) translateY(-18px);
}

.project:hover .panel .discord,
figure.panel:hover .discord {
  transform: rotate(0deg);
}

.shot {
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: 3px;
}

figcaption {
  margin-top: 0.6rem;
  color: var(--soft);
  font-size: 1rem;
  font-style: italic;
  line-height: 1.45;
}

/* A redrawing of what the Orbe School bot posts in Discord, in Discord's own type. */
.discord {
  display: grid;
  gap: 1.1rem;
  padding: 1.5rem;
  background: #313338;
  color: #dbdee1;
  font: 400 0.9375rem/1.4 "gg sans", "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-variant-numeric: normal;
  text-align: left;
}

.discord-msg {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  column-gap: 0.9rem;
}

.discord-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: #5865f2;
}

.discord-who {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.discord-who b {
  color: #f2f3f5;
  font-weight: 600;
}

.discord-app {
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
  background: #5865f2;
  color: #fff;
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 1.5;
}

.discord-time {
  color: #949ba4;
  font-size: 0.75rem;
}

.discord-msg p {
  margin-top: 0.1rem;
}

.discord-msg strong {
  color: #f2f3f5;
  font-weight: 600;
}

.discord-product {
  white-space: nowrap;
}

.discord-hidden {
  display: inline-block;
  width: 5em;
  height: 0.8em;
  border-radius: 2px;
  background: #1e1f22;
  vertical-align: -0.05em;
}

/* Prose */

.prose {
  max-width: var(--measure);
}

.prose p {
  text-wrap: pretty;
}

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

/* About: the text, and beside it a short list of what I take on. */

.about-columns {
  display: grid;
  grid-template-columns: minmax(0, var(--measure)) minmax(0, 17rem);
  column-gap: 4rem;
  justify-content: space-between;
  align-items: start;
}

.about .prose {
  font-size: 1.5rem;
  line-height: 1.35;
}

.flag {
  display: inline-block;
  width: auto;
  height: 0.62em;
  margin: 0 0.1em 0 0.2em;
  border-radius: 1px;
  vertical-align: 0.02em;
}

.takes ul {
  margin-top: 0.6rem;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--rule);
}

.takes li {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--rule);
}

/* The closer: the whole foot of the page in blue. */

.closer {
  padding: 4.5rem 0 2rem;
  background: var(--blue);
  color: var(--paper);
}

.closer .meta {
  color: rgba(245, 242, 234, 0.72);
}

.closer a:hover {
  color: #fff;
  text-decoration-thickness: 3px;
}

.closer-mail {
  font: italic 400 clamp(1.3rem, 0.4rem + 4.1vw, 4.25rem)/1.1 var(--serif);
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}

.closer-mail a {
  text-decoration-thickness: 2px;
  text-underline-offset: 0.14em;
}

.closer .colophon {
  margin-top: 5rem;
}

/* Project pages */

.case {
  padding: 4.5rem 0 6rem;
}

.case > * {
  grid-column: 2;
}

.case > .display {
  grid-column: 1 / -1;
}

.case-intro {
  margin-top: 2.25rem;
}

.case-intro .lead {
  margin-top: 0.75rem;
}

.case-intro .lead + .meta {
  margin-top: 1.25rem;
}

.case figure {
  margin: 3.5rem 0;
}

.case figure.panel {
  padding: 3.5rem 3rem 1.25rem;
}

.case figure.panel figcaption {
  width: 100%;
  margin-top: 2.25rem;
  color: rgba(255, 255, 255, 0.78);
}

.case .pair {
  grid-template-columns: minmax(0, 1fr) 19%;
  column-gap: 2rem;
  place-items: end stretch;
}

.case .pair img {
  border-radius: 5px;
}

.case .pair > img {
  border-radius: 12px;
}

.case .pair figcaption {
  grid-column: 1 / -1;
}

/* The last paragraphs share the row with a phone, so the right-hand space is used once on purpose. */
.beside {
  display: grid;
  grid-template-columns: minmax(0, var(--measure)) minmax(0, 13.5rem);
  column-gap: 4rem;
  justify-content: space-between;
  align-items: start;
}

.beside figure {
  margin: 0.4rem 0 0;
}

.next {
  margin-top: 5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}

.next .lead {
  margin-top: 0.15rem;
  font-variant-numeric: lining-nums;
}

/* In between: side columns drop under the text before the text gets squeezed. */

@media (max-width: 1100px) {
  .beside,
  .about-columns {
    grid-template-columns: minmax(0, 1fr);
  }

  .beside figure {
    width: 13.5rem;
    margin-top: 2.5rem;
  }

  .takes {
    max-width: var(--measure);
    margin-top: 3rem;
  }
}

/* Small screens */

@media (max-width: 900px) {
  body {
    font-size: 1.125rem;
  }

  .row {
    grid-template-columns: minmax(0, 1fr);
  }

  .display,
  .case > *,
  .case > .display,
  .intro .lead {
    grid-column: auto;
  }

  .display {
    font-size: clamp(2.25rem, 11vw, 3.25rem);
    line-height: 1.02;
  }

  .lead,
  .about .prose {
    font-size: 1.3125rem;
  }

  /* Name and link share the first line; the tagline sits under them. */
  .masthead {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 0.75rem 0;
  }

  .masthead div {
    display: contents;
  }

  .masthead div span {
    grid-column: 1 / -1;
    grid-row: 2;
    color: var(--soft);
    font-style: italic;
  }

  .masthead div a {
    font-style: italic;
  }

  .intro {
    padding: 3rem 0 4rem;
  }

  .intro .lead {
    margin-top: 1.75rem;
  }

  .section {
    padding-bottom: 4.5rem;
  }

  .section > h2 {
    position: static;
    margin-bottom: 1.5rem;
  }

  .project,
  .project.feature {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    row-gap: 0;
  }

  .project + .project {
    margin-top: 3.5rem;
  }

  .project .panel,
  .project.feature .panel,
  .project.feature .project-head,
  .project.feature .project-text {
    grid-column: auto;
    grid-row: auto;
    max-width: none;
  }

  .project .panel {
    order: -1;
    margin-bottom: 1.1rem;
  }

  .project .project-text,
  .project:not(.feature) .project-text {
    max-width: none;
    margin-top: 0.75rem;
    padding-top: 0;
  }

  /* The colour fields run to the edges of the phone. */
  .project .panel,
  .case figure.panel {
    margin-right: calc(var(--gutter) * -1);
    margin-left: calc(var(--gutter) * -1);
    padding: 2rem var(--gutter);
  }

  .panel-desktop {
    width: 84%;
    margin: 0.5rem 14% 0.5rem 0;
    border-radius: 3px;
  }

  .panel-phone {
    right: 5%;
    bottom: -12%;
    width: 24%;
    border-radius: 7px;
  }

  .discord {
    padding: 1.1rem 1rem;
    font-size: 0.8125rem;
  }

  .discord-msg {
    grid-template-columns: 2rem minmax(0, 1fr);
    column-gap: 0.7rem;
  }

  .discord-avatar {
    width: 2rem;
    height: 2rem;
  }

  .discord-hidden {
    width: 3.5em;
  }

  .closer {
    padding-top: 3rem;
  }

  .closer .row > .meta {
    margin-bottom: 0.75rem;
  }

  .closer .colophon {
    margin-top: 3rem;
  }

  .case {
    padding: 2.5rem 0 4rem;
  }

  .case figure {
    margin: 2.5rem 0;
  }

  .case figure.panel figcaption {
    margin-top: 1.5rem;
  }

  /* On a phone the laptop view is too small to read, so lead with the phone view. */
  .case .pair {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 1.25rem;
    place-items: start stretch;
  }

  .case .pair > img {
    order: -1;
    width: 62%;
    max-width: 15rem;
  }

  /* The schedule and prices swap to phone captures here, shown at phone size. */
  .case figure.swap {
    width: 62%;
    max-width: 15rem;
  }

  .beside figure {
    width: 62%;
    max-width: 15rem;
  }

  .next {
    margin-top: 3.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  a,
  .panel img,
  .panel .discord {
    transition: none;
  }

  .mark path {
    animation: none;
    stroke-dashoffset: 0;
  }
}
