/* samdecrock.be
   Colours are picked from the photograph at the top of the page. */

:root {
  --ink: #1c1917;          /* the black cable */
  --paper: #f4f1ea;        /* the table */
  --board: #ffffff;        /* the breadboard */
  --sweater: #8b1e2d;      /* the sweater, in the light */
  --sweater-deep: #6e1623; /* the sweater, in the shade */
  --led: #34e08d;          /* the LED */
  --muted: #615b54;
  --chip: #2b2623;         /* the black module on the table */
  --tin: #dcd8cf;          /* solder pads */
  --line: #d9d3c7;

  --font-display: "Montserrat", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --gutter: clamp(1rem, 5vw, 3rem);

  color-scheme: light;
}

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

html {
  background: var(--ink); /* what shows when you scroll past either end */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 1.5rem;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  font: 400 1.0625rem/1.6 var(--font-body);
  color: var(--ink);
  background: var(--paper);
  overflow-wrap: break-word;
}

h1, h2, h3, p, ul, ol { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; }

a { color: inherit; }

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

.hero :focus-visible,
.section--sweater :focus-visible,
.footer :focus-visible { outline-color: var(--led); }

[hidden] { display: none !important; }

.skip {
  position: absolute;
  left: 1rem;
  top: 1rem;
  z-index: 10;
  padding: .625rem 1rem;
  background: var(--board);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}
.skip:focus { transform: none; }

.sprite { position: absolute; }

.icon {
  width: 1.5rem;
  height: 1.5rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.icon--out {
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-left: .15em;
  vertical-align: -.14em;
  stroke-width: 2;
}

/* The LED. Used as a power light, and once more when a message is sent. */
.led {
  display: inline-block;
  flex: none;
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
  background: var(--led);
  box-shadow: 0 0 0 3px rgba(52, 224, 141, .2), 0 0 14px 3px rgba(52, 224, 141, .65);
}

.years {
  font: 400 .8125rem/1.6 var(--font-mono);
  letter-spacing: .01em;
  color: var(--muted);
  white-space: nowrap;
}

.wrap {
  width: min(100% - 2 * var(--gutter), 72rem);
  margin-inline: auto;
}


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

.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: auto 1fr auto;
  /* Full screen like the old page, but capped so it stays a hero on a tall monitor. */
  min-height: min(100vh, 64rem);
  min-height: min(100svh, 64rem);
  overflow: hidden;
  color: #fff;
  background: var(--ink);
}

.hero__photo {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 47% 50%;
}

/* Same idea as the 2018 page: the photo, turned down so the name can sit on it. */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(20, 10, 12, .92) 0, rgba(20, 10, 12, .55) 9rem, rgba(20, 10, 12, 0) 20rem),
    rgba(20, 12, 13, .6);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem var(--gutter);
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: 2.75rem;
  padding-left: .25rem;
  font: 400 .8125rem/1 var(--font-mono);
  letter-spacing: .02em;
}

.nav__domain { display: none; }

.nav__links {
  display: flex;
  margin-right: -.625rem;
}

.nav__links a {
  display: block;
  padding: .625rem;
  font-size: .9375rem;
  font-weight: 600;
  text-decoration: none;
}

.nav__links a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .35em; }

.hero__body {
  align-self: center;
  padding: 2rem var(--gutter);
  text-align: center;
}

h1 {
  font: 900 clamp(2.25rem, min(12.4vw, 1.7rem + 5.33vw), 6.5rem)/1 var(--font-display);
  letter-spacing: -.015em;
}

.tagline {
  margin-top: clamp(.75rem, 2vw, 1.25rem);
  font: 500 clamp(1.1875rem, 2.6vw, 1.75rem)/1.3 var(--font-display);
}

.social {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 1.5rem;
  margin-top: clamp(1.5rem, 3.5vw, 2.5rem);
  font: 500 .9375rem/1 var(--font-mono);
  letter-spacing: .02em;
}

.social a {
  display: block;
  padding: .875rem .125rem;
  color: #fff;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, .45);
  text-decoration-thickness: 1px;
  text-underline-offset: .4em;
}

