/*
 * bradgessler.com. Plain CSS, no build step: native nesting and custom
 * properties. Black on white, one grid, and type tuned for reading.
 */

:root {
  --sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --paper: #fff;
  --ink: #111;
  --text: #1d1d1d;
  --quiet: #636363;
  --line: #e6e6e6;
  --rule: #cfcfcf;
  --wash: #f4f4f4;

  /* Breakpoints (custom properties can't be used in media queries):
     56em stacks the grid, 42em is phones. */
  --gutter: 2rem;

  @media (prefers-color-scheme: dark) {
    --paper: #111;
    --ink: #f2f2f2;
    --text: #e4e4e4;
    --quiet: #a2a2a2;
    --line: #2a2a2a;
    --rule: #3a3a3a;
    --wash: #1c1c1c;
  }

  @media only screen and (max-width: 42em) {
    --gutter: 1.25rem;
  }
}

/* The root size drives every rem: 18px on desktop, 17px on phones. */
html {
  font-size: 112.5%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-gutter: stable;
  background-color: var(--paper);

  @media only screen and (max-width: 42em) {
    font-size: 106.25%;
  }
}

body {
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--paper);
  -webkit-font-smoothing: antialiased;
  /* Long words, like Ruby constants and URLs, wrap instead of overflowing. */
  overflow-wrap: break-word;
}

a {
  &, &:visited, &:active {
    color: var(--ink);
    text-decoration: none;
  }

  &:hover {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
  }
}

strong, b {
  font-weight: 700;
  color: var(--ink);
}

em, i {
  font-style: italic;
}

h1, h2, h3, h4 {
  color: var(--ink);
  font-weight: 700;
  text-wrap: balance;
}

img {
  max-width: 100%;
}

/*
 * The grid: a label column on the left, content on the right, rows
 * separated by a hairline. Stacks on narrow screens.
 */
.swiss {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.swiss--row {
  display: grid;
  grid-template-columns: 13rem minmax(0, 1fr);
  gap: 2rem;
  padding: 3.5rem 0;

  /* minmax(0, ...) so wide content (code, images) scrolls or shrinks
     instead of pushing the column past the screen. */
  @media only screen and (max-width: 56em) {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    padding: 2.5rem 0;
  }
}

h2.swiss--label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

p, li {
  text-wrap: pretty;
}

/* Top of every page but home: the name, and a jump to the footer's nav. */
header.site-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.5rem var(--gutter) 0;
}

/* The top bar is quiet so it doesn't compete with the page's title: grey,
   regular weight, full ink only on hover. */
header.site-top a {
  &, &:visited, &:active {
    color: var(--quiet);
  }

  &:hover, &:focus-visible {
    color: var(--ink);
    text-decoration: none;
  }
}

a.site-top--name {
  font-weight: 600;
}

/* Homepage intro: who Brad is, at a glance. */
header.intro {
  padding: 6rem 0 4.5rem;
  align-items: start;

  @media only screen and (max-width: 56em) {
    grid-template-columns: 6rem minmax(0, 1fr);
    gap: 1.25rem;
    padding: 3rem 0 2.5rem;
  }
}

.intro--headshot {
  aspect-ratio: 1;
  align-self: start;
}

.intro--headshot img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

h1.intro--name {
  margin-top: -0.12em;
  font-size: clamp(2.75rem, 7vw, 5.5rem);
  line-height: 0.92;
  font-weight: 800;
  letter-spacing: -0.05em;
}

p.intro--statement {
  max-width: 46rem;
  margin-top: 1.5rem;
  font-size: clamp(1.3rem, 2.3vw, 1.85rem);
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);

  a, a:visited, a:active {
    text-decoration: underline;
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.16em;
  }
}

header.intro .social {
  margin-top: 2rem;
}

/* On narrow screens the headshot sits beside the name; text spans below. */
@media only screen and (max-width: 56em) {
  .intro--text {
    grid-column: 1 / -1;
  }
}

/* Project cards: screenshot, name, one-liner. Screenshots are full
   browser captures, so crop from the top. */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
  gap: 2.5rem 1.5rem;
}

a.card {
  display: block;

  &:hover {
    text-decoration: none;

    h3 {
      text-decoration: underline;
      text-decoration-thickness: 1px;
      text-underline-offset: 0.18em;
    }
  }
}

.card--image {
  display: block;
  width: 100%;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  object-position: top;
  border: 1px solid var(--line);
}

