/* =========================================================
   Max's Website — the projects workshop
   loaded after style.css, which provides --px
   ========================================================= */

/* always keep the scrollbar, so tools line up with the holes at the real width */
html { overflow-y: scroll; }

body.workshop {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: Georgia, "Times New Roman", serif;
  color: #2a1d14;
  image-rendering: pixelated;
  background: #c1965e url("assets/sprites/workshop-pegboard.png") repeat 0 0 /
    calc(64px * var(--px)) calc(64px * var(--px));
  /* room down each side for the tools */
  --gutter: calc(48px * var(--px));
}

/* ---------- tools on the pegs ---------- */
.tool-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.tool-layer img {
  position: absolute;
  filter: drop-shadow(calc(2px * var(--px)) calc(2px * var(--px)) 0 rgba(42, 29, 20, 0.35));
}

/* ---------- header ---------- */
.shop-head {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  padding: 30px 16px 0;
}
.back-sign {
  padding: 6px 16px;
  font: 700 14px "Trebuchet MS", sans-serif;
  color: #2a1d14;
  text-decoration: none;
  background: #e8dcb9;
  border: 3px solid #2a1d14;
  box-shadow: 3px 3px 0 #2a1d14;
}
.back-sign:hover { background: #fbf3de; }
.back-sign:active { transform: translate(3px, 3px); box-shadow: none; }

.shop-sign {
  display: grid;
  place-items: center;
  width: calc(120px * var(--px));
  height: calc(28px * var(--px));
  margin: 0;
  font: 700 calc(11px * var(--px)) "Courier New", Courier, monospace;
  letter-spacing: calc(1.5px * var(--px));
  text-transform: uppercase;
  color: #3a2210;
  text-shadow: 0 2px 0 #d79a58;          /* burnt into the wood */
  background: url("assets/sprites/workshop-sign.png") no-repeat 0 0 / 100% 100%;
  filter: drop-shadow(calc(2px * var(--px)) calc(3px * var(--px)) 0 rgba(42, 29, 20, 0.35));
}

/* ---------- the board of project cards ---------- */
.board {
  position: relative;
  z-index: 1;
  flex: 1;
  box-sizing: border-box;
  width: 100%;
  display: grid;
  /* three cards across, each the size of an index card (about 380px wide);
     on a narrower screen they shrink a little rather than drop to two */
  grid-template-columns: repeat(3, minmax(0, 380px));
  justify-content: center;
  align-content: start;
  gap: 54px 40px;
  padding: 60px var(--gutter) 80px;
}

/* an index card: the title over a red line, the rest written on blue ruled lines */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 26px 20px 18px;
  color: #2a1d14;
  text-decoration: none;
  background: #fbf3de;
  border: 3px solid #2a1d14;
  box-shadow: 6px 8px 0 rgba(42, 29, 20, 0.3);
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.15s;
}
.card:hover, .card:focus-visible {
  transform: rotate(0deg) translateY(-4px);
  box-shadow: 8px 12px 0 rgba(42, 29, 20, 0.3);
  outline: none;
}
.card:focus-visible { border-color: #3f8fd6; }
.card .pin {
  position: absolute;
  top: calc(-3px * var(--px));
  left: 50%;
  width: calc(8px * var(--px));
  transform: translateX(-50%);
}
.card h2 {
  margin: 0 -20px;
  padding: 0 20px 8px;
  font-size: 19px;
  line-height: 1.2;
  border-bottom: 2px solid #e26d5c;
}
.card-kind {
  margin: 0;
  font: 700 12px "Trebuchet MS", sans-serif;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #8a5a2c;
}
.card-cover {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border: 3px solid #2a1d14;
  image-rendering: auto;
}
.card-sum {
  margin: 0;
  flex: 1;
  font-size: 15px;
  line-height: 24px;
  background: repeating-linear-gradient(transparent 0 23px, #c6dbe8 23px 24px);
}
.card-more { font: 700 13px "Trebuchet MS", sans-serif; color: #24609c; }

.board-empty {
  grid-column: 1 / -1;
  max-width: 560px;
  margin: 0 auto;
  padding: 22px;
  text-align: center;
  font-size: 17px;
  background: #fbf3de;
  border: 3px solid #2a1d14;
}

/* ---------- one project's write-up, on a big pinned sheet ---------- */
.sheet-wrap {
  position: relative;
  z-index: 1;
  flex: 1;
  padding: 50px var(--gutter) 80px;
}
.sheet {
  position: relative;
  box-sizing: border-box;
  max-width: 820px;
  margin: 0 auto;
  padding: 44px clamp(20px, 5vw, 56px) 40px;
  font-size: 17px;
  line-height: 1.65;
  background: #fffaf0;
  border: 3px solid #2a1d14;
  box-shadow: 8px 10px 0 rgba(42, 29, 20, 0.3);
}
.sheet .pin {
  position: absolute;
  top: 10px;
  width: calc(8px * var(--px));
}
.sheet .pin-l { left: 12px; }
.sheet .pin-r { right: 12px; }
.sheet-kind {
  margin: 0 0 4px;
  font: 700 13px "Trebuchet MS", sans-serif;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #8a5a2c;
}
.sheet h1 { margin: 0 0 18px; font-size: clamp(26px, 4vw, 36px); line-height: 1.15; }
.sheet h2 { margin: 1.6em 0 0.4em; font-size: 23px; border-bottom: 3px solid #e8dcb9; }
.sheet h3 { margin: 1.3em 0 0.3em; font-size: 19px; }
.sheet a { color: #24609c; }
.sheet img:not(.pin) {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 18px auto;
  border: 3px solid #2a1d14;
  image-rendering: auto;
}
.sheet code {
  padding: 1px 5px;
  font: 15px Consolas, "Courier New", monospace;
  background: #efe5cc;
}
.sheet pre {
  overflow-x: auto;
  padding: 14px 16px;
  color: #d8f5d0;
  background: #1f2a22;
  border: 3px solid #2a1d14;
}
.sheet pre code { padding: 0; color: inherit; background: none; }
.sheet blockquote {
  margin: 1em 0;
  padding: 4px 18px;
  color: #5c4517;
  background: #f4ecd2;
  border-left: 6px solid #c08549;
}
.sheet hr { border: 0; border-top: 3px dashed #d8cdb0; margin: 2em 0; }
.sheet table { border-collapse: collapse; margin: 1em 0; }
.sheet th, .sheet td { padding: 4px 10px; border: 2px solid #d8cdb0; text-align: left; }

/* the whole report, as a PDF on its own sheet under the write-up */
.sheet + .sheet { margin-top: 56px; }
.sheet.report h2 { margin-top: 0; }
.report-links { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 14px; }
.report-links a {
  padding: 5px 14px;
  font: 700 14px "Trebuchet MS", sans-serif;
  color: #2a1d14;
  text-decoration: none;
  background: #e8dcb9;
  border: 3px solid #2a1d14;
  box-shadow: 3px 3px 0 #2a1d14;
}
.report-links a:hover { background: #fbf3de; }
.report-links a:active { transform: translate(3px, 3px); box-shadow: none; }
.report-pdf {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1.3;
  border: 3px solid #2a1d14;
  background: #fff;
}

/* ---------- the workbench ---------- */
.bench {
  position: relative;
  z-index: 2;
  height: calc(48px * var(--px));
  background: url("assets/sprites/workshop-bench.png") repeat-x 0 0 /
    calc(128px * var(--px)) calc(48px * var(--px));
}
.mug {
  position: absolute;
  left: 14%;
  top: calc(-6px * var(--px));
  width: calc(11px * var(--px));
}

@media (max-width: 899px) {
  .board { grid-template-columns: repeat(2, minmax(0, 380px)); }
}
@media (max-width: 640px) {
  .board { grid-template-columns: minmax(0, 380px); }
  body.workshop { --gutter: 16px; }
  .board { gap: 44px; }
}
