/* Layout and components. Values come from css/tokens.css. */

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

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-display);
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* Header: shares the board's grid and its lines. */
.masthead {
  display: grid;
  grid-template-columns: repeat(var(--board-cols), minmax(0, 1fr));
  gap: var(--hairline);
  background: var(--line);
  border-bottom: var(--hairline) solid var(--line);
}

.masthead__name {
  grid-column: span 6;
  grid-row: span 2;
  display: flex;
  align-items: flex-end;
  min-height: 520px;
  padding: var(--space-10) var(--gutter) var(--space-6);
  background: var(--ground);
}

.masthead__name h1 {
  font-size: var(--fs-name);
  font-stretch: 68%;
  font-weight: 850;
  line-height: 0.96; /* Tighter than this and the accent on the last letter of the name touches the line above. */
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.masthead__lede {
  grid-column: span 2;
  display: flex;
  align-items: flex-end;
  padding: var(--space-6);
  background: var(--live-bg);
  color: var(--live-ink);
}

.masthead__lede p {
  font-family: var(--font-serif);
  font-size: var(--fs-lede);
  line-height: 1.15;
}

.masthead__links {
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--space-3) var(--space-6);
  background: var(--ground);
}

.profile-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  border-top: var(--hairline) solid var(--line);
  color: var(--ink);
  font-size: 17px;
  font-stretch: 85%;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-decoration: none;
  text-transform: uppercase;
}

.profile-link:hover {
  text-decoration: underline;
}

@media (max-width: 1023px) {
  .masthead__name {
    grid-column: span 4;
    grid-row: auto;
    min-height: 360px;
  }
}

@media (max-width: 639px) {
  .masthead__name {
    grid-column: span 2;
    min-height: 280px;
  }

  .masthead__lede,
  .masthead__links {
    padding-left: var(--gutter);
    padding-right: var(--gutter);
  }
}

/* At work heading */
.section-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-10) var(--gutter) var(--space-4);
  border-bottom: var(--hairline) solid var(--line);
}

.section-bar__title {
  font-size: var(--fs-label);
  font-stretch: 68%;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.section-bar__count {
  font-size: 14px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* At work cells: one row of equal cells on desktop, whatever the count. */
.work-cells {
  display: grid;
  grid-template-columns: repeat(var(--work-cols, 4), minmax(0, 1fr));
  gap: var(--hairline);
  background: var(--line);
  border-bottom: var(--hairline) solid var(--line);
}

@media (max-width: 1023px) {
  .work-cells {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .work-cells > .cell:last-child:nth-child(odd) {
    grid-column: span 2;
  }
}

@media (max-width: 639px) {
  .work-cells {
    grid-template-columns: minmax(0, 1fr);
  }

  .work-cells > .cell:last-child:nth-child(odd) {
    grid-column: auto;
  }
}

/* Cell. The fill sits on .cell__body so a faded cell keeps the board's ground and lines. */
.cell {
  display: flex;
  min-width: 0;
  background: var(--ground);
}

.cell__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--cell-pad);
  background: var(--ground);
  color: var(--ink);
}

.cell--live .cell__body {
  background: var(--live-bg);
  color: var(--live-ink);
}

.cell--archived .cell__body {
  background: repeating-linear-gradient(135deg, var(--hatch) 0 1px, transparent 1px 8px), var(--ground);
}

.cell--live a:focus-visible {
  outline-color: var(--live-ink);
}

.cell__name {
  font-size: var(--fs-cell-title);
  font-stretch: 85%;
  font-weight: 750;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.cell__desc {
  flex-grow: 1;
  font-size: 13px;
  line-height: 1.42;
}

.cell--featured {
  grid-column: span 2;
}

.cell--tall {
  grid-row: span var(--featured-rows);
}

.cell--featured .cell__body {
  gap: var(--space-3);
  min-height: 260px;
  padding: var(--space-6);
}

.cell--featured .cell__name {
  font-size: var(--fs-cell-title-featured);
  font-stretch: 72%;
}

.cell--featured .cell__desc {
  font-size: 16px;
}

.cell--work .cell__body {
  gap: var(--space-3);
  min-height: 260px;
  padding: var(--space-5);
}

.cell--work .cell__name {
  font-size: 24px;
  font-stretch: 80%;
  line-height: 1.08;
}

.cell--work .cell__desc {
  font-size: 14px;
}

@media (max-width: 639px) {
  .cell--work .cell__body,
  .cell--featured .cell__body {
    min-height: 0;
  }
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px var(--space-2);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
}

.meta__status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Cell foot: action on the left, dates in the bottom right corner. */
.cell__body {
  container-type: inline-size;
}

.cell__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 4px var(--space-2);
}

.meta__month {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
  white-space: nowrap;
}

.meta__month svg {
  flex: none;
}

.when-short {
  display: none;
  align-items: center;
  gap: inherit;
}

/* Where action and dates do not fit side by side, every cell stacks them, so a row stays even. */
@container (max-width: 205px) {
  .cell__foot {
    flex-direction: column;
    align-items: stretch;
  }

  .cell__foot .action {
    align-self: flex-start;
  }

  .cell__foot .meta__month {
    align-self: flex-end;
    margin-left: 0;
  }
}

/* The narrowest desktop cells: "Since" does not fit, so an arrow replaces it visually while screen
   readers still get the full text. A condensed cut keeps a range on one line and long words in a
   name whole. */
@container (max-width: 120px) {
  .cell__name {
    font-stretch: 72%;
  }

  .meta__month {
    gap: 3px;
    font-stretch: 75%;
    letter-spacing: 0.01em;
  }

  .when-short {
    display: inline-flex;
  }

  .when-long {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
}

.sw {
  flex: none;
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 1.5px solid currentColor;
}

/* Four shapes, so a status reads the same on a chip and in a cell: full, dot, empty, hatched. */
.sw--live {
  background: currentColor;
}

.sw--open-source {
  background: linear-gradient(currentColor, currentColor) center / 4px 4px no-repeat;
}

.sw--archived {
  background: repeating-linear-gradient(135deg, currentColor 0 1px, transparent 1px 3px);
}

/* Round, so it cannot be read as one of the square status icons. */
.now {
  flex: none;
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.action {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  border-bottom: 2px solid currentColor;
  color: inherit;
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-decoration: none;
  text-transform: uppercase;
}

.action:hover {
  margin-bottom: -1px;
  border-bottom-width: 3px;
}

.slot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--image-slot-height);
  padding: 0 var(--space-4);
  border: var(--hairline) dashed currentColor;
  font-size: 13px;
  text-align: center;
}

.slot--image {
  padding: 0;
  border: 0;
}

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

/* After hours band */
.after-hours {
  background: var(--band);
  color: var(--band-ink);
}

.band {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: var(--space-10);
  align-items: end;
  padding: var(--section-top) var(--gutter) var(--space-10);
}

.band__text {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.band__title {
  color: var(--accent);
  font-size: var(--fs-section);
  font-stretch: 68%;
  font-weight: 850;
  line-height: 0.9;
  text-transform: uppercase;
}

.band__intro {
  max-width: 640px;
  font-family: var(--font-serif);
  font-size: var(--fs-intro);
  font-style: italic;
  line-height: 1.2;
}

.band__summary {
  max-width: 600px;
  color: var(--ink-muted);
  font-size: 15px;
  line-height: 1.55;
}

.band__summary:empty,
.band__total:empty,
.chips:empty {
  display: none;
}

.band__total {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: flex-end;
  gap: var(--space-4);
}

.band__count {
  color: var(--accent);
  font-size: var(--fs-count);
  font-stretch: 62%;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 0.78;
}

.band__count-label {
  padding-bottom: 6px;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.04em;
  line-height: 1.3;
  text-transform: uppercase;
}

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

  .band__total {
    justify-content: flex-start;
  }
}

/* Status chips: picking one fades the other cells, nothing leaves the layout. */
.chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-5) var(--gutter) var(--space-10);
  border-top: var(--hairline) solid var(--band-rule);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-4);
  border: var(--hairline) solid var(--chip-border);
  border-radius: 0;
  background: transparent;
  color: var(--band-ink);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
}