h3.card--title {
  margin-top: 0.75rem;
  font-size: 1rem;
}

.card--subtitle {
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--quiet);
}

.card--year {
  margin-left: 0.5rem;
  font-weight: 400;
  color: var(--quiet);
  font-variant-numeric: tabular-nums;
}

/* Lists: a title and a quiet note, one per row. */
.list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.5rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);

  &:first-child {
    padding-top: 0;
  }

  @media only screen and (max-width: 42em) {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
}

.list li > a {
  justify-self: start;
}

.list--meta {
  color: var(--quiet);
  text-align: right;
  font-variant-numeric: tabular-nums;

  @media only screen and (max-width: 42em) {
    text-align: left;
  }
}

p.more {
  margin-top: 1rem;
  font-weight: 700;
}

/* Index pages: Projects, Writing, Talks, Timeline. */
h1.page-header--title {
  font-size: clamp(2.5rem, 7vw, 4.5rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.page-header--subtitle {
  max-width: 34rem;
  margin-top: 0.75rem;
  font-size: 1.15rem;
  line-height: 1.5;
  color: var(--quiet);
}

h2.timeline--year {
  font-size: 2rem;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

/*
 * The timeline reads like a story: jobs and launches are the milestones,
 * bold on a filled marker; writing and talks are quieter, on a small open
 * marker, so the big moments stand out with the work around them for
 * context. A thin rail runs through every year.
 */
.timeline {
  position: relative;
  padding-left: 1.75rem;
  border-left: 1px solid var(--rule);
}

.timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr);
  gap: 1rem;
  padding: 0.45rem 0;

  /* The marker on the rail. */
  &::before {
    content: "";
    position: absolute;
    left: calc(-1.75rem - 4px);
    top: 0.95rem;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    border: 1px solid var(--quiet);
    background-color: var(--paper);
  }

  @media only screen and (max-width: 42em) {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
}

.timeline--kind {
  color: var(--quiet);
  font-size: 0.85rem;
  line-height: 1.9;
}

.timeline--body > a {
  font-size: 0.95rem;
}

.timeline--note {
  display: block;
  color: var(--quiet);
  font-size: 0.85rem;
  line-height: 1.45;
}

/* Milestones: joining somewhere, starting something, school. */
.timeline li.timeline--joined, .timeline li.timeline--started, .timeline li.timeline--studied {
  padding: 0.9rem 0;

  &::before {
    left: calc(-1.75rem - 7px);
    top: 1.45rem;
    width: 13px;
    height: 13px;
    border: none;
    background-color: var(--ink);
    box-shadow: 0 0 0 4px var(--paper);
  }

  .timeline--body > a {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.01em;
  }

  .timeline--note {
    font-size: 0.95rem;
    color: var(--text);
  }
}

/* Reading pages: articles, About, talks, chapters. */
.page-header--reading h1.page-header--title {
  font-size: clamp(2rem, 4.5vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
  max-width: 22em;
}

.page-header--date {
  display: block;
  color: var(--quiet);
  font-size: 0.9rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.feature-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-top: 1.25rem;
  font-weight: 700;
}

.chapter-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3em;
  padding-top: 1.5em;
  border-top: 1px solid var(--rule);
  font-weight: 700;
}

/*
 * Prose: an article body. ~66 characters a line, 1.7 leading, generous
 * space above headings, and links underlined so they're easy to spot.
 */
.prose {
  max-width: 66ch;
  color: var(--text);
  line-height: 1.7;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;

  & > * {
    margin-bottom: 1.25em;
  }

  & > p:first-child {
    font-size: 1.2rem;
    line-height: 1.6;
  }

  h2 {
    margin: 2.25em 0 0.6em;
    font-size: 1.5rem;
    line-height: 1.25;
    letter-spacing: -0.015em;
  }

  h3 {
    margin: 1.9em 0 0.5em;
    font-size: 1.2rem;
    line-height: 1.35;
  }

  h4 {
    margin: 1.6em 0 0.4em;
    font-size: 1rem;
  }

  a, a:visited, a:active {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
    text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  }

  a:hover {
    text-decoration-color: currentColor;
  }

  ul, ol {
    padding-left: 1.5em;

    li {
      margin: 0.4em 0;
      padding-left: 0.25em;
    }

    li::marker {
      color: var(--quiet);
    }
  }

  ul li {
    list-style-type: disc;
  }

  ol li {
    list-style-type: decimal;
    font-variant-numeric: tabular-nums;
  }

  li > ul, li > ol {
    margin: 0.4em 0;
  }

  blockquote {
    padding-left: 1.25em;
    border-left: 3px solid var(--rule);
    color: var(--quiet);

    p {
      margin-bottom: 0.75em;
    }

    p:last-child {
      margin-bottom: 0;
    }
  }

  code {
    padding: 0.12em 0.35em;
    background-color: var(--wash);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 0.85em;
    overflow-wrap: anywhere;
  }

  pre {
    margin: 1.75em 0;
    padding: 1.25em 1.5em;
    background-color: var(--wash);
    font-family: var(--mono);
    font-size: 0.85rem;
    line-height: 1.6;
    overflow-x: auto;
    overflow-wrap: normal;

    code {
      padding: 0;
      background: none;
      font-size: inherit;
      overflow-wrap: normal;
    }
  }

  img, video, iframe {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 2em 0;
  }

  iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
  }

  hr {
    margin: 3em 0;
    border: none;
    border-top: 1px solid var(--rule);
  }

  table {
    width: 100%;
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;

    th, td {
      padding: 0.5em 0.75em 0.5em 0;
      border-bottom: 1px solid var(--line);
      vertical-align: top;
      text-align: left;
    }

    th {
      font-weight: 700;
      color: var(--ink);
    }
  }
}

/* Site nav and social icons, used in the footer. */
.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;

  a.is-current {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 0.25em;
  }
}

