/* Dan Griffiths. Paper for the front page, a cutting mat for the side of the desk. */
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("fonts/bricolage-grotesque.woff2") format("woff2-variations"), url("fonts/bricolage-grotesque.woff2") format("woff2");
  font-weight: 200 800; font-stretch: 75% 100%; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Gochi Hand";
  src: url("fonts/gochi-hand.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  --paper: #F5F6F3;
  --graphite: #222629;
  --pencil: #5E6469;
  --ink: #2442B0;            /* ballpoint blue, for links on paper */
  --mat: #1D594D;            /* self-healing cutting mat */
  --mat-deep: #164A40;
  --mat-line: rgba(255, 255, 255, .07);
  --mat-major: rgba(255, 255, 255, .17);
  --chalk: #EEF3EF;          /* text on the mat */
  --card: #FFFFFF;
  --card-rule: #D6E2F2;      /* index card ruling */
  --card-red: #E08A86;
  --tape: rgba(233, 219, 170, .92);
  --tape-idea: rgba(250, 233, 120, .92);
  --tape-live: rgba(176, 226, 196, .95);
  --focus: #FFD54A;
  --display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --hand: "Gochi Hand", "Comic Sans MS", cursive;
  --grid: 24px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--display);
  font-optical-sizing: auto;
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--graphite);
  background: var(--paper);
}
body.on-mat { background: var(--mat); color: var(--chalk); }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 2px; }
.mat :focus-visible { outline-color: var(--focus); }
h1, h2, h3 { line-height: 1.1; margin: 0; }
p { margin: 0 0 1em; }

.skip { position: absolute; left: -999px; top: 0; background: var(--card); padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: 1rem; top: 1rem; }

/* ---------- the cutting mat ---------- */
.mat {
  position: relative;
  background-color: var(--mat);
  background-image:
    linear-gradient(var(--mat-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--mat-major) 1px, transparent 1px),
    linear-gradient(var(--mat-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--mat-line) 1px, transparent 1px);
  background-size: calc(var(--grid) * 5) calc(var(--grid) * 5), calc(var(--grid) * 5) calc(var(--grid) * 5), var(--grid) var(--grid), var(--grid) var(--grid);
  color: var(--chalk);
}
/* ruler ticks along the top edge of the mat */
.mat::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 0; height: 14px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.55) 0 1px, transparent 1px calc(var(--grid) * 5)),
    repeating-linear-gradient(90deg, rgba(255,255,255,.35) 0 1px, transparent 1px var(--grid));
  background-size: 100% 14px, 100% 7px;
  background-repeat: no-repeat;
  pointer-events: none;
}
.mat a { color: var(--chalk); }

/* ---------- index cards ---------- */
.card {
  position: relative;
  background-color: var(--card);
  background-image: repeating-linear-gradient(transparent 0 calc(1.55rem - 1px), var(--card-rule) calc(1.55rem - 1px) 1.55rem);
  color: var(--graphite);
  padding: 0 1.25rem 1.2rem;
  transform: rotate(var(--tilt, 0deg));
  box-shadow: 0 1px 1px rgba(0, 0, 0, .18), 0 10px 22px -12px rgba(0, 0, 0, .55);
  transition: transform .18s ease, box-shadow .18s ease;
}
.card h3 {
  font-size: 1.45rem; font-weight: 800; letter-spacing: -.01em; line-height: 1.15;
  background: var(--card); border-bottom: 1px solid var(--card-red);
  margin: 0 -1.25rem .5rem; padding: 1.6rem 1.25rem .55rem;
}
.card h3 a { color: var(--graphite); text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; }
.card p { line-height: 1.55rem; margin: 0 0 1.55rem; }
.card .card-meta { margin: 0; color: var(--pencil); font-size: .9rem; }
.card--photo { background-image: none; padding-top: .75rem; }
.card--photo h3 { padding-top: 0; border-bottom: 0; }
.card--photo img { margin: 0 -.5rem .9rem; width: calc(100% + 1rem); max-width: none; aspect-ratio: 16 / 10; object-fit: cover; }
.card:hover, .card:focus-within { transform: rotate(0deg) translateY(-4px); box-shadow: 0 2px 2px rgba(0, 0, 0, .2), 0 18px 30px -14px rgba(0, 0, 0, .6); }
.card h3 a:focus-visible { outline: none; }
.card:focus-within { outline: 3px solid var(--focus); outline-offset: 4px; }

