/* SINK design tokens (locked)
   palette: paper #FDFCF0 · ink #0B0B0B · hull #9FA2A6 · hull-dark #6E7175 · stripe #FFF200 (the only accent)
   type: Permanent Marker (display scrawl) · Patrick Hand (body) · Pixelify Sans (app chrome)
   spacing: 4 / 8 / 12 / 16 / 24 / 40 px
   radius: deliberately uneven, hand-drawn: 10px 4px 12px 6px
   motion: steps() only, 8fps line-boil, no easing curves, no gradients, no glow */
@font-face { font-family: 'Permanent Marker'; src: url('/assets/fonts/permanent-marker-latin-400-normal.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Patrick Hand'; src: url('/assets/fonts/patrick-hand-latin-400-normal.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Pixelify Sans'; src: url('/assets/fonts/pixelify-sans-latin-400-normal.woff2') format('woff2'); font-display: swap; }

:root {
  --paper: #FDFCF0;
  --ink: #0B0B0B;
  --hull: #9FA2A6;
  --hull-dark: #6E7175;
  --stripe: #FFF200;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 40px;
  --wob: 10px 4px 12px 6px / 6px 12px 4px 10px;
  --line: 3px solid var(--ink);
  --display: 'Permanent Marker', 'Comic Sans MS', cursive;
  --body: 'Patrick Hand', 'Comic Sans MS', cursive;
  --chrome: 'Pixelify Sans', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body { font-family: var(--body); font-size: 20px; line-height: 1.35; overflow-x: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }

.desk { max-width: 1180px; margin: 0 auto; padding: var(--s5) var(--s4) var(--s6); }

/* the window */
.win { border: var(--line); border-radius: var(--wob); background: var(--paper); box-shadow: 6px 7px 0 var(--ink); transform: rotate(-0.4deg); }
.win.is-shake { animation: shake .4s steps(4) 1; }
@keyframes shake { 0%{transform:translate(0,0) rotate(-0.4deg)} 25%{transform:translate(-8px,2px) rotate(-1.4deg)} 50%{transform:translate(7px,-3px) rotate(0.8deg)} 75%{transform:translate(-4px,1px) rotate(-0.9deg)} 100%{transform:rotate(-0.4deg)} }

.titlebar { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); background: var(--ink); color: var(--paper); padding: var(--s1) var(--s2) var(--s1) var(--s3); border-radius: 7px 2px 0 0; font-family: var(--chrome); font-size: 16px; }
.titlebar__btns { display: flex; gap: var(--s1); }
.tb { width: 28px; height: 24px; line-height: 18px; padding: 0; background: var(--paper); color: var(--ink); border: 2px solid var(--paper); border-radius: 5px 2px 6px 3px; font-family: var(--chrome); font-size: 16px; }
.tb:hover, .tb:focus-visible { background: var(--stripe); }

.menubar { display: flex; flex-wrap: wrap; border-bottom: var(--line); font-family: var(--chrome); font-size: 16px; }
.menu { background: none; border: 0; padding: var(--s1) var(--s3); }
.menu:hover, .menu:focus-visible { background: var(--ink); color: var(--paper); outline: none; }

.work { display: grid; grid-template-columns: 1fr; }
.toolbox { display: flex; gap: var(--s2); padding: var(--s2); border-bottom: var(--line); }
.tool { flex: 1; display: flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 44px; padding: var(--s1) var(--s2); background: var(--paper); border: var(--line); border-radius: 8px 3px 9px 4px; font-family: var(--chrome); font-size: 15px; }
.tool__img { width: 32px; height: 32px; }
@media (min-width: 920px) { .tool__img { width: 44px; height: 44px; } }
.tool:hover { background: var(--hull); }
.tool.is-on { background: var(--stripe); transform: translate(2px, 2px); }

.stage { position: relative; background: var(--paper); aspect-ratio: 1 / 1.05; overflow: hidden; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: manipulation; outline: none; }
#scene:focus-visible { outline: 3px dashed var(--ink); outline-offset: -6px; }
.stage__fallback { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: var(--s4); }
.stage__fallback img { width: min(70%, 420px); height: auto; }
.stage__fallback p { font-family: var(--display); font-size: 18px; margin: var(--s2) 0 0; }
.is-live .stage__fallback { display: none; }

.gauge { position: absolute; left: var(--s3); top: var(--s3); font-family: var(--display); font-size: clamp(20px, 5.4vw, 38px); line-height: 1; transform: rotate(-3deg); pointer-events: none; }
.gauge #pct { display: inline-block; min-width: 1.9em; text-align: right; }
.gauge.is-bump { animation: bump .25s steps(2) 1; }
@keyframes bump { 50% { transform: rotate(2deg) scale(1.18); } }
.hint { position: absolute; left: 50%; bottom: var(--s3); font-family: var(--display); font-size: clamp(15px, 3.8vw, 22px); color: var(--ink); background: var(--stripe); padding: 0 var(--s2); white-space: nowrap; transform: translateX(-50%) rotate(2deg); pointer-events: none; animation: blink 1s steps(2) infinite; }
.hint.is-gone { display: none; }
@keyframes blink { 50% { opacity: 0; } }
.glug { position: absolute; left: 50%; top: 36%; font-family: var(--display); font-size: clamp(64px, 20vw, 190px); line-height: 1; color: var(--ink); background: var(--stripe); padding: 0 .25em; border: 4px solid var(--ink); border-radius: var(--wob); transform: translate(-50%, -50%) rotate(-6deg); pointer-events: none; display: none; }
.glug.is-on { display: block; animation: glug .7s steps(3) infinite; }
@keyframes glug { 0% { transform: translate(-50%,-50%) rotate(-6deg) scale(1); } 33% { transform: translate(-48%,-54%) rotate(4deg) scale(1.08); } 66% { transform: translate(-52%,-48%) rotate(-2deg) scale(.95); } }

/* palette strip = where the links live */
.palette { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3); border-top: var(--line); }
.swatches { display: flex; gap: var(--s2); }
.sw { width: 36px; height: 36px; border: var(--line); border-radius: 6px 2px 7px 3px; padding: 0; }
.sw--ink { background: var(--ink); } .sw--paper { background: var(--paper); } .sw--hull { background: var(--hull); } .sw--stripe { background: var(--stripe); }
.sw.is-on { outline: 3px solid var(--ink); outline-offset: 3px; }
.links { display: flex; flex-wrap: wrap; gap: var(--s2); }
.lnk { display: inline-flex; align-items: center; gap: var(--s2); min-height: 48px; padding: var(--s1) var(--s3) var(--s1) var(--s1); border: var(--line); border-radius: var(--wob); background: var(--paper); text-decoration: none; font-family: var(--display); font-size: 18px; }
.lnk img { width: 40px; height: 40px; }
.lnk:hover, .lnk:focus-visible { background: var(--stripe); transform: rotate(-2deg); }
#buy { background: var(--stripe); }
#buy:hover { background: var(--paper); }

.statusbar { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); align-items: center; padding: var(--s2) var(--s3); border-top: var(--line); font-family: var(--chrome); font-size: 14px; }
.ca { display: inline-flex; gap: var(--s1); align-items: center; max-width: 100%; background: var(--ink); color: var(--stripe); border: 0; border-radius: 4px 1px 5px 2px; padding: var(--s1) var(--s2); font-family: var(--chrome); font-size: 14px; overflow-wrap: anywhere; text-align: left; }
.ca__k { color: var(--paper); }
.sb { white-space: nowrap; }
#msg { flex: 1 1 100%; white-space: normal; order: -1; }
.sb--num b { font-weight: 400; }