.social {
  display: flex;
  gap: 1.25rem;
  margin-top: 1.25rem;

  a {
    display: inline-flex;

    &:hover {
      color: var(--quiet);
    }
  }
}

/* Footer: on every page. Brad's mug, a short bio, socials, and the nav. */
/* The body is a column so the footer can fill to the bottom of short pages. */
body {
  display: flex;
  flex-direction: column;
  min-height: 100svh;

  /* Keep each band full width; auto margins would otherwise shrink them. */
  & > * {
    width: 100%;
    box-sizing: border-box;
  }
}

/* The footer is a shade of the page it ends: deeper on dark pages, a
   touch darker on light ones. --if-dark says which kind of page this is. */
footer.site-footer {
  --footer-on-dark: var(--if-dark) color-mix(in oklab, var(--paper) 55%, #000);
  flex-grow: 1;
  margin-top: 5rem;
  background-color: var(--footer-on-dark, color-mix(in oklab, var(--paper) 93%, var(--ink)));
}

.site-footer--inner {
  display: grid;
  grid-template-columns: 13rem minmax(0, 1fr) 10rem;
  gap: 2rem;
  max-width: 72rem;
  margin: 0 auto;
  padding: 2.5rem var(--gutter) 4rem;

  @media only screen and (max-width: 56em) {
    grid-template-columns: 4.5rem minmax(0, 1fr);
    gap: 1.25rem;

    .site-nav {
      grid-column: 2;
    }
  }
}

.site-footer--mug {
  width: 6rem;
  aspect-ratio: 1;
  align-self: start;
  border-radius: 50%;

  img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
  }

  @media only screen and (max-width: 56em) {
    width: 100%;
  }
}

p.site-footer--bio {
  max-width: 30rem;
  line-height: 1.5;
}

a.site-footer--more {
  display: inline-block;
  margin-top: 0.5rem;
  font-weight: 700;
}

footer.site-footer .site-nav {
  flex-direction: column;
  gap: 0.35rem;

  @media only screen and (max-width: 56em) {
    flex-direction: row;
    gap: 0.25rem 1.25rem;
  }
}

/*
 * Phones: the headshot and name center on the page. The statement stays
 * left-aligned (centered paragraphs are hard to read), as a block that
 * shares the page's center line.
 */
@media only screen and (max-width: 42em) {
  header.intro {
    display: flex;
    flex-direction: column;
    align-items: center;

    .intro--headshot {
      align-self: center;
      width: 7.5rem;
      border-radius: 50%;
    }

    .intro--text {
      display: flex;
      flex-direction: column;
      align-items: center;
    }

    h1.intro--name {
      text-align: center;
    }

    /* Lines run nearly edge to edge so the left-aligned block sits
       balanced under the centered photo and name. */
    p.intro--statement {
      text-align: left;
      font-size: 1.22rem;
      line-height: 1.38;
      text-wrap: pretty;
    }
  }
}