.social a:hover {
  color: var(--led);
  text-decoration-color: currentColor;
}

.hero__down {
  justify-self: center;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-bottom: 1.25rem;
  color: #fff;
}

.hero__down:hover { color: var(--led); }

/* Very small phones: tighten the two rows that would otherwise run out of room. */
@media (max-width: 22.4375rem) {
  .nav__links a { padding-inline: .375rem; font-size: .875rem; }
  .social { gap: 0 1rem; }
}

@media (min-width: 30rem) {
  .nav__domain { display: inline; }
}


/* ---------- Sections ---------- */

.section { padding-block: clamp(3.5rem, 9vw, 7rem); }

.section--board { background: var(--board); }

.section__grid {
  display: grid;
  gap: 1.75rem;
}

.section__title {
  font: 800 clamp(1.75rem, 4vw, 2.125rem)/1.15 var(--font-display);
  letter-spacing: -.01em;
}

@media (min-width: 72rem) {
  .section__grid {
    grid-template-columns: clamp(10.5rem, 16vw, 13rem) minmax(0, 1fr);
    gap: clamp(2rem, 4vw, 3rem);
  }

  .section__grid > :first-child {
    position: sticky;
    top: 2rem;
    align-self: start;
  }
}


/* ---------- About ---------- */

.about {
  display: grid;
  gap: 2.5rem;
}

.about__text { max-width: 38rem; }
.about__text p + p { margin-top: 1.1em; }

.lead {
  font: 500 clamp(1.375rem, 3.2vw, 1.75rem)/1.3 var(--font-display);
  letter-spacing: -.005em;
  color: var(--sweater);
}

.lead + p { margin-top: 1.5rem; }

.timeline {
  align-self: start;
  padding: 1.25rem 1.5rem 1.5rem;
  background: var(--board);
  border: 1px solid var(--line);
  border-top: 3px solid var(--ink);
}

.timeline__title {
  font: 800 1rem/1.3 var(--font-display);
}

.timeline__list li {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.timeline__where { font-weight: 600; }

.timeline__what {
  font-size: .9375rem;
  line-height: 1.5;
  color: var(--muted);
}

@media (min-width: 56rem) {
  .about {
    grid-template-columns: minmax(0, 1fr) 19rem;
    gap: 3rem;
  }
}


/* ---------- Work ---------- */

.work__intro {
  max-width: 36rem;
  margin-bottom: 2rem;
}

.work { border-top: 2px solid var(--ink); }

.work__item {
  display: grid;
  gap: .375rem 2rem;
  padding-block: 1.75rem;
  border-bottom: 1px solid var(--line);
}

.work__main h3 {
  font: 800 1.25rem/1.25 var(--font-display);
  letter-spacing: -.005em;
}

.work__main p {
  margin-top: .5rem;
  max-width: 36rem;
}

.work__main code {
  padding: .1em .35em;
  font: 500 .9em/1 var(--font-mono);
  background: var(--paper);
  border-radius: 2px;
}

.work__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .5rem 1.5rem;
  margin-top: .625rem;
}

.stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0 .45rem;
  font: 400 .8125rem/1.7 var(--font-mono);
  color: var(--muted);
}

.stack li { white-space: nowrap; }

.stack li:not(:last-child)::after {
  content: ",";
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1.25rem;
}

.links a,
.more {
  display: inline-block;
  padding-block: .25rem;
  font-weight: 600;
  font-size: .9375rem;
  color: var(--sweater);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .25em;
}

.links a:hover,
.more:hover { text-decoration-thickness: 2px; }

@media (min-width: 40rem) {
  .work__item { grid-template-columns: 6.5rem minmax(0, 1fr); }
  .work__item .years { padding-top: .3rem; }
  .work__meta { grid-column: 2; }
}

@media (min-width: 60rem) {
  .work__item { grid-template-columns: 6.5rem minmax(0, 1fr) 11.5rem; }

  .work__meta {
    grid-column: 3;
    display: block;
    margin-top: 0;
    padding-top: .3rem;
  }

  .stack { display: block; }
  .stack li:not(:last-child)::after { content: none; }

  .links {
    display: block;
    margin-top: .375rem;
  }

}