.tape {
  position: absolute; top: -.85rem; left: 50%;
  transform: translateX(-50%) rotate(calc(var(--tilt, 0deg) * -1.6));
  background: var(--tape);
  font-family: var(--hand);
  font-size: 1.05rem; line-height: 1;
  color: var(--graphite);
  padding: .4rem 1.1rem .35rem;
  white-space: nowrap;
  clip-path: polygon(2% 0, 98% 4%, 100% 50%, 97% 100%, 1% 96%, 0 50%);
  z-index: 1;
}
.tape--idea { background: var(--tape-idea); }
.tape--live { background: var(--tape-live); }

/* ---------- front page ---------- */
.home {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 38vw);
  min-height: 100vh;
}
.home-text { padding: clamp(2rem, 6vw, 5.5rem) clamp(1rem, 6vw, 6rem) 3rem; max-width: 46rem; }
.masthead h1 {
  font-size: clamp(3.2rem, 9.5vw, 8rem);
  font-weight: 800;
  letter-spacing: -.045em;
  line-height: .88;
  margin: 0 0 2.5rem;
  max-width: 6ch;
}
.intro { font-size: clamp(1.15rem, 1.6vw, 1.35rem); line-height: 1.5; max-width: 33em; }
.intro p { margin-bottom: 1.1em; }
.work { margin-top: 3.5rem; }
.work h2 { font-size: 1rem; font-weight: 600; color: var(--pencil); margin-bottom: 1rem; }
.work-list { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--graphite); }
.work-list li { display: grid; grid-template-columns: 12rem minmax(0, 1fr); gap: 1.5rem; padding: 1rem 0; border-bottom: 1px solid #CDD1D3; }
.work-list h3 { font-size: 1.2rem; font-weight: 600; }
.work-list p { margin: 0; color: var(--pencil); }
.home-foot { margin-top: 3rem; }

.mat--side {
  position: sticky; top: 0; height: 100vh;
  overflow: hidden;
  padding: 2.5rem 2rem 2rem;
  display: flex; flex-direction: column;
  box-shadow: inset 10px 0 18px -12px rgba(0, 0, 0, .55);
}
.mat-label {
  font-size: clamp(2rem, 3.4vw, 3rem); font-weight: 800; letter-spacing: -.03em; line-height: 1;
  text-decoration: none; display: block;
}
.mat-label:hover { text-decoration: underline; text-decoration-thickness: 3px; }
.mat-count { display: block; font-family: var(--hand); font-size: 1.15rem; font-weight: 400; letter-spacing: 0; margin-top: .4rem; opacity: .85; }
.mat-pile { position: relative; flex: 1; margin-top: 2.25rem; }
.mat-pile .card { width: min(82%, 320px); margin-bottom: 1.6rem; background-image: none; }
.mat-pile .card:nth-child(2) { margin-left: 18%; }
.mat-pile .card:nth-child(3) { margin-left: 6%; }
.mat-pile .card:nth-child(4) { margin-left: 22%; }
.card--small { padding-bottom: .6rem; }
.card--small h3 { font-size: 1.2rem; margin-bottom: 0; border-bottom: 0; padding: 1.15rem 1.25rem .2rem; }
.card--small.card--photo img { aspect-ratio: 16 / 7; margin-bottom: .6rem; }
.mat-more {
  align-self: flex-start; margin-top: 1rem;
  font-family: var(--hand); font-size: 1.35rem; color: var(--graphite) !important; text-decoration: none;
  background: var(--tape); padding: .45rem 1.2rem; transform: rotate(-2deg);
}
.mat-more:hover { background: var(--tape-idea); }

/* ---------- the desk ---------- */
.mat--full { min-height: 100vh; padding: 3rem clamp(1rem, 5vw, 4.5rem) 5rem; }
.desk-head { max-width: 62rem; margin-bottom: 3.5rem; }
.back-tag {
  display: inline-block; font-family: var(--hand); font-size: 1.2rem;
  color: var(--graphite) !important; text-decoration: none;
  background: var(--tape); padding: .35rem 1rem; transform: rotate(-1.5deg); margin-bottom: 2rem;
}
.back-tag::before { content: "\2190\00a0"; }
.desk-head h1 { font-size: clamp(3rem, 8vw, 6.5rem); font-weight: 800; letter-spacing: -.045em; line-height: .9; margin-bottom: 1.25rem; }
.desk-intro { font-size: 1.25rem; max-width: 34em; opacity: .9; }
.finder { margin: 2.25rem 0 1.25rem; max-width: 28rem; }
.finder label { display: block; font-family: var(--hand); font-size: 1.2rem; margin-bottom: .35rem; }
.finder input {
  width: 100%; font: inherit; font-size: 1.2rem; color: var(--graphite);
  background: var(--card); border: 0; padding: .8rem 1rem;
  box-shadow: 0 8px 18px -10px rgba(0, 0, 0, .6);
  border-radius: 2px;
}
.finder input:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.tag-row { display: flex; flex-wrap: wrap; gap: .6rem .7rem; }
.tag {
  font-family: var(--hand); font-size: 1.1rem; line-height: 1; cursor: pointer;
  color: var(--graphite); background: var(--tape); border: 0; padding: .45rem .95rem .4rem;
  clip-path: polygon(3% 0, 97% 6%, 100% 55%, 96% 100%, 2% 94%, 0 45%);
}
.tag[aria-pressed="true"] { background: var(--graphite); color: var(--tape-idea); }
.tag:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; clip-path: none; }
.count { font-family: var(--hand); font-size: 1.15rem; margin: 1.25rem 0 0; opacity: .85; }
.pile {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr));
  gap: 3rem 2.25rem;
  align-items: start;
  max-width: 82rem;
}
.empty { font-size: 1.2rem; max-width: 30em; }