/*
 * Images are grayscale until you engage with them: hover, focus, or tap
 * brings the color in, and it fades back out when you move on.
 * --image-tone dials how the gray version renders.
 */
:root {
  --image-tone: grayscale(1) contrast(1.08) brightness(1.02);
}

.frame {
  position: relative;
  display: block;
  isolation: isolate;
  overflow: hidden;

  /* HDR photos stay at standard brightness while gray... */
  img {
    display: block;
    filter: var(--image-tone);
    dynamic-range-limit: standard;
    transition: filter 0.5s ease;
  }

  /* On a tinted page, the gray version takes the tint's hue. */
  &::after {
    content: "";
    position: absolute;
    inset: 0;
    background-color: var(--image-tint, transparent);
    mix-blend-mode: color;
    opacity: var(--image-tint-strength, 0.55);
    pointer-events: none;
    transition: opacity 0.5s ease;
  }
}

a:hover .frame, a:focus-visible .frame, a:active .frame,
a.frame:hover, a.frame:focus-visible, a.frame:active {
  /* ...and get the display's full HDR headroom with their color. */
  img {
    filter: none;
    dynamic-range-limit: no-limit;
  }

  &::after {
    opacity: 0;
  }
}

/*
 * Tints (see helpers/tint_helper.rb and lib/tint.rb). A tinted section
 * carries two precomputed scales of its color, light (--l-*) and dark
 * (--d-*), and this picks one: light by default, dark in dark mode or when
 * the section is pinned with data-tone="dark". data-tone="light" keeps a
 * section light in dark mode. Tints nest, since each section has its own.
 *
 * --if-dark is a "space toggle" that says whether the nearest surface is
 * dark: `initial` (off) or empty (on). Links read it to pick their colors.
 */
:root {
  --if-dark: initial;

  @media (prefers-color-scheme: dark) {
    --if-dark: ;
  }
}

[data-tint] {
  --paper: var(--l-paper);
  --wash: var(--l-wash);
  --line: var(--l-line);
  --rule: var(--l-rule);
  --quiet: var(--l-quiet);
  --text: var(--l-text);
  --ink: var(--l-ink);
  --image-tint: var(--l-tint);
  --if-dark: initial;
  background-color: var(--paper);
  color: var(--text);
}

@media (prefers-color-scheme: dark) {
  [data-tint]:not([data-tone="light"]) {
    --paper: var(--d-paper);
    --wash: var(--d-wash);
    --line: var(--d-line);
    --rule: var(--d-rule);
    --quiet: var(--d-quiet);
    --text: var(--d-text);
    --ink: var(--d-ink);
    --image-tint: var(--d-tint);
    --if-dark: ;
  }
}

[data-tint][data-tone="dark"] {
  --paper: var(--d-paper);
  --wash: var(--d-wash);
  --line: var(--d-line);
  --rule: var(--d-rule);
  --quiet: var(--d-quiet);
  --text: var(--d-text);
  --ink: var(--d-ink);
  --image-tint: var(--d-tint);
  --if-dark: ;
}

[data-tint][data-tone="jewel"] {
  --paper: var(--j-paper);
  --wash: var(--j-wash);
  --line: var(--j-line);
  --rule: var(--j-rule);
  --quiet: var(--j-quiet);
  --text: var(--j-text);
  --ink: var(--j-ink);
  --image-tint: var(--d-tint);
  --if-dark: ;
}

/* A tinted row inside a page bleeds to the page's gutters, as a band. */
.swiss--row.swiss--tinted {
  margin-inline: calc(-1 * var(--gutter));
  padding-inline: var(--gutter);
}

/*
 * Links preview where they go. At rest a link wears the color of the page
 * it's on, like any other text. On hover it takes on the destination
 * page's color, precomputed for light and dark surfaces (see
 * link_tint_properties), and the destination's paper washes in behind it.
 * --if-dark picks the set that suits the nearest surface.
 */
a[data-link-tint] {
  --li-pick: var(--if-dark) var(--li-d);
  --lw-pick: var(--if-dark) var(--lw-d);
  --link-ink: var(--li-pick, var(--li-l));
  --link-wash: var(--lw-pick, var(--lw-l));
  transition: color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;

  &:hover, &:focus-visible {
    color: var(--link-ink);
    text-decoration-color: var(--link-ink);
    background-color: var(--link-wash);
    box-shadow: 0 0 0 0.15em var(--link-wash);
  }

  /* Card titles follow the link; cards themselves don't get a wash. */
  h3 {
    color: inherit;
    transition: color 0.2s ease;
  }

  &.card:hover, &.card:focus-visible,
  &.career--row:hover, &.career--row:focus-visible {
    background-color: transparent;
    box-shadow: none;
  }

}