.chip[aria-pressed="true"] {
  border-color: var(--band-ink);
  background: var(--band-ink);
  color: var(--band);
}

.chip .sw {
  width: 12px;
  height: 12px;
}

.chip .sw--open-source {
  background-size: 6px 6px;
}

.chip__count {
  font-variant-numeric: tabular-nums;
  opacity: 0.7;
}

.legend {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: var(--space-2);
  color: var(--ink-muted);
  font-size: 14px;
}

.legend__mark {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--now);
}

.cell__body {
  transition: opacity 0.2s;
}

.is-dim .cell__body {
  opacity: 0.18;
}

@media (prefers-reduced-motion: reduce) {
  .cell__body {
    transition: none;
  }
}

/* Group: a header band, then a board */
.group {
  background: var(--ground);
  color: var(--ink);
}

.group__bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--group-top) var(--gutter) var(--space-5);
  border-top: var(--hairline) solid var(--line);
  border-bottom: var(--hairline) solid var(--line);
}

.group__title {
  max-width: 900px;
  font-size: var(--fs-group);
  font-stretch: 68%;
  font-weight: 850;
  line-height: 0.92;
  text-transform: uppercase;
}

.group__count {
  font-size: var(--fs-group-count);
  font-stretch: 62%;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  line-height: 0.8;
}

.board {
  display: grid;
  grid-template-columns: repeat(var(--board-cols), minmax(0, 1fr));
  grid-auto-rows: minmax(var(--board-row-min), auto);
  grid-auto-flow: dense;
  gap: var(--hairline);
  background: var(--line);
}

.blank {
  position: relative;
  background: var(--ground);
}

.blank::before {
  content: "+";
  position: absolute;
  top: 10px;
  left: 12px;
  color: var(--blank-mark);
  font-size: 14px;
  line-height: 1;
}

/* Shown only without JavaScript */
.noscript-list {
  margin: 0;
  padding: var(--space-4) var(--gutter) var(--space-10);
  list-style: none;
}

.noscript-list a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: inherit;
}

/* Footer */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-6) var(--gutter) var(--space-10);
  background: var(--band);
  color: var(--ink-muted);
  font-size: 14px;
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
}

.site-footer__links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  color: var(--band-ink);
}