/* ---------- a project sheet ---------- */
.crumbs { max-width: 46rem; margin: 0 auto; }
.sheet {
  position: relative; max-width: 46rem; margin: 0 auto;
  background: var(--card); color: var(--graphite);
  padding: clamp(2rem, 5vw, 3.5rem) clamp(1.25rem, 5vw, 3.5rem) 2.5rem;
  transform: rotate(var(--tilt, 0deg));
  box-shadow: 0 2px 2px rgba(0, 0, 0, .2), 0 24px 40px -18px rgba(0, 0, 0, .6);
}
.sheet .tape { font-size: 1.2rem; }
.sheet h1 { font-size: clamp(2.4rem, 6vw, 4rem); font-weight: 800; letter-spacing: -.035em; line-height: .95; margin: .5rem 0 1rem; }
.lede { font-size: 1.3rem; line-height: 1.45; max-width: 32em; }
.sheet-meta { color: var(--pencil); font-size: .95rem; }
.sheet-links { list-style: none; padding: 0; margin: 1.5rem 0; display: flex; flex-wrap: wrap; gap: .75rem; }
.sheet-links a {
  display: inline-block; font-weight: 600; text-decoration: none; color: var(--card);
  background: var(--ink); padding: .6rem 1.1rem; border-radius: 3px;
}
.sheet-links a:hover { background: var(--graphite); }
.sheet figure { margin: 2rem -1rem; }
.prose { max-width: 36em; }
.prose h2 { font-size: 1.35rem; font-weight: 800; margin: 2.25rem 0 .9rem; }
.prose ul, .prose ol { padding-left: 1.2rem; margin: 0 0 1em; }
.prose li { margin-bottom: .35em; }
.prose code { font-size: .92em; background: #EEF0F2; padding: .05em .3em; border-radius: 3px; }

/* ---------- 404 ---------- */
.lost { padding: 4rem clamp(1rem, 6vw, 6rem); max-width: 40rem; }
.lost h1 { font-size: clamp(2.5rem, 7vw, 5rem); font-weight: 800; letter-spacing: -.04em; margin-bottom: 1rem; }

/* ---------- smaller screens ---------- */
@media (max-width: 860px) {
  .home { grid-template-columns: 1fr; }
  .mat--side { position: relative; height: auto; padding: 2.25rem 16px 2rem; box-shadow: inset 0 10px 18px -12px rgba(0, 0, 0, .55); }
  .mat-pile { margin-top: 1.75rem; }
  .mat-pile .card:nth-child(n+4) { display: none; }
  .mat-pile .card:nth-child(2) { margin-left: 12%; }
  .mat-pile .card { margin-bottom: 1.6rem; }
  .mat-more { margin-top: 1.75rem; }
  .work-list li { grid-template-columns: 1fr; gap: .25rem; }
  .home-text { padding-left: 16px; padding-right: 16px; }
  .mat--full { padding-left: 16px; padding-right: 16px; }
}

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