/* ---------- Writing ---------- */

.writing__intro {
  max-width: 36rem;
  margin-bottom: 2rem;
}

.writing__year {
  display: grid;
  gap: .25rem 2rem;
  padding-block: 1rem;
  border-top: 1px solid var(--line);
}

.writing__year:first-of-type { border-top: 2px solid var(--ink); }

.writing__year li { padding-block: .05rem; }

.writing__year a {
  display: inline-block;
  padding-block: .4rem;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-decoration-thickness: 2px;
  text-underline-offset: .28em;
}

.writing__year a:hover {
  color: var(--sweater);
  text-decoration-color: currentColor;
}

.note {
  margin-left: .375rem;
  font: 400 .8125rem/1.6 var(--font-mono);
  color: var(--muted);
  white-space: nowrap;
}

.writing__more {
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

@media (min-width: 40rem) {
  .writing__year { grid-template-columns: 6.5rem minmax(0, 1fr); }
  .writing__year .years { padding-top: .5rem; }
}


/* ---------- Contact ---------- */

.section--sweater {
  background: var(--sweater-deep);
  color: var(--paper);
}

.contact__intro {
  margin-top: 1rem;
  max-width: 26rem;
}

.form {
  display: grid;
  gap: 1.25rem;
  max-width: 42rem;
}

.field label {
  display: block;
  margin-bottom: .375rem;
  font-size: .9375rem;
  font-weight: 600;
}

.field input,
.field textarea {
  display: block;
  width: 100%;
  padding: .75rem .875rem;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid transparent;
  border-radius: 2px;
  appearance: none;
}

.field textarea {
  min-height: 9rem;
  resize: vertical;
}

.field input:focus,
.field textarea:focus { background: var(--board); }

.field [aria-invalid="true"] { border-color: var(--ink); }

.field__error {
  margin-top: .5rem;
  font-size: .9375rem;
  font-weight: 600;
}

.field__error::before {
  content: "!";
  display: inline-grid;
  place-items: center;
  width: 1.25rem;
  height: 1.25rem;
  margin-right: .5rem;
  border-radius: 50%;
  background: var(--paper);
  color: var(--sweater-deep);
  font: 800 .8125rem/1 var(--font-display);
}

.form__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
}

.button {
  padding: .875rem 1.75rem;
  font: 800 1rem/1.2 var(--font-display);
  color: var(--ink);
  background: var(--paper);
  border: 0;
  border-radius: 2px;
  cursor: pointer;
  transition: background-color .15s;
}

.button:hover { background: var(--board); }

.button:disabled {
  opacity: .65;
  cursor: progress;
}

.form__status { font-weight: 600; }
.form__status:empty { display: none; }

.thanks {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  max-width: 34rem;
  font: 800 clamp(1.375rem, 3vw, 1.75rem)/1.3 var(--font-display);
}

.thanks .led {
  width: .75rem;
  height: .75rem;
  transform: translateY(-.1em);
}

.thanks:focus { outline: none; }

/* Wide screens: the short fields on the left, the message next to them. */
@media (min-width: 48rem) {
  .form {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
    column-gap: 1.5rem;
    max-width: none;
  }

  .field { grid-column: 1; }

  .field--message {
    grid-column: 2;
    grid-row: 1 / span 3;
    display: flex;
    flex-direction: column;
  }

  .field--message textarea { flex: 1; }
  .form__actions { grid-column: 2; }
}


/* ---------- Footer ---------- */

.footer {
  padding-block: clamp(3rem, 7vw, 5rem) 2.5rem;
  background: var(--ink);
  color: var(--paper);
}

/* One chip, eight pins. A single row of pins on a phone (SIP-8),
   pins down both sides from 48rem up (DIP-8). */
.pinout-fig { margin: clamp(1.75rem, 4vw, 2.75rem) 0 0; }

.pinout {
  display: grid;
  grid-template-columns: 4.75rem minmax(0, 1fr);
  grid-template-rows: repeat(8, 3.625rem);
  max-width: 30rem;
}