/* below the window */
.below { display: grid; gap: var(--s6); margin-top: var(--s6); }
.log__h { font-family: var(--display); font-weight: 400; font-size: 32px; margin: 0 0 var(--s3); transform: rotate(-1.5deg); display: inline-block; border-bottom: 4px solid var(--stripe); }
.log__list { list-style: none; margin: 0; padding: 0; }
.log__list li { padding: var(--s2) 0; border-bottom: 2px solid var(--ink); border-bottom-left-radius: 2px 6px; }
.log__list li:nth-child(odd) { transform: rotate(-0.4deg); }
.log__list li:nth-child(even) { transform: rotate(0.5deg); }
.log__list b { font-family: var(--chrome); font-weight: 400; font-size: 15px; margin-right: var(--s2); background: var(--ink); color: var(--paper); padding: 0 var(--s1); }
.files__row { display: grid; grid-template-columns: 1fr; gap: var(--s4); }
.file { display: flex; flex-direction: column; gap: var(--s1); align-items: flex-start; padding: var(--s2); background: var(--paper); border: var(--line); border-radius: var(--wob); font-family: var(--chrome); font-size: 14px; }
.file img { width: 100%; height: auto; display: block; border: 2px solid var(--ink); }
.file:nth-child(1) { transform: rotate(1.2deg); } .file:nth-child(2) { transform: rotate(-0.8deg); }
.file:hover, .file:focus-visible { background: var(--stripe); }
.foot { font-family: var(--display); text-align: center; margin: var(--s6) 0 0; transform: rotate(-1deg); }

.viewer { border: var(--line); border-radius: var(--wob); padding: 0; background: var(--paper); max-width: min(94vw, 1100px); box-shadow: 6px 7px 0 var(--ink); }
.viewer::backdrop { background: rgba(11, 11, 11, .55); }
.viewer__bar { display: flex; justify-content: space-between; align-items: center; background: var(--ink); color: var(--paper); padding: var(--s1) var(--s2); font-family: var(--chrome); font-size: 15px; }
.viewer img { display: block; max-width: 100%; max-height: 80vh; }

.toast { position: fixed; left: 50%; bottom: var(--s5); transform: translateX(-50%) rotate(-1deg); background: var(--stripe); border: var(--line); border-radius: var(--wob); padding: var(--s2) var(--s4); font-family: var(--display); font-size: 18px; max-width: calc(100vw - 32px); text-align: center; display: none; z-index: 50; }
.toast.is-on { display: block; }

@media (min-width: 920px) {
  .desk { padding: var(--s6) var(--s5); }
  .work { grid-template-columns: 96px 1fr; }
  .toolbox { flex-direction: column; border-bottom: 0; border-right: var(--line); }
  .tool { flex: 0 0 auto; flex-direction: column; min-height: 76px; gap: var(--s1); }
  .stage { aspect-ratio: 16 / 10; }
  #msg { flex: 1 1 auto; order: 0; }
  .below { grid-template-columns: 1fr 1.25fr; align-items: start; }
  .files__row { grid-template-columns: 1fr 2fr; align-items: start; }
}

@media (prefers-reduced-motion: reduce) {
  .hint, .glug.is-on, .gauge.is-bump, .win.is-shake { animation: none; }
}
