/* Linseed — a corner of a studio.
 * One deliberate theme: warm afternoon light raking a plaster wall.
 * Gesso #EFEADD · plaster #D6CFC0 · walnut ink #2E2A23 · brass #A67C3D */

:root {
  --wall: #d6cfc0;
  --gesso: #efeadd;
  --ink: #2e2a23;
  --ink-soft: #6b6355;
  --brass: #a67c3d;
  --line: rgba(46, 42, 35, 0.16);
  --shadow: 58, 48, 34; /* warm umber shadows, rgb */
  --body: 'Karla', 'Helvetica Neue', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--body);
  color: var(--ink);
  /* plaster: warm light from the upper left over a wall with a past —
     sand grain, lime-wash streaking, blotches where each coat dried at
     its own pace. All of it under the light, not over it. */
  background:
    url("data:image/svg+xml,%3Csvg%20xmlns='http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20width='420'%20height='420'%3E%3Cfilter%20id='t'%3E%3CfeTurbulence%20type='fractalNoise'%20baseFrequency='0.09'%20numOctaves='4'%20seed='4'%20stitchTiles='stitch'%20result='n'%2F%3E%3CfeDiffuseLighting%20in='n'%20lighting-color='%23d8d1c2'%20surfaceScale='1.35'%20diffuseConstant='1.05'%20result='l'%3E%3CfeDistantLight%20azimuth='235'%20elevation='58'%2F%3E%3C%2FfeDiffuseLighting%3E%3CfeColorMatrix%20in='l'%20values='1%200%200%200%200%200%201%200%200%200%200%200%201%200%200%200%200%200%200%200.30'%2F%3E%3C%2Ffilter%3E%3Crect%20width='420'%20height='420'%20filter='url(%23t)'%2F%3E%3C%2Fsvg%3E"),
    url("data:image/svg+xml,%3Csvg%20xmlns='http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20width='240'%20height='240'%3E%3Cfilter%20id='n'%3E%3CfeTurbulence%20type='fractalNoise'%20baseFrequency='0.55'%20numOctaves='2'%20stitchTiles='stitch'%2F%3E%3CfeColorMatrix%20values='0%200%200%200%200.35%200%200%200%200%200.31%200%200%200%200%200.24%200%200%200%200.045%200'%2F%3E%3C%2Ffilter%3E%3Crect%20width='240'%20height='240'%20filter='url(%23n)'%2F%3E%3C%2Fsvg%3E"),
    url("data:image/svg+xml,%3Csvg%20xmlns='http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20width='900'%20height='700'%3E%3Cfilter%20id='s'%3E%3CfeTurbulence%20type='fractalNoise'%20baseFrequency='0.0028%200.016'%20numOctaves='3'%20seed='11'%20stitchTiles='stitch'%2F%3E%3CfeColorMatrix%20values='0%200%200%200%200.36%200%200%200%200%200.31%200%200%200%200%200.24%200%200.28%200%200%20-0.10'%2F%3E%3C%2Ffilter%3E%3Crect%20width='900'%20height='700'%20filter='url(%23s)'%2F%3E%3C%2Fsvg%3E"),
    url("data:image/svg+xml,%3Csvg%20xmlns='http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20width='760'%20height='760'%3E%3Cfilter%20id='m'%3E%3CfeTurbulence%20type='fractalNoise'%20baseFrequency='0.011'%20numOctaves='3'%20seed='7'%20stitchTiles='stitch'%2F%3E%3CfeColorMatrix%20values='0%200%200%200%200.33%200%200%200%200%200.28%200%200%200%200%200.21%200.55%200%200%200%20-0.17'%2F%3E%3C%2Ffilter%3E%3Crect%20width='760'%20height='760'%20filter='url(%23m)'%2F%3E%3C%2Fsvg%3E"),
    url("data:image/svg+xml,%3Csvg%20xmlns='http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20width='820'%20height='820'%3E%3Cfilter%20id='p'%3E%3CfeTurbulence%20type='fractalNoise'%20baseFrequency='0.009'%20numOctaves='3'%20seed='23'%20stitchTiles='stitch'%2F%3E%3CfeColorMatrix%20values='0%200%200%200%200.99%200%200%200%200%200.97%200%200%200%200%200.91%200%200.5%200%200%20-0.16'%2F%3E%3C%2Ffilter%3E%3Crect%20width='820'%20height='820'%20filter='url(%23p)'%2F%3E%3C%2Fsvg%3E"),
    radial-gradient(130% 100% at 18% 0%, rgba(255, 250, 236, 0.65), transparent 55%),
    radial-gradient(120% 130% at 85% 110%, rgba(var(--shadow), 0.30), transparent 55%),
    linear-gradient(160deg, #ddd6c7 0%, var(--wall) 45%, #c9c1af 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

button { font-family: var(--body); cursor: pointer; }

/* ---------------- wall actions (small gallery labels, no chrome) ------- */

/* the actions live on a small brass plate screwed to the plaster, the way
   a gallery hangs its light switches — engraved marks, no words */
.actions {
  position: fixed;
  top: 18px;
  right: 26px;
  display: flex;
  align-items: center;
  padding: 5px 17px;
  border-radius: 3px;
  z-index: 20;
  /* rolled brass, lit from the upper left, with a fine rolling grain */
  background:
    repeating-linear-gradient(154deg,
      rgba(255, 252, 240, 0.05) 0 1px, rgba(58, 40, 12, 0.04) 1px 2px),
    linear-gradient(154deg, #dbbf88 0%, #c19d5d 20%, #9d783a 48%, #ba9453 72%, #7c5c28 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 250, 228, 0.8),
    inset 1px 0 0 rgba(255, 250, 228, 0.3),
    inset 0 -1px 0 rgba(56, 38, 10, 0.5),
    inset -1px 0 0 rgba(56, 38, 10, 0.35),
    0 1px 1px rgba(var(--shadow), 0.3),
    9px 13px 20px rgba(var(--shadow), 0.3);
}

/* the two slotted screws holding it to the wall */
.actions::before,
.actions::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-radius: 50%;
  /* a slotted head, driven a little off square the way a real one is */
  background:
    linear-gradient(62deg, transparent 40%, rgba(44, 29, 6, 0.9) 40%,
                    rgba(44, 29, 6, 0.9) 60%, transparent 60%),
    radial-gradient(circle at 32% 26%, #fbf0c8 0%, #dab766 34%, #977322 76%, #4f3813 100%);
  box-shadow:
    inset 0 0 1px rgba(40, 26, 4, 0.9),
    0 1px 1px rgba(255, 250, 228, 0.5),
    0 0 2px rgba(var(--shadow), 0.4);
}
.actions::before { left: 5.5px; }
.actions::after { right: 5.5px; }

.actions button {
  position: relative;
  width: 34px;
  height: 31px;
  display: grid;
  place-items: center;
  background: none;
  border: none;
  border-radius: 3px;
  color: rgba(52, 36, 10, 0.8);
  transition: color 140ms ease, transform 100ms ease;
}

/* a hairline scored between the keys of a group; a breath between groups */
.actions button + button {
  border-left: 1px solid rgba(70, 48, 14, 0.26);
  box-shadow: inset 1px 0 0 rgba(255, 249, 224, 0.3);
}

.actions button.group {
  margin-left: 11px;
  border-left: none;
  box-shadow: none;
}

/* the mark itself is engraved: the incision catches light on its lower lip */
.actions svg {
  position: relative;
  z-index: 1;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 0 rgba(255, 249, 226, 0.6));
}

.actions button:hover:not(:disabled) { color: rgba(34, 23, 4, 0.96); }
.actions button:active:not(:disabled) { transform: translateY(1px); }
.actions button:disabled { opacity: 0.3; cursor: default; }
.actions button:focus-visible { outline: 1px solid rgba(46, 32, 8, 0.6); outline-offset: 1px; }

/* a switch that is on stays pressed into the plate */
.actions button.active { color: #332206; }
.actions button.active::before {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 2px;
  background: rgba(58, 40, 12, 0.26);
  box-shadow:
    inset 0 2px 3px rgba(34, 22, 3, 0.62),
    inset 0 -1px 0 rgba(255, 249, 226, 0.3),
    0 1px 0 rgba(255, 249, 226, 0.45);
}

/* the waves only sound while the sound is on */
#sound .wave, #sound.active .mute { opacity: 0; }
#sound.active .wave, #sound .mute { opacity: 1; }

/* the stretcher rack: the same brass, hung at the opposite corner */
.aspects {
  right: auto;
  left: 26px;
}

/* the confirm card: a gallery label pinned beneath the brass plate */
.confirm {
  position: fixed;
  top: 66px;
  right: 26px;
  z-index: 30;
  width: 210px;
  padding: 13px 15px 12px;
  border-radius: 2px;
  background:
    linear-gradient(168deg, #f6f1e3 0%, #ece5d2 70%, #ddd4bd 100%);
  border: 1px solid rgba(46, 42, 35, 0.25);
  box-shadow:
    inset 0 1px 0 rgba(255, 253, 244, 0.85),
    2px 3px 4px rgba(var(--shadow), 0.3),
    10px 16px 26px rgba(var(--shadow), 0.28);
}

.confirm p {
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--ink);
  margin-bottom: 10px;
}

.confirm-row { display: flex; gap: 8px; justify-content: flex-end; }

.confirm-row button {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 2px;
  border: 1px solid rgba(46, 42, 35, 0.3);
  background: none;
  color: var(--ink-soft);
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}

.confirm-row button:hover { color: var(--ink); border-color: rgba(46, 42, 35, 0.55); }

#confirm-yes {
  color: #fff8ea;
  border-color: rgba(56, 38, 10, 0.6);
  background: linear-gradient(160deg, #b98f4a 0%, #96702f 60%, #7c5c26 100%);
  box-shadow: inset 0 1px 0 rgba(255, 250, 228, 0.5), 1px 2px 3px rgba(var(--shadow), 0.3);
}

#confirm-yes:hover { color: #fff; background: linear-gradient(160deg, #c69a52 0%, #a17834 60%, #86642a 100%); }

/* ---------------- studio layout ---------------- */

.studio {
  flex: 1;
  display: flex;
  min-height: 0;
  padding: 34px 10px 0 26px;
  gap: 6px;
}

/* ---------------- the canvas, in the room ---------------- */

.stage {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* the stretched canvas: a real object. Its right and bottom stretcher
   edges turn away from the light; the whole thing throws a deep, warm
   shadow down-right onto the wall, and stands on a wooden ledge. */
.stretched {
  position: relative;
  filter:
    drop-shadow(2px 3px 3px rgba(var(--shadow), 0.5))
    drop-shadow(22px 30px 34px rgba(var(--shadow), 0.36));
}

#painting {
  display: block;
  cursor: none;
  touch-action: none;
}

/* wrapped canvas edges: the fabric folding over the stretcher bars */
.stretched::after {
  content: '';
  position: absolute;
  top: 3px;
  right: -7px;
  bottom: -7px;
  width: 7px;
  background: linear-gradient(90deg, #cfc8b6, #b7ae99 55%, #9d937d);
  border-radius: 0 1px 2px 0;
}

.stretched::before {
  content: '';
  position: absolute;
  left: 3px;
  right: -7px;
  bottom: -7px;
  height: 7px;
  background: linear-gradient(180deg, #c6beab, #a89e88 60%, #8f8570);
  border-radius: 0 0 2px 2px;
}

/* ---------------- the palette, hung on the wall ---------------- */

.palette-wall {
  flex: none;
  width: clamp(200px, 30vw, 286px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.palette-board {
  width: min(230px, calc((100vh - 250px) * 0.371), 26vw);
  aspect-ratio: 230 / 620;
  border-radius: 26px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(38, 30, 20, 0.55);
  box-shadow:
    2px 3px 3px rgba(var(--shadow), 0.48),
    14px 22px 30px rgba(var(--shadow), 0.3);
}

/* the rounded-over edge of the slab: inset shadows on the board itself sit
   under the canvas and never show, so the bevel lives on an overlay */
.palette-board::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow:
    inset 0 1px 1px rgba(255, 240, 214, 0.4),
    inset 1px 0 1px rgba(255, 240, 214, 0.22),
    inset 0 -3px 4px rgba(24, 17, 9, 0.5),
    inset -3px 0 4px rgba(24, 17, 9, 0.35);
}

#palette {
  display: block;
  width: 100%;
  height: 100%;
  cursor: none;
  touch-action: none;
}

/* ---------------- the bench: brushes standing at the bottom edge ------- */

.bench {
  flex: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(26px, 5vw, 60px);
  padding: 8px 16px 0;
}

.brush-row {
  display: flex;
  align-items: flex-end;
  gap: clamp(8px, 1.8vw, 20px);
}

/* each brush stands tip-up in an unseen jar below the frame;
   only its head shows, the handle running off the bottom edge */
.brush {
  position: relative;
  background: none;
  border: none;
  padding: 0;
  transform: translateY(30px);
  transition: transform 160ms ease;
}

.brush img,
.brush svg {
  width: clamp(26px, 3.5vw, 38px);
  height: auto;
  display: block;
  filter: drop-shadow(4px 5px 4px rgba(var(--shadow), 0.3));
  transition: filter 160ms ease;
}

.brush svg { aspect-ratio: 30 / 126; }
.brush img { -webkit-user-drag: none; user-select: none; }

.brush:hover { transform: translateY(23px); }

/* paint staining the bristles of the brush in hand: a colour wash masked
   by the tool photo itself, clipped to its bristle (or blade) zone */
.brush .stain { transition: opacity 250ms ease; }

.brush span.stain {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  opacity: 0;
  pointer-events: none;
  -webkit-mask-image: var(--ph);
  mask-image: var(--ph);
  -webkit-mask-size: 100% auto;
  mask-size: 100% auto;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: top;
  mask-position: top;
}

/* the brush in hand: drawn up out of the jar */
.brush.active { transform: translateY(9px) rotate(1.5deg); }

/* the rag doesn't stand in the jar — it lies crumpled on the bench lip,
   and the hand plucks it up rather than drawing it out */
.brush.rag { transform: translateY(18%); align-self: flex-end; }
.brush.rag img { width: clamp(70px, 9.5vw, 104px); }
.brush.rag:hover { transform: translateY(10%); }
.brush.rag.active { transform: translateY(2%) rotate(-2deg); }

.brush.active img,
.brush.active svg { filter: drop-shadow(6px 9px 7px rgba(var(--shadow), 0.35)); }

/* the bottles stand on the same unseen shelf, deep enough in frame that
   you can read what you are dipping into */
.cup-row { display: flex; gap: clamp(10px, 1.6vw, 22px); align-items: flex-end; }

.cup {
  background: none;
  border: none;
  padding: 0;
  transform: translateY(20%);
  transition: transform 160ms ease;
}

.cup img {
  /* both bottles are cut to the same height, so their caps and labels
     sit level however differently they are proportioned */
  height: clamp(100px, 12.5vw, 150px);
  width: auto;
  display: block;
  filter: drop-shadow(4px 5px 4px rgba(var(--shadow), 0.3));
  -webkit-user-drag: none;
}

.cup:hover { transform: translateY(14%); }

/* dipped in linseed: the bottle stays lifted while glazing */
.cup.active { transform: translateY(10%); }

.size-block {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-bottom: 26px;
}

/* the dots at the stick's ends: a light touch and a loaded one */
.size-tip {
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #8a8072, #55493a 70%, #3b3226);
  box-shadow: 0 1px 1px rgba(255, 250, 236, 0.5), 0 1px 2px rgba(var(--shadow), 0.35) inset;
}
.size-tip.small { width: 4px; height: 4px; }
.size-tip.large { width: 11px; height: 11px; }

input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: clamp(72px, 9vw, 110px);
  height: 18px;
  background: transparent;
  cursor: pointer;
}

/* the stick: turned wood, lit like everything else from the upper left */
input[type='range']::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 3px;
  background:
    repeating-linear-gradient(92deg,
      rgba(255, 244, 218, 0.07) 0 2px, rgba(46, 28, 8, 0.09) 2px 5px),
    linear-gradient(180deg, #a87c50 0%, #85603a 45%, #5e401f 100%);
  box-shadow:
    0 1px 0 rgba(255, 240, 210, 0.4) inset,
    0 -1px 0 rgba(38, 24, 6, 0.5) inset,
    0 1px 1px rgba(var(--shadow), 0.4),
    3px 4px 6px rgba(var(--shadow), 0.25);
}

/* the brass collar that slides along it, kin to the plate on the wall */
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 16px;
  border-radius: 3px;
  margin-top: -5.5px;
  background:
    linear-gradient(90deg, #ecd39c 0%, #c9a45e 30%, #96702f 55%, #c19a52 78%, #7c5c26 100%);
  box-shadow:
    0 1px 0 rgba(255, 250, 228, 0.7) inset,
    0 -1px 0 rgba(56, 38, 10, 0.55) inset,
    1px 2px 3px rgba(var(--shadow), 0.45);
}

input[type='range']::-moz-range-track {
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(180deg, #a87c50 0%, #85603a 45%, #5e401f 100%);
}

input[type='range']::-moz-range-thumb {
  width: 10px;
  height: 16px;
  border-radius: 3px;
  border: none;
  background: linear-gradient(90deg, #ecd39c 0%, #c9a45e 30%, #96702f 55%, #c19a52 78%, #7c5c26 100%);
  box-shadow: 1px 2px 3px rgba(var(--shadow), 0.45);
}

#brush-cursor {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  border: 1px solid rgba(46, 42, 35, 0.6);
  border-radius: 50%;
  translate: -50% -50%;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  /* sizing via the wheel breathes rather than jumps */
  transition: width 90ms ease-out, height 90ms ease-out;
}

#brush-cursor.visible { display: flex; }

/* a pinpoint of the loaded colour at the centre — an aim mark, not a
   painted blob; the full-size filled dot used to read as a circle of
   paint sitting wherever the hand came to rest */
#brush-cursor .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
}

#brush-cursor .cast { display: none; }

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