.chip {
  position: relative;
  grid-column: 1;
  grid-row: 1 / -1;
  display: grid;
  place-items: center;
  border-radius: 3px;
  background: var(--chip);
  box-shadow: inset 0 0 0 1px rgba(244, 241, 234, .16);
}

.chip::before { /* orientation notch */
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 1.625rem;
  height: .8125rem;
  margin-left: -.8125rem;
  border-radius: 0 0 .8125rem .8125rem;
  background: var(--ink);
  box-shadow: inset 0 -1px 0 rgba(244, 241, 234, .16);
}

.chip__dot {
  position: absolute;
  top: 1.375rem;
  right: .625rem;
  width: .4375rem;
  height: .4375rem;
  border-radius: 50%;
  background: rgba(244, 241, 234, .35);
}

.chip__mark {
  display: flex;
  flex-direction: column;
  gap: .1875rem;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font: 400 .6875rem/1.3 var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(244, 241, 234, .72);
}

.chip__mark b {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: .08em;
  color: var(--paper);
}

.pin { grid-column: 2; display: flex; }

.pin a {
  flex: 1;
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  min-width: 0;
  color: var(--paper);
  text-decoration: none;
}

.pad {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.875rem;
  height: 1.25rem;
  background: var(--tin);
  color: var(--ink);
  font: 600 .6875rem/1 var(--font-mono);
}

.trace {
  flex: none;
  width: 1.125rem;
  height: 2px;
  background: rgba(52, 224, 141, .38);
}

.pin__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding-left: .75rem;
}

.pin__name { font: 500 1.0625rem/1.3 var(--font-mono); }

.pin__sub {
  font: 400 .8125rem/1.35 var(--font-mono);
  color: #bdb6ab;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pin a:hover .pad,
.pin a:focus-visible .pad,
.pin a:hover .trace,
.pin a:focus-visible .trace { background: var(--led); }

.pin a:hover .pin__name,
.pin a:focus-visible .pin__name {
  text-decoration: underline;
  text-decoration-color: var(--led);
  text-underline-offset: .25em;
}

.pinout-fig figcaption {
  margin-top: 1.75rem;
  font: 400 .8125rem/1.5 var(--font-mono);
  color: #bdb6ab;
}

@media (min-width: 48rem) {
  .pinout {
    grid-template-columns: minmax(0, 1fr) 13rem minmax(0, 1fr);
    grid-template-rows: repeat(4, 5rem);
    max-width: 54rem;
    margin-inline: auto;
  }

  .chip { grid-column: 2; }
  .chip__dot { top: 1.5rem; right: auto; left: .875rem; }
  .chip__mark { writing-mode: horizontal-tb; transform: none; align-items: center; gap: .125rem; }
  .chip__mark b { font-size: 1.5rem; margin-bottom: .25rem; }

  .p1, .p2, .p3, .p4 { grid-column: 1; }
  .p5, .p6, .p7, .p8 { grid-column: 3; }
  .p1, .p8 { grid-row: 1; }
  .p2, .p7 { grid-row: 2; }
  .p3, .p6 { grid-row: 3; }
  .p4, .p5 { grid-row: 4; }

  .p1 a, .p2 a, .p3 a, .p4 a { flex-direction: row; }
  .p1 .pin__text, .p2 .pin__text, .p3 .pin__text, .p4 .pin__text { flex: none; padding: 0 .75rem 0 0; text-align: right; }
  .p5 .pin__text, .p6 .pin__text, .p7 .pin__text, .p8 .pin__text { flex: none; }
  .trace { flex: 1; width: auto; min-width: 1.125rem; }
  .pinout-fig figcaption { text-align: center; }
}

.footer__base {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 2rem;
  margin-top: clamp(2.5rem, 6vw, 4rem);
  padding-top: 1.5rem;
  border-top: 1px solid rgba(244, 241, 234, .22);
  font: 400 .8125rem/1.7 var(--font-mono);
  color: #bdb6ab;
}

.footer__base p:last-child { margin-left: auto; }
.footer__base a {
  display: inline-block;
  padding-block: .25rem;
  text-underline-offset: .25em;
}
.footer__base a:hover { color: var(--led); }


@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