/*
 * Project pages. A jewel-toned hero (always dark) with the role, title,
 * and tagline. Under them the real site, crisp and in its own colors, in a
 * desktop browser and a phone, rising out of the hero; the section below
 * overlaps their bottoms like a pocket at the fold.
 */
main.project {
  margin: 0;
}

.project--hero {
  overflow: hidden;
}

.project--intro {
  max-width: 72rem;
  margin: 0 auto;
  padding: 4rem var(--gutter) 0;

  @media only screen and (max-width: 42em) {
    padding-top: 2.5rem;
  }
}

/* Role and address share one quiet line, separated by a dot. */
.project--meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0;
  margin-top: 1.5rem;
  color: var(--quiet);

  & > * + *::before {
    content: "·";
    margin: 0 0.6em;
    color: var(--quiet);
  }
}

h1.project--title {
  font-size: clamp(3rem, 9vw, 6.5rem);
  line-height: 0.95;
  font-weight: 800;
  letter-spacing: -0.045em;
}

.project--tagline {
  max-width: 34rem;
  margin-top: 0.6rem;
  font-size: clamp(1.3rem, 2.4vw, 1.8rem);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

a.project--link {
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);

  &:hover {
    text-decoration-color: currentColor;
  }
}

/*
 * The stage: the screen leans back in perspective, lit by a glow of the
 * page's color, and only its top shows above the pocket. Hover stands it
 * up a little. One screen at a time: desktop site on larger screens, the
 * mobile site on phones.
 */
.project--stage {
  position: relative;
  max-width: 64rem;
  height: clamp(18rem, 40vw, 33rem);
  margin: 3.5rem auto 0;
  padding: 0 var(--gutter);
  perspective: 1800px;

  /* The glow behind the screen. */
  &::before {
    content: "";
    position: absolute;
    inset: 10% 5% -20%;
    background: radial-gradient(closest-side, color-mix(in srgb, var(--l-tint, var(--quiet)) 55%, transparent), transparent);
    filter: blur(40px);
    opacity: 0.7;
    pointer-events: none;
    transition: opacity 0.6s ease;
  }

  &:has(.project--devices:hover, .project--devices:focus-visible)::before {
    opacity: 1;
  }

  @media only screen and (max-width: 42em) {
    height: 27rem;
    margin-top: 2.5rem;
    perspective: 1200px;
  }
}

.project--devices {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  text-decoration: none;
  transform-style: preserve-3d;

  /* Hover lifts the screen toward you: a little up, a little bigger, a
     little more upright, while the glow behind it brightens. */
  &:hover, &:focus-visible {
    text-decoration: none;

    .device {
      transform: translateY(-14px) scale(1.035) rotateX(11deg);
      box-shadow:
        0 0 0 1px rgb(255 255 255 / 0.18),
        0 1px 0 0 rgb(255 255 255 / 0.25) inset,
        0 50px 90px -30px rgb(0 0 0 / 0.85),
        0 0 80px -10px color-mix(in srgb, var(--image-tint, #fff) 45%, transparent);
    }
  }
}

.device {
  position: absolute;
  top: 0;
  display: block;
  overflow: hidden;
  background-color: #000;
  transform-origin: 50% 0;
  transform: rotateX(16deg);
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.6s ease;
  box-shadow:
    0 0 0 1px rgb(255 255 255 / 0.14),
    0 1px 0 0 rgb(255 255 255 / 0.25) inset,
    0 40px 80px -30px rgb(0 0 0 / 0.8);

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

.device--browser {
  left: 0;
  right: 0;
  border-radius: 14px 14px 0 0;
}

.device--phone {
  display: none;
  left: 50%;
  width: 74%;
  max-width: 18rem;
  margin-left: calc(-0.5 * min(74%, 18rem));
  /* A real phone: a dark body with a bezel, and the screen inset with
     its own, smaller corners. */
  padding: 11px 11px 0;
  background-color: #0c0c0d;
  border-radius: 44px 44px 0 0;

  img {
    border-radius: 33px 33px 0 0;
  }
}

.device--photo {
  left: 0;
  right: 0;
  border-radius: 14px 14px 0 0;
}

@media only screen and (max-width: 42em) {
  .project--devices:has(.device--phone) .device--browser {
    display: none;
  }

  .device--phone {
    display: block;
  }

  .device {
    transform: rotateX(10deg);
  }
}

/* The pocket: the page below rides up over the devices' bottoms. */
.project--pocket {
  position: relative;
  z-index: 1;
  max-width: none;
  margin: 0;
  padding: 0 var(--gutter);
  background-color: var(--paper);
  box-shadow: 0 -1px 0 var(--rule), 0 -24px 40px -24px rgb(0 0 0 / 0.55);
}

.project--caption {
  /* 66ch at the body size, measured in this smaller type. */
  max-width: calc(66ch / 0.9);
  margin: 0 auto;
  padding-top: 1rem;
  font-size: 0.9rem;
  color: var(--quiet);
}

.prose.project--body {
  margin: 0 auto;
  padding: 3.5rem 0 1rem;

  @media only screen and (max-width: 42em) {
    padding-top: 2.5rem;
  }
}


/* A single picture (a photo, a ticket) instead of a site: smaller, centered,
   and a shorter stage on phones so it doesn't leave a gap. */
.device--photo {
  left: 50%;
  right: auto;
  width: min(100%, 38rem);
  margin-left: calc(-0.5 * min(100%, 38rem));
  border-radius: 14px 14px 0 0;
}

@media only screen and (max-width: 42em) {
  .project--stage:not(:has(.device--phone)) {
    height: 15rem;
  }
}

/*
 * Project screenshots are tinted in the page's own color until you engage:
 * sharp and fully visible, just recolored (a grayscale image with the tint
 * blended over its hue). Hover, focus, or tap shows the real colors.
 */
.device {
  img {
    filter: grayscale(1) contrast(1.05);
    transition: filter 0.5s ease;
  }

  &::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background-color: var(--image-tint, transparent);
    mix-blend-mode: color;
    opacity: 0.9;
    pointer-events: none;
    transition: opacity 0.5s ease;
  }
}

.project--devices:hover .device, .project--devices:focus-visible .device,
.project--devices:active .device {
  img {
    filter: none;
  }

  &::after {
    opacity: 0;
  }
}

/* Real photos (an astrophoto, a ticket) keep their true colors. */
.device--photo {
  img {
    filter: none;
  }

  &::after {
    display: none;
  }
}

/* An outline button: the one call to action at the end of a project page. */
.prose .project--cta {
  margin-top: 2.5em;
}

.prose a.button, a.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.75em 1.4em;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease;

  &:visited, &:active {
    color: var(--ink);
  }

  &:hover, &:focus-visible {
    background-color: var(--ink);
    color: var(--paper);
    text-decoration: none;
  }
}

/*
 * Career chart: one bar per role across the years, with its label under
 * it, starting where the bar starts (or ending where it ends, for recent
 * roles).
 */
.career {
  margin: 0 0 1rem;
}

.career--bars li {
  border-top: 1px solid var(--line);
}

a.career--row {
  display: block;
  padding: 0.7rem 0 0.8rem;
  text-decoration: none;

  &:hover {
    text-decoration: none;

    .career--bar {
      opacity: 0.75;
    }

    .career--name {
      text-decoration: underline;
      text-underline-offset: 0.18em;
    }
  }
}

.career--bar {
  display: block;
  height: 10px;
  margin-left: var(--left);
  width: var(--width);
  border-radius: 5px;
  background-color: var(--ink);
  transition: opacity 0.2s ease;

  .career--ongoing & {
    border-radius: 5px 0 0 5px;
    background: linear-gradient(to right, var(--ink) 80%, color-mix(in srgb, var(--ink) 15%, transparent));
  }
}

.career--label {
  display: block;
  margin-top: 0.4rem;
  padding-left: var(--left);

  .career--late & {
    padding-left: 0;
    padding-right: var(--right);
    text-align: right;
  }
}

.career--name {
  display: block;
  font-weight: 700;
  color: var(--ink);
}

.career--role {
  display: block;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--quiet);
}

.career--axis {
  position: relative;
  height: 1.5rem;
  margin-top: 0.75rem;
  border-top: 1px solid var(--rule);

  span {
    position: absolute;
    left: var(--at);
    top: 0.35rem;
    translate: -50% 0;
    font-size: 0.8rem;
    color: var(--quiet);
    font-variant-numeric: tabular-nums;
  }
}
